Commit 60edbf65 authored by Yang Tse's avatar Yang Tse
Browse files

libtest: fix some compiler warnings

parent fe2b2a3b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)
+7 −2
Original line number Diff line number Diff line
@@ -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 */
+8 −3
Original line number Diff line number Diff line
@@ -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;
+8 −3
Original line number Diff line number Diff line
@@ -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;
+8 −3
Original line number Diff line number Diff line
@@ -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;
Loading