From: Wolfgang Stöggl Date: Fri, 25 Jan 2019 14:22:23 +0000 (+0100) Subject: Fix warnings: different const qualifiers (MSVC) X-Git-Tag: v1.7.1~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ffd63f9ba433338185ca577554b6c0976312792;p=thirdparty%2Frrdtool-1.x.git Fix warnings: different const qualifiers (MSVC) - Cast affected variables from 'const char **' to 'char **' - Fixes the following warning: C4090: 'function': different 'const' qualifiers in: rrd_create.c(248), rrd_modify.c(1312), rrd_modify.c(1329), rrd_modify.c(1457), rrd_modify.c(1463) --- diff --git a/src/rrd_create.c b/src/rrd_create.c index d2d372ba..c2565904 100644 --- a/src/rrd_create.c +++ b/src/rrd_create.c @@ -245,7 +245,7 @@ int rrd_create( } done: if (sources_array != NULL) { - free(sources_array); + free((char **) sources_array); /* Cast 'sources_array' from 'const char **' to 'char **' to avoid MSVC warning C4090 */ sources_array = NULL; } if (sources != NULL) { diff --git a/src/rrd_modify.c b/src/rrd_modify.c index 0a94b502..c4037ec0 100644 --- a/src/rrd_modify.c +++ b/src/rrd_modify.c @@ -1309,7 +1309,7 @@ int handle_modify(const rrd_t *in, const char *outfilename, for (i = optidx ; i < argc ; i++) { if (strncmp("DEL:", argv[i], 4) == 0 && strlen(argv[i]) > 4) { - del = (const char **) realloc(del, (rcnt + 2) * sizeof(char*)); + del = (const char **) realloc((char **) del, (rcnt + 2) * sizeof(char*)); /* Cast 'del' from 'const char **' to 'char **' to avoid MSVC warning C4090 */ if (del == NULL) { rrd_set_error("out of memory"); rc = -1; @@ -1326,7 +1326,7 @@ int handle_modify(const rrd_t *in, const char *outfilename, rcnt++; del[rcnt] = NULL; } else if (strncmp("DS:", argv[i], 3) == 0 && strlen(argv[i]) > 3) { - add = (const char **) realloc(add, (acnt + 2) * sizeof(char*)); + add = (const char **) realloc((char **) add, (acnt + 2) * sizeof(char*)); /* Cast 'add' from 'const char **' to 'char **' to avoid MSVC warning C4090 */ if (add == NULL) { rrd_set_error("out of memory"); rc = -1; @@ -1454,13 +1454,13 @@ done: for (const char **c = del ; *c ; c++) { free((void*) *c); } - free(del); + free((char **) del); /* Cast 'del' from 'const char **' to 'char **' to avoid MSVC warning C4090 */ } if (add) { for (const char **c = add ; *c ; c++) { free((void*) *c); } - free(add); + free((char **) add); /* Cast 'add' from 'const char **' to 'char **' to avoid MSVC warning C4090 */ } if (rra_ops) { for (i = 0 ; i < rraopcnt ; i++) {