]> granicus.if.org Git - graphviz/commitdiff
Resolve one Wsign-conversion in attr.c
authorErwin Janssen <erwinjanssen@outlook.com>
Thu, 1 Sep 2016 13:05:09 +0000 (15:05 +0200)
committerErwin Janssen <erwinjanssen@outlook.com>
Thu, 1 Sep 2016 13:05:09 +0000 (15:05 +0200)
This cast that resolves this warning does not change the sign of `sz`, because the if statement above it makes sure it isn't a negative number.

lib/cgraph/attr.c

index 3e22021965044d591d6da47b305650dc31794727..d7f7f8c78da3a56f1a3d6e063409d6f5dd71b5cf 100644 (file)
@@ -193,7 +193,7 @@ static Agrec_t *agmakeattrs(Agraph_t * context, void *obj)
        sz = topdictsize(obj);
        if (sz < MINATTR)
            sz = MINATTR;
-       rec->str = agalloc(agraphof(obj), sz * sizeof(char *));
+       rec->str = agalloc(agraphof(obj), (size_t) sz * sizeof(char *));
        /* doesn't call agxset() so no obj-modified callbacks occur */
        for (sym = (Agsym_t *) dtfirst(datadict); sym;
             sym = (Agsym_t *) dtnext(datadict, sym))