Преглед изворни кода

Fixed compiler warnings for tests in src/microhttpd

Evgeny Grin (Karlson2k) пре 8 година
родитељ
комит
3f5fe81d43

+ 9 - 0
src/microhttpd/test_daemon.c

@@ -57,6 +57,8 @@ apc_nothing (void *cls,
              const struct sockaddr *addr,
              socklen_t addrlen)
 {
+  (void)cls; (void)addr; (void)addrlen; /* Unused. Silent compiler warning. */
+
   return MHD_NO;
 }
 
@@ -66,6 +68,8 @@ apc_all (void *cls,
          const struct sockaddr *addr,
          socklen_t addrlen)
 {
+  (void)cls; (void)addr; (void)addrlen; /* Unused. Silent compiler warning. */
+
   return MHD_YES;
 }
 
@@ -79,6 +83,10 @@ ahc_nothing (void *cls,
              const char *upload_data, size_t *upload_data_size,
              void **unused)
 {
+  (void)cls;(void)connection;(void)url;          /* Unused. Silent compiler warning. */
+  (void)method;(void)version;(void)upload_data;  /* Unused. Silent compiler warning. */
+  (void)upload_data_size;(void)unused;           /* Unused. Silent compiler warning. */
+
   return MHD_NO;
 }
 
@@ -215,6 +223,7 @@ main (int argc,
       char *const *argv)
 {
   int errorCount = 0;
+  (void)argc; (void)argv; /* Unused. Silent compiler warning. */
 
   errorCount += testStartError ();
   errorCount += testStartStop ();

+ 2 - 0
src/microhttpd/test_http_reasons.c

@@ -121,6 +121,8 @@ static int test_5xx(void)
 int main(int argc, char * argv[])
 {
   int errcount = 0;
+  (void)argc; (void)argv; /* Unused. Silent compiler warning. */
+
   errcount += test_absent_codes();
   errcount += test_1xx();
   errcount += test_2xx();

+ 17 - 14
src/microhttpd/test_postprocessor.c

@@ -91,6 +91,8 @@ value_checker (void *cls,
 {
   int *want_off = cls;
   int idx = *want_off;
+  (void)kind;  /* Unused. Silent compiler warning. */
+
 
 #if 0
   fprintf (stderr,
@@ -120,14 +122,14 @@ value_checker (void *cls,
 
 
 static int
-test_urlencoding ()
+test_urlencoding (void)
 {
   struct MHD_Connection connection;
   struct MHD_HTTP_Header header;
   struct MHD_PostProcessor *pp;
   unsigned int want_off = URL_START;
-  int i;
-  int delta;
+  size_t i;
+  size_t delta;
   size_t size;
 
   memset (&connection, 0, sizeof (struct MHD_Connection));
@@ -154,7 +156,7 @@ test_urlencoding ()
 
 
 static int
-test_multipart_garbage ()
+test_multipart_garbage (void)
 {
   struct MHD_Connection connection;
   struct MHD_HTTP_Header header;
@@ -195,7 +197,7 @@ test_multipart_garbage ()
 
 
 static int
-test_multipart_splits ()
+test_multipart_splits (void)
 {
   struct MHD_Connection connection;
   struct MHD_HTTP_Header header;
@@ -228,14 +230,14 @@ test_multipart_splits ()
 
 
 static int
-test_multipart ()
+test_multipart (void)
 {
   struct MHD_Connection connection;
   struct MHD_HTTP_Header header;
   struct MHD_PostProcessor *pp;
   unsigned int want_off = FORM_START;
-  int i;
-  int delta;
+  size_t i;
+  size_t delta;
   size_t size;
 
   memset (&connection, 0, sizeof (struct MHD_Connection));
@@ -263,14 +265,14 @@ test_multipart ()
 
 
 static int
-test_nested_multipart ()
+test_nested_multipart (void)
 {
   struct MHD_Connection connection;
   struct MHD_HTTP_Header header;
   struct MHD_PostProcessor *pp;
   unsigned int want_off = FORM_NESTED_START;
-  int i;
-  int delta;
+  size_t i;
+  size_t delta;
   size_t size;
 
   memset (&connection, 0, sizeof (struct MHD_Connection));
@@ -298,14 +300,14 @@ test_nested_multipart ()
 
 
 static int
-test_empty_value ()
+test_empty_value (void)
 {
   struct MHD_Connection connection;
   struct MHD_HTTP_Header header;
   struct MHD_PostProcessor *pp;
   unsigned int want_off = URL_EMPTY_VALUE_START;
-  int i;
-  int delta;
+  size_t i;
+  size_t delta;
   size_t size;
 
   memset (&connection, 0, sizeof (struct MHD_Connection));
@@ -337,6 +339,7 @@ int
 main (int argc, char *const *argv)
 {
   unsigned int errorCount = 0;
+  (void)argc; (void)argv;  /* Unused. Silent compiler warning. */
 
   errorCount += test_multipart_splits ();
   errorCount += test_multipart_garbage ();

+ 3 - 0
src/microhttpd/test_postprocessor_amp.c

@@ -11,6 +11,8 @@ int check_post(void *cls, enum MHD_ValueKind kind, const char* key,
                  const char* content_encoding, const char* data,
                  uint64_t off, size_t size)
 {
+  (void)cls; (void)kind; (void)filename; (void)content_type;  /* Unused. Silent compiler warning. */
+  (void)content_encoding; (void)data; (void)off; (void)size;  /* Unused. Silent compiler warning. */
   if ((0 != strcmp(key, "a")) && (0 != strcmp(key, "b")))
     {
       printf("ERROR: got unexpected '%s'\n", key);
@@ -26,6 +28,7 @@ main (int argc, char *const *argv)
   struct MHD_Connection connection;
   struct MHD_HTTP_Header header;
   struct MHD_PostProcessor *pp;
+  (void)argc; (void)argv;  /* Unused. Silent compiler warning. */
 
   memset (&connection, 0, sizeof (struct MHD_Connection));
   memset (&header, 0, sizeof (struct MHD_HTTP_Header));

+ 5 - 2
src/microhttpd/test_postprocessor_large.c

@@ -43,6 +43,8 @@ value_checker (void *cls,
                const char *data, uint64_t off, size_t size)
 {
   unsigned int *pos = cls;
+  (void)kind; (void)key; (void)filename; (void)content_type;  /* Unused. Silent compiler warning. */
+  (void)transfer_encoding; (void)data; (void)off;             /* Unused. Silent compiler warning. */
 #if 0
   fprintf (stderr,
            "VC: %llu %u `%s' `%s' `%s' `%s' `%.*s'\n",
@@ -63,8 +65,8 @@ test_simple_large ()
   struct MHD_Connection connection;
   struct MHD_HTTP_Header header;
   struct MHD_PostProcessor *pp;
-  int i;
-  int delta;
+  size_t i;
+  size_t delta;
   size_t size;
   char data[102400];
   unsigned int pos;
@@ -98,6 +100,7 @@ int
 main (int argc, char *const *argv)
 {
   unsigned int errorCount = 0;
+  (void)argc; (void)argv;  /* Unused. Silent compiler warning. */
 
   errorCount += test_simple_large ();
   if (errorCount != 0)

+ 1 - 0
src/microhttpd/test_shutdown_select.c

@@ -286,6 +286,7 @@ main (int argc, char *const *argv)
 #endif /* MHD_WINSOCK_SOCKETS */
   bool test_poll;
   bool must_ignore;
+  (void)argc; /* Unused. Silent compiler warning. */
 
   test_poll = has_in_name(argv[0], "_poll");
   must_ignore = has_in_name(argv[0], "_ignore");

+ 1 - 0
src/microhttpd/test_str_token.c

@@ -111,6 +111,7 @@ int check_not_match(void)
 int main(int argc, char * argv[])
 {
   int errcount = 0;
+  (void)argc; (void)argv; /* Unused. Silent compiler warning. */
   errcount += check_match();
   errcount += check_not_match();
   return errcount == 0 ? 0 : 1;

+ 8 - 0
src/microhttpd/test_upgrade.c

@@ -443,6 +443,7 @@ notify_completed_cb (void *cls,
                      void **con_cls,
                      enum MHD_RequestTerminationCode toe)
 {
+  (void)cls; (void)connection;  /* Unused. Silent compiler warning. */
   if ( (toe != MHD_REQUEST_TERMINATED_COMPLETED_OK) &&
        (toe != MHD_REQUEST_TERMINATED_CLIENT_ABORT) &&
        (toe != MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN) )
@@ -468,6 +469,8 @@ log_cb (void *cls,
         struct MHD_Connection *connection)
 {
   pthread_t* ppth;
+  (void)cls; (void)connection;  /* Unused. Silent compiler warning. */
+
   if (0 != strcmp (uri,
                    "/"))
     abort ();
@@ -505,6 +508,7 @@ notify_connection_cb (void *cls,
                       enum MHD_ConnectionNotificationCode toe)
 {
   static int started;
+  (void)cls; (void)connection;  /* Unused. Silent compiler warning. */
 
   switch (toe)
   {
@@ -759,6 +763,7 @@ upgrade_cb (void *cls,
             MHD_socket sock,
             struct MHD_UpgradeResponseHandle *urh)
 {
+  (void)cls; (void)connection; (void)con_cls; (void)extra_in; /* Unused. Silent compiler warning. */
   usock = wr_create_from_plain_sckt (sock);
   if (0 != extra_in_size)
     abort ();
@@ -821,6 +826,8 @@ ahc_upgrade (void *cls,
 {
   struct MHD_Response *resp;
   int ret;
+  (void)cls;(void)url;(void)method;                        /* Unused. Silent compiler warning. */
+  (void)version;(void)upload_data;(void)upload_data_size;  /* Unused. Silent compiler warning. */
 
   if (NULL == *con_cls)
     abort ();
@@ -898,6 +905,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
 static void
 run_mhd_poll_loop (struct MHD_Daemon *daemon)
 {
+  (void)daemon; /* Unused. Silent compiler warning. */
   abort (); /* currently not implementable with existing MHD API */
 }
 #endif /* HAVE_POLL */