gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated (ccfb2c2e6 -> 8547143da)


From: gnunet
Subject: [gnunet] branch master updated (ccfb2c2e6 -> 8547143da)
Date: Thu, 09 Apr 2020 00:33:50 +0200

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

grothoff pushed a change to branch master
in repository gnunet.

    from ccfb2c2e6 introduce enum for generic return values
     new 6fc0526b4 fix warnings
     new 8547143da adapt code to work with latest MHD API

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:
 src/gns/gnunet-bcd.c                               |  5 ++--
 src/gns/gnunet-gns-proxy.c                         |  4 +--
 src/include/Makefile.am                            |  1 +
 .../gnunet_mhd_compat.h}                           | 31 ++++++++--------------
 src/namestore/gnunet-namestore-fcfsd.c             | 11 ++++----
 src/pq/pq_query_helper.c                           |  4 +--
 src/pq/pq_result_helper.c                          |  2 +-
 src/rest/gnunet-rest-server.c                      | 22 ++++++++-------
 src/transport/plugin_transport_http_server.c       | 12 ++++-----
 9 files changed, 45 insertions(+), 47 deletions(-)
 copy src/{dht/gnunet-service-dht_nse.h => include/gnunet_mhd_compat.h} (67%)

diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c
index d6de86fa0..6ceff4a9a 100644
--- a/src/gns/gnunet-bcd.c
+++ b/src/gns/gnunet-bcd.c
@@ -27,6 +27,7 @@
 #include "platform.h"
 #include <microhttpd.h>
 #include "gnunet_util_lib.h"
+#include "gnunet_mhd_compat.h"
 
 /**
  * Error page to display if submitted GNS key is invalid.
@@ -91,7 +92,7 @@ struct Entry
 /**
  * Main request handler.
  */
-static int
+static MHD_RESULT
 access_handler_callback (void *cls,
                          struct MHD_Connection *connection,
                          const char *url,
@@ -153,7 +154,7 @@ access_handler_callback (void *cls,
     struct stat st;
     struct MHD_Response *response;
     int fd;
-    int ret;
+    MHD_RESULT ret;
 
     const char *gpg_fp = MHD_lookup_connection_value (connection,
                                                       MHD_GET_ARGUMENT_KIND,
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c
index 5b8348d43..c0572fe40 100644
--- a/src/gns/gnunet-gns-proxy.c
+++ b/src/gns/gnunet-gns-proxy.c
@@ -43,7 +43,7 @@
 #include "gnunet_gns_service.h"
 #include "gnunet_identity_service.h"
 #include "gns.h"
-
+#include "gnunet_mhd_compat.h"
 
 /**
  * Default Socks5 listen port.
@@ -1827,7 +1827,7 @@ con_val_iter (void *cls,
  *         #MHD_NO if the socket must be closed due to a serious
  *         error while handling the request
  */
-static int
+static MHD_RESULT
 create_response (void *cls,
                  struct MHD_Connection *con,
                  const char *url,
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 5c57b5be2..d2c254ae6 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -62,6 +62,7 @@ gnunetinclude_HEADERS = \
   gnunet_json_lib.h \
   gnunet_load_lib.h \
   gnunet_cadet_service.h \
+  gnunet_mhd_compat.h \
   gnunet_microphone_lib.h \
   gnunet_mst_lib.h \
   gnunet_mq_lib.h \
diff --git a/src/dht/gnunet-service-dht_nse.h b/src/include/gnunet_mhd_compat.h
similarity index 67%
copy from src/dht/gnunet-service-dht_nse.h
copy to src/include/gnunet_mhd_compat.h
index e99389e74..0cfcc6445 100644
--- a/src/dht/gnunet-service-dht_nse.h
+++ b/src/include/gnunet_mhd_compat.h
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2011 GNUnet e.V.
+     Copyright (C) 2020 GNUnet e.V.
 
      GNUnet is free software: you can redistribute it and/or modify it
      under the terms of the GNU Affero General Public License as published
@@ -19,34 +19,25 @@
  */
 
 /**
- * @file dht/gnunet-service-dht_nse.h
- * @brief GNUnet DHT integration with NSE
  * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_DHT_NSE_H
-#define GNUNET_SERVICE_DHT_NSE_H
-
-
-/**
- * Return the log of the current network size estimate.
  *
- * @return log of NSE
+ * @file
+ * MHD compatibility definitions for warning-less compile of
+ * our code against MHD before and after #MHD_VERSION 0x00097002.
  */
-double
-GDS_NSE_get (void);
-
+#include <microhttpd.h>
 
+#if MHD_VERSION >= 0x00097002
 /**
- * Initialize NSE subsystem.
+ * Data type to use for functions return an "MHD result".
  */
-void
-GDS_NSE_init (void);
+#define MHD_RESULT enum MHD_Result
 
+#else
 
 /**
- * Shutdown NSE subsystem.
+ * Data type to use for functions return an "MHD result".
  */
-void
-GDS_NSE_done (void);
+#define MHD_RESULT int
 
 #endif
diff --git a/src/namestore/gnunet-namestore-fcfsd.c 
b/src/namestore/gnunet-namestore-fcfsd.c
index fa0f835d1..67fc5bdf4 100644
--- a/src/namestore/gnunet-namestore-fcfsd.c
+++ b/src/namestore/gnunet-namestore-fcfsd.c
@@ -36,6 +36,7 @@
 #include "gnunet_identity_service.h"
 #include "gnunet_gnsrecord_lib.h"
 #include "gnunet_namestore_service.h"
+#include "gnunet_mhd_compat.h"
 
 /**
  * Invalid method page.
@@ -507,10 +508,10 @@ fill_s_reply (const char *info,
  *              specified offset
  * @param off offset of data in the overall value
  * @param size number of bytes in data available
- * @return MHD_YES to continue iterating,
- *         MHD_NO to abort the iteration
+ * @return #MHD_YES to continue iterating,
+ *         #MHD_NO to abort the iteration
  */
-static int
+static MHD_RESULT
 post_iterator (void *cls,
                enum MHD_ValueKind kind,
                const char *key,
@@ -754,7 +755,7 @@ lookup_it_finished (void *cls)
  *         #MHD_NO if the socket must be closed due to a serious
  *         error while handling the request
  */
-static int
+static MHD_RESULT
 create_response (void *cls,
                  struct MHD_Connection *connection,
                  const char *url,
@@ -767,7 +768,7 @@ create_response (void *cls,
   struct MHD_Response *response;
   struct Request *request;
   struct GNUNET_CRYPTO_EcdsaPublicKey pub;
-  int ret;
+  MHD_RESULT ret;
 
   (void) cls;
   (void) version;
diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c
index 8bdf8144a..1290a6fb2 100644
--- a/src/pq/pq_query_helper.c
+++ b/src/pq/pq_query_helper.c
@@ -294,7 +294,7 @@ qconv_rsa_public_key (void *cls,
                       unsigned int scratch_length)
 {
   const struct GNUNET_CRYPTO_RsaPublicKey *rsa = data;
-  char *buf;
+  void *buf;
   size_t buf_size;
 
   GNUNET_break (NULL == cls);
@@ -354,7 +354,7 @@ qconv_rsa_signature (void *cls,
                      unsigned int scratch_length)
 {
   const struct GNUNET_CRYPTO_RsaSignature *sig = data;
-  char *buf;
+  void *buf;
   size_t buf_size;
 
   GNUNET_break (NULL == cls);
diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c
index 1fb1e71c0..dc64597f8 100644
--- a/src/pq/pq_result_helper.c
+++ b/src/pq/pq_result_helper.c
@@ -345,7 +345,7 @@ extract_rsa_signature (void *cls,
 {
   struct GNUNET_CRYPTO_RsaSignature **sig = dst;
   size_t len;
-  const char *res;
+  const void *res;
   int fnum;
 
   (void) cls;
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c
index 02a2c6daf..30eade623 100644
--- a/src/rest/gnunet-rest-server.c
+++ b/src/rest/gnunet-rest-server.c
@@ -27,7 +27,7 @@
 #include <microhttpd.h>
 #include "gnunet_util_lib.h"
 #include "gnunet_rest_plugin.h"
-
+#include "gnunet_mhd_compat.h"
 
 /**
  * Default Socks5 listen port.
@@ -302,7 +302,7 @@ url_iterator (void *cls,
 }
 
 
-static int
+static MHD_RESULT
 post_data_iter (void *cls,
                 enum MHD_ValueKind kind,
                 const char *key,
@@ -359,11 +359,11 @@ post_data_iter (void *cls,
  *        @a upload_data provided; the method must update this
  *        value to the number of bytes NOT processed;
  * @param con_cls pointer to location where we store the 'struct Request'
- * @return MHD_YES if the connection was handled successfully,
- *         MHD_NO if the socket must be closed due to a serious
+ * @return #MHD_YES if the connection was handled successfully,
+ *         #MHD_NO if the socket must be closed due to a serious
  *         error while handling the request
  */
-static int
+static MHD_RESULT
 create_response (void *cls,
                  struct MHD_Connection *con,
                  const char *url,
@@ -430,7 +430,7 @@ create_response (void *cls,
                                rest_conndata_handle);
     con_handle->pp = MHD_create_post_processor (con,
                                                 65536,
-                                                post_data_iter,
+                                                &post_data_iter,
                                                 rest_conndata_handle);
     if (*upload_data_size)
     {
@@ -509,9 +509,13 @@ create_response (void *cls,
                              allow_headers);
   }
   run_mhd_now ();
-  int ret = MHD_queue_response (con, con_handle->status, con_handle->response);
-  cleanup_handle (con_handle);
-  return ret;
+  {
+    MHD_RESULT ret = MHD_queue_response (con,
+                                         con_handle->status,
+                                         con_handle->response);
+    cleanup_handle (con_handle);
+    return ret;
+  }
 }
 
 
diff --git a/src/transport/plugin_transport_http_server.c 
b/src/transport/plugin_transport_http_server.c
index 20bdb6273..eef83b29d 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -33,7 +33,7 @@
 #include "plugin_transport_http_common.h"
 #include <microhttpd.h>
 #include <regex.h>
-
+#include "gnunet_mhd_compat.h"
 
 #if BUILD_HTTPS
 #define PLUGIN_NAME "https_server"
@@ -1741,9 +1741,9 @@ add_cors_headers (struct MHD_Response *response)
  * @param upload_data upload data
  * @param upload_data_size size of @a upload_data
  * @param httpSessionCache the session cache to remember the connection
- * @return MHD_YES if connection is accepted, MHD_NO on reject
+ * @return #MHD_YES if connection is accepted, #MHD_NO on reject
  */
-static int
+static MHD_RESULT
 server_access_cb (void *cls,
                   struct MHD_Connection *mhd_connection,
                   const char *url,
@@ -1757,7 +1757,7 @@ server_access_cb (void *cls,
   struct ServerRequest *sc = *httpSessionCache;
   struct GNUNET_ATS_Session *s;
   struct MHD_Response *response;
-  int res = MHD_YES;
+  MHD_RESULT res = MHD_YES;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        _ (
@@ -2025,9 +2025,9 @@ server_connection_cb (void *cls,
  * @param cls plugin as closure
  * @param addr address of incoming connection
  * @param addr_len number of bytes in @a addr
- * @return MHD_YES if connection is accepted, MHD_NO if connection is rejected
+ * @return #MHD_YES if connection is accepted, #MHD_NO if connection is 
rejected
  */
-static int
+static MHD_RESULT
 server_accept_cb (void *cls,
                   const struct sockaddr *addr,
                   socklen_t addr_len)

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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