gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 08/09: testcurl: fixed used types and related warnings


From: gnunet
Subject: [libmicrohttpd] 08/09: testcurl: fixed used types and related warnings
Date: Sat, 01 Oct 2022 14:16:08 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 023e1dba2a6a8b3710613aa84d6253a62038cdad
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Sep 30 15:46:23 2022 +0300

    testcurl: fixed used types and related warnings
---
 src/testcurl/perf_get.c                       | 42 ++++++------
 src/testcurl/perf_get_concurrent.c            | 32 ++++-----
 src/testcurl/test_add_conn.c                  | 94 +++++++++++++--------------
 src/testcurl/test_basicauth.c                 |  5 +-
 src/testcurl/test_callback.c                  |  6 +-
 src/testcurl/test_concurrent_stop.c           | 34 +++++-----
 src/testcurl/test_delete.c                    | 36 +++++-----
 src/testcurl/test_digestauth.c                |  9 +--
 src/testcurl/test_digestauth2.c               |  8 +--
 src/testcurl/test_digestauth_concurrent.c     |  3 +-
 src/testcurl/test_digestauth_emu_ext.c        |  5 +-
 src/testcurl/test_digestauth_sha256.c         | 10 +--
 src/testcurl/test_digestauth_with_arguments.c |  6 +-
 src/testcurl/test_get.c                       | 62 +++++++++---------
 src/testcurl/test_get_chunked.c               | 38 ++++++-----
 src/testcurl/test_get_close_keep_alive.c      | 47 +++++++-------
 src/testcurl/test_get_empty.c                 | 62 +++++++++---------
 src/testcurl/test_get_iovec.c                 | 42 ++++++------
 src/testcurl/test_get_response_cleanup.c      | 40 ++++++------
 src/testcurl/test_get_sendfile.c              | 36 +++++-----
 src/testcurl/test_get_wait.c                  | 16 ++---
 src/testcurl/test_head.c                      |  4 +-
 src/testcurl/test_iplimit.c                   | 12 ++--
 src/testcurl/test_large_put.c                 | 24 +++----
 src/testcurl/test_long_header.c               | 16 ++---
 src/testcurl/test_parse_cookies.c             |  4 +-
 src/testcurl/test_patch.c                     | 38 +++++------
 src/testcurl/test_post.c                      | 36 +++++-----
 src/testcurl/test_post_loop.c                 | 52 ++++++++-------
 src/testcurl/test_postform.c                  | 24 +++----
 src/testcurl/test_process_arguments.c         |  6 +-
 src/testcurl/test_process_headers.c           | 24 +++----
 src/testcurl/test_put.c                       | 36 +++++-----
 src/testcurl/test_put_chunked.c               | 48 +++++++-------
 src/testcurl/test_quiesce.c                   | 26 ++++----
 src/testcurl/test_quiesce_stream.c            | 10 +--
 src/testcurl/test_termination.c               |  8 +--
 src/testcurl/test_timeout.c                   | 18 ++---
 src/testcurl/test_toolarge.c                  | 73 +++++++++++----------
 src/testcurl/test_tricky.c                    | 41 ++++++------
 src/testcurl/test_urlparse.c                  | 10 +--
 src/testzzuf/test_get.c                       |  6 +-
 src/testzzuf/test_get_chunked.c               |  6 +-
 src/testzzuf/test_long_header.c               |  4 +-
 src/testzzuf/test_post.c                      |  6 +-
 src/testzzuf/test_post_form.c                 |  6 +-
 src/testzzuf/test_put.c                       |  6 +-
 src/testzzuf/test_put_chunked.c               |  6 +-
 src/testzzuf/test_put_large.c                 |  6 +-
 49 files changed, 603 insertions(+), 586 deletions(-)

diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c
index a168205f..bcd5a21c 100644
--- a/src/testcurl/perf_get.c
+++ b/src/testcurl/perf_get.c
@@ -186,8 +186,8 @@ ahc_echo (void *cls,
 }
 
 
-static int
-testInternalGet (int port, int poll_flag)
+static unsigned int
+testInternalGet (uint16_t port, uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -215,12 +215,12 @@ testInternalGet (int port, int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   snprintf (url,
             sizeof (url),
-            "http://127.0.0.1:%d/hello_world";,
-            port);
+            "http://127.0.0.1:%u/hello_world";,
+            (unsigned int) port);
   start_timer ();
   for (i = 0; i < ROUNDS; i++)
   {
@@ -264,8 +264,8 @@ testInternalGet (int port, int poll_flag)
 }
 
 
-static int
-testMultithreadedGet (int port, int poll_flag)
+static unsigned int
+testMultithreadedGet (uint16_t port, uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -294,12 +294,12 @@ testMultithreadedGet (int port, int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   snprintf (url,
             sizeof (url),
-            "http://127.0.0.1:%d/hello_world";,
-            port);
+            "http://127.0.0.1:%u/hello_world";,
+            (unsigned int) port);
   start_timer ();
   for (i = 0; i < ROUNDS; i++)
   {
@@ -346,8 +346,8 @@ testMultithreadedGet (int port, int poll_flag)
 }
 
 
-static int
-testMultithreadedPoolGet (int port, int poll_flag)
+static unsigned int
+testMultithreadedPoolGet (uint16_t port, uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -377,12 +377,12 @@ testMultithreadedPoolGet (int port, int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   snprintf (url,
             sizeof (url),
-            "http://127.0.0.1:%d/hello_world";,
-            port);
+            "http://127.0.0.1:%u/hello_world";,
+            (unsigned int) port);
   start_timer ();
   for (i = 0; i < ROUNDS; i++)
   {
@@ -426,8 +426,8 @@ testMultithreadedPoolGet (int port, int poll_flag)
 }
 
 
-static int
-testExternalGet (int port)
+static unsigned int
+testExternalGet (uint16_t port)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -471,12 +471,12 @@ testExternalGet (int port)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   snprintf (url,
             sizeof (url),
-            "http://127.0.0.1:%d/hello_world";,
-            port);
+            "http://127.0.0.1:%u/hello_world";,
+            (unsigned int) port);
   start_timer ();
   multi = curl_multi_init ();
   if (multi == NULL)
@@ -628,7 +628,7 @@ int
 main (int argc, char *const *argv)
 {
   unsigned int errorCount = 0;
-  int port = 1130;
+  uint16_t port = 1130;
   (void) argc;   /* Unused. Silent compiler warning. */
 
   if ((NULL == argv) || (0 == argv[0]))
diff --git a/src/testcurl/perf_get_concurrent.c 
b/src/testcurl/perf_get_concurrent.c
index e0c70189..d1d396ae 100644
--- a/src/testcurl/perf_get_concurrent.c
+++ b/src/testcurl/perf_get_concurrent.c
@@ -224,14 +224,14 @@ do_gets (void *param)
   int j;
   pthread_t par[PAR];
   char url[64];
-  int port = (int) (intptr_t) param;
+  uint16_t port = (uint16_t) (intptr_t) param;
   char *err = NULL;
   static char pthr_err_marker[] = "pthread_create error";
 
   snprintf (url,
             sizeof (url),
-            "http://127.0.0.1:%d/hello_world";,
-            port);
+            "http://127.0.0.1:%u/hello_world";,
+            (unsigned int) port);
   for (j = 0; j < PAR; j++)
   {
     if (0 != pthread_create (&par[j], NULL, &thread_gets, (void *) url))
@@ -253,8 +253,8 @@ do_gets (void *param)
 }
 
 
-static int
-testInternalGet (int port, int poll_flag)
+static unsigned int
+testInternalGet (uint16_t port, uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   const char *const test_desc = ((poll_flag & MHD_USE_AUTO) ?
@@ -283,7 +283,7 @@ testInternalGet (int port, int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   start_timer ();
   ret_val = do_gets ((void *) (intptr_t) port);
@@ -300,8 +300,8 @@ testInternalGet (int port, int poll_flag)
 }
 
 
-static int
-testMultithreadedGet (int port, int poll_flag)
+static unsigned int
+testMultithreadedGet (uint16_t port, uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   const char *const test_desc = ((poll_flag & MHD_USE_AUTO) ?
@@ -334,7 +334,7 @@ testMultithreadedGet (int port, int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   start_timer ();
   ret_val = do_gets ((void *) (intptr_t) port);
@@ -351,8 +351,8 @@ testMultithreadedGet (int port, int poll_flag)
 }
 
 
-static int
-testMultithreadedPoolGet (int port, int poll_flag)
+static unsigned int
+testMultithreadedPoolGet (uint16_t port, uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   const char *const test_desc = ((poll_flag & MHD_USE_AUTO) ?
@@ -383,7 +383,7 @@ testMultithreadedPoolGet (int port, int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   start_timer ();
   ret_val = do_gets ((void *) (intptr_t) port);
@@ -400,8 +400,8 @@ testMultithreadedPoolGet (int port, int poll_flag)
 }
 
 
-static int
-testExternalGet (int port)
+static unsigned int
+testExternalGet (uint16_t port)
 {
   struct MHD_Daemon *d;
   pthread_t pid;
@@ -431,7 +431,7 @@ testExternalGet (int port)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   if (0 != pthread_create (&pid, NULL,
                            &do_gets, (void *) (intptr_t) port))
@@ -507,7 +507,7 @@ int
 main (int argc, char *const *argv)
 {
   unsigned int errorCount = 0;
-  int port = 1100;
+  uint16_t port = 1100;
   (void) argc;   /* Unused. Silent compiler warning. */
 
   if ((NULL == argv) || (0 == argv[0]))
diff --git a/src/testcurl/test_add_conn.c b/src/testcurl/test_add_conn.c
index 085d5e69..b50b6a86 100644
--- a/src/testcurl/test_add_conn.c
+++ b/src/testcurl/test_add_conn.c
@@ -79,20 +79,19 @@
 
 /* Cleanup test: max number of concurrent daemons depending on maximum number
  * of open FDs. */
-#define CLEANUP_MAX_DAEMONS(max_fds) ( ((max_fds) < 10) ? 0 : \
-                                         ( (((max_fds) - 10) / \
-                                           (CLEANUP_NUM_REQS_PER_DAEMON * 5 \
-                                            + 3)) ) )
+#define CLEANUP_MAX_DAEMONS(max_fds) (unsigned int) \
+  ( ((max_fds) < 10) ? \
+    0 : ( (((max_fds) - 10) / (CLEANUP_NUM_REQS_PER_DAEMON * 5 + 3)) ) )
 
 #define EXPECTED_URI_BASE_PATH  "/hello_world"
 #define EXPECTED_URI_QUERY      "a=%26&b=c"
 #define EXPECTED_URI_FULL_PATH  EXPECTED_URI_BASE_PATH "?" EXPECTED_URI_QUERY
 
 /* Global parameters */
-static int oneone;         /**< Use HTTP/1.1 instead of HTTP/1.0 */
-static int no_listen;      /**< Start MHD daemons without listen socket */
-static int global_port;    /**< MHD daemons listen port number */
-static int cleanup_test;   /**< Test for final cleanup */
+static int oneone;           /**< Use HTTP/1.1 instead of HTTP/1.0 */
+static int no_listen;        /**< Start MHD daemons without listen socket */
+static uint16_t global_port; /**< MHD daemons listen port number */
+static int cleanup_test;     /**< Test for final cleanup */
 static int slow_reply = 0; /**< Slowdown MHD replies */
 static int ignore_response_errors = 0; /**< Do not fail test if CURL
                                             returns error */
@@ -255,11 +254,11 @@ _externalErrorExit_func (const char *errDesc, const char 
*funcName, int lineNum)
 
 
 /* Static const value, indicates that result value was not set yet */
-static const int eMarker = 0xCE;
+static const unsigned int eMarker = 0xCE;
 
 
 static MHD_socket
-createListeningSocket (int *pport)
+createListeningSocket (uint16_t *pport)
 {
   MHD_socket skt;
   struct sockaddr_in sin;
@@ -300,7 +299,7 @@ createListeningSocket (int *pport)
     if (AF_INET != sin.sin_family)
       externalErrorExitDesc ("getsockname() returned wrong socket family");
 
-    *pport = (int) ntohs (sin.sin_port);
+    *pport = ntohs (sin.sin_port);
   }
 
   return skt;
@@ -338,14 +337,14 @@ struct addConnParam
 
   MHD_socket clent_sk;
   /* Non-zero indicate error */
-  volatile int result;
+  volatile unsigned int result;
 
 #ifdef HAVE_PTHREAD_H
   pthread_t addConnThread;
 #endif /* HAVE_PTHREAD_H */
 };
 
-static int
+static unsigned int
 doAcceptAndAddConnInThread (struct addConnParam *p)
 {
   struct sockaddr addr;
@@ -386,7 +385,7 @@ startThreadAddConn (struct addConnParam *param)
 }
 
 
-static int
+static unsigned int
 finishThreadAddConn (struct addConnParam *param)
 {
   struct addConnParam *result;
@@ -413,10 +412,10 @@ struct curlQueryParams
   const char *queryPath;
 
   /* Destination port for CURL query */
-  int queryPort;
+  uint16_t queryPort;
 
   /* CURL query result error flag */
-  volatile int queryError;
+  volatile unsigned int queryError;
 
 #ifdef HAVE_PTHREAD_H
   pthread_t queryThread;
@@ -424,7 +423,7 @@ struct curlQueryParams
 };
 
 static CURL *
-curlEasyInitForTest (const char *queryPath, int port, struct CBC *pcbc)
+curlEasyInitForTest (const char *queryPath, uint16_t port, struct CBC *pcbc)
 {
   CURL *c;
 
@@ -458,7 +457,7 @@ curlEasyInitForTest (const char *queryPath, int port, 
struct CBC *pcbc)
 }
 
 
-static int
+static unsigned int
 doCurlQueryInThread (struct curlQueryParams *p)
 {
   CURL *c;
@@ -539,7 +538,7 @@ startThreadCurlQuery (struct curlQueryParams *param)
 }
 
 
-static int
+static unsigned int
 finishThreadCurlQuery (struct curlQueryParams *param)
 {
   struct curlQueryParams *result;
@@ -558,13 +557,13 @@ finishThreadCurlQuery (struct curlQueryParams *param)
 
 
 /* Perform test queries and shut down MHD daemon */
-static int
-performTestQueries (struct MHD_Daemon *d, int d_port)
+static unsigned int
+performTestQueries (struct MHD_Daemon *d, uint16_t d_port)
 {
   struct curlQueryParams qParam;
   struct addConnParam aParam;
-  int a_port;           /* Additional listening socket port */
-  int ret = 0;          /* Return value */
+  uint16_t a_port;      /* Additional listening socket port */
+  unsigned int ret = 0; /* Return value */
 
   qParam.queryPath = "http://127.0.0.1"; EXPECTED_URI_FULL_PATH;
   a_port = 0; /* auto-assign */
@@ -603,16 +602,16 @@ performTestQueries (struct MHD_Daemon *d, int d_port)
 
 
 /* Perform test for cleanup and shutdown MHD daemon */
-static int
-performTestCleanup (struct MHD_Daemon *d, int num_queries)
+static unsigned int
+performTestCleanup (struct MHD_Daemon *d, unsigned int num_queries)
 {
   struct curlQueryParams *qParamList;
   struct addConnParam aParam;
   MHD_socket lstn_sk;   /* Additional listening socket */
   MHD_socket *clntSkList;
-  int a_port;           /* Additional listening socket port */
-  int i;
-  int ret = 0;          /* Return value */
+  uint16_t a_port;      /* Additional listening socket port */
+  unsigned int i;
+  unsigned int ret = 0; /* Return value */
 
   a_port = 0; /* auto-assign */
 
@@ -703,7 +702,7 @@ enum testMhdPollType
 static unsigned int
 testNumThreadsForPool (enum testMhdPollType pollType)
 {
-  int numThreads = MHD_CPU_COUNT;
+  unsigned int numThreads = MHD_CPU_COUNT;
   if (! cleanup_test)
     return numThreads; /* No practical limit for non-cleanup test */
   if (CLEANUP_MAX_DAEMONS (sys_max_fds) < numThreads)
@@ -720,7 +719,7 @@ testNumThreadsForPool (enum testMhdPollType pollType)
 
 static struct MHD_Daemon *
 startTestMhdDaemon (enum testMhdThreadsType thrType,
-                    enum testMhdPollType pollType, int *pport)
+                    enum testMhdPollType pollType, uint16_t *pport)
 {
   struct MHD_Daemon *d;
   const union MHD_DaemonInfo *dinfo;
@@ -738,7 +737,7 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
   }
 
   if (testMhdThreadInternalPool != thrType)
-    d = MHD_start_daemon (((int) thrType) | ((int) pollType)
+    d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
                           | (thrType == testMhdThreadExternal ?
                              0 : MHD_USE_ITC)
                           | (no_listen ? MHD_USE_NO_LISTEN_SOCKET : 0)
@@ -748,7 +747,8 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
                           MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
                           MHD_OPTION_END);
   else
-    d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | ((int) pollType)
+    d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD
+                          | ((unsigned int) pollType)
                           | MHD_USE_ITC
                           | (no_listen ? MHD_USE_NO_LISTEN_SOCKET : 0)
                           | MHD_USE_ERROR_LOG,
@@ -773,7 +773,7 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
       fprintf (stderr, "MHD_get_daemon_info() failed.\n");
       abort ();
     }
-    *pport = (int) dinfo->port;
+    *pport = dinfo->port;
   }
 
   return d;
@@ -783,7 +783,7 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
 /* Test runners */
 
 
-static int
+static unsigned int
 testExternalGet (void)
 {
   struct MHD_Daemon *d;
@@ -796,10 +796,10 @@ testExternalGet (void)
   CURLM *multi;
   time_t start;
   struct timeval tv;
-  int d_port = global_port; /* Daemon's port */
-  int a_port = 0;           /* Additional listening socket port */
+  uint16_t d_port = global_port; /* Daemon's port */
+  uint16_t a_port = 0;      /* Additional listening socket port */
   struct addConnParam aParam;
-  int ret = 0;              /* Return value of the test */
+  unsigned int ret = 0;     /* Return value of the test */
   const int c_no_listen = no_listen; /* Local const value to mute analyzer */
 
   d = startTestMhdDaemon (testMhdThreadExternal, testMhdPollBySelect, &d_port);
@@ -993,11 +993,11 @@ testExternalGet (void)
 
 
 #ifdef HAVE_PTHREAD_H
-static int
+static unsigned int
 testInternalGet (enum testMhdPollType pollType)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
+  uint16_t d_port = global_port; /* Daemon's port */
 
   d = startTestMhdDaemon (testMhdThreadInternal, pollType,
                           &d_port);
@@ -1008,11 +1008,11 @@ testInternalGet (enum testMhdPollType pollType)
 }
 
 
-static int
+static unsigned int
 testMultithreadedGet (enum testMhdPollType pollType)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
+  uint16_t d_port = global_port; /* Daemon's port */
 
   d = startTestMhdDaemon (testMhdThreadInternalPerConnection, pollType,
                           &d_port);
@@ -1025,11 +1025,11 @@ testMultithreadedGet (enum testMhdPollType pollType)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolGet (enum testMhdPollType pollType)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
+  uint16_t d_port = global_port; /* Daemon's port */
 
   d = startTestMhdDaemon (testMhdThreadInternalPool, pollType,
                           &d_port);
@@ -1041,17 +1041,17 @@ testMultithreadedPoolGet (enum testMhdPollType pollType)
 }
 
 
-static int
+static unsigned int
 testStopRace (enum testMhdPollType pollType)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
-  int a_port = 0;           /* Additional listening socket port */
+  uint16_t d_port = global_port; /* Daemon's port */
+  uint16_t a_port = 0;           /* Additional listening socket port */
   struct sockaddr_in sin;
   MHD_socket fd1;
   MHD_socket fd2;
   struct addConnParam aParam;
-  int ret = 0;              /* Return value of the test */
+  unsigned int ret = 0;              /* Return value of the test */
 
   d = startTestMhdDaemon (testMhdThreadInternal, pollType,
                           &d_port);
diff --git a/src/testcurl/test_basicauth.c b/src/testcurl/test_basicauth.c
index f9ce2455..333ccfee 100644
--- a/src/testcurl/test_basicauth.c
+++ b/src/testcurl/test_basicauth.c
@@ -426,7 +426,7 @@ ahc_echo (void *cls,
 
 
 static CURL *
-setupCURL (void *cbc, int port, char *errbuf)
+setupCURL (void *cbc, uint16_t port, char *errbuf)
 {
   CURL *c;
   char url[512];
@@ -437,7 +437,8 @@ setupCURL (void *cbc, int port, char *errbuf)
     /* A workaround for some old libcurl versions, which ignore the specified
      * port by CURLOPT_PORT when authorisation is used. */
     res = snprintf (url, (sizeof(url) / sizeof(url[0])),
-                    "http://127.0.0.1:%d%s";, port, MHD_URI_BASE_PATH);
+                    "http://127.0.0.1:%u%s";, (unsigned int) port,
+                    MHD_URI_BASE_PATH);
     if ((0 >= res) || ((sizeof(url) / sizeof(url[0])) <= (size_t) res))
       externalErrorExitDesc ("Cannot form request URL");
   }
diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c
index 8b23ed02..49b11e36 100644
--- a/src/testcurl/test_callback.c
+++ b/src/testcurl/test_callback.c
@@ -47,7 +47,7 @@ called_twice (void *cls, uint64_t pos, char *buf, size_t max)
   {
     memcpy (buf, "test", 5);
     cls2->called = 1;
-    return strlen (buf);
+    return (ssize_t) strlen (buf);
   }
   if (cls2->called == 1)
   {
@@ -132,7 +132,7 @@ main (int argc, char **argv)
   int running;
   struct timeval tv;
   int extra;
-  int port;
+  uint16_t port;
   (void) argc; (void) argv; /* Unused. Silent compiler warning. */
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
@@ -157,7 +157,7 @@ main (int argc, char **argv)
     {
       MHD_stop_daemon (d); return 48;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/";);
diff --git a/src/testcurl/test_concurrent_stop.c 
b/src/testcurl/test_concurrent_stop.c
index 80b49ed7..dec0d269 100644
--- a/src/testcurl/test_concurrent_stop.c
+++ b/src/testcurl/test_concurrent_stop.c
@@ -216,12 +216,12 @@ do_gets (void *param)
   int j;
   pthread_t par[PAR];
   char url[64];
-  int port = (int) (intptr_t) param;
+  uint16_t port = (uint16_t) (intptr_t) param;
 
   snprintf (url,
             sizeof (url),
-            "http://127.0.0.1:%d/hello_world";,
-            port);
+            "http://127.0.0.1:%u/hello_world";,
+            (unsigned int) port);
 
   for (j = 0; j < PAR; j++)
   {
@@ -246,7 +246,7 @@ do_gets (void *param)
 
 
 static pthread_t
-start_gets (int port)
+start_gets (uint16_t port)
 {
   pthread_t tid;
   continue_requesting = 1;
@@ -259,18 +259,18 @@ start_gets (int port)
 }
 
 
-static int
-testMultithreadedGet (int port,
-                      int poll_flag)
+static unsigned int
+testMultithreadedGet (uint16_t port,
+                      uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   pthread_t p;
-  int result;
+  unsigned int result;
 
   result = 0;
   d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION
                         | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
+                        | (enum MHD_FLAG) poll_flag,
                         port,
                         NULL, NULL,
                         &ahc_echo, NULL,
@@ -285,7 +285,7 @@ testMultithreadedGet (int port,
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   client_error = CURLE_OK; /* clear client error state */
   p = start_gets (port);
@@ -305,17 +305,17 @@ testMultithreadedGet (int port,
 }
 
 
-static int
-testMultithreadedPoolGet (int port,
-                          int poll_flag)
+static unsigned int
+testMultithreadedPoolGet (uint16_t port,
+                          uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   pthread_t p;
-  int result;
+  unsigned int result;
 
   result = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
+                        | (enum MHD_FLAG) poll_flag,
                         port,
                         NULL, NULL,
                         &ahc_echo, NULL,
@@ -331,7 +331,7 @@ testMultithreadedPoolGet (int port,
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   client_error = CURLE_OK; /* clear client error state */
   p = start_gets (port);
@@ -355,7 +355,7 @@ int
 main (int argc, char *const *argv)
 {
   unsigned int errorCount = 0;
-  int port;
+  uint16_t port;
   (void) argc;   /* Unused. Silent compiler warning. */
   (void) argv;   /* Unused. Silent compiler warning. */
 
diff --git a/src/testcurl/test_delete.c b/src/testcurl/test_delete.c
index 07af82e5..442d4397 100644
--- a/src/testcurl/test_delete.c
+++ b/src/testcurl/test_delete.c
@@ -58,8 +58,8 @@ struct CBC
 static size_t
 putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
 {
-  unsigned int *pos = ptr;
-  unsigned int wrt;
+  size_t *pos = ptr;
+  size_t wrt;
 
   wrt = size * nmemb;
   if (wrt > 8 - (*pos))
@@ -123,17 +123,17 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testInternalDelete (void)
 {
   struct MHD_Daemon *d;
   CURL *c;
   char buf[2048];
   struct CBC cbc;
-  unsigned int pos = 0;
+  size_t pos = 0;
   int done_flag = 0;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -156,7 +156,7 @@ testInternalDelete (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -198,17 +198,17 @@ testInternalDelete (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedDelete (void)
 {
   struct MHD_Daemon *d;
   CURL *c;
   char buf[2048];
   struct CBC cbc;
-  unsigned int pos = 0;
+  size_t pos = 0;
   int done_flag = 0;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -232,7 +232,7 @@ testMultithreadedDelete (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -275,17 +275,17 @@ testMultithreadedDelete (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolDelete (void)
 {
   struct MHD_Daemon *d;
   CURL *c;
   char buf[2048];
   struct CBC cbc;
-  unsigned int pos = 0;
+  size_t pos = 0;
   int done_flag = 0;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -310,7 +310,7 @@ testMultithreadedPoolDelete (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -353,7 +353,7 @@ testMultithreadedPoolDelete (void)
 }
 
 
-static int
+static unsigned int
 testExternalDelete (void)
 {
   struct MHD_Daemon *d;
@@ -375,9 +375,9 @@ testExternalDelete (void)
   struct CURLMsg *msg;
   time_t start;
   struct timeval tv;
-  unsigned int pos = 0;
+  size_t pos = 0;
   int done_flag = 0;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -401,7 +401,7 @@ testExternalDelete (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
diff --git a/src/testcurl/test_digestauth.c b/src/testcurl/test_digestauth.c
index adc5f330..3388ffbc 100644
--- a/src/testcurl/test_digestauth.c
+++ b/src/testcurl/test_digestauth.c
@@ -349,7 +349,8 @@ setupCURL (void *cbc, uint16_t port)
     /* A workaround for some old libcurl versions, which ignore the specified
      * port by CURLOPT_PORT when digest authorisation is used. */
     res = snprintf (url, (sizeof(url) / sizeof(url[0])),
-                    "http://127.0.0.1:%d%s";, (int) port, MHD_URI_BASE_PATH);
+                    "http://127.0.0.1:%u%s";,
+                    (unsigned int) port, MHD_URI_BASE_PATH);
     if ((0 >= res) || ((sizeof(url) / sizeof(url[0])) <= (size_t) res))
       externalErrorExitDesc ("Cannot form request URL");
   }
@@ -419,9 +420,9 @@ testDigestAuth (void)
 
   while (off < 8)
   {
-    len = read (fd,
-                rnd + off,
-                8 - off);
+    len = (size_t) read (fd,
+                         rnd + off,
+                         8 - off);
     if (len == (size_t) -1)
       externalErrorExitDesc ("Failed to read '/dev/urandom'");
     off += len;
diff --git a/src/testcurl/test_digestauth2.c b/src/testcurl/test_digestauth2.c
index ab8d2b07..a1a2a700 100644
--- a/src/testcurl/test_digestauth2.c
+++ b/src/testcurl/test_digestauth2.c
@@ -1098,7 +1098,7 @@ ahc_echo (void *cls,
  * @param uri_num the number of URI, should be 0, 1 or 2
  */
 static void
-setCURL_rq_path (CURL *c, unsigned int port, unsigned int uri_num)
+setCURL_rq_path (CURL *c, uint16_t port, unsigned int uri_num)
 {
   const char *req_path;
   char uri[512];
@@ -1113,7 +1113,7 @@ setCURL_rq_path (CURL *c, unsigned int port, unsigned int 
uri_num)
   /* A workaround for some old libcurl versions, which ignore the specified
    * port by CURLOPT_PORT when authorisation is used. */
   res = snprintf (uri, (sizeof(uri) / sizeof(uri[0])),
-                  "http://127.0.0.1:%u%s";, port,
+                  "http://127.0.0.1:%u%s";, (unsigned int) port,
                   req_path);
   if ((0 >= res) || ((sizeof(uri) / sizeof(uri[0])) <= (size_t) res))
     externalErrorExitDesc ("Cannot form request URL");
@@ -1124,7 +1124,7 @@ setCURL_rq_path (CURL *c, unsigned int port, unsigned int 
uri_num)
 
 
 static CURL *
-setupCURL (void *cbc, unsigned int port)
+setupCURL (void *cbc, uint16_t port)
 {
   CURL *c;
 
@@ -1394,7 +1394,7 @@ testDigestAuth (void)
   cbc.size = sizeof (buf);
   cbc.pos = 0;
   memset (cbc.buf, 0, cbc.size);
-  c = setupCURL (&cbc, (unsigned int) port);
+  c = setupCURL (&cbc, port);
   multi_reuse = NULL;
   /* First request */
   if (check_result (performQueryExternal (d, c, &multi_reuse), c, &cbc))
diff --git a/src/testcurl/test_digestauth_concurrent.c 
b/src/testcurl/test_digestauth_concurrent.c
index 792d15de..e7789cbe 100644
--- a/src/testcurl/test_digestauth_concurrent.c
+++ b/src/testcurl/test_digestauth_concurrent.c
@@ -361,7 +361,8 @@ setupCURL (void *cbc, uint16_t port, char *errbuf)
     /* A workaround for some old libcurl versions, which ignore the specified
      * port by CURLOPT_PORT when digest authorisation is used. */
     res = snprintf (url, (sizeof(url) / sizeof(url[0])),
-                    "http://127.0.0.1:%d%s";, (int) port, MHD_URI_BASE_PATH);
+                    "http://127.0.0.1:%u%s";, (unsigned int) port,
+                    MHD_URI_BASE_PATH);
     if ((0 >= res) || ((sizeof(url) / sizeof(url[0])) <= (size_t) res))
       externalErrorExitDesc ("Cannot form request URL");
   }
diff --git a/src/testcurl/test_digestauth_emu_ext.c 
b/src/testcurl/test_digestauth_emu_ext.c
index 10e04477..e10944c7 100644
--- a/src/testcurl/test_digestauth_emu_ext.c
+++ b/src/testcurl/test_digestauth_emu_ext.c
@@ -599,7 +599,7 @@ ahc_echo (void *cls,
 
 
 static CURL *
-setupCURL (void *cbc, int port)
+setupCURL (void *cbc, uint16_t port)
 {
   CURL *c;
   char url[512];
@@ -610,7 +610,8 @@ setupCURL (void *cbc, int port)
     /* A workaround for some old libcurl versions, which ignore the specified
      * port by CURLOPT_PORT when authorisation is used. */
     res = snprintf (url, (sizeof(url) / sizeof(url[0])),
-                    "http://127.0.0.1:%d%s";, port, MHD_URI_BASE_PATH);
+                    "http://127.0.0.1:%u%s";,
+                    (unsigned int) port, MHD_URI_BASE_PATH);
     if ((0 >= res) || ((sizeof(url) / sizeof(url[0])) <= (size_t) res))
       externalErrorExitDesc ("Cannot form request URL");
   }
diff --git a/src/testcurl/test_digestauth_sha256.c 
b/src/testcurl/test_digestauth_sha256.c
index cf6ab8ff..82b79c1b 100644
--- a/src/testcurl/test_digestauth_sha256.c
+++ b/src/testcurl/test_digestauth_sha256.c
@@ -194,9 +194,9 @@ testDigestAuth (void)
   }
   while (off < 8)
   {
-    len = read (fd,
-                rnd + off,
-                8 - off);
+    len = (size_t) read (fd,
+                         rnd + off,
+                         8 - off);
     if (len == (size_t) -1)
     {
       fprintf (stderr,
@@ -262,8 +262,8 @@ testDigestAuth (void)
   }
   snprintf (url,
             sizeof (url),
-            "http://127.0.0.1:%d/bar%%20foo?key=value";,
-            (int) port);
+            "http://127.0.0.1:%u/bar%%20foo?key=value";,
+            (unsigned int) port);
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, url);
   curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
diff --git a/src/testcurl/test_digestauth_with_arguments.c 
b/src/testcurl/test_digestauth_with_arguments.c
index 903d90a2..f0c6cd4b 100644
--- a/src/testcurl/test_digestauth_with_arguments.c
+++ b/src/testcurl/test_digestauth_with_arguments.c
@@ -184,7 +184,7 @@ testDigestAuth (void)
   }
   while (off < 8)
   {
-    len = read (fd, rnd + off, 8 - off);
+    len = (size_t) read (fd, rnd + off, 8 - off);
     if (len == (size_t) -1)
     {
       fprintf (stderr,
@@ -239,9 +239,9 @@ testDigestAuth (void)
   }
   snprintf (url,
             sizeof (url),
-            "http://127.0.0.1:%d/bar%%20foo?";
+            "http://127.0.0.1:%u/bar%%20foo?";
             "key=value&more=even%%20more&empty&=no_key&&same=one&&same=two",
-            (int) port);
+            (unsigned int) port);
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, url);
   curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c
index c412d257..732bd3b1 100644
--- a/src/testcurl/test_get.c
+++ b/src/testcurl/test_get.c
@@ -58,7 +58,7 @@
 #endif
 
 static int oneone;
-static int global_port;
+static uint16_t global_port;
 
 struct CBC
 {
@@ -171,8 +171,8 @@ ahc_echo (void *cls,
 }
 
 
-static int
-testInternalGet (int poll_flag)
+static unsigned int
+testInternalGet (uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -192,7 +192,7 @@ testInternalGet (int poll_flag)
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
+                        | (enum MHD_FLAG) poll_flag,
                         global_port, NULL, NULL,
                         &ahc_echo, NULL,
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
@@ -207,7 +207,7 @@ testInternalGet (int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    global_port = (int) dinfo->port;
+    global_port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1"; EXPECTED_URI_PATH);
@@ -244,8 +244,8 @@ testInternalGet (int poll_flag)
 }
 
 
-static int
-testMultithreadedGet (int poll_flag)
+static unsigned int
+testMultithreadedGet (uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -266,7 +266,7 @@ testMultithreadedGet (int poll_flag)
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION
                         | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
+                        | (enum MHD_FLAG) poll_flag,
                         global_port, NULL, NULL,
                         &ahc_echo, NULL,
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
@@ -281,7 +281,7 @@ testMultithreadedGet (int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    global_port = (int) dinfo->port;
+    global_port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1"; EXPECTED_URI_PATH);
@@ -318,8 +318,8 @@ testMultithreadedGet (int poll_flag)
 }
 
 
-static int
-testMultithreadedPoolGet (int poll_flag)
+static unsigned int
+testMultithreadedPoolGet (uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -339,7 +339,7 @@ testMultithreadedPoolGet (int poll_flag)
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
+                        | (enum MHD_FLAG) poll_flag,
                         global_port, NULL, NULL,
                         &ahc_echo, NULL,
                         MHD_OPTION_THREAD_POOL_SIZE, MHD_CPU_COUNT,
@@ -355,7 +355,7 @@ testMultithreadedPoolGet (int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    global_port = (int) dinfo->port;
+    global_port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1"; EXPECTED_URI_PATH);
@@ -392,7 +392,7 @@ testMultithreadedPoolGet (int poll_flag)
 }
 
 
-static int
+static unsigned int
 testExternalGet (void)
 {
   struct MHD_Daemon *d;
@@ -438,7 +438,7 @@ testExternalGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    global_port = (int) dinfo->port;
+    global_port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1"; EXPECTED_URI_PATH);
@@ -577,8 +577,8 @@ testExternalGet (void)
 }
 
 
-static int
-testUnknownPortGet (int poll_flag)
+static unsigned int
+testUnknownPortGet (uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   const union MHD_DaemonInfo *di;
@@ -586,7 +586,7 @@ testUnknownPortGet (int poll_flag)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   struct sockaddr_in addr;
   socklen_t addr_len = sizeof(addr);
@@ -599,7 +599,7 @@ testUnknownPortGet (int poll_flag)
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
+                        | (enum MHD_FLAG) poll_flag,
                         0, NULL, NULL, &ahc_echo, NULL,
                         MHD_OPTION_SOCK_ADDR, &addr,
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
@@ -615,7 +615,7 @@ testUnknownPortGet (int poll_flag)
 
     if (addr.sin_family != AF_INET)
       return 26214;
-    port = (int) ntohs (addr.sin_port);
+    port = ntohs (addr.sin_port);
   }
   else
   {
@@ -625,13 +625,13 @@ testUnknownPortGet (int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
 
   snprintf (buf,
             sizeof(buf),
-            "http://127.0.0.1:%d%s";,
-            port,
+            "http://127.0.0.1:%u%s";,
+            (unsigned int) port,
             EXPECTED_URI_PATH);
 
   c = curl_easy_init ();
@@ -668,8 +668,8 @@ testUnknownPortGet (int poll_flag)
 }
 
 
-static int
-testStopRace (int poll_flag)
+static unsigned int
+testStopRace (uint32_t poll_flag)
 {
   struct sockaddr_in sin;
   MHD_socket fd;
@@ -685,7 +685,7 @@ testStopRace (int poll_flag)
 
   d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION
                         | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
+                        | (enum MHD_FLAG) poll_flag,
                         global_port, NULL, NULL,
                         &ahc_echo, NULL,
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
@@ -700,7 +700,7 @@ testStopRace (int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    global_port = (int) dinfo->port;
+    global_port = dinfo->port;
   }
 
   fd = socket (PF_INET, SOCK_STREAM, 0);
@@ -797,8 +797,8 @@ curlExcessFound (CURL *c,
 }
 
 
-static int
-testEmptyGet (int poll_flag)
+static unsigned int
+testEmptyGet (uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -819,7 +819,7 @@ testEmptyGet (int poll_flag)
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
+                        | (enum MHD_FLAG) poll_flag,
                         global_port, NULL, NULL,
                         &ahc_empty, NULL,
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
@@ -834,7 +834,7 @@ testEmptyGet (int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    global_port = (int) dinfo->port;
+    global_port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1"; EXPECTED_URI_PATH);
diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c
index 3643a2ba..5c7b6f39 100644
--- a/src/testcurl/test_get_chunked.c
+++ b/src/testcurl/test_get_chunked.c
@@ -84,7 +84,7 @@ int chunked_forced;
 /**
  * MHD port used for testing
  */
-int port_global;
+uint16_t port_global;
 
 
 struct headers_check_result
@@ -159,7 +159,9 @@ crc (void *cls,
 
   if (max < RESP_BLOCK_SIZE)
     abort ();                   /* should not happen in this testcase... */
-  memset (buf, 'A' + (pos / RESP_BLOCK_SIZE), RESP_BLOCK_SIZE);
+  memset (buf,
+          'A' + (char) (unsigned char) (pos / RESP_BLOCK_SIZE),
+          RESP_BLOCK_SIZE);
   return RESP_BLOCK_SIZE;
 }
 
@@ -225,7 +227,9 @@ ahc_echo (void *cls,
       if (NULL == buf)
         _exit (99);
       for (pos = 0; pos < resp_size; pos += RESP_BLOCK_SIZE)
-        memset (buf + pos, 'A' + (pos / RESP_BLOCK_SIZE), RESP_BLOCK_SIZE);
+        memset (buf + pos,
+                'A' + (char) (unsigned char) (pos / RESP_BLOCK_SIZE),
+                RESP_BLOCK_SIZE);
 
       response = MHD_create_response_from_buffer_copy (resp_size, buf);
       free (buf);
@@ -264,8 +268,8 @@ ahc_echo (void *cls,
 }
 
 
-static int
-validate (struct CBC cbc, int ebase)
+static unsigned int
+validate (struct CBC cbc, unsigned int ebase)
 {
   int i;
   char buf[RESP_BLOCK_SIZE];
@@ -306,7 +310,7 @@ validate (struct CBC cbc, int ebase)
 }
 
 
-static int
+static unsigned int
 testInternalGet (void)
 {
   struct MHD_Daemon *d;
@@ -314,7 +318,7 @@ testInternalGet (void)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
   struct curl_slist *h_list = NULL;
   struct headers_check_result hdr_check;
 
@@ -334,7 +338,7 @@ testInternalGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
     if (0 == port_global)
       port_global = port; /* Re-use the same port for all checks */
   }
@@ -388,7 +392,7 @@ testInternalGet (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedGet (void)
 {
   struct MHD_Daemon *d;
@@ -396,7 +400,7 @@ testMultithreadedGet (void)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
   struct curl_slist *h_list = NULL;
   struct headers_check_result hdr_check;
 
@@ -417,7 +421,7 @@ testMultithreadedGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
     if (0 == port_global)
       port_global = port; /* Re-use the same port for all checks */
   }
@@ -471,7 +475,7 @@ testMultithreadedGet (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolGet (void)
 {
   struct MHD_Daemon *d;
@@ -479,7 +483,7 @@ testMultithreadedPoolGet (void)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
   struct curl_slist *h_list = NULL;
   struct headers_check_result hdr_check;
 
@@ -501,7 +505,7 @@ testMultithreadedPoolGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
     if (0 == port_global)
       port_global = port; /* Re-use the same port for all checks */
   }
@@ -555,7 +559,7 @@ testMultithreadedPoolGet (void)
 }
 
 
-static int
+static unsigned int
 testExternalGet (void)
 {
   struct MHD_Daemon *d;
@@ -577,7 +581,7 @@ testExternalGet (void)
   struct CURLMsg *msg;
   time_t start;
   struct timeval tv;
-  int port;
+  uint16_t port;
   struct curl_slist *h_list = NULL;
   struct headers_check_result hdr_check;
 
@@ -598,7 +602,7 @@ testExternalGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
     if (0 == port_global)
       port_global = port; /* Re-use the same port for all checks */
   }
diff --git a/src/testcurl/test_get_close_keep_alive.c 
b/src/testcurl/test_get_close_keep_alive.c
index 169a2098..3754325c 100644
--- a/src/testcurl/test_get_close_keep_alive.c
+++ b/src/testcurl/test_get_close_keep_alive.c
@@ -167,9 +167,9 @@ _libcurlErrorExit_func (const char *errDesc, const char 
*funcName, int lineNum)
                                   HDR_CONN_KEEP_ALIVE_VALUE
 
 /* Global parameters */
-static int oneone;         /**< Use HTTP/1.1 instead of HTTP/1.0 for requests*/
-static int conn_close;     /**< Don't use Keep-Alive */
-static int global_port;    /**< MHD daemons listen port number */
+static int oneone;           /**< Use HTTP/1.1 instead of HTTP/1.0 for 
requests*/
+static int conn_close;       /**< Don't use Keep-Alive */
+static uint16_t global_port; /**< MHD daemons listen port number */
 static int slow_reply = 0; /**< Slowdown MHD replies */
 static int ignore_response_errors = 0; /**< Do not fail test if CURL
                                             returns error */
@@ -384,15 +384,15 @@ struct curlQueryParams
   const char *queryPath;
 
   /* Destination port for CURL query */
-  int queryPort;
+  uint16_t queryPort;
 
   /* CURL query result error flag */
-  volatile int queryError;
+  volatile unsigned int queryError;
 };
 
 
 static CURL *
-curlEasyInitForTest (const char *queryPath, int port, struct CBC *pcbc,
+curlEasyInitForTest (const char *queryPath, uint16_t port, struct CBC *pcbc,
                      struct headers_check_result *hdr_chk_result,
                      int add_hdr_close, int add_hdr_k_alive)
 {
@@ -625,7 +625,7 @@ getMhdActiveConnections (struct MHD_Daemon *d)
 }
 
 
-static int
+static unsigned int
 doCurlQueryInThread (struct MHD_Daemon *d,
                      struct curlQueryParams *p,
                      int add_hdr_close,
@@ -853,11 +853,11 @@ doCurlQueryInThread (struct MHD_Daemon *d,
 
 
 /* Perform test queries and shut down MHD daemon */
-static int
-performTestQueries (struct MHD_Daemon *d, int d_port)
+static unsigned int
+performTestQueries (struct MHD_Daemon *d, uint16_t d_port)
 {
   struct curlQueryParams qParam;
-  int ret = 0;          /* Return value */
+  unsigned int ret = 0;          /* Return value */
   int i = 0;
   /* masks */
   const int m_mhd_close = 1 << (i++);
@@ -932,7 +932,7 @@ enum testMhdPollType
 static unsigned int
 testNumThreadsForPool (enum testMhdPollType pollType)
 {
-  int numThreads = MHD_CPU_COUNT;
+  unsigned int numThreads = MHD_CPU_COUNT;
   (void) pollType; /* Don't care about pollType for this test */
   return numThreads; /* No practical limit for non-cleanup test */
 }
@@ -940,7 +940,7 @@ testNumThreadsForPool (enum testMhdPollType pollType)
 
 static struct MHD_Daemon *
 startTestMhdDaemon (enum testMhdThreadsType thrType,
-                    enum testMhdPollType pollType, int *pport)
+                    enum testMhdPollType pollType, uint16_t *pport)
 {
   struct MHD_Daemon *d;
   const union MHD_DaemonInfo *dinfo;
@@ -956,14 +956,15 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
   }
 
   if (testMhdThreadInternalPool != thrType)
-    d = MHD_start_daemon (((int) thrType) | ((int) pollType)
+    d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
                           | MHD_USE_ERROR_LOG,
                           *pport, NULL, NULL,
                           &ahc_echo, NULL,
                           MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
                           MHD_OPTION_END);
   else
-    d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | ((int) pollType)
+    d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD
+                          | ((unsigned int) pollType)
                           | MHD_USE_ERROR_LOG,
                           *pport, NULL, NULL,
                           &ahc_echo, NULL,
@@ -986,7 +987,7 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
       fprintf (stderr, "MHD_get_daemon_info() failed.\n");
       abort ();
     }
-    *pport = (int) dinfo->port;
+    *pport = dinfo->port;
     if (0 == global_port)
       global_port = *pport; /* Reuse the same port for all tests */
   }
@@ -998,11 +999,11 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
 /* Test runners */
 
 
-static int
+static unsigned int
 testExternalGet (void)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
+  uint16_t d_port = global_port; /* Daemon's port */
 
   d = startTestMhdDaemon (testMhdThreadExternal, testMhdPollBySelect, &d_port);
 
@@ -1010,11 +1011,11 @@ testExternalGet (void)
 }
 
 
-static int
+static unsigned int
 testInternalGet (enum testMhdPollType pollType)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
+  uint16_t d_port = global_port; /* Daemon's port */
 
   d = startTestMhdDaemon (testMhdThreadInternal, pollType,
                           &d_port);
@@ -1023,11 +1024,11 @@ testInternalGet (enum testMhdPollType pollType)
 }
 
 
-static int
+static unsigned int
 testMultithreadedGet (enum testMhdPollType pollType)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
+  uint16_t d_port = global_port; /* Daemon's port */
 
   d = startTestMhdDaemon (testMhdThreadInternalPerConnection, pollType,
                           &d_port);
@@ -1035,11 +1036,11 @@ testMultithreadedGet (enum testMhdPollType pollType)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolGet (enum testMhdPollType pollType)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
+  uint16_t d_port = global_port; /* Daemon's port */
 
   d = startTestMhdDaemon (testMhdThreadInternalPool, pollType,
                           &d_port);
diff --git a/src/testcurl/test_get_empty.c b/src/testcurl/test_get_empty.c
index 32d6b16f..1dd4500d 100644
--- a/src/testcurl/test_get_empty.c
+++ b/src/testcurl/test_get_empty.c
@@ -58,7 +58,7 @@
 #endif
 
 static int oneone;
-static int global_port;
+static uint16_t global_port;
 
 struct CBC
 {
@@ -139,8 +139,8 @@ ahc_echo (void *cls,
 }
 
 
-static int
-testInternalGet (int poll_flag)
+static unsigned int
+testInternalGet (uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -160,7 +160,7 @@ testInternalGet (int poll_flag)
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
+                        | (enum MHD_FLAG) poll_flag,
                         global_port, NULL, NULL,
                         &ahc_echo, "GET",
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
@@ -175,7 +175,7 @@ testInternalGet (int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    global_port = (int) dinfo->port;
+    global_port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1"; EXPECTED_URI_PATH);
@@ -210,8 +210,8 @@ testInternalGet (int poll_flag)
 }
 
 
-static int
-testMultithreadedGet (int poll_flag)
+static unsigned int
+testMultithreadedGet (uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -232,7 +232,7 @@ testMultithreadedGet (int poll_flag)
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION
                         | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
+                        | (enum MHD_FLAG) poll_flag,
                         global_port, NULL, NULL,
                         &ahc_echo, "GET",
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
@@ -247,7 +247,7 @@ testMultithreadedGet (int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    global_port = (int) dinfo->port;
+    global_port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1"; EXPECTED_URI_PATH);
@@ -282,8 +282,8 @@ testMultithreadedGet (int poll_flag)
 }
 
 
-static int
-testMultithreadedPoolGet (int poll_flag)
+static unsigned int
+testMultithreadedPoolGet (uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -303,7 +303,7 @@ testMultithreadedPoolGet (int poll_flag)
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
+                        | (enum MHD_FLAG) poll_flag,
                         global_port, NULL, NULL,
                         &ahc_echo, "GET",
                         MHD_OPTION_THREAD_POOL_SIZE, MHD_CPU_COUNT,
@@ -319,7 +319,7 @@ testMultithreadedPoolGet (int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    global_port = (int) dinfo->port;
+    global_port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1"; EXPECTED_URI_PATH);
@@ -354,7 +354,7 @@ testMultithreadedPoolGet (int poll_flag)
 }
 
 
-static int
+static unsigned int
 testExternalGet ()
 {
   struct MHD_Daemon *d;
@@ -400,7 +400,7 @@ testExternalGet ()
     {
       MHD_stop_daemon (d); return 32;
     }
-    global_port = (int) dinfo->port;
+    global_port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1"; EXPECTED_URI_PATH);
@@ -537,8 +537,8 @@ testExternalGet ()
 }
 
 
-static int
-testUnknownPortGet (int poll_flag)
+static unsigned int
+testUnknownPortGet (uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   const union MHD_DaemonInfo *di;
@@ -546,7 +546,7 @@ testUnknownPortGet (int poll_flag)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   struct sockaddr_in addr;
   socklen_t addr_len = sizeof(addr);
@@ -559,7 +559,7 @@ testUnknownPortGet (int poll_flag)
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
+                        | (enum MHD_FLAG) poll_flag,
                         0, NULL, NULL, &ahc_echo, "GET",
                         MHD_OPTION_SOCK_ADDR, &addr,
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
@@ -575,7 +575,7 @@ testUnknownPortGet (int poll_flag)
 
     if (addr.sin_family != AF_INET)
       return 26214;
-    port = (int) ntohs (addr.sin_port);
+    port = ntohs (addr.sin_port);
   }
   else
   {
@@ -585,13 +585,13 @@ testUnknownPortGet (int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
 
   snprintf (buf,
             sizeof(buf),
-            "http://127.0.0.1:%d%s";,
-            port,
+            "http://127.0.0.1:%u%s";,
+            (unsigned int) port,
             EXPECTED_URI_PATH);
 
   c = curl_easy_init ();
@@ -626,8 +626,8 @@ testUnknownPortGet (int poll_flag)
 }
 
 
-static int
-testStopRace (int poll_flag)
+static unsigned int
+testStopRace (uint32_t poll_flag)
 {
   struct sockaddr_in sin;
   MHD_socket fd;
@@ -643,7 +643,7 @@ testStopRace (int poll_flag)
 
   d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION
                         | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
+                        | (enum MHD_FLAG) poll_flag,
                         global_port, NULL, NULL,
                         &ahc_echo, "GET",
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
@@ -658,7 +658,7 @@ testStopRace (int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    global_port = (int) dinfo->port;
+    global_port = dinfo->port;
   }
 
   fd = socket (PF_INET, SOCK_STREAM, 0);
@@ -749,8 +749,8 @@ curlExcessFound (CURL *c, curl_infotype type, char *data, 
size_t size,
 }
 
 
-static int
-testEmptyGet (int poll_flag)
+static unsigned int
+testEmptyGet (uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -771,7 +771,7 @@ testEmptyGet (int poll_flag)
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
+                        | (enum MHD_FLAG) poll_flag,
                         global_port, NULL, NULL,
                         &ahc_empty, NULL,
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
@@ -786,7 +786,7 @@ testEmptyGet (int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    global_port = (int) dinfo->port;
+    global_port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1"; EXPECTED_URI_PATH);
diff --git a/src/testcurl/test_get_iovec.c b/src/testcurl/test_get_iovec.c
index 0a41e6d1..f979ae6e 100644
--- a/src/testcurl/test_get_iovec.c
+++ b/src/testcurl/test_get_iovec.c
@@ -169,8 +169,8 @@ ahc_cont (void *cls,
 
   for (i = 0; i < TESTSTR_IOVCNT; ++i)
   {
-    iov[i].iov_base = data + (i * (TESTSTR_SIZE / TESTSTR_IOVCNT
-                                   / sizeof(int)));
+    iov[i].iov_base = data + (((size_t) i)
+                              * (TESTSTR_SIZE / TESTSTR_IOVCNT / sizeof(int)));
     iov[i].iov_len = TESTSTR_SIZE / TESTSTR_IOVCNT;
   }
 
@@ -230,7 +230,7 @@ ahc_ncont (void *cls,
 
     for (i = 0; i < (int) (TESTSTR_IOVLEN / sizeof(int)); ++i)
     {
-      data[i] = i + (j * TESTSTR_IOVLEN / sizeof(int));
+      data[i] = i + (j * (int) (TESTSTR_IOVLEN / sizeof(int)));
     }
     iov[j].iov_base = (const void *) data;
     iov[j].iov_len = TESTSTR_IOVLEN;
@@ -251,14 +251,14 @@ ahc_ncont (void *cls,
 }
 
 
-static int
+static unsigned int
 testInternalGet (bool contiguous)
 {
   struct MHD_Daemon *d;
   CURL *c;
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -294,7 +294,7 @@ testInternalGet (bool contiguous)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/";);
@@ -331,14 +331,14 @@ testInternalGet (bool contiguous)
 }
 
 
-static int
+static unsigned int
 testMultithreadedGet (void)
 {
   struct MHD_Daemon *d;
   CURL *c;
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -366,7 +366,7 @@ testMultithreadedGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/";);
@@ -403,14 +403,14 @@ testMultithreadedGet (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolGet (void)
 {
   struct MHD_Daemon *d;
   CURL *c;
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -439,7 +439,7 @@ testMultithreadedPoolGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/";);
@@ -476,7 +476,7 @@ testMultithreadedPoolGet (void)
 }
 
 
-static int
+static unsigned int
 testExternalGet (void)
 {
   struct MHD_Daemon *d;
@@ -497,7 +497,7 @@ testExternalGet (void)
   struct CURLMsg *msg;
   time_t start;
   struct timeval tv;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -524,7 +524,7 @@ testExternalGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/";);
@@ -659,7 +659,7 @@ testExternalGet (void)
 }
 
 
-static int
+static unsigned int
 testUnknownPortGet (void)
 {
   struct MHD_Daemon *d;
@@ -667,7 +667,7 @@ testUnknownPortGet (void)
   CURL *c;
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
   char buf[2048];
 
   struct sockaddr_in addr;
@@ -698,7 +698,7 @@ testUnknownPortGet (void)
 
     if (addr.sin_family != AF_INET)
       return 26214;
-    port = (int) ntohs (addr.sin_port);
+    port = ntohs (addr.sin_port);
   }
   else
   {
@@ -708,11 +708,11 @@ testUnknownPortGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
 
-  snprintf (buf, sizeof(buf), "http://127.0.0.1:%d/";,
-            port);
+  snprintf (buf, sizeof(buf), "http://127.0.0.1:%u/";,
+            (unsigned int) port);
 
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, buf);
diff --git a/src/testcurl/test_get_response_cleanup.c 
b/src/testcurl/test_get_response_cleanup.c
index dee0806c..442f9f25 100644
--- a/src/testcurl/test_get_response_cleanup.c
+++ b/src/testcurl/test_get_response_cleanup.c
@@ -152,12 +152,12 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testInternalGet (void)
 {
   struct MHD_Daemon *d;
   pid_t curl;
-  int port;
+  uint16_t port;
   char url[127];
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
@@ -182,12 +182,12 @@ testInternalGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   snprintf (url,
             sizeof (url),
-            "http://127.0.0.1:%d/";,
-            port);
+            "http://127.0.0.1:%u/";,
+            (unsigned int) port);
   curl = fork_curl (url);
   (void) sleep (1);
   kill_curl (curl);
@@ -200,12 +200,12 @@ testInternalGet (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedGet (void)
 {
   struct MHD_Daemon *d;
   pid_t curl;
-  int port;
+  uint16_t port;
   char url[127];
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
@@ -233,12 +233,12 @@ testMultithreadedGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   snprintf (url,
             sizeof (url),
-            "http://127.0.0.1:%d/";,
-            port);
+            "http://127.0.0.1:%u/";,
+            (unsigned int) port);
   // fprintf (stderr, "Forking cURL!\n");
   curl = fork_curl (url);
   (void) sleep (1);
@@ -263,12 +263,12 @@ testMultithreadedGet (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolGet (void)
 {
   struct MHD_Daemon *d;
   pid_t curl;
-  int port;
+  uint16_t port;
   char url[127];
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
@@ -295,12 +295,12 @@ testMultithreadedPoolGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   snprintf (url,
             sizeof (url),
-            "http://127.0.0.1:%d/";,
-            port);
+            "http://127.0.0.1:%u/";,
+            (unsigned int) port);
   curl = fork_curl (url);
   (void) sleep (1);
   kill_curl (curl);
@@ -313,7 +313,7 @@ testMultithreadedPoolGet (void)
 }
 
 
-static int
+static unsigned int
 testExternalGet (void)
 {
   struct MHD_Daemon *d;
@@ -324,7 +324,7 @@ testExternalGet (void)
   time_t start;
   struct timeval tv;
   pid_t curl;
-  int port;
+  uint16_t port;
   char url[127];
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
@@ -349,12 +349,12 @@ testExternalGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   snprintf (url,
             sizeof (url),
-            "http://127.0.0.1:%d/";,
-            port);
+            "http://127.0.0.1:%u/";,
+            (unsigned int) port);
   curl = fork_curl (url);
 
   start = time (NULL);
diff --git a/src/testcurl/test_get_sendfile.c b/src/testcurl/test_get_sendfile.c
index 897af245..3e424b10 100644
--- a/src/testcurl/test_get_sendfile.c
+++ b/src/testcurl/test_get_sendfile.c
@@ -119,7 +119,7 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testInternalGet (void)
 {
   struct MHD_Daemon *d;
@@ -127,7 +127,7 @@ testInternalGet (void)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -153,7 +153,7 @@ testInternalGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/";);
@@ -190,7 +190,7 @@ testInternalGet (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedGet (void)
 {
   struct MHD_Daemon *d;
@@ -198,7 +198,7 @@ testMultithreadedGet (void)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -225,7 +225,7 @@ testMultithreadedGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/";);
@@ -262,7 +262,7 @@ testMultithreadedGet (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolGet (void)
 {
   struct MHD_Daemon *d;
@@ -270,7 +270,7 @@ testMultithreadedPoolGet (void)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -298,7 +298,7 @@ testMultithreadedPoolGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/";);
@@ -335,7 +335,7 @@ testMultithreadedPoolGet (void)
 }
 
 
-static int
+static unsigned int
 testExternalGet (void)
 {
   struct MHD_Daemon *d;
@@ -357,7 +357,7 @@ testExternalGet (void)
   struct CURLMsg *msg;
   time_t start;
   struct timeval tv;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -384,7 +384,7 @@ testExternalGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/";);
@@ -526,7 +526,7 @@ testExternalGet (void)
 }
 
 
-static int
+static unsigned int
 testUnknownPortGet (void)
 {
   struct MHD_Daemon *d;
@@ -535,7 +535,7 @@ testUnknownPortGet (void)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   struct sockaddr_in addr;
   socklen_t addr_len = sizeof(addr);
@@ -565,7 +565,7 @@ testUnknownPortGet (void)
 
     if (addr.sin_family != AF_INET)
       return 26214;
-    port = (int) ntohs (addr.sin_port);
+    port = (uint16_t) ntohs (addr.sin_port);
   }
   else
   {
@@ -575,11 +575,11 @@ testUnknownPortGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
 
-  snprintf (buf, sizeof(buf), "http://127.0.0.1:%d/";,
-            port);
+  snprintf (buf, sizeof(buf), "http://127.0.0.1:%u/";,
+            (unsigned int) port);
 
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, buf);
diff --git a/src/testcurl/test_get_wait.c b/src/testcurl/test_get_wait.c
index b2938fdf..a382a798 100644
--- a/src/testcurl/test_get_wait.c
+++ b/src/testcurl/test_get_wait.c
@@ -116,12 +116,12 @@ thread_gets (void *param)
   CURLcode errornum;
   unsigned int i;
   char url[64];
-  int port = (int) (intptr_t) param;
+  uint16_t port = (uint16_t) (intptr_t) param;
 
   snprintf (url,
             sizeof (url),
-            "http://127.0.0.1:%d/hello_world";,
-            port);
+            "http://127.0.0.1:%u/hello_world";,
+            (unsigned int) port);
 
   c = curl_easy_init ();
   if (NULL == c)
@@ -156,8 +156,8 @@ thread_gets (void *param)
 }
 
 
-static int
-testRunWaitGet (int port, int poll_flag)
+static unsigned int
+testRunWaitGet (uint16_t port, uint32_t poll_flag)
 {
   pthread_t get_tid;
   struct MHD_Daemon *d;
@@ -175,7 +175,7 @@ testRunWaitGet (int port, int poll_flag)
   printf ("Starting MHD_run_wait() test with MHD in %s polling mode.\n",
           test_desc);
   signal_done = 0;
-  d = MHD_start_daemon (MHD_USE_ERROR_LOG | poll_flag,
+  d = MHD_start_daemon (MHD_USE_ERROR_LOG | (enum MHD_FLAG) poll_flag,
                         port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     abort ();
@@ -185,7 +185,7 @@ testRunWaitGet (int port, int poll_flag)
     dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
     if ((NULL == dinfo) || (0 == dinfo->port) )
       abort ();
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
 
   if (0 != pthread_create (&get_tid, NULL,
@@ -214,7 +214,7 @@ testRunWaitGet (int port, int poll_flag)
 int
 main (int argc, char *const *argv)
 {
-  int port = 1675;
+  uint16_t port = 1675;
   (void) argc;   /* Unused. Silent compiler warning. */
 
   if ((NULL == argv) || (0 == argv[0]))
diff --git a/src/testcurl/test_head.c b/src/testcurl/test_head.c
index f435a4f4..6ce78217 100644
--- a/src/testcurl/test_head.c
+++ b/src/testcurl/test_head.c
@@ -435,7 +435,7 @@ setCURL_rq_path (CURL *c, int uri_exist)
 
 
 static CURL *
-setupCURL (void *cbc, unsigned int port,
+setupCURL (void *cbc, uint16_t port,
            struct headers_check_result *hdr_chk_result)
 {
   CURL *c;
@@ -715,7 +715,7 @@ testHead (void)
   cbc.size = sizeof (buf);
   cbc.pos = 0;
   memset (cbc.buf, 0, cbc.size);
-  c = setupCURL (&cbc, (unsigned int) port, &rp_headers_check);
+  c = setupCURL (&cbc, port, &rp_headers_check);
   setCURL_rq_path (c, 1);
   multi_reuse = NULL;
   /* First request */
diff --git a/src/testcurl/test_iplimit.c b/src/testcurl/test_iplimit.c
index 1e747f0c..f60876e3 100644
--- a/src/testcurl/test_iplimit.c
+++ b/src/testcurl/test_iplimit.c
@@ -108,7 +108,7 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testMultithreadedGet (void)
 {
   struct MHD_Daemon *d;
@@ -116,7 +116,7 @@ testMultithreadedGet (void)
   int k;
   unsigned int success;
   unsigned int failure;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -146,7 +146,7 @@ testMultithreadedGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
 
   for (k = 0; k < 3; ++k)
@@ -223,13 +223,13 @@ testMultithreadedGet (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolGet (void)
 {
   struct MHD_Daemon *d;
   char buf[2048];
   int k;
-  int port;
+  uint16_t port;
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
   else
@@ -258,7 +258,7 @@ testMultithreadedPoolGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
 
   for (k = 0; k < 3; ++k)
diff --git a/src/testcurl/test_large_put.c b/src/testcurl/test_large_put.c
index 8a597c28..c46e120a 100644
--- a/src/testcurl/test_large_put.c
+++ b/src/testcurl/test_large_put.c
@@ -297,7 +297,7 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testPutInternalThread (unsigned int add_flag)
 {
   struct MHD_Daemon *d;
@@ -307,7 +307,7 @@ testPutInternalThread (unsigned int add_flag)
   int done_flag = 0;
   CURLcode errornum;
   char buf[2048];
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -338,7 +338,7 @@ testPutInternalThread (unsigned int add_flag)
     dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
     if ((NULL == dinfo) || (0 == dinfo->port) )
       mhdErrorExit ();
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
 
   c = curl_easy_init ();
@@ -402,7 +402,7 @@ testPutInternalThread (unsigned int add_flag)
 }
 
 
-static int
+static unsigned int
 testPutThreadPerConn (unsigned int add_flag)
 {
   struct MHD_Daemon *d;
@@ -412,7 +412,7 @@ testPutThreadPerConn (unsigned int add_flag)
   int done_flag = 0;
   CURLcode errornum;
   char buf[2048];
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -444,7 +444,7 @@ testPutThreadPerConn (unsigned int add_flag)
     dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
     if ((NULL == dinfo) || (0 == dinfo->port) )
       mhdErrorExit ();
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
 
   c = curl_easy_init ();
@@ -507,7 +507,7 @@ testPutThreadPerConn (unsigned int add_flag)
 }
 
 
-static int
+static unsigned int
 testPutThreadPool (unsigned int add_flag)
 {
   struct MHD_Daemon *d;
@@ -517,7 +517,7 @@ testPutThreadPool (unsigned int add_flag)
   int done_flag = 0;
   CURLcode errornum;
   char buf[2048];
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -549,7 +549,7 @@ testPutThreadPool (unsigned int add_flag)
     dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
     if ((NULL == dinfo) || (0 == dinfo->port) )
       mhdErrorExit ();
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
 
   c = curl_easy_init ();
@@ -611,7 +611,7 @@ testPutThreadPool (unsigned int add_flag)
 }
 
 
-static int
+static unsigned int
 testPutExternal (void)
 {
   struct MHD_Daemon *d;
@@ -629,7 +629,7 @@ testPutExternal (void)
   size_t pos = 0;
   int done_flag = 0;
   char buf[2048];
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -660,7 +660,7 @@ testPutExternal (void)
     dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
     if ((NULL == dinfo) || (0 == dinfo->port) )
       mhdErrorExit ();
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
 
   c = curl_easy_init ();
diff --git a/src/testcurl/test_long_header.c b/src/testcurl/test_long_header.c
index c1d07cb3..6ed8d78d 100644
--- a/src/testcurl/test_long_header.c
+++ b/src/testcurl/test_long_header.c
@@ -96,7 +96,7 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testLongUrlGet (size_t buff_size)
 {
   struct MHD_Daemon *d;
@@ -105,13 +105,13 @@ testLongUrlGet (size_t buff_size)
   struct CBC cbc;
   char *url;
   long code;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
   else
   {
-    port = 1330 + buff_size % 20;
+    port = 1330 + (uint16_t) (buff_size % 20);
     if (oneone)
       port += 5;
   }
@@ -136,7 +136,7 @@ testLongUrlGet (size_t buff_size)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   url = malloc (VERY_LONG);
@@ -187,7 +187,7 @@ testLongUrlGet (size_t buff_size)
 }
 
 
-static int
+static unsigned int
 testLongHeaderGet (size_t buff_size)
 {
   struct MHD_Daemon *d;
@@ -197,13 +197,13 @@ testLongHeaderGet (size_t buff_size)
   char *url;
   long code;
   struct curl_slist *header = NULL;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
   else
   {
-    port = 1331 + buff_size % 20;
+    port = 1331 + (uint16_t) (buff_size % 20);
     if (oneone)
       port += 5;
   }
@@ -229,7 +229,7 @@ testLongHeaderGet (size_t buff_size)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   url = malloc (VERY_LONG);
diff --git a/src/testcurl/test_parse_cookies.c 
b/src/testcurl/test_parse_cookies.c
index 7de83c32..835e8934 100644
--- a/src/testcurl/test_parse_cookies.c
+++ b/src/testcurl/test_parse_cookies.c
@@ -146,7 +146,7 @@ ahc_echo (void *cls,
 
 
 /* Re-use the same port for all checks */
-static unsigned int port;
+static uint16_t port;
 
 static unsigned int
 testExternalGet (int test_number)
@@ -188,7 +188,7 @@ testExternalGet (int test_number)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
diff --git a/src/testcurl/test_patch.c b/src/testcurl/test_patch.c
index ffdbf229..d5608335 100644
--- a/src/testcurl/test_patch.c
+++ b/src/testcurl/test_patch.c
@@ -58,8 +58,8 @@ struct CBC
 static size_t
 putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
 {
-  unsigned int *pos = ptr;
-  unsigned int wrt;
+  size_t *pos = ptr;
+  size_t wrt;
 
   wrt = size * nmemb;
   if (wrt > 8 - (*pos))
@@ -126,7 +126,7 @@ ahc_echo (void *cls,
 static CURL *
 setup_curl (long port,
             struct CBC *cbc,
-            unsigned int *pos)
+            size_t *pos)
 {
   CURL *c;
 
@@ -156,17 +156,17 @@ setup_curl (long port,
 }
 
 
-static int
+static unsigned int
 testInternalPut (void)
 {
   struct MHD_Daemon *d;
   CURL *c;
   char buf[2048];
   struct CBC cbc;
-  unsigned int pos = 0;
+  size_t pos = 0;
   int done_flag = 0;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -193,7 +193,7 @@ testInternalPut (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = setup_curl (port, &cbc, &pos);
   if (CURLE_OK != (errornum = curl_easy_perform (c)))
@@ -215,17 +215,17 @@ testInternalPut (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPut (void)
 {
   struct MHD_Daemon *d;
   CURL *c;
   char buf[2048];
   struct CBC cbc;
-  unsigned int pos = 0;
+  size_t pos = 0;
   int done_flag = 0;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -253,7 +253,7 @@ testMultithreadedPut (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = setup_curl (port, &cbc, &pos);
   if (CURLE_OK != (errornum = curl_easy_perform (c)))
@@ -276,17 +276,17 @@ testMultithreadedPut (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolPut (void)
 {
   struct MHD_Daemon *d;
   CURL *c;
   char buf[2048];
   struct CBC cbc;
-  unsigned int pos = 0;
+  size_t pos = 0;
   int done_flag = 0;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -315,7 +315,7 @@ testMultithreadedPoolPut (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = setup_curl (port, &cbc, &pos);
   if (CURLE_OK != (errornum = curl_easy_perform (c)))
@@ -338,7 +338,7 @@ testMultithreadedPoolPut (void)
 }
 
 
-static int
+static unsigned int
 testExternalPut (void)
 {
   struct MHD_Daemon *d;
@@ -356,9 +356,9 @@ testExternalPut (void)
   struct CURLMsg *msg;
   time_t start;
   struct timeval tv;
-  unsigned int pos = 0;
+  size_t pos = 0;
   int done_flag = 0;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -386,7 +386,7 @@ testExternalPut (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = setup_curl (port, &cbc, &pos);
 
diff --git a/src/testcurl/test_post.c b/src/testcurl/test_post.c
index f0040140..1102da5a 100644
--- a/src/testcurl/test_post.c
+++ b/src/testcurl/test_post.c
@@ -165,7 +165,7 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testInternalPost (void)
 {
   struct MHD_Daemon *d;
@@ -173,7 +173,7 @@ testInternalPost (void)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -201,7 +201,7 @@ testInternalPost (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -241,7 +241,7 @@ testInternalPost (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPost (void)
 {
   struct MHD_Daemon *d;
@@ -249,7 +249,7 @@ testMultithreadedPost (void)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -278,7 +278,7 @@ testMultithreadedPost (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -318,7 +318,7 @@ testMultithreadedPost (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolPost (void)
 {
   struct MHD_Daemon *d;
@@ -326,7 +326,7 @@ testMultithreadedPoolPost (void)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -355,7 +355,7 @@ testMultithreadedPoolPost (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -395,7 +395,7 @@ testMultithreadedPoolPost (void)
 }
 
 
-static int
+static unsigned int
 testExternalPost (void)
 {
   struct MHD_Daemon *d;
@@ -417,7 +417,7 @@ testExternalPost (void)
   struct CURLMsg *msg;
   time_t start;
   struct timeval tv;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -446,7 +446,7 @@ testExternalPost (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -666,7 +666,7 @@ slowReadBuffer (void *p, size_t size, size_t nmemb, void 
*opaque)
 #define FLAG_COUNT 16
 
 
-static int
+static unsigned int
 testMultithreadedPostCancelPart (int flags)
 {
   struct MHD_Daemon *d;
@@ -677,9 +677,9 @@ testMultithreadedPostCancelPart (int flags)
   struct curl_slist *headers = NULL;
   long response_code;
   CURLcode cc;
-  int result = 0;
+  unsigned int result = 0;
   struct CRBC crbc;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -712,7 +712,7 @@ testMultithreadedPostCancelPart (int flags)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
 
   crbc.buffer = "Test content";
@@ -802,10 +802,10 @@ testMultithreadedPostCancelPart (int flags)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPostCancel (void)
 {
-  int result = 0;
+  unsigned int result = 0;
   int flags;
   for (flags = 0; flags < FLAG_COUNT; ++flags)
     result |= testMultithreadedPostCancelPart (flags);
diff --git a/src/testcurl/test_post_loop.c b/src/testcurl/test_post_loop.c
index efcd5370..8a7e0d05 100644
--- a/src/testcurl/test_post_loop.c
+++ b/src/testcurl/test_post_loop.c
@@ -117,7 +117,7 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testInternalPost (void)
 {
   struct MHD_Daemon *d;
@@ -127,7 +127,7 @@ testInternalPost (void)
   CURLcode errornum;
   int i;
   char url[1024];
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -152,7 +152,7 @@ testInternalPost (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   for (i = 0; i < LOOPCOUNT; i++)
   {
@@ -163,8 +163,8 @@ testInternalPost (void)
     buf[0] = '\0';
     snprintf (url,
               sizeof (url),
-              "http://127.0.0.1:%d/hw%d";,
-              port,
+              "http://127.0.0.1:%u/hw%d";,
+              (unsigned int) port,
               i);
     curl_easy_setopt (c, CURLOPT_URL, url);
     curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
@@ -206,7 +206,7 @@ testInternalPost (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPost (void)
 {
   struct MHD_Daemon *d;
@@ -216,7 +216,7 @@ testMultithreadedPost (void)
   CURLcode errornum;
   int i;
   char url[1024];
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -244,7 +244,7 @@ testMultithreadedPost (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   for (i = 0; i < LOOPCOUNT; i++)
   {
@@ -255,8 +255,8 @@ testMultithreadedPost (void)
     buf[0] = '\0';
     snprintf (url,
               sizeof (url),
-              "http://127.0.0.1:%d/hw%d";,
-              port,
+              "http://127.0.0.1:%u/hw%d";,
+              (unsigned int) port,
               i);
     curl_easy_setopt (c, CURLOPT_URL, url);
     curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
@@ -298,7 +298,7 @@ testMultithreadedPost (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolPost (void)
 {
   struct MHD_Daemon *d;
@@ -308,7 +308,7 @@ testMultithreadedPoolPost (void)
   CURLcode errornum;
   int i;
   char url[1024];
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -335,7 +335,7 @@ testMultithreadedPoolPost (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   for (i = 0; i < LOOPCOUNT; i++)
   {
@@ -346,8 +346,8 @@ testMultithreadedPoolPost (void)
     buf[0] = '\0';
     snprintf (url,
               sizeof (url),
-              "http://127.0.0.1:%d/hw%d";,
-              port,
+              "http://127.0.0.1:%u/hw%d";,
+              (unsigned int) port,
               i);
     curl_easy_setopt (c, CURLOPT_URL, url);
     curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
@@ -389,7 +389,7 @@ testMultithreadedPoolPost (void)
 }
 
 
-static int
+static unsigned int
 testExternalPost (void)
 {
   struct MHD_Daemon *d;
@@ -415,7 +415,7 @@ testExternalPost (void)
   uint64_t timeout64;
   long ctimeout;
   char url[1024];
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -442,7 +442,7 @@ testExternalPost (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   multi = curl_multi_init ();
   if (multi == NULL)
@@ -459,8 +459,8 @@ testExternalPost (void)
     buf[0] = '\0';
     snprintf (url,
               sizeof (url),
-              "http://127.0.0.1:%d/hw%d";,
-              port,
+              "http://127.0.0.1:%u/hw%d";,
+              (unsigned int) port,
               i);
     curl_easy_setopt (c, CURLOPT_URL, url);
     curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
@@ -644,21 +644,24 @@ main (int argc, char *const *argv)
              oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" :
              "%s: Sequential POSTs (http/1.0) %f/s\n",
              "internal select",
-             (double) 1000 * LOOPCOUNT / (now () - start_time + 1.0));
+             (double) 1000 * LOOPCOUNT
+             / ((double) (now () - start_time) + 1.0));
     start_time = now ();
     errorCount += testMultithreadedPost ();
     fprintf (stderr,
              oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" :
              "%s: Sequential POSTs (http/1.0) %f/s\n",
              "multithreaded post",
-             (double) 1000 * LOOPCOUNT / (now () - start_time + 1.0));
+             (double) 1000 * LOOPCOUNT
+             / ((double) (now () - start_time) + 1.0));
     start_time = now ();
     errorCount += testMultithreadedPoolPost ();
     fprintf (stderr,
              oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" :
              "%s: Sequential POSTs (http/1.0) %f/s\n",
              "thread with pool",
-             (double) 1000 * LOOPCOUNT / (now () - start_time + 1.0));
+             (double) 1000 * LOOPCOUNT
+             / ((double) (now () - start_time) + 1.0));
   }
   start_time = now ();
   errorCount += testExternalPost ();
@@ -666,7 +669,8 @@ main (int argc, char *const *argv)
            oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" :
            "%s: Sequential POSTs (http/1.0) %f/s\n",
            "external select",
-           (double) 1000 * LOOPCOUNT / (now () - start_time + 1.0));
+           (double) 1000 * LOOPCOUNT
+           / ((double) (now () - start_time) + 1.0));
   if (errorCount != 0)
     fprintf (stderr, "Error (code: %u)\n", errorCount);
   curl_global_cleanup ();
diff --git a/src/testcurl/test_postform.c b/src/testcurl/test_postform.c
index 4fb4fe4f..e46250af 100644
--- a/src/testcurl/test_postform.c
+++ b/src/testcurl/test_postform.c
@@ -187,7 +187,7 @@ make_form (void)
 }
 
 
-static int
+static unsigned int
 testInternalPost (void)
 {
   struct MHD_Daemon *d;
@@ -196,7 +196,7 @@ testInternalPost (void)
   struct CBC cbc;
   CURLcode errornum;
   struct curl_httppost *pd;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -224,7 +224,7 @@ testInternalPost (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -265,7 +265,7 @@ testInternalPost (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPost (void)
 {
   struct MHD_Daemon *d;
@@ -274,7 +274,7 @@ testMultithreadedPost (void)
   struct CBC cbc;
   CURLcode errornum;
   struct curl_httppost *pd;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -303,7 +303,7 @@ testMultithreadedPost (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -344,7 +344,7 @@ testMultithreadedPost (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolPost (void)
 {
   struct MHD_Daemon *d;
@@ -353,7 +353,7 @@ testMultithreadedPoolPost (void)
   struct CBC cbc;
   CURLcode errornum;
   struct curl_httppost *pd;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -382,7 +382,7 @@ testMultithreadedPoolPost (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -423,7 +423,7 @@ testMultithreadedPoolPost (void)
 }
 
 
-static int
+static unsigned int
 testExternalPost (void)
 {
   struct MHD_Daemon *d;
@@ -446,7 +446,7 @@ testExternalPost (void)
   time_t start;
   struct timeval tv;
   struct curl_httppost *pd;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -475,7 +475,7 @@ testExternalPost (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
diff --git a/src/testcurl/test_process_arguments.c 
b/src/testcurl/test_process_arguments.c
index 14c00aab..9aa713dc 100644
--- a/src/testcurl/test_process_arguments.c
+++ b/src/testcurl/test_process_arguments.c
@@ -111,7 +111,7 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testExternalGet (void)
 {
   struct MHD_Daemon *d;
@@ -133,7 +133,7 @@ testExternalGet (void)
   struct CURLMsg *msg;
   time_t start;
   struct timeval tv;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -160,7 +160,7 @@ testExternalGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL,
diff --git a/src/testcurl/test_process_headers.c 
b/src/testcurl/test_process_headers.c
index 603b1fb6..721e3073 100644
--- a/src/testcurl/test_process_headers.c
+++ b/src/testcurl/test_process_headers.c
@@ -152,7 +152,7 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testInternalGet (void)
 {
   struct MHD_Daemon *d;
@@ -160,7 +160,7 @@ testInternalGet (void)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -186,7 +186,7 @@ testInternalGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -223,7 +223,7 @@ testInternalGet (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedGet (void)
 {
   struct MHD_Daemon *d;
@@ -231,7 +231,7 @@ testMultithreadedGet (void)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -258,7 +258,7 @@ testMultithreadedGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -295,7 +295,7 @@ testMultithreadedGet (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolGet (void)
 {
   struct MHD_Daemon *d;
@@ -303,7 +303,7 @@ testMultithreadedPoolGet (void)
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -331,7 +331,7 @@ testMultithreadedPoolGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -368,7 +368,7 @@ testMultithreadedPoolGet (void)
 }
 
 
-static int
+static unsigned int
 testExternalGet (void)
 {
   struct MHD_Daemon *d;
@@ -390,7 +390,7 @@ testExternalGet (void)
   struct CURLMsg *msg;
   time_t start;
   struct timeval tv;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -417,7 +417,7 @@ testExternalGet (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
diff --git a/src/testcurl/test_put.c b/src/testcurl/test_put.c
index 67318934..bc16ef52 100644
--- a/src/testcurl/test_put.c
+++ b/src/testcurl/test_put.c
@@ -58,8 +58,8 @@ struct CBC
 static size_t
 putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
 {
-  unsigned int *pos = ptr;
-  unsigned int wrt;
+  size_t *pos = ptr;
+  size_t wrt;
 
   wrt = size * nmemb;
   if (wrt > 8 - (*pos))
@@ -123,17 +123,17 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testInternalPut (void)
 {
   struct MHD_Daemon *d;
   CURL *c;
   char buf[2048];
   struct CBC cbc;
-  unsigned int pos = 0;
+  size_t pos = 0;
   int done_flag = 0;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -160,7 +160,7 @@ testInternalPut (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -201,17 +201,17 @@ testInternalPut (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPut (void)
 {
   struct MHD_Daemon *d;
   CURL *c;
   char buf[2048];
   struct CBC cbc;
-  unsigned int pos = 0;
+  size_t pos = 0;
   int done_flag = 0;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -239,7 +239,7 @@ testMultithreadedPut (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -281,17 +281,17 @@ testMultithreadedPut (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolPut (void)
 {
   struct MHD_Daemon *d;
   CURL *c;
   char buf[2048];
   struct CBC cbc;
-  unsigned int pos = 0;
+  size_t pos = 0;
   int done_flag = 0;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -320,7 +320,7 @@ testMultithreadedPoolPut (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -362,7 +362,7 @@ testMultithreadedPoolPut (void)
 }
 
 
-static int
+static unsigned int
 testExternalPut (void)
 {
   struct MHD_Daemon *d;
@@ -380,9 +380,9 @@ testExternalPut (void)
   struct CURLMsg *msg;
   time_t start;
   struct timeval tv;
-  unsigned int pos = 0;
+  size_t pos = 0;
   int done_flag = 0;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -410,7 +410,7 @@ testExternalPut (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
diff --git a/src/testcurl/test_put_chunked.c b/src/testcurl/test_put_chunked.c
index 7779b315..3ec998d8 100644
--- a/src/testcurl/test_put_chunked.c
+++ b/src/testcurl/test_put_chunked.c
@@ -56,8 +56,8 @@ struct CBC
 static size_t
 putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
 {
-  unsigned int *pos = ptr;
-  unsigned int wrt;
+  size_t *pos = ptr;
+  size_t wrt;
 
   wrt = size * nmemb;
   if (wrt > 8 - (*pos))
@@ -92,10 +92,10 @@ ahc_echo (void *cls,
           const char *upload_data, size_t *upload_data_size,
           void **req_cls)
 {
-  int *done = cls;
+  size_t *done = cls;
   struct MHD_Response *response;
   enum MHD_Result ret;
-  int have;
+  size_t have;
   (void) version; (void) req_cls;   /* Unused. Silent compiler warning. */
 
   if (0 != strcmp ("PUT", method))
@@ -133,17 +133,17 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testInternalPut (void)
 {
   struct MHD_Daemon *d;
   CURL *c;
   char buf[2048];
   struct CBC cbc;
-  unsigned int pos = 0;
-  int done_flag = 0;
+  size_t pos = 0;
+  size_t done_flag = 0;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -166,7 +166,7 @@ testInternalPut (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -207,17 +207,17 @@ testInternalPut (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPut (void)
 {
   struct MHD_Daemon *d;
   CURL *c;
   char buf[2048];
   struct CBC cbc;
-  unsigned int pos = 0;
-  int done_flag = 0;
+  size_t pos = 0;
+  size_t done_flag = 0;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -241,7 +241,7 @@ testMultithreadedPut (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -283,17 +283,17 @@ testMultithreadedPut (void)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolPut (void)
 {
   struct MHD_Daemon *d;
   CURL *c;
   char buf[2048];
   struct CBC cbc;
-  unsigned int pos = 0;
-  int done_flag = 0;
+  size_t pos = 0;
+  size_t done_flag = 0;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -318,7 +318,7 @@ testMultithreadedPoolPut (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -360,7 +360,7 @@ testMultithreadedPoolPut (void)
 }
 
 
-static int
+static unsigned int
 testExternalPut (void)
 {
   struct MHD_Daemon *d;
@@ -382,9 +382,9 @@ testExternalPut (void)
   struct CURLMsg *msg;
   time_t start;
   struct timeval tv;
-  unsigned int pos = 0;
-  int done_flag = 0;
-  int port;
+  size_t pos = 0;
+  size_t done_flag = 0;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -408,7 +408,7 @@ testExternalPut (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
diff --git a/src/testcurl/test_quiesce.c b/src/testcurl/test_quiesce.c
index 7425f839..6bd6967f 100644
--- a/src/testcurl/test_quiesce.c
+++ b/src/testcurl/test_quiesce.c
@@ -219,7 +219,7 @@ _checkCURLE_OK_func (CURLcode code, const char *curlFunc,
 /* Global parameters */
 static int verbose;                 /**< Be verbose */
 static int oneone;                  /**< If false use HTTP/1.0 for requests*/
-static int global_port;             /**< MHD daemons listen port number */
+static uint16_t global_port;        /**< MHD daemons listen port number */
 
 struct CBC
 {
@@ -394,8 +394,8 @@ setupCURL (void *cbc)
 }
 
 
-static int
-testGet (int type, int pool_count, int poll_flag)
+static unsigned int
+testGet (unsigned int type, int pool_count, uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -406,15 +406,16 @@ testGet (int type, int pool_count, int poll_flag)
   char *thrdRet;
 
   if (verbose)
-    printf ("testGet(%d, %d, %d) test started.\n",
-            type, pool_count, poll_flag);
+    printf ("testGet(%u, %d, %u) test started.\n",
+            type, pool_count, (unsigned int) poll_flag);
 
   cbc.buf = buf;
   cbc.size = sizeof(buf);
   cbc.pos = 0;
   if (pool_count > 0)
   {
-    d = MHD_start_daemon (type | MHD_USE_ERROR_LOG | MHD_USE_ITC | poll_flag,
+    d = MHD_start_daemon (type | MHD_USE_ERROR_LOG | MHD_USE_ITC
+                          | (enum MHD_FLAG) poll_flag,
                           global_port, NULL, NULL, &ahc_echo, NULL,
                           MHD_OPTION_THREAD_POOL_SIZE,
                           (unsigned int) pool_count,
@@ -423,7 +424,8 @@ testGet (int type, int pool_count, int poll_flag)
   }
   else
   {
-    d = MHD_start_daemon (type | MHD_USE_ERROR_LOG | MHD_USE_ITC | poll_flag,
+    d = MHD_start_daemon (type | MHD_USE_ERROR_LOG | MHD_USE_ITC
+                          | (enum MHD_FLAG) poll_flag,
                           global_port, NULL, NULL, &ahc_echo, NULL,
                           MHD_OPTION_END);
   }
@@ -435,7 +437,7 @@ testGet (int type, int pool_count, int poll_flag)
     dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
     if ((NULL == dinfo) || (0 == dinfo->port) )
       mhdErrorExit ();
-    global_port = (int) dinfo->port;
+    global_port = dinfo->port;
   }
 
   c = setupCURL (&cbc);
@@ -515,8 +517,8 @@ testGet (int type, int pool_count, int poll_flag)
 
   if (verbose)
   {
-    printf ("testGet(%d, %d, %d) test succeed.\n",
-            type, pool_count, poll_flag);
+    printf ("testGet(%u, %d, %u) test succeed.\n",
+            type, pool_count, (unsigned int) poll_flag);
     fflush (stdout);
   }
 
@@ -524,7 +526,7 @@ testGet (int type, int pool_count, int poll_flag)
 }
 
 
-static int
+static unsigned int
 testExternalGet (void)
 {
   struct MHD_Daemon *d;
@@ -564,7 +566,7 @@ testExternalGet (void)
     dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
     if ((NULL == dinfo) || (0 == dinfo->port) )
       mhdErrorExit ();
-    global_port = (int) dinfo->port;
+    global_port = dinfo->port;
   }
 
   for (i = 0; i < 2; i++)
diff --git a/src/testcurl/test_quiesce_stream.c 
b/src/testcurl/test_quiesce_stream.c
index 12b35903..b766012d 100644
--- a/src/testcurl/test_quiesce_stream.c
+++ b/src/testcurl/test_quiesce_stream.c
@@ -94,7 +94,7 @@ suspend_connection (struct MHD_Connection *connection)
 
 struct ContentReaderUserdata
 {
-  int bytes_written;
+  size_t bytes_written;
   struct MHD_Connection *connection;
 };
 
@@ -188,7 +188,7 @@ http_AccessHandlerCallback (void *cls,
 int
 main (void)
 {
-  int port;
+  uint16_t port;
   char command_line[1024];
   /* Flags */
   unsigned int daemon_flags
@@ -226,12 +226,12 @@ main (void)
     {
       MHD_stop_daemon (daemon); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   snprintf (command_line,
             sizeof (command_line),
-            "curl -s http://127.0.0.1:%d";,
-            port);
+            "curl -s http://127.0.0.1:%u";,
+            (unsigned int) port);
 
   if (0 != system (command_line))
   {
diff --git a/src/testcurl/test_termination.c b/src/testcurl/test_termination.c
index 239f10ec..47e873b0 100644
--- a/src/testcurl/test_termination.c
+++ b/src/testcurl/test_termination.c
@@ -98,7 +98,7 @@ int
 main (void)
 {
   struct MHD_Daemon *daemon;
-  int port;
+  uint16_t port;
   char url[255];
   CURL *curl;
   CURLcode success;
@@ -129,15 +129,15 @@ main (void)
     {
       MHD_stop_daemon (daemon); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
 
   curl = curl_easy_init ();
   /* curl_easy_setopt(curl, CURLOPT_POST, 1L); */
   snprintf (url,
             sizeof (url),
-            "http://127.0.0.1:%d";,
-            port);
+            "http://127.0.0.1:%u";,
+            (unsigned int) port);
   curl_easy_setopt (curl, CURLOPT_URL, url);
   curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, write_data);
 
diff --git a/src/testcurl/test_timeout.c b/src/testcurl/test_timeout.c
index 404cf040..79f8c88d 100644
--- a/src/testcurl/test_timeout.c
+++ b/src/testcurl/test_timeout.c
@@ -149,8 +149,8 @@ termination_cb (void *cls,
 static size_t
 putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
 {
-  unsigned int *pos = ptr;
-  unsigned int wrt;
+  size_t *pos = ptr;
+  size_t wrt;
 
   wrt = size * nmemb;
   if (wrt > 8 - (*pos))
@@ -223,17 +223,17 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testWithoutTimeout (void)
 {
   struct MHD_Daemon *d;
   CURL *c;
   char buf[2048];
   struct CBC cbc;
-  unsigned int pos = 0;
+  size_t pos = 0;
   int done_flag = 0;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -264,7 +264,7 @@ testWithoutTimeout (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
@@ -310,7 +310,7 @@ testWithoutTimeout (void)
 }
 
 
-static int
+static unsigned int
 testWithTimeout (void)
 {
   struct MHD_Daemon *d;
@@ -319,7 +319,7 @@ testWithTimeout (void)
   struct CBC cbc;
   int done_flag = 0;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -350,7 +350,7 @@ testWithTimeout (void)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world";);
diff --git a/src/testcurl/test_toolarge.c b/src/testcurl/test_toolarge.c
index 30f0d922..2b94ab7b 100644
--- a/src/testcurl/test_toolarge.c
+++ b/src/testcurl/test_toolarge.c
@@ -219,7 +219,7 @@ _mhdErrorExit_func (const char *errDesc, const char 
*funcName, int lineNum)
 /* Global parameters */
 static int verbose;                 /**< Be verbose */
 static int oneone;                  /**< If false use HTTP/1.0 for requests*/
-static int global_port;             /**< MHD daemons listen port number */
+static uint16_t global_port;        /**< MHD daemons listen port number */
 static int large_req_method;        /**< Large request method */
 static int large_req_url;           /**< Large request URL */
 static int large_req_header_name; /**< Large request single header name */
@@ -256,8 +256,8 @@ test_global_cleanup (void)
 struct headers_check_result
 {
   unsigned int num_n1_headers;
-  unsigned int large_header_name_size;
-  unsigned int large_header_value_size;
+  size_t large_header_name_size;
+  size_t large_header_value_size;
   int large_header_valid;
 };
 
@@ -281,7 +281,7 @@ lcurl_hdr_callback (char *buffer, size_t size, size_t 
nitems,
     if (NULL != col_ptr)
     {
       const char *const name = buffer;
-      const size_t name_len = col_ptr - buffer;
+      const size_t name_len = (size_t) (col_ptr - buffer);
       const size_t val_pos = name_len + 2;
       const size_t val_len = data_size - val_pos - 2; /* 2 = strlen("\r\n") */
       const char *const value = buffer + val_pos;
@@ -367,8 +367,8 @@ check_uri_cb (void *cls,
 struct mhd_header_checker_param
 {
   unsigned int num_n1_headers;
-  unsigned int large_header_name_size;
-  unsigned int large_header_value_size;
+  size_t large_header_name_size;
+  size_t large_header_value_size;
   int large_header_valid;
 };
 
@@ -520,10 +520,10 @@ ahcCheck (void *cls,
       externalErrorExit ();
     large_hrd_name[0] = '0'; /* Name starts with zero for unique 
identification */
     for (i = 1; i < large_hdr_name_size; i++)
-      large_hrd_name[i] = 'a' + i % ('z' - 'a' + 1);
+      large_hrd_name[i] = 'a' + (char) (unsigned char) (i % ('z' - 'a' + 1));
     large_hrd_name[large_hdr_name_size] = 0;
     for (i = 0; i < large_hdr_value_size; i++)
-      large_hrd_value[i] = 'Z' - i % ('Z' - 'A' + 1);
+      large_hrd_value[i] = 'Z' - (char) (unsigned char) (i % ('Z' - 'A' + 1));
     if (NULL != large_hrd_value)
       large_hrd_value[large_hdr_value_size] = 0;
     if (MHD_YES != MHD_add_response_header (response,
@@ -549,7 +549,7 @@ ahcCheck (void *cls,
 
 static CURL *
 curlEasyInitForTest (const char *queryPath, const char *method,
-                     int port,
+                     uint16_t port,
                      struct lcurl_data_cb_param *dcbp,
                      struct headers_check_result *hdr_chk_result,
                      struct curl_slist *headers)
@@ -701,13 +701,13 @@ struct curlQueryParams
   const char *method;
 
   /* Destination port for CURL query */
-  int queryPort;
+  uint16_t queryPort;
 
   /* List of additional request headers */
   struct curl_slist *headers;
 
   /* CURL query result error flag */
-  volatile int queryError;
+  volatile unsigned int queryError;
 
   /* Response HTTP code, zero if no response */
   volatile int responseCode;
@@ -715,7 +715,7 @@ struct curlQueryParams
 
 
 /* Returns zero for successful response and non-zero for failed response */
-static int
+static unsigned int
 doCurlQueryInThread (struct MHD_Daemon *d,
                      struct curlQueryParams *p,
                      struct headers_check_result *hdr_res,
@@ -810,13 +810,13 @@ doCurlQueryInThread (struct MHD_Daemon *d,
 
 
 /* Perform test queries, shut down MHD daemon, and free parameters */
-static int
-performTestQueries (struct MHD_Daemon *d, int d_port,
+static unsigned int
+performTestQueries (struct MHD_Daemon *d, uint16_t d_port,
                     struct ahc_cls_type *ahc_param,
                     struct check_uri_cls *uri_cb_param)
 {
   struct curlQueryParams qParam;
-  int ret = 0;          /* Return value */
+  unsigned int ret = 0;          /* Return value */
   struct headers_check_result rp_headers_check;
   char *buf;
   size_t i;
@@ -845,7 +845,7 @@ performTestQueries (struct MHD_Daemon *d, int d_port,
   if (large_req_method)
   {
     for (i = 0; i < TEST_START_SIZE; i++)
-      buf[i] = 'A' + i % ('Z' - 'A' + 1);
+      buf[i] = 'A' + (char) (unsigned char) (i % ('Z' - 'A' + 1));
     for (; i <= TEST_FAIL_SIZE; i++)
     {
       buf[i] = 0;
@@ -890,7 +890,7 @@ performTestQueries (struct MHD_Daemon *d, int d_port,
       if (0 != rp_headers_check.large_header_name_size)
         mhdErrorExitDesc ("Detected unexpected large reply header");
 
-      buf[i] = 'A' + i % ('Z' - 'A' + 1);
+      buf[i] = 'A' + (char) (unsigned char) (i % ('Z' - 'A' + 1));
     }
   }
   else if (large_req_url)
@@ -901,7 +901,7 @@ performTestQueries (struct MHD_Daemon *d, int d_port,
     memcpy (buf, URL_SCHEME_HOST, base_size);
     url[0] = '/';
     for (i = 1; i < TEST_START_SIZE; i++)
-      url[i] = 'a' + i % ('z' - 'a' + 1);
+      url[i] = 'a' + (char) (unsigned char) (i % ('z' - 'a' + 1));
     for (; i <= TEST_FAIL_SIZE; i++)
     {
       url[i] = 0;
@@ -947,14 +947,14 @@ performTestQueries (struct MHD_Daemon *d, int d_port,
       if (0 != rp_headers_check.large_header_name_size)
         mhdErrorExitDesc ("Detected unexpected large reply header");
 
-      url[i] = 'a' + i % ('z' - 'a' + 1);
+      url[i] = 'a' + (char) (unsigned char) (i % ('z' - 'a' + 1));
     }
   }
   else if (large_req_header_name)
   {
     buf[0] = '0'; /* Name starts with zero for unique identification */
     for (i = 1; i < TEST_START_SIZE; i++)
-      buf[i] = 'a' + i % ('z' - 'a' + 1);
+      buf[i] = 'a' + (char) (unsigned char) (i % ('z' - 'a' + 1));
     for (; i <= TEST_FAIL_SIZE; i++)
     {
       struct curl_slist *curl_headers;
@@ -1020,7 +1020,7 @@ performTestQueries (struct MHD_Daemon *d, int d_port,
         mhdErrorExitDesc ("Detected unexpected large reply header");
 
       curl_slist_free_all (curl_headers);
-      buf[i] = 'a' + i % ('z' - 'a' + 1);
+      buf[i] = 'a' + (char) (unsigned char) (i % ('z' - 'a' + 1));
     }
   }
   else if (large_req_header_value)
@@ -1029,7 +1029,7 @@ performTestQueries (struct MHD_Daemon *d, int d_port,
     /* Name starts with zero for unique identification */
     memcpy (buf, "0: ", 3); /* Note: strlen(": Z") is less than 
strlen(URL_SCHEME_HOST) */
     for (i = 0; i < TEST_START_SIZE; i++)
-      hdr_value[i] = 'Z' - i % ('Z' - 'A' + 1);
+      hdr_value[i] = 'Z' - (char) (unsigned char) (i % ('Z' - 'A' + 1));
     for (; i <= TEST_FAIL_SIZE; i++)
     {
       struct curl_slist *curl_headers;
@@ -1094,7 +1094,7 @@ performTestQueries (struct MHD_Daemon *d, int d_port,
         mhdErrorExitDesc ("Detected unexpected large reply header");
 
       curl_slist_free_all (curl_headers);
-      hdr_value[i] = 'Z' - i % ('Z' - 'A' + 1);
+      hdr_value[i] = 'Z' - (char) (unsigned char) (i % ('Z' - 'A' + 1));
     }
   }
   else if (large_req_headers)
@@ -1353,7 +1353,7 @@ enum testMhdPollType
 static unsigned int
 testNumThreadsForPool (enum testMhdPollType pollType)
 {
-  int numThreads = MHD_CPU_COUNT;
+  unsigned int numThreads = MHD_CPU_COUNT;
   (void) pollType; /* Don't care about pollType for this test */
   return numThreads; /* No practical limit for non-cleanup test */
 }
@@ -1361,7 +1361,7 @@ testNumThreadsForPool (enum testMhdPollType pollType)
 
 static struct MHD_Daemon *
 startTestMhdDaemon (enum testMhdThreadsType thrType,
-                    enum testMhdPollType pollType, int *pport,
+                    enum testMhdPollType pollType, uint16_t *pport,
                     struct ahc_cls_type **ahc_param,
                     struct check_uri_cls **uri_cb_param)
 {
@@ -1404,7 +1404,7 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
   }
 
   if (testMhdThreadInternalPool != thrType)
-    d = MHD_start_daemon (((int) thrType) | ((int) pollType)
+    d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
                           | (verbose ? MHD_USE_ERROR_LOG : 0),
                           *pport, NULL, NULL,
                           &ahcCheck, *ahc_param,
@@ -1414,7 +1414,8 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
                           (size_t) BUFFER_SIZE,
                           MHD_OPTION_END);
   else
-    d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | ((int) pollType)
+    d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD
+                          | ((unsigned int) pollType)
                           | (verbose ? MHD_USE_ERROR_LOG : 0),
                           *pport, NULL, NULL,
                           &ahcCheck, *ahc_param,
@@ -1440,7 +1441,7 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
       fprintf (stderr, "MHD_get_daemon_info() failed.\n");
       abort ();
     }
-    *pport = (int) dinfo->port;
+    *pport = dinfo->port;
     if (0 == global_port)
       global_port = *pport; /* Reuse the same port for all tests */
   }
@@ -1452,11 +1453,11 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
 /* Test runners */
 
 
-static int
+static unsigned int
 testExternalGet (void)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
+  uint16_t d_port = global_port; /* Daemon's port */
   struct ahc_cls_type *ahc_param;
   struct check_uri_cls *uri_cb_param;
 
@@ -1467,11 +1468,11 @@ testExternalGet (void)
 }
 
 
-static int
+static unsigned int
 testInternalGet (enum testMhdPollType pollType)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
+  uint16_t d_port = global_port; /* Daemon's port */
   struct ahc_cls_type *ahc_param;
   struct check_uri_cls *uri_cb_param;
 
@@ -1482,11 +1483,11 @@ testInternalGet (enum testMhdPollType pollType)
 }
 
 
-static int
+static unsigned int
 testMultithreadedGet (enum testMhdPollType pollType)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
+  uint16_t d_port = global_port; /* Daemon's port */
   struct ahc_cls_type *ahc_param;
   struct check_uri_cls *uri_cb_param;
 
@@ -1496,11 +1497,11 @@ testMultithreadedGet (enum testMhdPollType pollType)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolGet (enum testMhdPollType pollType)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
+  uint16_t d_port = global_port; /* Daemon's port */
   struct ahc_cls_type *ahc_param;
   struct check_uri_cls *uri_cb_param;
 
diff --git a/src/testcurl/test_tricky.c b/src/testcurl/test_tricky.c
index b3042f61..bca27606 100644
--- a/src/testcurl/test_tricky.c
+++ b/src/testcurl/test_tricky.c
@@ -211,7 +211,7 @@ _mhdErrorExit_func (const char *errDesc, const char 
*funcName, int lineNum)
 /* Global parameters */
 static int verbose;                 /**< Be verbose */
 static int oneone;                  /**< If false use HTTP/1.0 for requests*/
-static int global_port;             /**< MHD daemons listen port number */
+static uint16_t global_port;        /**< MHD daemons listen port number */
 static int response_timeout_val = TIMEOUTS_VAL;
 
 static int tricky_url;              /**< Tricky request URL */
@@ -455,13 +455,13 @@ struct curlQueryParams
   const char *method;
 
   /* Destination port for CURL query */
-  int queryPort;
+  uint16_t queryPort;
 
   /* List of additional request headers */
   struct curl_slist *headers;
 
   /* CURL query result error flag */
-  volatile int queryError;
+  volatile unsigned int queryError;
 
   /* Response HTTP code, zero if no response */
   volatile int responseCode;
@@ -623,7 +623,7 @@ performQueryExternal (struct MHD_Daemon *d, CURL *c)
 
 
 /* Returns zero for successful response and non-zero for failed response */
-static int
+static unsigned int
 doCurlQueryInThread (struct MHD_Daemon *d,
                      struct curlQueryParams *p,
                      struct headers_check_result *hdr_res,
@@ -722,13 +722,13 @@ doCurlQueryInThread (struct MHD_Daemon *d,
 
 
 /* Perform test queries, shut down MHD daemon, and free parameters */
-static int
-performTestQueries (struct MHD_Daemon *d, int d_port,
+static unsigned int
+performTestQueries (struct MHD_Daemon *d, uint16_t d_port,
                     struct ahc_cls_type *ahc_param,
                     struct check_uri_cls *uri_cb_param)
 {
   struct curlQueryParams qParam;
-  int ret = 0;          /* Return value */
+  unsigned int ret = 0;          /* Return value */
   struct headers_check_result rp_headers_check;
   struct curl_slist *curl_headers;
   curl_headers = NULL;
@@ -923,7 +923,7 @@ enum testMhdPollType
 static unsigned int
 testNumThreadsForPool (enum testMhdPollType pollType)
 {
-  int numThreads = MHD_CPU_COUNT;
+  unsigned int numThreads = MHD_CPU_COUNT;
   (void) pollType; /* Don't care about pollType for this test */
   return numThreads; /* No practical limit for non-cleanup test */
 }
@@ -931,7 +931,7 @@ testNumThreadsForPool (enum testMhdPollType pollType)
 
 static struct MHD_Daemon *
 startTestMhdDaemon (enum testMhdThreadsType thrType,
-                    enum testMhdPollType pollType, int *pport,
+                    enum testMhdPollType pollType, uint16_t *pport,
                     struct ahc_cls_type **ahc_param,
                     struct check_uri_cls **uri_cb_param)
 {
@@ -962,7 +962,7 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
   }
 
   if (testMhdThreadInternalPool != thrType)
-    d = MHD_start_daemon (((int) thrType) | ((int) pollType)
+    d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
                           | (verbose ? MHD_USE_ERROR_LOG : 0),
                           *pport, NULL, NULL,
                           &ahcCheck, *ahc_param,
@@ -970,7 +970,8 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
                           *uri_cb_param,
                           MHD_OPTION_END);
   else
-    d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | ((int) pollType)
+    d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD
+                          | ((unsigned int) pollType)
                           | (verbose ? MHD_USE_ERROR_LOG : 0),
                           *pport, NULL, NULL,
                           &ahcCheck, *ahc_param,
@@ -994,7 +995,7 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
       fprintf (stderr, "MHD_get_daemon_info() failed.\n");
       abort ();
     }
-    *pport = (int) dinfo->port;
+    *pport = dinfo->port;
     if (0 == global_port)
       global_port = *pport; /* Reuse the same port for all tests */
   }
@@ -1006,11 +1007,11 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
 /* Test runners */
 
 
-static int
+static unsigned int
 testExternalGet (void)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
+  uint16_t d_port = global_port; /* Daemon's port */
   struct ahc_cls_type *ahc_param;
   struct check_uri_cls *uri_cb_param;
 
@@ -1021,11 +1022,11 @@ testExternalGet (void)
 }
 
 
-static int
+static unsigned int
 testInternalGet (enum testMhdPollType pollType)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
+  uint16_t d_port = global_port; /* Daemon's port */
   struct ahc_cls_type *ahc_param;
   struct check_uri_cls *uri_cb_param;
 
@@ -1036,11 +1037,11 @@ testInternalGet (enum testMhdPollType pollType)
 }
 
 
-static int
+static unsigned int
 testMultithreadedGet (enum testMhdPollType pollType)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
+  uint16_t d_port = global_port; /* Daemon's port */
   struct ahc_cls_type *ahc_param;
   struct check_uri_cls *uri_cb_param;
 
@@ -1050,11 +1051,11 @@ testMultithreadedGet (enum testMhdPollType pollType)
 }
 
 
-static int
+static unsigned int
 testMultithreadedPoolGet (enum testMhdPollType pollType)
 {
   struct MHD_Daemon *d;
-  int d_port = global_port; /* Daemon's port */
+  uint16_t d_port = global_port; /* Daemon's port */
   struct ahc_cls_type *ahc_param;
   struct check_uri_cls *uri_cb_param;
 
diff --git a/src/testcurl/test_urlparse.c b/src/testcurl/test_urlparse.c
index 71ac668b..18c6ab37 100644
--- a/src/testcurl/test_urlparse.c
+++ b/src/testcurl/test_urlparse.c
@@ -128,15 +128,15 @@ ahc_echo (void *cls,
 }
 
 
-static int
-testInternalGet (int poll_flag)
+static unsigned int
+testInternalGet (uint32_t poll_flag)
 {
   struct MHD_Daemon *d;
   CURL *c;
   char buf[2048];
   struct CBC cbc;
   CURLcode errornum;
-  int port;
+  uint16_t port;
 
   if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
     port = 0;
@@ -151,7 +151,7 @@ testInternalGet (int poll_flag)
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG
-                        | poll_flag,
+                        | (enum MHD_FLAG) poll_flag,
                         port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
   if (d == NULL)
     return 1;
@@ -163,7 +163,7 @@ testInternalGet (int poll_flag)
     {
       MHD_stop_daemon (d); return 32;
     }
-    port = (int) dinfo->port;
+    port = dinfo->port;
   }
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world?a=b&c=&d";);
diff --git a/src/testzzuf/test_get.c b/src/testzzuf/test_get.c
index 313ab1da..e2b86ffe 100644
--- a/src/testzzuf/test_get.c
+++ b/src/testzzuf/test_get.c
@@ -104,7 +104,7 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testInternalGet ()
 {
   struct MHD_Daemon *d;
@@ -150,7 +150,7 @@ testInternalGet ()
 }
 
 
-static int
+static unsigned int
 testMultithreadedGet ()
 {
   struct MHD_Daemon *d;
@@ -196,7 +196,7 @@ testMultithreadedGet ()
 }
 
 
-static int
+static unsigned int
 testExternalGet ()
 {
   struct MHD_Daemon *d;
diff --git a/src/testzzuf/test_get_chunked.c b/src/testzzuf/test_get_chunked.c
index ff49cd5f..8013494f 100644
--- a/src/testzzuf/test_get_chunked.c
+++ b/src/testzzuf/test_get_chunked.c
@@ -146,7 +146,7 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testInternalGet ()
 {
   struct MHD_Daemon *d;
@@ -189,7 +189,7 @@ testInternalGet ()
 }
 
 
-static int
+static unsigned int
 testMultithreadedGet ()
 {
   struct MHD_Daemon *d;
@@ -232,7 +232,7 @@ testMultithreadedGet ()
 }
 
 
-static int
+static unsigned int
 testExternalGet ()
 {
   struct MHD_Daemon *d;
diff --git a/src/testzzuf/test_long_header.c b/src/testzzuf/test_long_header.c
index 7213ee41..c0259398 100644
--- a/src/testzzuf/test_long_header.c
+++ b/src/testzzuf/test_long_header.c
@@ -106,7 +106,7 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testLongUrlGet ()
 {
   struct MHD_Daemon *d;
@@ -173,7 +173,7 @@ testLongUrlGet ()
 }
 
 
-static int
+static unsigned int
 testLongHeaderGet ()
 {
   struct MHD_Daemon *d;
diff --git a/src/testzzuf/test_post.c b/src/testzzuf/test_post.c
index 29a14ce8..895c5fce 100644
--- a/src/testzzuf/test_post.c
+++ b/src/testzzuf/test_post.c
@@ -160,7 +160,7 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testInternalPost ()
 {
   struct MHD_Daemon *d;
@@ -213,7 +213,7 @@ testInternalPost ()
 }
 
 
-static int
+static unsigned int
 testMultithreadedPost ()
 {
   struct MHD_Daemon *d;
@@ -267,7 +267,7 @@ testMultithreadedPost ()
 }
 
 
-static int
+static unsigned int
 testExternalPost ()
 {
   struct MHD_Daemon *d;
diff --git a/src/testzzuf/test_post_form.c b/src/testzzuf/test_post_form.c
index faeefb98..b16b0cdd 100644
--- a/src/testzzuf/test_post_form.c
+++ b/src/testzzuf/test_post_form.c
@@ -179,7 +179,7 @@ make_form ()
 }
 
 
-static int
+static unsigned int
 testInternalPost ()
 {
   struct MHD_Daemon *d;
@@ -231,7 +231,7 @@ testInternalPost ()
 }
 
 
-static int
+static unsigned int
 testMultithreadedPost ()
 {
   struct MHD_Daemon *d;
@@ -283,7 +283,7 @@ testMultithreadedPost ()
 }
 
 
-static int
+static unsigned int
 testExternalPost ()
 {
   struct MHD_Daemon *d;
diff --git a/src/testzzuf/test_put.c b/src/testzzuf/test_put.c
index eba9d1fa..9e3749d1 100644
--- a/src/testzzuf/test_put.c
+++ b/src/testzzuf/test_put.c
@@ -127,7 +127,7 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testInternalPut ()
 {
   struct MHD_Daemon *d;
@@ -180,7 +180,7 @@ testInternalPut ()
 }
 
 
-static int
+static unsigned int
 testMultithreadedPut ()
 {
   struct MHD_Daemon *d;
@@ -233,7 +233,7 @@ testMultithreadedPut ()
 }
 
 
-static int
+static unsigned int
 testExternalPut ()
 {
   struct MHD_Daemon *d;
diff --git a/src/testzzuf/test_put_chunked.c b/src/testzzuf/test_put_chunked.c
index 34c03215..3dd67e43 100644
--- a/src/testzzuf/test_put_chunked.c
+++ b/src/testzzuf/test_put_chunked.c
@@ -137,7 +137,7 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testInternalPut ()
 {
   struct MHD_Daemon *d;
@@ -190,7 +190,7 @@ testInternalPut ()
 }
 
 
-static int
+static unsigned int
 testMultithreadedPut ()
 {
   struct MHD_Daemon *d;
@@ -249,7 +249,7 @@ testMultithreadedPut ()
 }
 
 
-static int
+static unsigned int
 testExternalPut ()
 {
   struct MHD_Daemon *d;
diff --git a/src/testzzuf/test_put_large.c b/src/testzzuf/test_put_large.c
index 6da41473..900284ef 100644
--- a/src/testzzuf/test_put_large.c
+++ b/src/testzzuf/test_put_large.c
@@ -141,7 +141,7 @@ ahc_echo (void *cls,
 }
 
 
-static int
+static unsigned int
 testInternalPut ()
 {
   struct MHD_Daemon *d;
@@ -195,7 +195,7 @@ testInternalPut ()
 }
 
 
-static int
+static unsigned int
 testMultithreadedPut ()
 {
   struct MHD_Daemon *d;
@@ -249,7 +249,7 @@ testMultithreadedPut ()
 }
 
 
-static int
+static unsigned int
 testExternalPut ()
 {
   struct MHD_Daemon *d;

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]