diff options
author | Yang Tse <yangsita@gmail.com> | 2012-12-15 20:31:42 +0100 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2012-12-15 20:31:42 +0100 |
commit | f6af9d9886ae49963bec0fda7dc6ea8720bbc20c (patch) | |
tree | fa3e582453d96ab56e1182a52a22462ecc1403ec | |
parent | 87e8691e7c7afff10997edcdf22d86fcfb3bdc38 (diff) |
warnless.c: fix compiler warnings
-rw-r--r-- | lib/warnless.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/warnless.c b/lib/warnless.c index f62138356..9cc7be9d3 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -204,7 +204,9 @@ unsigned long curlx_uztoul(size_t uznum) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif +#if (CURL_SIZEOF_LONG < SIZEOF_SIZE_T) DEBUGASSERT(uznum <= (size_t) CURL_MASK_ULONG); +#endif return (unsigned long)(uznum & (size_t) CURL_MASK_ULONG); #ifdef __INTEL_COMPILER @@ -223,7 +225,9 @@ unsigned int curlx_uztoui(size_t uznum) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif +#if (SIZEOF_INT < SIZEOF_SIZE_T) DEBUGASSERT(uznum <= (size_t) CURL_MASK_UINT); +#endif return (unsigned int)(uznum & (size_t) CURL_MASK_UINT); #ifdef __INTEL_COMPILER @@ -243,7 +247,9 @@ int curlx_sltosi(long slnum) #endif DEBUGASSERT(slnum >= 0); +#if (SIZEOF_INT < CURL_SIZEOF_LONG) DEBUGASSERT((unsigned long) slnum <= (unsigned long) CURL_MASK_SINT); +#endif return (int)(slnum & (long) CURL_MASK_SINT); #ifdef __INTEL_COMPILER @@ -263,7 +269,9 @@ unsigned int curlx_sltoui(long slnum) #endif DEBUGASSERT(slnum >= 0); +#if (SIZEOF_INT < CURL_SIZEOF_LONG) DEBUGASSERT((unsigned long) slnum <= (unsigned long) CURL_MASK_UINT); +#endif return (unsigned int)(slnum & (long) CURL_MASK_UINT); #ifdef __INTEL_COMPILER @@ -341,7 +349,9 @@ int curlx_sztosi(ssize_t sznum) #endif DEBUGASSERT(sznum >= 0); +#if (SIZEOF_INT < SIZEOF_SIZE_T) DEBUGASSERT((size_t) sznum <= (size_t) CURL_MASK_SINT); +#endif return (int)(sznum & (ssize_t) CURL_MASK_SINT); #ifdef __INTEL_COMPILER |