diff options
| -rw-r--r-- | docs/examples/cookie_interface.c | 4 | ||||
| -rw-r--r-- | docs/examples/rtsp.c | 18 | ||||
| -rw-r--r-- | tests/libtest/Makefile.inc | 2 | ||||
| -rw-r--r-- | tests/libtest/lib1502.c | 9 | ||||
| -rw-r--r-- | tests/libtest/lib540.c | 11 | ||||
| -rw-r--r-- | tests/libtest/lib591.c | 11 | ||||
| -rw-r--r-- | tests/libtest/lib597.c | 11 | ||||
| -rw-r--r-- | tests/libtest/libntlmconnect.c | 18 | 
8 files changed, 55 insertions, 29 deletions
| diff --git a/docs/examples/cookie_interface.c b/docs/examples/cookie_interface.c index ac3685fd8..2e7c66db2 100644 --- a/docs/examples/cookie_interface.c +++ b/docs/examples/cookie_interface.c @@ -5,7 +5,7 @@   *                            | (__| |_| |  _ <| |___   *                             \___|\___/|_| \_\_____|   * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2012, 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 @@ -89,7 +89,7 @@ main(void)  #endif      /* Netscape format cookie */      snprintf(nline, sizeof(nline), "%s\t%s\t%s\t%s\t%lu\t%s\t%s", -      ".google.com", "TRUE", "/", "FALSE", time(NULL) + 31337, "PREF", "hello google, i like you very much!"); +      ".google.com", "TRUE", "/", "FALSE", (unsigned long)time(NULL) + 31337UL, "PREF", "hello google, i like you very much!");      res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline);      if (res != CURLE_OK) {        fprintf(stderr, "Curl curl_easy_setopt failed: %s\n", curl_easy_strerror(res)); diff --git a/docs/examples/rtsp.c b/docs/examples/rtsp.c index 1cc19677a..669780a9b 100644 --- a/docs/examples/rtsp.c +++ b/docs/examples/rtsp.c @@ -178,7 +178,7 @@ int main(int argc, char * const argv[])  #endif    const char *range = "0.000-";    int rc = EXIT_SUCCESS; -  char *basename = NULL; +  char *base_name = NULL;    printf("\nRTSP request %s\n", VERSION_STR);    printf("    Project web site: http://code.google.com/p/rtsprequest/\n"); @@ -186,20 +186,20 @@ int main(int argc, char * const argv[])    /* check command line */    if ((argc != 2) && (argc != 3)) { -    basename = strrchr(argv[0], '/'); -    if (basename == NULL) { -      basename = strrchr(argv[0], '\\'); +    base_name = strrchr(argv[0], '/'); +    if (base_name == NULL) { +      base_name = strrchr(argv[0], '\\');      } -    if (basename == NULL) { -      basename = argv[0]; +    if (base_name == NULL) { +      base_name = argv[0];      } else { -      basename++; +      base_name++;      } -    printf("Usage:   %s url [transport]\n", basename); +    printf("Usage:   %s url [transport]\n", base_name);      printf("         url of video server\n");      printf("         transport (optional) specifier for media stream protocol\n");      printf("         default transport: %s\n", transport); -    printf("Example: %s rtsp://192.168.0.2/media/video1\n\n", basename); +    printf("Example: %s rtsp://192.168.0.2/media/video1\n\n", base_name);      rc = EXIT_FAILURE;    } else {      const char *url = argv[1]; diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc index 881622a90..c773d2b73 100644 --- a/tests/libtest/Makefile.inc +++ b/tests/libtest/Makefile.inc @@ -220,5 +220,5 @@ lib1502_SOURCES = lib1502.c $(SUPPORTFILES)  libauthretry_SOURCES = libauthretry.c $(SUPPORTFILES) -libntlmconnect_SOURCES = libntlmconnect.c $(SUPPORTFILES) $(TESTUTIL) +libntlmconnect_SOURCES = libntlmconnect.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)  libntlmconnect_LDADD = $(TESTUTIL_LIBS) diff --git a/tests/libtest/lib1502.c b/tests/libtest/lib1502.c index ec1058826..bb008f17c 100644 --- a/tests/libtest/lib1502.c +++ b/tests/libtest/lib1502.c @@ -26,6 +26,10 @@  #include "test.h" +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif +  #include <stdio.h>  #include <string.h> @@ -92,11 +96,12 @@ int test(char *URL)      curl_multi_timeout(multi_handle, &curl_timeo);      if(curl_timeo >= 0) { -      timeout.tv_sec = curl_timeo / 1000; +      int itimeout = (curl_timeo > (long)INT_MAX) ? INT_MAX : (int)curl_timeo; +      timeout.tv_sec = itimeout / 1000;        if(timeout.tv_sec > 1)          timeout.tv_sec = 1;        else -        timeout.tv_usec = (curl_timeo % 1000) * 1000; +        timeout.tv_usec = (itimeout % 1000) * 1000;      }      /* get file descriptors from the transfers */ diff --git a/tests/libtest/lib540.c b/tests/libtest/lib540.c index a47f1dee6..ac0ebe60b 100644 --- a/tests/libtest/lib540.c +++ b/tests/libtest/lib540.c @@ -5,7 +5,7 @@   *                            | (__| |_| |  _ <| |___   *                             \___|\___/|_| \_\_____|   * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2012, 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 @@ -30,6 +30,10 @@  #include "test.h" +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif +  #include "testutil.h"  #include "warnless.h"  #include "memdebug.h" @@ -139,8 +143,9 @@ static int loop(int num, CURLM *cm, const char* url, const char* userpwd,        /* At this point, L is guaranteed to be greater or equal than -1. */        if(L != -1) { -        T.tv_sec = L/1000; -        T.tv_usec = (L%1000)*1000; +        int itimeout = (L > (long)INT_MAX) ? INT_MAX : (int)L; +        T.tv_sec = itimeout/1000; +        T.tv_usec = (itimeout%1000)*1000;        }        else {          T.tv_sec = 5; diff --git a/tests/libtest/lib591.c b/tests/libtest/lib591.c index 8a55e2cd1..5cd4644e3 100644 --- a/tests/libtest/lib591.c +++ b/tests/libtest/lib591.c @@ -5,7 +5,7 @@   *                            | (__| |_| |  _ <| |___   *                             \___|\___/|_| \_\_____|   * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2012, 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 @@ -23,6 +23,10 @@  /* lib591 is used for test cases 591, 592, 593 and 594 */ +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif +  #include <fcntl.h>  #include "testutil.h" @@ -112,8 +116,9 @@ int test(char *URL)      /* At this point, timeout is guaranteed to be greater or equal than -1. */      if(timeout != -1L) { -      interval.tv_sec = timeout/1000; -      interval.tv_usec = (timeout%1000)*1000; +      int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout; +      interval.tv_sec = itimeout/1000; +      interval.tv_usec = (itimeout%1000)*1000;      }      else {        interval.tv_sec = 0; diff --git a/tests/libtest/lib597.c b/tests/libtest/lib597.c index 6a5ee4f8f..a27cefd5b 100644 --- a/tests/libtest/lib597.c +++ b/tests/libtest/lib597.c @@ -5,7 +5,7 @@   *                            | (__| |_| |  _ <| |___   *                             \___|\___/|_| \_\_____|   * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2012, 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 @@ -21,6 +21,10 @@   ***************************************************************************/  #include "test.h" +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif +  #include "testutil.h"  #include "warnless.h"  #include "memdebug.h" @@ -113,8 +117,9 @@ int test(char *URL)        /* At this point, timeout is guaranteed to be greater or equal than -1. */        if(timeout != -1L) { -        interval.tv_sec = timeout/1000; -        interval.tv_usec = (timeout%1000)*1000; +        int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout; +        interval.tv_sec = itimeout/1000; +        interval.tv_usec = (itimeout%1000)*1000;        }        else {          interval.tv_sec = TEST_HANG_TIMEOUT/1000+1; diff --git a/tests/libtest/libntlmconnect.c b/tests/libtest/libntlmconnect.c index fd64e5f84..66d09e936 100644 --- a/tests/libtest/libntlmconnect.c +++ b/tests/libtest/libntlmconnect.c @@ -21,8 +21,13 @@   ***************************************************************************/  #include "test.h" +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif  #include <assert.h> +  #include "testutil.h" +#include "warnless.h"  #include "memdebug.h"  #define TEST_HANG_TIMEOUT 5 * 1000 @@ -40,7 +45,7 @@ int res = 0;  static size_t callback(char* ptr, size_t size, size_t nmemb, void* data)  { -  int idx = ((CURL **) data) - easy; +  ssize_t idx = ((CURL **) data) - easy;    curl_socket_t sock;    long lastsock; @@ -69,8 +74,8 @@ static size_t callback(char* ptr, size_t size, size_t nmemb, void* data)        sockets[idx] = sock;      }      else if (sock != sockets[idx]) { -      fprintf(stderr, "Handle %d started on socket %d and moved to %d\n", idx, -              sockets[idx], sock); +      fprintf(stderr, "Handle %d started on socket %d and moved to %d\n", +              curlx_sztosi(idx), (int)sockets[idx], (int)sock);        res = TEST_ERR_MAJOR_BAD;        return 0;      } @@ -195,7 +200,7 @@ int test(char *url)             matched socket_exists should be true and we would never get here */          assert(curfd != sockets[num_handles-1]);          fprintf(stderr, "Handle %d wrote to socket %d then detected on %d\n", -                num_handles-1, sockets[num_handles-1], curfd); +                num_handles-1, (int)sockets[num_handles-1], (int)curfd);          res = TEST_ERR_MAJOR_BAD;          goto test_cleanup;        } @@ -224,8 +229,9 @@ int test(char *url)              __FILE__, __LINE__, num_handles, timeout);      if(timeout != -1L) { -      interval.tv_sec = timeout/1000; -      interval.tv_usec = (timeout%1000)*1000; +      int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout; +      interval.tv_sec = itimeout/1000; +      interval.tv_usec = (itimeout%1000)*1000;      }      else {        interval.tv_sec = TEST_HANG_TIMEOUT/1000+1; | 
