tool_getparam.c: Fixed compilation warnings

There is an implicit conversion from "unsigned long" to "long"
This commit is contained in:
Steve Holme 2014-03-23 12:46:54 +00:00
parent 415c982afb
commit a7999da39e
3 changed files with 23 additions and 2 deletions

View File

@ -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
*/

View File

@ -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);

View File

@ -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);
}
}
/*