From: Marcel Raad Date: Tue, 9 May 2017 17:20:28 +0000 (+0200) Subject: tool: fix remaining -Wcast-qual warnings X-Git-Tag: curl-7_54_1~132 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4dc8499494dc16bf336c1055f2ae4b78c709c87d;p=thirdparty%2Fcurl.git tool: fix remaining -Wcast-qual warnings Avoid casting away low-level const. --- diff --git a/src/tool_formparse.c b/src/tool_formparse.c index 1bcd4c5636..952377c499 100644 --- a/src/tool_formparse.c +++ b/src/tool_formparse.c @@ -154,7 +154,7 @@ int formparse(struct OperationConfig *config, char type_major[128] = ""; char type_minor[128] = ""; char *contp; - const char *type = NULL; + char *type = NULL; char *sep; if((1 == sscanf(input, "%255[^=]=", name)) && @@ -215,7 +215,7 @@ int formparse(struct OperationConfig *config, } /* now point beyond the content-type specifier */ - sep = (char *)type + strlen(type_major)+strlen(type_minor)+1; + sep = type + strlen(type_major)+strlen(type_minor)+1; /* there's a semicolon following - we check if it is a filename specified and if not we simply assume that it is text that diff --git a/src/tool_getparam.c b/src/tool_getparam.c index fde819e8d6..56bbbf18f0 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -420,10 +420,10 @@ GetFileAndPassword(char *nextarg, char **file, char **password) cleanarg(nextarg); } -ParameterError getparameter(char *flag, /* f or -long-flag */ - char *nextarg, /* NULL if unset */ - bool *usedarg, /* set to TRUE if the arg - has been used */ +ParameterError getparameter(const char *flag, /* f or -long-flag */ + char *nextarg, /* NULL if unset */ + bool *usedarg, /* set to TRUE if the arg + has been used */ struct GlobalConfig *global, struct OperationConfig *config) { @@ -444,7 +444,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ if(('-' != flag[0]) || (('-' == flag[0]) && ('-' == flag[1]))) { /* this should be a long name */ - char *word = ('-' == flag[0]) ? flag+2 : flag; + const char *word = ('-' == flag[0]) ? flag+2 : flag; size_t fnam = strlen(word); int numhits = 0; diff --git a/src/tool_getparam.h b/src/tool_getparam.h index 4e97721ede..29e158816a 100644 --- a/src/tool_getparam.h +++ b/src/tool_getparam.h @@ -47,7 +47,7 @@ typedef enum { struct GlobalConfig; struct OperationConfig; -ParameterError getparameter(char *flag, char *nextarg, bool *usedarg, +ParameterError getparameter(const char *flag, char *nextarg, bool *usedarg, struct GlobalConfig *global, struct OperationConfig *operation);