diff options
author | Yang Tse <yangsita@gmail.com> | 2010-02-22 02:37:13 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2010-02-22 02:37:13 +0000 |
commit | dc9f0a9758536d1bd7bfa2f9b073d6a63570f721 (patch) | |
tree | c98e2e003dce7ae7a5361d80965cf49a83380307 /lib | |
parent | 10affed097df354f1b9db8602cd7257f76d10654 (diff) |
fix compiler warning
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base64.c | 6 | ||||
-rw-r--r-- | lib/warnless.c | 14 | ||||
-rw-r--r-- | lib/warnless.h | 2 |
3 files changed, 19 insertions, 3 deletions
diff --git a/lib/base64.c b/lib/base64.c index dea74de9e..1820302a1 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -70,11 +70,11 @@ static void decodeQuantum(unsigned char *dest, const char *src) x = (x << 6); } - dest[2] = (unsigned char)(x & 0xFFUL); + dest[2] = Curl_ultouc(x); x >>= 8; - dest[1] = (unsigned char)(x & 0xFFUL); + dest[1] = Curl_ultouc(x); x >>= 8; - dest[0] = (unsigned char)(x & 0xFFUL); + dest[0] = Curl_ultouc(x); } /* diff --git a/lib/warnless.c b/lib/warnless.c index 83a1c68ab..94e77de46 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -38,3 +38,17 @@ unsigned short Curl_ultous(unsigned long ulnum) # pragma warning(pop) #endif } + +unsigned char Curl_ultouc(unsigned long ulnum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + return (unsigned char)(ulnum & 0xFFUL); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} diff --git a/lib/warnless.h b/lib/warnless.h index cd257d3ed..d8734910a 100644 --- a/lib/warnless.h +++ b/lib/warnless.h @@ -25,4 +25,6 @@ unsigned short Curl_ultous(unsigned long ulnum); +unsigned char Curl_ultouc(unsigned long ulnum); + #endif /* HEADER_CURL_WARNLESS_H */ |