projects
/
graphviz
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
84efe93
)
remove use of int as size_t in rindexOf
author
Matthew Fernandez
<matthew.fernandez@gmail.com>
Wed, 24 Feb 2021 01:54:31 +0000
(17:54 -0800)
committer
Matthew Fernandez
<matthew.fernandez@gmail.com>
Tue, 2 Mar 2021 06:05:11 +0000
(22:05 -0800)
This removes two -Wconversion and one -Wsign-conversion warnings.
lib/gvpr/actions.c
patch
|
blob
|
history
diff --git
a/lib/gvpr/actions.c
b/lib/gvpr/actions.c
index 61f833afc5a6bfe003441d3980a9e773acb80e9d..7b7566e944c1dd5663685c6fa322b50f53a9727a 100644
(file)
--- a/
lib/gvpr/actions.c
+++ b/
lib/gvpr/actions.c
@@
-18,6
+18,7
@@
#include <ast/ast.h>
#include <gvpr/compile.h>
#include <ast/sfstr.h>
+#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
@@
-66,11
+67,13
@@
int rindexOf(char *s1, char *s2)
char c1 = *s2;
char c;
char *p;
-
in
t len1 = strlen(s1);
-
in
t len2 = strlen(s2);
+
size_
t len1 = strlen(s1);
+
size_
t len2 = strlen(s2);
if (c1 == '\0')
return (len1);
+ if (len2 > len1)
+ return -1;
p = s1 + (len1 - len2);
while (p >= s1) {
c = *p;