From f6af9d9886ae49963bec0fda7dc6ea8720bbc20c Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sat, 15 Dec 2012 20:31:42 +0100 Subject: warnless.c: fix compiler warnings --- lib/warnless.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/warnless.c') 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 -- cgit v1.2.3