Forráskód Böngészése

-work around compiler warnings

Christian Grothoff 12 éve
szülő
commit
324e9852db

+ 3 - 0
ChangeLog

@@ -1,3 +1,6 @@
+Sun Dec 22 14:54:30 CET 2013
+	Adding a few lines to avoid warnings from picky compilers. -CG
+
 Sat Dec 21 17:26:08 CET 2013
 	Fixed an issue with a missing argument in the postexample.
 	Fixed issue with bogus offset increment involving sendfile

+ 2 - 2
src/examples/demo.c

@@ -258,7 +258,7 @@ list_directory (struct ResponseDataContext *rdc,
     {
       if ('.' == de->d_name[0])
 	continue;
-      if (sizeof (fullname) <=
+      if (sizeof (fullname) <= (size_t)
 	  snprintf (fullname, sizeof (fullname),
 		    "%s/%s",
 		    dirname, de->d_name))
@@ -557,7 +557,7 @@ process_upload_data (void *cls,
       uc->filename = strdup (fn);
     }
   if ( (0 != size) &&
-       (size != write (uc->fd, data, size)) )
+       (size != (size_t) write (uc->fd, data, size)) )
     {
       /* write failed; likely: disk full */
       fprintf (stderr,

+ 14 - 14
src/examples/digest_auth_example.c

@@ -47,41 +47,41 @@ ahc_echo (void *cls,
   int ret;
 
   username = MHD_digest_auth_get_username(connection);
-  if (username == NULL) 
+  if (username == NULL)
     {
-      response = MHD_create_response_from_buffer(strlen (DENIED), 
+      response = MHD_create_response_from_buffer(strlen (DENIED),
 						 DENIED,
-						 MHD_RESPMEM_PERSISTENT);  
+						 MHD_RESPMEM_PERSISTENT);
       ret = MHD_queue_auth_fail_response(connection, realm,
 					 MY_OPAQUE_STR,
 					 response,
-					 MHD_NO);    
-      MHD_destroy_response(response);  
+					 MHD_NO);
+      MHD_destroy_response(response);
       return ret;
     }
   ret = MHD_digest_auth_check(connection, realm,
-			      username, 
-			      password, 
+			      username,
+			      password,
 			      300);
   free(username);
   if ( (ret == MHD_INVALID_NONCE) ||
        (ret == MHD_NO) )
     {
-      response = MHD_create_response_from_buffer(strlen (DENIED), 
+      response = MHD_create_response_from_buffer(strlen (DENIED),
 						 DENIED,
-						 MHD_RESPMEM_PERSISTENT);  
-      if (NULL == response) 
+						 MHD_RESPMEM_PERSISTENT);
+      if (NULL == response)
 	return MHD_NO;
       ret = MHD_queue_auth_fail_response(connection, realm,
 					 MY_OPAQUE_STR,
 					 response,
-					 (ret == MHD_INVALID_NONCE) ? MHD_YES : MHD_NO);  
-      MHD_destroy_response(response);  
+					 (ret == MHD_INVALID_NONCE) ? MHD_YES : MHD_NO);
+      MHD_destroy_response(response);
       return ret;
     }
   response = MHD_create_response_from_buffer(strlen(PAGE), PAGE,
 					     MHD_RESPMEM_PERSISTENT);
-  ret = MHD_queue_response(connection, MHD_HTTP_OK, response);  
+  ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
   MHD_destroy_response(response);
   return ret;
 }
@@ -91,7 +91,7 @@ main (int argc, char *const *argv)
 {
   int fd;
   char rnd[8];
-  size_t len;
+  ssize_t len;
   size_t off;
   struct MHD_Daemon *d;
 

+ 3 - 4
src/examples/fileserver_example_external_select.c

@@ -134,12 +134,11 @@ main (int argc, char *const *argv)
       if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
 	break; /* fatal internal error */
       if (MHD_get_timeout (d, &mhd_timeout) == MHD_YES)
-
         {
-          if (tv.tv_sec * 1000 < mhd_timeout)
+          if (((MHD_UNSIGNED_LONG_LONG)tv.tv_sec) < mhd_timeout / 1000LL)
             {
-              tv.tv_sec = mhd_timeout / 1000;
-              tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000)) * 1000;
+              tv.tv_sec = mhd_timeout / 1000LL;
+              tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000LL)) * 1000LL;
             }
         }
       select (max + 1, &rs, &ws, &es, &tv);

+ 2 - 1
src/microhttpd/daemon.c

@@ -1878,6 +1878,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
 #endif
 
   have_timeout = MHD_NO;
+  earliest_deadline = 0; /* avoid compiler warnings */
   for (pos = daemon->manual_timeout_head; NULL != pos; pos = pos->nextX)
     {
       if (0 != pos->connection_timeout)
@@ -2457,7 +2458,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
 #endif
 	  return MHD_NO;
 	}
-      for (i=0;i<num_events;i++)
+      for (i=0;i<(unsigned int) num_events;i++)
 	{
 	  if (NULL == events[i].data.ptr)
 	    continue; /* shutdown signal! */

+ 1 - 1
src/microhttpd/digestauth.c

@@ -258,7 +258,7 @@ lookup_sub_value (char *dest,
 	    }
 	  else
 	    {
-	      if (size > (q2 - q1) + 1)
+	      if (size > (size_t) ((q2 - q1) + 1))
 		size = (q2 - q1) + 1;
 	      size--;
 	      memcpy (dest,