From: Matthew Fernandez Date: Wed, 24 Feb 2021 01:54:31 +0000 (-0800) Subject: remove use of int as size_t in rindexOf X-Git-Tag: 2.47.0~17^2~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=002bc070c0def12d4e12a762650e0b1c7bc9073f;p=graphviz remove use of int as size_t in rindexOf This removes two -Wconversion and one -Wsign-conversion warnings. --- diff --git a/lib/gvpr/actions.c b/lib/gvpr/actions.c index 61f833afc..7b7566e94 100644 --- a/lib/gvpr/actions.c +++ b/lib/gvpr/actions.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -66,11 +67,13 @@ int rindexOf(char *s1, char *s2) char c1 = *s2; char c; char *p; - int len1 = strlen(s1); - int 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;