diff options
author | Yang Tse <yangsita@gmail.com> | 2010-12-04 05:53:07 +0100 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2010-12-04 05:53:07 +0100 |
commit | c1901f7ed0dc43a92e611ff4cfc00ad97425318f (patch) | |
tree | 394c83122f62518080a923494fe5411afccded97 /lib/warnless.c | |
parent | 9c4ff4874e0df1c16d10674ec418cd23c263ec3f (diff) | |
download | curl-c1901f7ed0dc43a92e611ff4cfc00ad97425318f.tar.gz |
fix compiler warning: conversion may lose significant bits
Diffstat (limited to 'lib/warnless.c')
-rw-r--r-- | lib/warnless.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/warnless.c b/lib/warnless.c index 3bd23df03..bc29d28df 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -141,7 +141,7 @@ unsigned char curlx_ultouc(unsigned long ulnum) } /* -** size_t to signed int +** unsigned size_t to signed int */ int curlx_uztosi(size_t uznum) @@ -169,6 +169,7 @@ int curlx_sltosi(long slnum) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif + DEBUGASSERT(slnum >= 0); return (int)(slnum & (long) CURL_MASK_SINT); #ifdef __INTEL_COMPILER @@ -187,6 +188,7 @@ unsigned int curlx_sltoui(long slnum) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif + DEBUGASSERT(slnum >= 0); return (unsigned int)(slnum & (long) CURL_MASK_UINT); #ifdef __INTEL_COMPILER @@ -205,6 +207,7 @@ unsigned short curlx_sltous(long slnum) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif + DEBUGASSERT(slnum >= 0); return (unsigned short)(slnum & (long) CURL_MASK_USHORT); #ifdef __INTEL_COMPILER @@ -229,3 +232,22 @@ ssize_t curlx_uztosz(size_t uznum) # pragma warning(pop) #endif } + +/* +** signed curl_off_t to unsigned size_t +*/ + +size_t curlx_sotouz(curl_off_t sonum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(sonum >= 0); + return (size_t)(sonum & (curl_off_t) CURL_MASK_USIZE_T); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} |