]> granicus.if.org Git - curl/commitdiff
fix compiler warning
authorYang Tse <yangsita@gmail.com>
Fri, 19 Feb 2010 18:02:38 +0000 (18:02 +0000)
committerYang Tse <yangsita@gmail.com>
Fri, 19 Feb 2010 18:02:38 +0000 (18:02 +0000)
14 files changed:
lib/Makefile.Watcom
lib/Makefile.inc
lib/Makefile.riscos
lib/Makefile.vc6
lib/makefile.amiga
lib/warnless.c [new file with mode: 0644]
lib/warnless.h [new file with mode: 0644]
packages/Symbian/group/libcurl.mmp
packages/TPF/curl.mak
tests/server/Makefile.inc
tests/server/rtspd.c
tests/server/sockfilt.c
tests/server/sws.c
tests/server/tftpd.c

index 05eb4181021410496035c6ae381adbe1fb012804..544e7a2341e5faa8b0a4b47c9c82fed5d0bcdc30 100644 (file)
@@ -52,7 +52,8 @@ CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c   &
   inet_ntop.c parsedate.c select.c gtls.c sslgen.c tftp.c splay.c      &
   strdup.c socks.c ssh.c nss.c qssl.c rawstr.c curl_addrinfo.c          &
   socks_gssapi.c socks_sspi.c curl_sspi.c slist.c nonblock.c           &
-  curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c curl_threads.c
+  curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c curl_threads.c &
+  warnless.c
 
 OBJS = $(CSOURCES:.c=.obj)
 OBJS = $OBJ_DIR\$(OBJS: = $OBJ_DIR\)
index 90d6fec8199b09811ca6c3ca85a62cbb57bab237..9803c8c17a010188c9677ddf79120fa7165331ea 100644 (file)
@@ -11,7 +11,8 @@ CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c   \
   inet_ntop.c parsedate.c select.c gtls.c sslgen.c tftp.c splay.c      \
   strdup.c socks.c ssh.c nss.c qssl.c rawstr.c curl_addrinfo.c          \
   socks_gssapi.c socks_sspi.c curl_sspi.c slist.c nonblock.c           \
-  curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c curl_threads.c
+  curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c curl_threads.c \
+  warnless.c
 
 HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h      \
   progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h     \
@@ -23,4 +24,5 @@ HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h     \
   transfer.h select.h easyif.h multiif.h parsedate.h sslgen.h gtls.h   \
   tftp.h sockaddr.h splay.h strdup.h setup_once.h socks.h ssh.h nssg.h \
   curl_base64.h rawstr.h curl_addrinfo.h curl_sspi.h slist.h nonblock.h        \
-  curl_memrchr.h imap.h pop3.h smtp.h pingpong.h rtsp.h curl_threads.h
+  curl_memrchr.h imap.h pop3.h smtp.h pingpong.h rtsp.h curl_threads.h \
+  warnless.h
index 57475e4d0b89f34948adb0fa04dedc57d91b1aae..f7b071f34234480994e245d3deb0e6af40559a7d 100644 (file)
@@ -15,7 +15,7 @@ objs =        o.base64 o.connect o.cookie o.dict \
        o.transfer o.url o.version o.strtoofft o.sslgen o.gtls \
        o.rawstr o.curl_addrinfo o.slist o.nonblock o.curl_rand \
        o.curl_memrchr o.imap o.pop3 o.smtp o.pingpong o.rtsp \
-       o.curl_threads
+       o.curl_threads o.warnless
 
 
 # Compile options:
@@ -191,3 +191,6 @@ o.url:      c.url
 
 o.version:     c.version
                gcc $(compileropts) -c -o version.o c.version
+
+o.warnless:    c.warnless
+               gcc $(compileropts) -c -o warnless.o c.warnless
index 44259559618a9e7ff42a23167787682cf0321640..2262444e3d40d70af14e3a1d115d6c5da9f9cd10 100644 (file)
@@ -517,6 +517,7 @@ X_OBJS= \
        $(DIROBJ)\transfer.obj \\r
        $(DIROBJ)\url.obj \\r
        $(DIROBJ)\version.obj \\r
+       $(DIROBJ)\warnless.obj \\r
        $(RESOURCE)\r
 \r
 all : $(TARGET)\r
index 7d1b062c745c30d457b88d45b8f79fecb1140284..4d63e04a00d2e74a6ea9be52acc3df95a285354b 100644 (file)
@@ -22,7 +22,8 @@ OBJS = amigaos.c \
   inet_ntop.c parsedate.c select.c gtls.c sslgen.c tftp.c splay.c      \
   strdup.c socks.c ssh.c nss.c qssl.c rawstr.c curl_addrinfo.c          \
   socks_gssapi.c socks_sspi.c curl_sspi.c slist.c nonblock.c           \
-  curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c curl_threads.c
+  curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c curl_threads.c \
+  warnless.c
 
 all:   $(OBJS:.c=.o)
        ar cru libcurl.a $(OBJS:.c=.o)
diff --git a/lib/warnless.c b/lib/warnless.c
new file mode 100644 (file)
index 0000000..83a1c68
--- /dev/null
@@ -0,0 +1,40 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2010, 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.
+ *
+ * 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
+}
diff --git a/lib/warnless.h b/lib/warnless.h
new file mode 100644 (file)
index 0000000..cd257d3
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef HEADER_CURL_WARNLESS_H
+#define HEADER_CURL_WARNLESS_H
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2010, 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.
+ *
+ * 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$
+ ***************************************************************************/
+
+unsigned short Curl_ultous(unsigned long ulnum);
+
+#endif /* HEADER_CURL_WARNLESS_H */
index 512ff97aedf1e08b668cfed01043cab528e4c17a..825eb57fa16209506c030e0ea99c8c49b80703c9 100644 (file)
@@ -32,7 +32,8 @@ SOURCE \
   inet_ntop.c parsedate.c select.c gtls.c sslgen.c tftp.c splay.c   \
   strdup.c socks.c ssh.c nss.c qssl.c rawstr.c curl_addrinfo.c      \
   socks_gssapi.c socks_sspi.c curl_sspi.c slist.c nonblock.c        \
-  curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c curl_threads.c
+  curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c warnless.c  \
+  curl_threads.c
 
 USERINCLUDE   ../../../lib ../../../include/curl
 #ifdef ENABLE_SSL
index 8f55a3febcc502526f8760378d3f7f6f8b046b48..c1616dcf54ac446c1468a4120f9fe08e0fbe9352 100644 (file)
@@ -108,6 +108,7 @@ C_SRC += timeval.c
 C_SRC += transfer.c
 C_SRC += url.c
 C_SRC += version.c
+C_SRC += warnless.c
 
 #######################################################################
 # Additions and overrides for gcc compiler flags
index 4e8fc3658a4adf97b0471e7e7d44fac6d7f4fda2..b9bac82793545fa96407b10fee28eec5648bdfed 100644 (file)
@@ -6,20 +6,33 @@ useful = getpart.c getpart.h $(top_srcdir)/lib/strequal.c     \
 
 resolve_SOURCES= resolve.c util.c util.h $(useful)
 resolve_LDADD = @TEST_SERVER_LIBS@
+resolve_CFLAGS = $(AM_CFLAGS)
 
-sws_SOURCES= sws.c util.c util.h $(useful)
+sws_SOURCES= sws.c util.c util.h $(useful) \
+ $(top_srcdir)/lib/warnless.c \
+ $(top_srcdir)/lib/warnless.h
 sws_LDADD = @TEST_SERVER_LIBS@
+sws_CFLAGS = $(AM_CFLAGS)
 
 sockfilt_SOURCES = sockfilt.c util.c util.h $(useful)  \
- $(top_srcdir)/lib/inet_pton.c
+ $(top_srcdir)/lib/inet_pton.c \
+ $(top_srcdir)/lib/warnless.c \
+ $(top_srcdir)/lib/warnless.h
 sockfilt_LDADD = @TEST_SERVER_LIBS@
+sockfilt_CFLAGS = $(AM_CFLAGS)
 
 getpart_SOURCES= testpart.c $(useful)
-# This is needed because of (unused) network debugging functions in memdebug.c
 getpart_LDADD = @TEST_SERVER_LIBS@
+getpart_CFLAGS = $(AM_CFLAGS)
 
-tftpd_SOURCES = tftpd.c util.c util.h $(useful) tftp.h
+tftpd_SOURCES = tftpd.c util.c util.h $(useful) tftp.h \
+ $(top_srcdir)/lib/warnless.c \
+ $(top_srcdir)/lib/warnless.h
 tftpd_LDADD = @TEST_SERVER_LIBS@
+tftpd_CFLAGS = $(AM_CFLAGS)
 
-rtspd_SOURCES = rtspd.c util.c util.h $(useful)
+rtspd_SOURCES = rtspd.c util.c util.h $(useful) \
+ $(top_srcdir)/lib/warnless.c \
+ $(top_srcdir)/lib/warnless.h
 rtspd_LDADD = @TEST_SERVER_LIBS@
+rtspd_CFLAGS = $(AM_CFLAGS)
index 9fd5d3418fe81e9e2f773d400d8beab1b233f1bc..4c5e6a107c9ba12f93f6bfcae96339efff5e3ca2 100644 (file)
@@ -59,6 +59,7 @@
 #include "curlx.h" /* from the private lib dir */
 #include "getpart.h"
 #include "util.h"
+#include "warnless.h"
 
 /* include memdebug.h last */
 #include "memdebug.h"
@@ -1234,7 +1235,7 @@ int main(int argc, char *argv[])
                   argv[arg]);
           return 0;
         }
-        port = (unsigned short)(ulnum & 0xFFFFUL);
+        port = Curl_ultous(ulnum);
         arg++;
       }
     }
index 1bd19924ee556ce4175236c1bff50c61eebf1c26..50e91f41df11ba8762af41c9ba23326e2a5a5b85 100644 (file)
 #include "getpart.h"
 #include "inet_pton.h"
 #include "util.h"
+#include "warnless.h"
 
 /* include memdebug.h last */
 #include "memdebug.h"
@@ -898,7 +899,7 @@ int main(int argc, char *argv[])
                   argv[arg]);
           return 0;
         }
-        port = (unsigned short)(ulnum & 0xFFFFUL);
+        port = Curl_ultous(ulnum);
         arg++;
       }
     }
@@ -915,7 +916,7 @@ int main(int argc, char *argv[])
                   argv[arg]);
           return 0;
         }
-        connectport = (unsigned short)(ulnum & 0xFFFFUL);
+        connectport = Curl_ultous(ulnum);
         arg++;
       }
     }
index 5e1b0dc70b219e5a09038411d39fddddde7c04da..14058e548f4165d9fe070ca809c89bdd69c6265e 100644 (file)
@@ -60,6 +60,7 @@
 #include "curlx.h" /* from the private lib dir */
 #include "getpart.h"
 #include "util.h"
+#include "warnless.h"
 
 /* include memdebug.h last */
 #include "memdebug.h"
@@ -1138,7 +1139,7 @@ int main(int argc, char *argv[])
                   argv[arg]);
           return 0;
         }
-        port = (unsigned short)(ulnum & 0xFFFFUL);
+        port = Curl_ultous(ulnum);
         arg++;
       }
     }
index 8822f4bb6851e408909d1a523b69e75ea32e73e9..97669896c50d99731829a4a5ef286490079aeb13 100644 (file)
@@ -97,6 +97,7 @@
 #include "curlx.h" /* from the private lib dir */
 #include "getpart.h"
 #include "util.h"
+#include "warnless.h"
 
 /* include memdebug.h last */
 #include "memdebug.h"
@@ -716,7 +717,7 @@ int main(int argc, char **argv)
                   argv[arg]);
           return 0;
         }
-        port = (unsigned short)(ulnum & 0xFFFFUL);
+        port = Curl_ultous(ulnum);
         arg++;
       }
     }