]> granicus.if.org Git - graphviz/commitdiff
ccomps: use a size_t when dealing with character offsets in split
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 25 Jul 2021 17:34:10 +0000 (10:34 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 27 Jul 2021 14:31:58 +0000 (07:31 -0700)
Squashes a -Wconversion and a -Wsign-conversion warning.

cmd/tools/ccomps.c

index 7b466b3a23ff30d349613aaa2dc9f4a1a439eb44..ad51103482b08e3e335b7ebf6c570525230ec08a 100644 (file)
@@ -133,12 +133,11 @@ static void usage(int v)
 static void split(char *name)
 {
     char *sfx = 0;
-    int size;
 
     sfx = strrchr(name, '.');
     if (sfx) {
        suffix = sfx + 1;
-       size = sfx - name;
+       size_t size = (size_t)(sfx - name);
        path = xmalloc(size + 1);
        strncpy(path, name, size);
        *(path + size) = '\0';