mirror of
https://github.com/curl/curl.git
synced 2024-11-27 05:50:21 +08:00
tool_getparam.c: Fixed compilation warnings
There is an implicit conversion from "unsigned long" to "long"
This commit is contained in:
parent
415c982afb
commit
a7999da39e
@ -174,6 +174,25 @@ int curlx_ultosi(unsigned long ulnum)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** unsigned size_t to signed curl_off_t
|
||||
*/
|
||||
|
||||
curl_off_t curlx_uztoso(size_t uznum)
|
||||
{
|
||||
#ifdef __INTEL_COMPILER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:810) /* conversion may lose significant bits */
|
||||
#endif
|
||||
|
||||
DEBUGASSERT(uznum <= (size_t) CURL_MASK_SCOFFT);
|
||||
return (curl_off_t)(uznum & (size_t) CURL_MASK_SCOFFT);
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** unsigned size_t to signed int
|
||||
*/
|
||||
|
@ -34,6 +34,8 @@ int curlx_ultosi(unsigned long ulnum);
|
||||
|
||||
int curlx_uztosi(size_t uznum);
|
||||
|
||||
curl_off_t curlx_uztoso(size_t uznum);
|
||||
|
||||
unsigned long curlx_uztoul(size_t uznum);
|
||||
|
||||
unsigned int curlx_uztoui(size_t uznum);
|
||||
|
@ -1239,7 +1239,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
&-letter */
|
||||
char *oldpost = config->postfields;
|
||||
curl_off_t oldlen = config->postfieldsize;
|
||||
curl_off_t newlen = oldlen + size + 2;
|
||||
curl_off_t newlen = oldlen + curlx_uztoso(size) + 2;
|
||||
config->postfields = malloc((size_t)newlen);
|
||||
if(!config->postfields) {
|
||||
Curl_safefree(oldpost);
|
||||
@ -1257,7 +1257,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
}
|
||||
else {
|
||||
config->postfields = postdata;
|
||||
config->postfieldsize = size;
|
||||
config->postfieldsize = curlx_uztoso(size);
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user