]> granicus.if.org Git - graphviz/commitdiff
Fgets: use size_t instead of int for buffer length
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 24 Jul 2021 23:41:11 +0000 (16:41 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 28 Jul 2021 00:17:12 +0000 (17:17 -0700)
Squashes three -Wconversion warnings.

lib/common/utils.c

index 131a481ce0f1f4c215f5bb5e2682270e66fb952e..4a573592c0904cc9e19e9264df2600e53c2f1a95 100644 (file)
@@ -278,10 +278,10 @@ Agnodeinfo_t* ND_info(node_t * n) { return ((Agnodeinfo_t*)AGDATA(n));}
  */
 char *Fgets(FILE * fp)
 {
-    static int bsize = 0;
+    static size_t bsize = 0;
     static char *buf;
     char *lp;
-    int len;
+    size_t len;
 
     len = 0;
     do {
@@ -289,7 +289,7 @@ char *Fgets(FILE * fp)
            bsize += BUFSIZ;
            buf = grealloc(buf, bsize);
        }
-       lp = fgets(buf + len, bsize - len, fp);
+       lp = fgets(buf + len, (int)(bsize - len), fp);
        if (lp == 0)
            break;
        len += strlen(lp);      /* since lp != NULL, len > 0 */