From: Matthew Fernandez Date: Tue, 8 Nov 2022 02:03:31 +0000 (-0800) Subject: gvc: squash 'api_t' related -Wsign-compare warnings X-Git-Tag: 7.0.2~14^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c96c240d87ac3a5ca67437d4cb5092a6a295e1a;p=graphviz gvc: squash 'api_t' related -Wsign-compare warnings The range of either 'int' or 'size_t' is enough to cover all valid values this takes on, so we can safely squash the following: gvplugin.c: In function ‘gvPluginList’: gvplugin.c:408:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare] 408 | for (api = 0; api < ARRAY_SIZE(api_names); api++) { | ^ gvplugin.c: In function ‘gvplugin_write_status’: gvplugin.c:450:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare] 450 | for (api = 0; api < ARRAY_SIZE(api_names); api++) { | ^ gvplugin.c: In function ‘gvplugin_graph’: gvplugin.c:501:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare] 501 | for (api = 0; api < ARRAY_SIZE(api_names); api++) { | ^ gvplugin.c:680:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare] 680 | for (api = 0; api < ARRAY_SIZE(api_names); api++) { | ^ --- diff --git a/lib/gvc/gvplugin.c b/lib/gvc/gvplugin.c index 1618efc62..1047f53b5 100644 --- a/lib/gvc/gvplugin.c +++ b/lib/gvc/gvplugin.c @@ -396,7 +396,7 @@ char *gvplugin_list(GVC_t * gvc, api_t api, const char *str) */ char **gvPluginList(GVC_t * gvc, const char *kind, int *sz, const char *str) { - int api; + size_t api; const gvplugin_available_t *pnext, *plugin; int cnt = 0; char **list = NULL; @@ -447,7 +447,7 @@ void gvplugin_write_status(GVC_t * gvc) } #endif - for (api = 0; api < ARRAY_SIZE(api_names); api++) { + for (api = 0; api < (int)ARRAY_SIZE(api_names); api++) { if (gvc->common.verbose >= 2) fprintf(stderr, " %s\t: %s\n", api_names[api], gvplugin_list(gvc, api, ":")); else @@ -465,7 +465,7 @@ Agraph_t *gvplugin_graph(GVC_t * gvc) gvplugin_package_t *package; const gvplugin_available_t *pnext; char bufa[100], *buf1, *buf2, bufb[100], *p, *q, *lq, *t; - int api, neededge_loadimage, neededge_device; + int neededge_loadimage, neededge_device; g = agopen("G", Agdirected, NULL); agattr(g, AGRAPH, "label", ""); @@ -498,7 +498,7 @@ Agraph_t *gvplugin_graph(GVC_t * gvc) strcpy(bufa, package->name); strcat(bufa, "_"); buf1 = bufa + strlen(bufa); - for (api = 0; api < ARRAY_SIZE(api_names); api++) { + for (size_t api = 0; api < ARRAY_SIZE(api_names); api++) { strcpy(buf1, api_names[api]); ssg = agsubg(sg, bufa, 1); a = agfindgraphattr(ssg, "rank"); @@ -677,7 +677,7 @@ Agraph_t *gvplugin_graph(GVC_t * gvc) strcpy(bufa, package->name); strcat(bufa, "_"); buf1 = bufa + strlen(bufa); - for (api = 0; api < ARRAY_SIZE(api_names); api++) { + for (size_t api = 0; api < ARRAY_SIZE(api_names); api++) { strcpy(buf1, api_names[api]); strcat(buf1, "_"); buf2 = bufa + strlen(bufa);