gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r35928 - in libmicrohttpd: doc/examples src/microhttpd


From: gnunet
Subject: [GNUnet-SVN] r35928 - in libmicrohttpd: doc/examples src/microhttpd
Date: Fri, 12 Jun 2015 09:45:50 +0200

Author: grothoff
Date: 2015-06-12 09:45:50 +0200 (Fri, 12 Jun 2015)
New Revision: 35928

Modified:
   libmicrohttpd/doc/examples/sessions.c
   libmicrohttpd/src/microhttpd/daemon.c
Log:
-fix compiler warnings

Modified: libmicrohttpd/doc/examples/sessions.c
===================================================================
--- libmicrohttpd/doc/examples/sessions.c       2015-06-11 23:25:56 UTC (rev 
35927)
+++ libmicrohttpd/doc/examples/sessions.c       2015-06-12 07:45:50 UTC (rev 
35928)
@@ -98,7 +98,7 @@
   struct Session *next;
 
   /**
-   * Unique ID for this session. 
+   * Unique ID for this session.
    */
   char sid[33];
 
@@ -144,7 +144,7 @@
   struct MHD_PostProcessor *pp;
 
   /**
-   * URL to serve in response to this POST (if this request 
+   * URL to serve in response to this POST (if this request
    * was a 'POST')
    */
   const char *post_url;
@@ -162,7 +162,7 @@
 
 
 /**
- * Return the session handle for this connection, or 
+ * Return the session handle for this connection, or
  * create one if this is a new user.
  */
 static struct Session *
@@ -193,9 +193,9 @@
   /* create fresh session */
   ret = calloc (1, sizeof (struct Session));
   if (NULL == ret)
-    {                                          
+    {
       fprintf (stderr, "calloc error: %s\n", strerror (errno));
-      return NULL; 
+      return NULL;
     }
   /* not a super-secure way to generate a random session ID,
      but should do for a simple example... */
@@ -206,7 +206,7 @@
            (unsigned int) rand (),
            (unsigned int) rand (),
            (unsigned int) rand ());
-  ret->rc++;  
+  ret->rc++;
   ret->start = time (NULL);
   ret->next = sessions;
   sessions = ret;
@@ -231,7 +231,7 @@
 
 /**
  * Entry we generate for each page served.
- */ 
+ */
 struct Page
 {
   /**
@@ -251,7 +251,7 @@
 
   /**
    * Extra argument to handler.
-   */ 
+   */
   const void *handler_cls;
 };
 
@@ -261,7 +261,7 @@
  *
  * @param session session to use
  * @param response response to modify
- */ 
+ */
 static void
 add_session_cookie (struct Session *session,
                    struct MHD_Response *response)
@@ -272,12 +272,12 @@
            "%s=%s",
            COOKIE_NAME,
            session->sid);
-  if (MHD_NO == 
+  if (MHD_NO ==
       MHD_add_response_header (response,
                               MHD_HTTP_HEADER_SET_COOKIE,
                               cstr))
     {
-      fprintf (stderr, 
+      fprintf (stderr,
               "Failed to set session cookie header!\n");
     }
 }
@@ -289,7 +289,7 @@
  *
  * @param cls a 'const char *' with the HTML webpage to return
  * @param mime mime type to use
- * @param session session handle 
+ * @param session session handle
  * @param connection connection to use
  */
 static int
@@ -310,8 +310,8 @@
   MHD_add_response_header (response,
                           MHD_HTTP_HEADER_CONTENT_ENCODING,
                           mime);
-  ret = MHD_queue_response (connection, 
-                           MHD_HTTP_OK, 
+  ret = MHD_queue_response (connection,
+                           MHD_HTTP_OK,
                            response);
   MHD_destroy_response (response);
   return ret;
@@ -323,7 +323,7 @@
  *
  * @param cls a 'const char *' with the HTML webpage to return
  * @param mime mime type to use
- * @param session session handle 
+ * @param session session handle
  * @param connection connection to use
  */
 static int
@@ -352,8 +352,8 @@
   MHD_add_response_header (response,
                           MHD_HTTP_HEADER_CONTENT_ENCODING,
                           mime);
-  ret = MHD_queue_response (connection, 
-                           MHD_HTTP_OK, 
+  ret = MHD_queue_response (connection,
+                           MHD_HTTP_OK,
                            response);
   MHD_destroy_response (response);
   return ret;
@@ -365,7 +365,7 @@
  *
  * @param cls a 'const char *' with the HTML webpage to return
  * @param mime mime type to use
- * @param session session handle 
+ * @param session session handle
  * @param connection connection to use
  */
 static int
@@ -395,8 +395,8 @@
   MHD_add_response_header (response,
                           MHD_HTTP_HEADER_CONTENT_ENCODING,
                           mime);
-  ret = MHD_queue_response (connection, 
-                           MHD_HTTP_OK, 
+  ret = MHD_queue_response (connection,
+                           MHD_HTTP_OK,
                            response);
   MHD_destroy_response (response);
   return ret;
@@ -408,7 +408,7 @@
  *
  * @param cls a 'const char *' with the HTML webpage to return
  * @param mime mime type to use
- * @param session session handle 
+ * @param session session handle
  * @param connection connection to use
  */
 static int
@@ -424,8 +424,8 @@
   response = MHD_create_response_from_buffer (strlen (NOT_FOUND_ERROR),
                                              (void *) NOT_FOUND_ERROR,
                                              MHD_RESPMEM_PERSISTENT);
-  ret = MHD_queue_response (connection, 
-                           MHD_HTTP_NOT_FOUND, 
+  ret = MHD_queue_response (connection,
+                           MHD_HTTP_NOT_FOUND,
                            response);
   MHD_add_response_header (response,
                           MHD_HTTP_HEADER_CONTENT_ENCODING,
@@ -438,7 +438,7 @@
 /**
  * List of all pages served by this HTTP server.
  */
-static struct Page pages[] = 
+static struct Page pages[] =
   {
     { "/", "text/html",  &fill_v1_form, MAIN_PAGE },
     { "/2", "text/html", &fill_v1_v2_form, SECOND_PAGE },
@@ -556,7 +556,7 @@
                 const char *url,
                 const char *method,
                 const char *version,
-                const char *upload_data, 
+                const char *upload_data,
                 size_t *upload_data_size,
                 void **ptr)
 {
@@ -602,7 +602,7 @@
   session = request->session;
   session->start = time (NULL);
   if (0 == strcmp (method, MHD_HTTP_METHOD_POST))
-    {      
+    {
       /* evaluate POST data */
       MHD_post_process (request->pp,
                        upload_data,
@@ -628,7 +628,7 @@
       while ( (pages[i].url != NULL) &&
              (0 != strcmp (pages[i].url, url)) )
        i++;
-      ret = pages[i].handler (pages[i].handler_cls, 
+      ret = pages[i].handler (pages[i].handler_cls,
                              pages[i].mime,
                              session, connection);
       if (ret != MHD_YES)
@@ -640,8 +640,8 @@
   response = MHD_create_response_from_buffer (strlen (METHOD_ERROR),
                                              (void *) METHOD_ERROR,
                                              MHD_RESPMEM_PERSISTENT);
-  ret = MHD_queue_response (connection, 
-                           MHD_HTTP_METHOD_NOT_ACCEPTABLE, 
+  ret = MHD_queue_response (connection,
+                           MHD_HTTP_NOT_ACCEPTABLE,
                            response);
   MHD_destroy_response (response);
   return ret;
@@ -705,7 +705,7 @@
       else
         prev = pos;
       pos = next;
-    }      
+    }
 }
 
 
@@ -734,8 +734,8 @@
   srand ((unsigned int) time (NULL));
   d = MHD_start_daemon (MHD_USE_DEBUG,
                         atoi (argv[1]),
-                        NULL, NULL, 
-                       &create_response, NULL, 
+                        NULL, NULL,
+                       &create_response, NULL,
                        MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 15,
                        MHD_OPTION_NOTIFY_COMPLETED, 
&request_completed_callback, NULL,
                        MHD_OPTION_END);
@@ -750,11 +750,11 @@
       FD_ZERO (&es);
       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 (MHD_get_timeout (d, &mhd_timeout) == MHD_YES)
        {
          tv.tv_sec = mhd_timeout / 1000;
          tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000)) * 1000;
-         tvp = &tv;      
+         tvp = &tv;
        }
       else
        tvp = NULL;
@@ -761,7 +761,7 @@
       if (-1 == select (max + 1, &rs, &ws, &es, tvp))
        {
          if (EINTR != errno)
-           fprintf (stderr, 
+           fprintf (stderr,
                     "Aborting due to error during select: %s\n",
                     strerror (errno));
          break;
@@ -771,4 +771,3 @@
   MHD_stop_daemon (d);
   return 0;
 }
-

Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c       2015-06-11 23:25:56 UTC (rev 
35927)
+++ libmicrohttpd/src/microhttpd/daemon.c       2015-06-12 07:45:50 UTC (rev 
35928)
@@ -1037,7 +1037,9 @@
                    size_t i)
 {
   ssize_t ret;
+#if EPOLL_SUPPORT
   const size_t requested_size = i;
+#endif
 
   if ( (MHD_INVALID_SOCKET == connection->socket_fd) ||
        (MHD_CONNECTION_CLOSED == connection->state) )
@@ -1055,7 +1057,7 @@
 
   ret = recv(connection->socket_fd, other, i, MSG_NOSIGNAL);
 #if EPOLL_SUPPORT
-  if (0 > ret || requested_size > (size_t) ret)
+  if ( (0 > ret) || (requested_size > (size_t) ret))
     {
       /* partial read --- no longer read-ready */
       connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY;
@@ -1079,7 +1081,9 @@
                    size_t i)
 {
   ssize_t ret;
+#if EPOLL_SUPPORT
   const size_t requested_size = i;
+#endif
 #if LINUX
   MHD_socket fd;
 #endif
@@ -1151,7 +1155,7 @@
 #endif
   ret = send (connection->socket_fd, other, i, MSG_NOSIGNAL);
 #if EPOLL_SUPPORT
-  if (0 > ret || requested_size > (size_t) ret)
+  if ( (0 > ret) || (requested_size > (size_t) ret) )
     {
       /* partial write --- no longer write-ready */
       connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY;




reply via email to

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