From 048438345aed2acbb044e107946a804bc2d02363 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 19 Feb 2010 18:02:38 +0000 Subject: fix compiler warning --- lib/warnless.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lib/warnless.c (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c new file mode 100644 index 000000000..83a1c68ab --- /dev/null +++ b/lib/warnless.c @@ -0,0 +1,40 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , 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. + * + * 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 + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id$ + ***************************************************************************/ + +#include "setup.h" + +#include "warnless.h" + +unsigned short Curl_ultous(unsigned long ulnum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + return (unsigned short)(ulnum & 0xFFFFUL); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} -- cgit v1.2.1 From dc9f0a9758536d1bd7bfa2f9b073d6a63570f721 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Mon, 22 Feb 2010 02:37:13 +0000 Subject: fix compiler warning --- lib/warnless.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/warnless.c') 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 +} -- cgit v1.2.1 From 439f62bfa8fff1b6370c286f4e06775aa81661bc Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Mon, 22 Feb 2010 18:56:29 +0000 Subject: convert Curl_ultous() and Curl_ultouc() functions to curlx_ultous() and curlx_ultouc(), exposing them through curlx.h to allow proper code reuse later in our test harness. --- lib/warnless.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index 94e77de46..ffbcaa3f1 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -25,7 +25,7 @@ #include "warnless.h" -unsigned short Curl_ultous(unsigned long ulnum) +unsigned short curlx_ultous(unsigned long ulnum) { #ifdef __INTEL_COMPILER # pragma warning(push) @@ -39,7 +39,7 @@ unsigned short Curl_ultous(unsigned long ulnum) #endif } -unsigned char Curl_ultouc(unsigned long ulnum) +unsigned char curlx_ultouc(unsigned long ulnum) { #ifdef __INTEL_COMPILER # pragma warning(push) -- cgit v1.2.1 From bcd1c7c2e92d41ab02163a36a1ab9d5a7afd83a9 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 26 Feb 2010 16:42:33 +0000 Subject: fix compiler warning --- lib/warnless.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 2 deletions(-) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index ffbcaa3f1..232ff8027 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -25,6 +25,52 @@ #include "warnless.h" +#define CURL_MASK_SCHAR 0x7F +#define CURL_MASK_UCHAR 0xFF + +#if (SIZEOF_SHORT == 2) +# define CURL_MASK_SSHORT 0x7FFF +# define CURL_MASK_USHORT 0xFFFF +#elif (SIZEOF_SHORT == 4) +# define CURL_MASK_SSHORT 0x7FFFFFFF +# define CURL_MASK_USHORT 0xFFFFFFFF +#elif (SIZEOF_SHORT == 8) +# define CURL_MASK_SSHORT 0x7FFFFFFFFFFFFFFF +# define CURL_MASK_USHORT 0xFFFFFFFFFFFFFFFF +#endif + +#if (SIZEOF_INT == 2) +# define CURL_MASK_SINT 0x7FFF +# define CURL_MASK_UINT 0xFFFF +#elif (SIZEOF_INT == 4) +# define CURL_MASK_SINT 0x7FFFFFFF +# define CURL_MASK_UINT 0xFFFFFFFF +#elif (SIZEOF_INT == 8) +# define CURL_MASK_SINT 0x7FFFFFFFFFFFFFFF +# define CURL_MASK_UINT 0xFFFFFFFFFFFFFFFF +#elif (SIZEOF_INT == 16) +# define CURL_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +# define CURL_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +#endif + +#if (SIZEOF_LONG == 2) +# define CURL_MASK_SLONG 0x7FFFL +# define CURL_MASK_ULONG 0xFFFFUL +#elif (SIZEOF_LONG == 4) +# define CURL_MASK_SLONG 0x7FFFFFFFL +# define CURL_MASK_ULONG 0xFFFFFFFFUL +#elif (SIZEOF_LONG == 8) +# define CURL_MASK_SLONG 0x7FFFFFFFFFFFFFFFL +# define CURL_MASK_ULONG 0xFFFFFFFFFFFFFFFFUL +#elif (SIZEOF_LONG == 16) +# define CURL_MASK_SLONG 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL +# define CURL_MASK_ULONG 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUL +#endif + +/* +** unsigned long to unsigned short +*/ + unsigned short curlx_ultous(unsigned long ulnum) { #ifdef __INTEL_COMPILER @@ -32,13 +78,17 @@ unsigned short curlx_ultous(unsigned long ulnum) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif - return (unsigned short)(ulnum & 0xFFFFUL); + return (unsigned short)(ulnum & (unsigned long) CURL_MASK_USHORT); #ifdef __INTEL_COMPILER # pragma warning(pop) #endif } +/* +** unsigned long to unsigned char +*/ + unsigned char curlx_ultouc(unsigned long ulnum) { #ifdef __INTEL_COMPILER @@ -46,7 +96,25 @@ unsigned char curlx_ultouc(unsigned long ulnum) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif - return (unsigned char)(ulnum & 0xFFUL); + return (unsigned char)(ulnum & (unsigned long) CURL_MASK_UCHAR); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** size_t to signed int +*/ + +int curlx_uztosi(size_t uznum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + return (int)(uznum & (size_t) CURL_MASK_SINT); #ifdef __INTEL_COMPILER # pragma warning(pop) -- cgit v1.2.1 From cef95aadebf0be4be6b4ed82e07f38cc83faf546 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 26 Feb 2010 18:32:46 +0000 Subject: Added SIZEOF_INT and SIZEOF_SHORT definitions for non-configure systems --- lib/warnless.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index 232ff8027..45ed832f6 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -53,7 +53,7 @@ # define CURL_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF #endif -#if (SIZEOF_LONG == 2) +#if (CURL_SIZEOF_LONG == 2) # define CURL_MASK_SLONG 0x7FFFL # define CURL_MASK_ULONG 0xFFFFUL #elif (SIZEOF_LONG == 4) -- cgit v1.2.1 From 2309b4e330b96bc2e1f8e36b6184015e59544037 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Mar 2010 11:02:54 +0100 Subject: remove the CVSish $Id$ lines --- lib/warnless.c | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index 45ed832f6..778a12fac 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -18,7 +18,6 @@ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * - * $Id$ ***************************************************************************/ #include "setup.h" -- cgit v1.2.1 From d42f9329dc52200e3964d1060f373368f401b828 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 24 Mar 2010 10:57:54 -0400 Subject: Fix curl CMake build. This commit fixes the cmake build of curl, and cleans up the cmake code a little. It removes some commented out code and some trailing whitespace. To get curl to build the binary tree include/curl directory needed to be added to the include path. Also, SIZEOF_SHORT needed to be added. A check for the lack of defines of SIZEOF_* for warnless.c was added. --- lib/warnless.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index 778a12fac..f19bbe398 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -36,6 +36,8 @@ #elif (SIZEOF_SHORT == 8) # define CURL_MASK_SSHORT 0x7FFFFFFFFFFFFFFF # define CURL_MASK_USHORT 0xFFFFFFFFFFFFFFFF +#else +# error "SIZEOF_SHORT not defined" #endif #if (SIZEOF_INT == 2) @@ -50,6 +52,8 @@ #elif (SIZEOF_INT == 16) # define CURL_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF # define CURL_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +#else +# error "SIZEOF_INT not defined" #endif #if (CURL_SIZEOF_LONG == 2) @@ -64,6 +68,8 @@ #elif (SIZEOF_LONG == 16) # define CURL_MASK_SLONG 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL # define CURL_MASK_ULONG 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUL +#else +# error "SIZEOF_LONG not defined" #endif /* -- cgit v1.2.1 From 675330b8dfd3e62c6748de0ebeab4a2d32affcf6 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 25 Mar 2010 11:39:13 +0100 Subject: use CURL_SIZEOF_LONG instead of SIZEOF_LONG That's the symbol we have or generate in include/curl/curlbuild.h --- lib/warnless.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index f19bbe398..4f42dd07f 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -59,13 +59,13 @@ #if (CURL_SIZEOF_LONG == 2) # define CURL_MASK_SLONG 0x7FFFL # define CURL_MASK_ULONG 0xFFFFUL -#elif (SIZEOF_LONG == 4) +#elif (CURL_SIZEOF_LONG == 4) # define CURL_MASK_SLONG 0x7FFFFFFFL # define CURL_MASK_ULONG 0xFFFFFFFFUL -#elif (SIZEOF_LONG == 8) +#elif (CURL_SIZEOF_LONG == 8) # define CURL_MASK_SLONG 0x7FFFFFFFFFFFFFFFL # define CURL_MASK_ULONG 0xFFFFFFFFFFFFFFFFUL -#elif (SIZEOF_LONG == 16) +#elif (CURL_SIZEOF_LONG == 16) # define CURL_MASK_SLONG 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL # define CURL_MASK_ULONG 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUL #else -- cgit v1.2.1 From 7e3f0bffe5d930489db80e1d65c27fe44a51f6f4 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 1 Dec 2010 23:33:43 +0100 Subject: fix compiler warning: conversion may lose significant bits --- lib/warnless.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index 4f42dd07f..471e4b2c7 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -125,3 +125,57 @@ int curlx_uztosi(size_t uznum) # pragma warning(pop) #endif } + +/* +** signed long to signed int +*/ + +int curlx_sltosi(long slnum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + return (int)(slnum & (long) CURL_MASK_SINT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** signed long to unsigned int +*/ + +unsigned int curlx_sltoui(long slnum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + return (unsigned int)(slnum & (long) CURL_MASK_UINT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** signed long to unsigned short +*/ + +unsigned short curlx_sltous(long slnum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + return (unsigned short)(slnum & (long) CURL_MASK_USHORT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} -- cgit v1.2.1 From 07f60235b06a172a98082d11f065c13f7ecb1ec0 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 2 Dec 2010 18:46:13 +0100 Subject: fix compiler warning: rounding, sign extension, or loss of accuracy may result --- lib/warnless.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 3 deletions(-) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index 471e4b2c7..3bd23df03 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -37,7 +37,7 @@ # define CURL_MASK_SSHORT 0x7FFFFFFFFFFFFFFF # define CURL_MASK_USHORT 0xFFFFFFFFFFFFFFFF #else -# error "SIZEOF_SHORT not defined" +# error "SIZEOF_SHORT not defined" #endif #if (SIZEOF_INT == 2) @@ -53,7 +53,7 @@ # define CURL_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF # define CURL_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF #else -# error "SIZEOF_INT not defined" +# error "SIZEOF_INT not defined" #endif #if (CURL_SIZEOF_LONG == 2) @@ -69,7 +69,39 @@ # define CURL_MASK_SLONG 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL # define CURL_MASK_ULONG 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUL #else -# error "SIZEOF_LONG not defined" +# error "CURL_SIZEOF_LONG not defined" +#endif + +#if (CURL_SIZEOF_CURL_OFF_T == 2) +# define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFF) +# define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFF) +#elif (CURL_SIZEOF_CURL_OFF_T == 4) +# define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFF) +# define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFF) +#elif (CURL_SIZEOF_CURL_OFF_T == 8) +# define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF) +# define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFFFFFFFFFF) +#elif (CURL_SIZEOF_CURL_OFF_T == 16) +# define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +# define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +#else +# error "CURL_SIZEOF_CURL_OFF_T not defined" +#endif + +#if (SIZEOF_SIZE_T == SIZEOF_SHORT) +# define CURL_MASK_SSIZE_T CURL_MASK_SSHORT +# define CURL_MASK_USIZE_T CURL_MASK_USHORT +#elif (SIZEOF_SIZE_T == SIZEOF_INT) +# define CURL_MASK_SSIZE_T CURL_MASK_SINT +# define CURL_MASK_USIZE_T CURL_MASK_UINT +#elif (SIZEOF_SIZE_T == CURL_SIZEOF_LONG) +# define CURL_MASK_SSIZE_T CURL_MASK_SLONG +# define CURL_MASK_USIZE_T CURL_MASK_ULONG +#elif (SIZEOF_SIZE_T == CURL_SIZEOF_CURL_OFF_T) +# define CURL_MASK_SSIZE_T CURL_MASK_SCOFFT +# define CURL_MASK_USIZE_T CURL_MASK_UCOFFT +#else +# error "SIZEOF_SIZE_T not defined" #endif /* @@ -179,3 +211,21 @@ unsigned short curlx_sltous(long slnum) # pragma warning(pop) #endif } + +/* +** unsigned size_t to signed ssize_t +*/ + +ssize_t curlx_uztosz(size_t uznum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + return (ssize_t)(uznum & (size_t) CURL_MASK_SSIZE_T); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} -- cgit v1.2.1 From c1901f7ed0dc43a92e611ff4cfc00ad97425318f Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sat, 4 Dec 2010 05:53:07 +0100 Subject: fix compiler warning: conversion may lose significant bits --- lib/warnless.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'lib/warnless.c') 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 +} -- cgit v1.2.1 From b7357176063256a44b4a5a20c6b9bbe92bdda713 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 24 May 2011 20:39:58 +0200 Subject: compiler warning: fix Fix compiler warning: variable was set but never used Fix compiler warning: clobber ignored --- lib/warnless.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index bc29d28df..89abd14bc 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -22,6 +22,8 @@ #include "setup.h" +#define BUILDING_WARNLESS_C 1 + #include "warnless.h" #define CURL_MASK_SCHAR 0x7F @@ -251,3 +253,31 @@ size_t curlx_sotouz(curl_off_t sonum) # pragma warning(pop) #endif } + +#if defined(__INTEL_COMPILER) && defined(__unix__) + +int curlx_FD_ISSET(int fd, fd_set *fdset) +{ + #pragma warning(push) + #pragma warning(disable:1469) /* clobber ignored */ + return FD_ISSET(fd, fdset); + #pragma warning(pop) +} + +void curlx_FD_SET(int fd, fd_set *fdset) +{ + #pragma warning(push) + #pragma warning(disable:1469) /* clobber ignored */ + FD_SET(fd, fdset); + #pragma warning(pop) +} + +void curlx_FD_ZERO(fd_set *fdset) +{ + #pragma warning(push) + #pragma warning(disable:593) /* variable was set but never used */ + FD_ZERO(fdset); + #pragma warning(pop) +} + +#endif /* __INTEL_COMPILER && __unix__ */ -- cgit v1.2.1 From 3c9ff41a1fef4b03571f5a7f905e5016cae55208 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 26 May 2011 15:44:53 +0200 Subject: compiler warning: fix Fix compiler warning: conversion may lose significant bits --- lib/warnless.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index 89abd14bc..0f7814b27 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -280,4 +280,20 @@ void curlx_FD_ZERO(fd_set *fdset) #pragma warning(pop) } +unsigned short curlx_htons(unsigned short usnum) +{ + #pragma warning(push) + #pragma warning(disable:810) /* conversion may lose significant bits */ + return htons(usnum); + #pragma warning(pop) +} + +unsigned short curlx_ntohs(unsigned short usnum) +{ + #pragma warning(push) + #pragma warning(disable:810) /* conversion may lose significant bits */ + return ntohs(usnum); + #pragma warning(pop) +} + #endif /* __INTEL_COMPILER && __unix__ */ -- cgit v1.2.1 From 7dd449d843e21df679f85d1b4d3065644e088410 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 27 May 2011 06:56:56 +0200 Subject: warnless: header inclusion fix --- lib/warnless.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index 0f7814b27..8a2211019 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -22,6 +22,20 @@ #include "setup.h" +#if defined(__INTEL_COMPILER) && defined(__unix__) + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#endif /* __INTEL_COMPILER && __unix__ */ + #define BUILDING_WARNLESS_C 1 #include "warnless.h" -- cgit v1.2.1 From a689072f33ae5a3a59586fb419b2e3d6a74f5482 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 1 Jun 2011 12:13:42 +0200 Subject: warnless: icc 9.1 workaround --- lib/warnless.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index 8a2211019..37d15ce87 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -296,18 +296,26 @@ void curlx_FD_ZERO(fd_set *fdset) unsigned short curlx_htons(unsigned short usnum) { +#if (__INTEL_COMPILER == 910) && defined(__i386__) + return (unsigned short)(((usnum << 8) & 0xFF00) | ((usnum >> 8) & 0x00FF)); +#else #pragma warning(push) #pragma warning(disable:810) /* conversion may lose significant bits */ return htons(usnum); #pragma warning(pop) +#endif } unsigned short curlx_ntohs(unsigned short usnum) { +#if (__INTEL_COMPILER == 910) && defined(__i386__) + return (unsigned short)(((usnum << 8) & 0xFF00) | ((usnum >> 8) & 0x00FF)); +#else #pragma warning(push) #pragma warning(disable:810) /* conversion may lose significant bits */ return ntohs(usnum); #pragma warning(pop) +#endif } #endif /* __INTEL_COMPILER && __unix__ */ -- cgit v1.2.1 From fd00b382b2d33ef90c6f5c840a32b66c8ceb1662 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 24 Aug 2011 08:07:36 +0200 Subject: base64: fix Curl_base64_encode and Curl_base64_decode interfaces Previous interfaces for these libcurl internal functions did not allow to tell apart a legitimate zero size result from an error condition. These functions now return a CURLcode indicating function success or otherwise specific error. Output size is returned using a pointer argument. All usage of these two functions, and others closely related, has been adapted to the new interfaces. Relative error and OOM handling adapted or added where missing. Unit test 1302 also adapted. --- lib/warnless.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index 37d15ce87..0f5fb5f4d 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -268,6 +268,25 @@ size_t curlx_sotouz(curl_off_t sonum) #endif } +/* +** signed int to unsigned size_t +*/ + +size_t curlx_sitouz(int sinum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(sinum >= 0); + return (size_t) sinum; + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + #if defined(__INTEL_COMPILER) && defined(__unix__) int curlx_FD_ISSET(int fd, fd_set *fdset) -- cgit v1.2.1 From 8e82ef9c324c12096f722801518178d0c92e9f80 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 13 Jan 2012 13:34:43 +0100 Subject: http_negotiate_sspi.c: fix compiler warning --- lib/warnless.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index 0f5fb5f4d..acdcb26ea 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -174,6 +174,24 @@ int curlx_uztosi(size_t uznum) #endif } +/* +** unsigned size_t to unsigned long +*/ + +unsigned long curlx_uztoul(size_t uznum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + return (unsigned long)(uznum & (size_t) CURL_MASK_ULONG); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + /* ** signed long to signed int */ -- cgit v1.2.1 From 8af4b657d0f44bd6f2b1d672666c046e53af0e0c Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 16 Mar 2012 19:06:34 +0100 Subject: fix some compiler warnings --- lib/warnless.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index acdcb26ea..5fbc23400 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -286,6 +286,25 @@ size_t curlx_sotouz(curl_off_t sonum) #endif } +/* +** signed ssize_t to signed int +*/ + +int curlx_sztosi(ssize_t sznum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(sznum >= 0); + return (int)(sznum & (ssize_t) CURL_MASK_SINT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + /* ** signed int to unsigned size_t */ -- cgit v1.2.1 From c6825b7a6b5e8798bc861b3d280430e8149e7298 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 20 Mar 2012 18:28:24 +0100 Subject: fix several compiler warnings --- lib/warnless.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index 5fbc23400..6b77eea22 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -185,6 +185,7 @@ unsigned long curlx_uztoul(size_t uznum) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif + DEBUGASSERT(uznum <= (size_t) CURL_MASK_ULONG); return (unsigned long)(uznum & (size_t) CURL_MASK_ULONG); #ifdef __INTEL_COMPILER @@ -192,6 +193,25 @@ unsigned long curlx_uztoul(size_t uznum) #endif } +/* +** unsigned size_t to unsigned int +*/ + +unsigned int curlx_uztoui(size_t uznum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(uznum <= (size_t) CURL_MASK_UINT); + return (unsigned int)(uznum & (size_t) CURL_MASK_UINT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + /* ** signed long to signed int */ -- cgit v1.2.1 From 3c80309c276b8ceac13ab1a4824d216805d45afe Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 22 Mar 2012 02:40:19 +0100 Subject: fix several compiler warnings --- lib/warnless.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index 6b77eea22..d01490b15 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -131,6 +131,7 @@ unsigned short curlx_ultous(unsigned long ulnum) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif + DEBUGASSERT(ulnum <= (unsigned long) CURL_MASK_USHORT); return (unsigned short)(ulnum & (unsigned long) CURL_MASK_USHORT); #ifdef __INTEL_COMPILER @@ -149,6 +150,7 @@ unsigned char curlx_ultouc(unsigned long ulnum) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif + DEBUGASSERT(ulnum <= (unsigned long) CURL_MASK_UCHAR); return (unsigned char)(ulnum & (unsigned long) CURL_MASK_UCHAR); #ifdef __INTEL_COMPILER @@ -167,6 +169,7 @@ int curlx_uztosi(size_t uznum) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif + DEBUGASSERT(uznum <= (size_t) CURL_MASK_SINT); return (int)(uznum & (size_t) CURL_MASK_SINT); #ifdef __INTEL_COMPILER @@ -224,6 +227,7 @@ int curlx_sltosi(long slnum) #endif DEBUGASSERT(slnum >= 0); + DEBUGASSERT((unsigned long) slnum <= (unsigned long) CURL_MASK_SINT); return (int)(slnum & (long) CURL_MASK_SINT); #ifdef __INTEL_COMPILER @@ -243,6 +247,7 @@ unsigned int curlx_sltoui(long slnum) #endif DEBUGASSERT(slnum >= 0); + DEBUGASSERT((unsigned long) slnum <= (unsigned long) CURL_MASK_UINT); return (unsigned int)(slnum & (long) CURL_MASK_UINT); #ifdef __INTEL_COMPILER @@ -262,6 +267,7 @@ unsigned short curlx_sltous(long slnum) #endif DEBUGASSERT(slnum >= 0); + DEBUGASSERT((unsigned long) slnum <= (unsigned long) CURL_MASK_USHORT); return (unsigned short)(slnum & (long) CURL_MASK_USHORT); #ifdef __INTEL_COMPILER @@ -280,6 +286,7 @@ ssize_t curlx_uztosz(size_t uznum) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif + DEBUGASSERT(uznum <= (size_t) CURL_MASK_SSIZE_T); return (ssize_t)(uznum & (size_t) CURL_MASK_SSIZE_T); #ifdef __INTEL_COMPILER @@ -318,6 +325,7 @@ int curlx_sztosi(ssize_t sznum) #endif DEBUGASSERT(sznum >= 0); + DEBUGASSERT((size_t) sznum <= (size_t) CURL_MASK_SINT); return (int)(sznum & (ssize_t) CURL_MASK_SINT); #ifdef __INTEL_COMPILER -- cgit v1.2.1 From 9801596fb35f1e0c6e02eb3d5d6c9ad31fa70860 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sun, 25 Mar 2012 17:51:59 +0200 Subject: fix some compiler warnings --- lib/warnless.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib/warnless.c') diff --git a/lib/warnless.c b/lib/warnless.c index d01490b15..aab95ab2b 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -158,6 +158,25 @@ unsigned char curlx_ultouc(unsigned long ulnum) #endif } +/* +** unsigned long to signed int +*/ + +int curlx_ultosi(unsigned long ulnum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(ulnum <= (unsigned long) CURL_MASK_SINT); + return (int)(ulnum & (unsigned long) CURL_MASK_SINT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + /* ** unsigned size_t to signed int */ -- cgit v1.2.1