gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (badf7560 -> bd9b7be7)


From: gnunet
Subject: [libmicrohttpd] branch master updated (badf7560 -> bd9b7be7)
Date: Thu, 02 Jun 2022 08:43:22 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from badf7560 http_chunked_compression: fixed errors
     new 8da7be3b examples: marked non-global variables as 'static'
     new bd9b7be7 doc/examples: fixed compiler warnings

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 doc/examples/largepost.c                 | 16 ++++++++--------
 doc/examples/responseheaders.c           |  2 +-
 doc/examples/sessions.c                  | 23 ++++++++++++++++++-----
 doc/examples/simplepost.c                |  4 ++--
 doc/examples/tlsauthentication.c         |  8 ++++----
 src/examples/benchmark_https.c           |  4 ++--
 src/examples/demo_https.c                |  4 ++--
 src/examples/https_fileserver_example.c  |  4 ++--
 src/examples/minimal_example_empty_tls.c |  4 ++--
 src/examples/refuse_post_example.c       |  2 +-
 10 files changed, 42 insertions(+), 29 deletions(-)

diff --git a/doc/examples/largepost.c b/doc/examples/largepost.c
index da9c1c56..8669bc28 100644
--- a/doc/examples/largepost.c
+++ b/doc/examples/largepost.c
@@ -74,26 +74,26 @@ struct connection_info_struct
   "<input name=\"file\" type=\"file\">\n" \
   "<input type=\"submit\" value=\" Send \"></form>\n" \
   "</body></html>"
-const char *busypage =
+static const char *busypage =
   "<html><body>This server is busy, please try again later.</body></html>";
-const char *completepage =
+static const char *completepage =
   "<html><body>The upload has been completed.</body></html>";
-const char *errorpage =
+static const char *errorpage =
   "<html><body>This doesn't seem to be right.</body></html>";
-const char *servererrorpage =
+static const char *servererrorpage =
   "<html><body>Invalid request.</body></html>";
-const char *fileexistspage =
+static const char *fileexistspage =
   "<html><body>This file already exists.</body></html>";
-const char *fileioerror =
+static const char *fileioerror =
   "<html><body>IO error writing to disk.</body></html>";
-const char *const postprocerror =
+static const char *const postprocerror =
   "<html><head><title>Error</title></head><body>Error processing POST 
data</body></html>";
 
 
 static enum MHD_Result
 send_page (struct MHD_Connection *connection,
            const char *page,
-           int status_code)
+           unsigned int status_code)
 {
   enum MHD_Result ret;
   struct MHD_Response *response;
diff --git a/doc/examples/responseheaders.c b/doc/examples/responseheaders.c
index ce8167f3..30ac4596 100644
--- a/doc/examples/responseheaders.c
+++ b/doc/examples/responseheaders.c
@@ -63,7 +63,7 @@ answer_to_connection (void *cls, struct MHD_Connection 
*connection,
       return MHD_NO;
   }
   response =
-    MHD_create_response_from_fd_at_offset64 (sbuf.st_size, fd, 0);
+    MHD_create_response_from_fd_at_offset64 ((size_t) sbuf.st_size, fd, 0);
   MHD_add_response_header (response, "Content-Type", MIMETYPE);
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
   MHD_destroy_response (response);
diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c
index 7f62e73b..de864382 100644
--- a/doc/examples/sessions.c
+++ b/doc/examples/sessions.c
@@ -33,7 +33,7 @@ MHD_asprintf (char **resultp, const char *format, ...)
     size_t buf_size;
     char *buf;
 
-    buf_size = len + 1;
+    buf_size = (size_t) len + 1;
     buf = (char *) malloc (buf_size * sizeof(char));
     if (NULL != buf)
     {
@@ -406,7 +406,7 @@ fill_v1_v2_form (const void *cls,
   }
   /* return static form */
   response =
-    MHD_create_response_from_buffer_with_free_callback (reply_len,
+    MHD_create_response_from_buffer_with_free_callback ((size_t) reply_len,
                                                         (void *) reply,
                                                         &free);
   add_session_cookie (session, response);
@@ -749,16 +749,25 @@ main (int argc, char *const *argv)
   fd_set es;
   MHD_socket max;
   uint64_t mhd_timeout;
+  unsigned int port;
 
   if (argc != 2)
   {
     printf ("%s PORT\n", argv[0]);
     return 1;
   }
+  if ( (1 != sscanf (argv[1], "%u", &port)) ||
+       (0 == port) || (65535 < port) )
+  {
+    fprintf (stderr,
+             "Port must be a number between 1 and 65535.\n");
+    return 1;
+  }
+
   /* initialize PRNG */
   srand ((unsigned int) time (NULL));
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        atoi (argv[1]),
+                        (uint16_t) port,
                         NULL, NULL,
                         &create_response, NULL,
                         MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 15,
@@ -778,13 +787,17 @@ main (int argc, char *const *argv)
       break; /* fatal internal error */
     if (MHD_get_timeout64 (d, &mhd_timeout) == MHD_YES)
     {
-      tv.tv_sec = (time_t) mhd_timeout / 1000;
+#if ! defined(_WIN32) || defined(__CYGWIN__)
+      tv.tv_sec = (time_t) (mhd_timeout / 1000);
+#else  /* Native W32 */
+      tv.tv_sec = (long) (mhd_timeout / 1000);
+#endif /* Native W32 */
       tv.tv_usec = ((long) (mhd_timeout % 1000)) * 1000;
       tvp = &tv;
     }
     else
       tvp = NULL;
-    if (-1 == select (max + 1, &rs, &ws, &es, tvp))
+    if (-1 == select ((int) max + 1, &rs, &ws, &es, tvp))
     {
       if (EINTR != errno)
         fprintf (stderr,
diff --git a/doc/examples/simplepost.c b/doc/examples/simplepost.c
index 80a948fe..4d42b9a7 100644
--- a/doc/examples/simplepost.c
+++ b/doc/examples/simplepost.c
@@ -33,7 +33,7 @@ struct connection_info_struct
   struct MHD_PostProcessor *postprocessor;
 };
 
-const char *askpage =
+static const char *askpage =
   "<html><body>\n"
   "What's your name, Sir?<br>\n"
   "<form action=\"/namepost\" method=\"post\">\n"
@@ -44,7 +44,7 @@ const char *askpage =
 #define GREETINGPAGE \
   "<html><body><h1>Welcome, %s!</center></h1></body></html>"
 
-const char *errorpage =
+static const char *errorpage =
   "<html><body>This doesn't seem to be right.</body></html>";
 
 
diff --git a/doc/examples/tlsauthentication.c b/doc/examples/tlsauthentication.c
index 57556d0b..65d9d8db 100644
--- a/doc/examples/tlsauthentication.c
+++ b/doc/examples/tlsauthentication.c
@@ -65,7 +65,7 @@ string_to_base64 (const char *message)
 }
 
 
-static long
+static size_t
 get_file_size (const char *filename)
 {
   FILE *fp;
@@ -80,7 +80,7 @@ get_file_size (const char *filename)
 
     fclose (fp);
 
-    return size;
+    return (size_t) size;
   }
   else
     return 0;
@@ -92,7 +92,7 @@ load_file (const char *filename)
 {
   FILE *fp;
   char *buffer;
-  long size;
+  size_t size;
 
   size = get_file_size (filename);
   if (0 == size)
@@ -110,7 +110,7 @@ load_file (const char *filename)
   }
   buffer[size] = '\0';
 
-  if (size != (long) fread (buffer, 1, size, fp))
+  if (size != fread (buffer, 1, size, fp))
   {
     free (buffer);
     buffer = NULL;
diff --git a/src/examples/benchmark_https.c b/src/examples/benchmark_https.c
index 7f391b0e..34325528 100644
--- a/src/examples/benchmark_https.c
+++ b/src/examples/benchmark_https.c
@@ -132,7 +132,7 @@ ahc_echo (void *cls,
 
 
 /* test server key */
-const char srv_signed_key_pem[] =
+static const char srv_signed_key_pem[] =
   "-----BEGIN PRIVATE KEY-----\n\
 MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCff7amw9zNSE+h\n\
 rOMhBrzbbsJluUP3gmd8nOKY5MUimoPkxmAXfp2L0il+MPZT/ZEmo11q0k6J2jfG\n\
@@ -163,7 +163,7 @@ qdJNJ1DkyUc9dN2cliX4R+rG\n\
 -----END PRIVATE KEY-----";
 
 /* test server CA signed certificates */
-const char srv_signed_cert_pem[] =
+static const char srv_signed_cert_pem[] =
   "-----BEGIN CERTIFICATE-----\n\
 MIIFSzCCAzOgAwIBAgIBBDANBgkqhkiG9w0BAQsFADCBgTELMAkGA1UEBhMCUlUx\n\
 DzANBgNVBAgMBk1vc2NvdzEPMA0GA1UEBwwGTW9zY293MRswGQYDVQQKDBJ0ZXN0\n\
diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c
index 940bf556..56c746ca 100644
--- a/src/examples/demo_https.c
+++ b/src/examples/demo_https.c
@@ -923,7 +923,7 @@ ignore_sigpipe (void)
 #endif
 
 /* test server key */
-const char srv_signed_key_pem[] =
+static const char srv_signed_key_pem[] =
   "-----BEGIN PRIVATE KEY-----\n\
 MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCff7amw9zNSE+h\n\
 rOMhBrzbbsJluUP3gmd8nOKY5MUimoPkxmAXfp2L0il+MPZT/ZEmo11q0k6J2jfG\n\
@@ -954,7 +954,7 @@ qdJNJ1DkyUc9dN2cliX4R+rG\n\
 -----END PRIVATE KEY-----";
 
 /* test server CA signed certificates */
-const char srv_signed_cert_pem[] =
+static const char srv_signed_cert_pem[] =
   "-----BEGIN CERTIFICATE-----\n\
 MIIFSzCCAzOgAwIBAgIBBDANBgkqhkiG9w0BAQsFADCBgTELMAkGA1UEBhMCUlUx\n\
 DzANBgNVBAgMBk1vc2NvdzEPMA0GA1UEBwwGTW9zY293MRswGQYDVQQKDBJ0ZXN0\n\
diff --git a/src/examples/https_fileserver_example.c 
b/src/examples/https_fileserver_example.c
index 30fbf4d8..7fac39b6 100644
--- a/src/examples/https_fileserver_example.c
+++ b/src/examples/https_fileserver_example.c
@@ -45,7 +45,7 @@
   "<html><head><title>File not found</title></head><body>File not 
found</body></html>"
 
 /* test server key */
-const char key_pem[] =
+static const char key_pem[] =
   "-----BEGIN PRIVATE KEY-----\n\
 MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCff7amw9zNSE+h\n\
 rOMhBrzbbsJluUP3gmd8nOKY5MUimoPkxmAXfp2L0il+MPZT/ZEmo11q0k6J2jfG\n\
@@ -76,7 +76,7 @@ qdJNJ1DkyUc9dN2cliX4R+rG\n\
 -----END PRIVATE KEY-----";
 
 /* test server CA signed certificates */
-const char cert_pem[] =
+static const char cert_pem[] =
   "-----BEGIN CERTIFICATE-----\n\
 MIIFSzCCAzOgAwIBAgIBBDANBgkqhkiG9w0BAQsFADCBgTELMAkGA1UEBhMCUlUx\n\
 DzANBgNVBAgMBk1vc2NvdzEPMA0GA1UEBwwGTW9zY293MRswGQYDVQQKDBJ0ZXN0\n\
diff --git a/src/examples/minimal_example_empty_tls.c 
b/src/examples/minimal_example_empty_tls.c
index e01dc008..465f7492 100644
--- a/src/examples/minimal_example_empty_tls.c
+++ b/src/examples/minimal_example_empty_tls.c
@@ -67,7 +67,7 @@ ahc_echo (void *cls,
 
 
 /* test server key */
-const char srv_signed_key_pem[] =
+static const char srv_signed_key_pem[] =
   "-----BEGIN PRIVATE KEY-----\n\
 MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCff7amw9zNSE+h\n\
 rOMhBrzbbsJluUP3gmd8nOKY5MUimoPkxmAXfp2L0il+MPZT/ZEmo11q0k6J2jfG\n\
@@ -98,7 +98,7 @@ qdJNJ1DkyUc9dN2cliX4R+rG\n\
 -----END PRIVATE KEY-----";
 
 /* test server CA signed certificates */
-const char srv_signed_cert_pem[] =
+static const char srv_signed_cert_pem[] =
   "-----BEGIN CERTIFICATE-----\n\
 MIIFSzCCAzOgAwIBAgIBBDANBgkqhkiG9w0BAQsFADCBgTELMAkGA1UEBhMCUlUx\n\
 DzANBgNVBAgMBk1vc2NvdzEPMA0GA1UEBwwGTW9zY293MRswGQYDVQQKDBJ0ZXN0\n\
diff --git a/src/examples/refuse_post_example.c 
b/src/examples/refuse_post_example.c
index 8a8eac37..aafa6654 100644
--- a/src/examples/refuse_post_example.c
+++ b/src/examples/refuse_post_example.c
@@ -31,7 +31,7 @@ struct handler_param
   const char *response_page;
 };
 
-const char *askpage =
+static const char *askpage =
   "<html><body>\n\
  Upload a file, please!<br>\n\
  <form action=\"/filepost\" method=\"post\" enctype=\"multipart/form-data\">\n\

-- 
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]