]> granicus.if.org Git - graphviz/commitdiff
use size_t when handling the length of some directory lists
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 24 Jul 2021 23:54:02 +0000 (16:54 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 28 Jul 2021 00:17:12 +0000 (17:17 -0700)
Squashes five -Wsign-compare/-Wconversion warnings.

lib/common/utils.c

index 0abc3cfef6ea1f29872999e75fb4760cadb60af1..a38b577ee8e2e164336db2a3aad6c0c714435644 100644 (file)
@@ -333,13 +333,13 @@ char *Fgets(FILE * fp)
 #define PATHSEP ":"
 #endif
 
-static char** mkDirlist (const char* list, int* maxdirlen)
+static char** mkDirlist (const char* list, size_t* maxdirlen)
 {
     int cnt = 0;
     char* s = strdup (list);
     char* dir;
     char** dirs = NULL;
-    int maxlen = 0;
+    size_t maxlen = 0;
 
     for (dir = strtok (s, PATHSEP); dir; dir = strtok (NULL, PATHSEP)) {
        dirs = ALLOC (cnt+2,dirs,char*);
@@ -351,7 +351,7 @@ static char** mkDirlist (const char* list, int* maxdirlen)
     return dirs;
 }
 
-static char* findPath (char** dirs, int maxdirlen, const char* str)
+static char* findPath (char** dirs, size_t maxdirlen, const char* str)
 {
     static char *safefilename = NULL;
     char** dp;
@@ -374,7 +374,7 @@ const char *safefile(const char *filename)
 {
     static boolean onetime = TRUE;
     static char *pathlist = NULL;
-    static int maxdirlen;
+    static size_t maxdirlen;
     static char** dirs;
     const char *str, *p;