diff options
author | Curl Upstream <curl-library@cool.haxx.se> | 2016-08-03 06:37:16 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-08-03 18:26:29 (GMT) |
commit | 202adcfe056681109fe61569ecdb3bd69f0b4f97 (patch) | |
tree | babb186f9f5f5e1345c61a2b2a4b955a9bae7849 /lib/warnless.c | |
parent | 7ec709d3d7cc988d4cf6dc2c49713d4c55f09542 (diff) | |
download | CMake-202adcfe056681109fe61569ecdb3bd69f0b4f97.zip CMake-202adcfe056681109fe61569ecdb3bd69f0b4f97.tar.gz CMake-202adcfe056681109fe61569ecdb3bd69f0b4f97.tar.bz2 |
curl 2016-08-03 (f2cb3a01)
Code extracted from:
https://github.com/bagder/curl.git
at commit f2cb3a01192d36395d16acec6cdb93446ca6fd45 (curl-7_50_1).
Diffstat (limited to 'lib/warnless.c')
-rw-r--r-- | lib/warnless.c | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/lib/warnless.c b/lib/warnless.c index 8c130d3..0c4472e 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -5,11 +5,11 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. + * are also available at https://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is @@ -379,6 +379,63 @@ int curlx_sztosi(ssize_t sznum) } /* +** unsigned int to unsigned short +*/ + +unsigned short curlx_uitous(unsigned int uinum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(uinum <= (unsigned int) CURL_MASK_USHORT); + return (unsigned short) (uinum & (unsigned int) CURL_MASK_USHORT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** unsigned int to unsigned char +*/ + +unsigned char curlx_uitouc(unsigned int uinum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(uinum <= (unsigned int) CURL_MASK_UCHAR); + return (unsigned char) (uinum & (unsigned int) CURL_MASK_UCHAR); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** unsigned int to signed int +*/ + +int curlx_uitosi(unsigned int uinum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(uinum <= (unsigned int) CURL_MASK_SINT); + return (int) (uinum & (unsigned int) CURL_MASK_SINT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* ** signed int to unsigned size_t */ |