Merge branch 'lurchi_social'
authorlurchi <lurchi@strangeplace.net>
Sat, 6 Jan 2018 17:52:34 +0000 (18:52 +0100)
committerlurchi <lurchi@strangeplace.net>
Sat, 6 Jan 2018 17:52:39 +0000 (18:52 +0100)
45 files changed:
.mailmap [new file with mode: 0644]
doc/documentation/chapters/installation.texi
doc/doxygen/Makefile.am
src/abe/Makefile.am
src/cadet/cadet_api.c
src/credential/test_credential_verify_simple.sh
src/curl/curl.c
src/datacache/plugin_datacache_postgres.c
src/dns/dnsparser.c
src/fs/fs_dirmetascan.c
src/fs/fs_download.c
src/fs/gnunet-download.c
src/gns/gnunet-service-gns_resolver.c
src/identity-provider/gnunet-service-identity-provider.c
src/identity/plugin_rest_identity.c
src/include/gnunet_network_lib.h
src/include/gnunet_set_service.h
src/jsonapi/test_jsonapi.c
src/multicast/gnunet-service-multicast.c
src/peerinfo/gnunet-service-peerinfo.c
src/regex/regex_internal_dht.c
src/regex/regex_test_lib.c
src/revocation/gnunet-service-revocation.c
src/set/set_api.c
src/testbed/gnunet-daemon-testbed-blacklist.c
src/transport/gnunet-service-transport_neighbours.c
src/transport/plugin_transport_tcp.c
src/transport/plugin_transport_udp.c
src/transport/tcp_connection_legacy.c
src/transport/tcp_server_legacy.c
src/util/common_logging.c
src/util/gnunet-config.c
src/util/gnunet-ecc.c
src/util/gnunet-resolver.c
src/util/gnunet-service-resolver.c
src/util/network.c
src/util/os_installation.c
src/util/os_priority.c
src/util/peer.c
src/util/program.c
src/util/resolver_api.c
src/util/scheduler.c
src/util/service.c
src/util/speedup.c
src/util/strings.c

diff --git a/.mailmap b/.mailmap
new file mode 100644 (file)
index 0000000..4db81bf
--- /dev/null
+++ b/.mailmap
@@ -0,0 +1,26 @@
+Bart Polot <bart.polot+gnunet@gmail.com>
+Bart Polot <bart.polot+gnunet@gmail.com> <bart.polot+voyager@gmail.com>
+Bart Polot <bart.polot+gnunet@gmail.com> <bart@net.in.tum.de>
+Carlo von lynX <lynX@time.to.get.psyced.org>
+Carlo von lynX <lynX@time.to.get.psyced.org> psyc://loupsycedyglgamf.onion/~lynX <BM-NB7xa9gEpmJgYp9PVnEdACiZcGmmEJcY>
+Carlo von lynX <lynX@time.to.get.psyced.org> psyc://loupsycedyglgamf.onion/~lynX <ircs://psyced.org/youbroketheinternet>
+David Barksdale <amatus@amat.us> <amatus.amongus@gmail.com>
+David Barksdale <amatus@amat.us>
+David Barksdale <amatus@amat.us> <amatus@amatus.name>
+Jeffrey Burdges <burdges@gnunet.org> Jeff Burdges <burdges@gnunet.org>
+Jeffrey Burdges <burdges@gnunet.org>
+Руслан Ижбулатов <lrn1986@gmail.com>
+Руслан Ижбулатов <lrn1986@gmail.com> LRN <lrn1986@gmail.com>
+Martin Schanzenbach <martin.schanzenbach@aisec.fraunhofer.de> Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>
+Martin Schanzenbach <martin.schanzenbach@aisec.fraunhofer.de> Schanzenbach, Martin <mschanzenbach@posteo.de>
+Martin Schanzenbach <martin.schanzenbach@aisec.fraunhofer.de> Martin Schanzenbach <mschanzenbach@posteo.de>
+ng0 <ng0@n0.is>
+ng0 <ng0@n0.is> <contact.ng0@cryptolab.net>
+ng0 <ng0@n0.is> <ng0@infotropique.org>
+ng0 <ng0@n0.is> N. 'ng0' Gillmann <ngillmann@runbox.com>
+ng0 <ng0@n0.is> <ng0@we.make.ritual.n0.is>
+t3sserakt <t3ss@posteo.de>
+t3sserakt <t3ss@posteo.de> <t3sserakt@posteo.de>
+tg(x) <*@tg-x.net>
+tg(x) <*@tg-x.net> Gabor X Toth <*@tg-x.net>
+
index eca77afcdfacae0b3f5a0274b011e91204024deb..45aeba9b09bb8519024cdd102f4a2f3f34b49ac9 100644 (file)
@@ -122,6 +122,8 @@ optional (for @command{gnunet-gtk})
 optional (for @command{gnunet-gtk})
 @item libqrencode @geq{} 3.0,
 optional (for @command{gnunet-namestore-gtk})
+@item libpbc @geq{} 0.5.14, optional for Attribute-Based Encryption and Identity Provider functionality
+@item libgabe (https://github.com/schanzen/libgabe), optional for Attribute-Based Encryption and Identity Provider functionality
 @end itemize
 
 @node Internal dependencies
index b6f433a1717685ada046aea3a099c5953e5fc9e9..7819bb55834926e4c22f10ba14c6c230ee61227a 100644 (file)
@@ -13,3 +13,6 @@ fast: gnunet.doxy
 
 clean:
        rm -rf html
+
+EXTRA_DIST = \
+   gnunet.doxy
index 308e6c67c0a6b4ac6772e6b86255b5a25fd61e98..23a7ae68ea72e602ab429a2c5d308089f8ba91d2 100644 (file)
@@ -7,9 +7,6 @@ libexecdir= $(pkglibdir)/libexec/
 
 pkgcfgdir= $(pkgdatadir)/config.d/
 
-dist_pkgcfg_DATA = \
-  abe.conf
-
 if USE_COVERAGE
   AM_CFLAGS = --coverage -O0
   XLIB = -lgcov
index 497c9a4f0ba887216a28e21a182d7344ab08d9b1..6b07ab7b721edba48f8c8156ee20b69791e8918c 100644 (file)
@@ -491,7 +491,7 @@ cadet_mq_send_impl (struct GNUNET_MQ_Handle *mq,
   struct GNUNET_CADET_Handle *h = ch->cadet;
   uint16_t msize;
   struct GNUNET_MQ_Envelope *env;
-  struct GNUNET_CADET_LocalData *cadet_msg;
+  struct GNUNET_CADET_LocalData *cadet_msg = NULL;
 
   if (NULL == h->mq)
   {
@@ -638,7 +638,6 @@ handle_channel_created (void *cls,
   ch = create_channel (h,
                        &ccn);
   ch->peer = msg->peer;
-  ch->cadet = h;
   ch->incoming_port = port;
   ch->options = ntohl (msg->opt);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
index c4fd8c7a397f21ccf879f8ffcc530ccd48d79f81..bcb3f9877babd823e18252c550cdd78566a7b367 100755 (executable)
@@ -31,17 +31,19 @@ CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=testissuer --subject=$SUBJECT_
 TEST_CREDENTIAL="t1"
 gnunet-namestore -p -z testsubject -a -n $TEST_CREDENTIAL -t CRED -V "$CRED" -e 5m -c test_credential_lookup.conf
 
+CREDS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --ego=testsubject -c test_credential_lookup.conf | paste -d, -s`
+
+
 #TODO2 Add -z swich like in gnunet-gns
 #RES_CRED=`$DO_TIMEOUT gnunet-credential --verify --issuer=$ISSUER_KEY --attribute="$TEST_ATTR" --subject=$SUBJECT_KEY --credential=$TEST_CREDENTIAL -c test_credential_lookup.conf`
-RES_CRED=`gnunet-credential --verify --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --credential=$TEST_CREDENTIAL -c test_credential_lookup.conf`
+RES_CRED=`gnunet-credential --verify --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --credential="$CREDS" -c test_credential_lookup.conf`
 
 #TODO cleanup properly
 gnunet-namestore -z testsubject -d -n $TEST_CREDENTIAL -t CRED -e never -c test_credential_lookup.conf
 gnunet-identity -D testsubject -c test_credential_lookup.conf
 gnunet-arm -e -c test_credential_lookup.conf
-echo $RES_CRED
 #TODO3 proper test
-if [ "$RES_CRED" == "Successful." ]
+if [ "$RES_CRED" != "Failed." ]
 then
   exit 0
 else
index 6087cbddba566b70e8e2dd4e88881bd2843f7e66..0a9fc5ffb722cf37475298f1f928fb0915bb7d83 100644 (file)
@@ -1,6 +1,6 @@
 /*
   This file is part of GNUnet
-  Copyright (C) 2014, 2015, 2016 GNUnet e.V.
+  Copyright (C) 2014, 2015, 2016, 2018 GNUnet e.V.
 
   GNUnet is free software; you can redistribute it and/or modify it under the
   terms of the GNU General Public License as published by the Free Software
@@ -466,6 +466,7 @@ GNUNET_CURL_perform (struct GNUNET_CURL_Context *ctx)
                                       CURLINFO_PRIVATE,
                                       (char **) &job));
     GNUNET_assert (job->ctx == ctx);
+    response_code = 0;
     j = download_get_result (&job->db,
                              job->easy_handle,
                              &response_code);
index 2fe6498a5149c8d9cd65014e637c5c4792a010a3..2c233c4c21cdd82e93f7aed8b3b4bf9ae4fd3a5d 100644 (file)
@@ -538,6 +538,14 @@ extract_result_cb (void *cls,
       GNUNET_PQ_result_spec_end
     };
 
+    if (GNUNET_YES !=
+        GNUNET_PQ_extract_result (result,
+                                  rs,
+                                  i))
+    {
+      GNUNET_break (0);
+      return;
+    }
     if (0 != (path_len % sizeof (struct GNUNET_PeerIdentity)))
     {
       GNUNET_break (0);
index 30d9245ff7bd7ee5de002a289b6fef66e2569533..1fe6f595fef6151beb5432040b2437c5d0a92679 100644 (file)
@@ -1170,7 +1170,10 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
   trc = GNUNET_NO;
   for (i=0;i<p->num_queries;i++)
   {
-    ret = GNUNET_DNSPARSER_builder_add_query (tmp, sizeof (tmp), &off, &p->queries[i]);
+    ret = GNUNET_DNSPARSER_builder_add_query (tmp,
+                                             sizeof (tmp),
+                                             &off,
+                                             &p->queries[i]);
     if (GNUNET_SYSERR == ret)
       return GNUNET_SYSERR;
     if (GNUNET_NO == ret)
@@ -1182,7 +1185,10 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
   }
   for (i=0;i<p->num_answers;i++)
   {
-    ret = add_record (tmp, sizeof (tmp), &off, &p->answers[i]);
+    ret = add_record (tmp,
+                     sizeof (tmp),
+                     &off,
+                     &p->answers[i]);
     if (GNUNET_SYSERR == ret)
       return GNUNET_SYSERR;
     if (GNUNET_NO == ret)
@@ -1194,7 +1200,10 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
   }
   for (i=0;i<p->num_authority_records;i++)
   {
-    ret = add_record (tmp, sizeof (tmp), &off, &p->authority_records[i]);
+    ret = add_record (tmp,
+                     sizeof (tmp),
+                     &off,
+                     &p->authority_records[i]);
     if (GNUNET_SYSERR == ret)
       return GNUNET_SYSERR;
     if (GNUNET_NO == ret)
@@ -1206,7 +1215,10 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
   }
   for (i=0;i<p->num_additional_records;i++)
   {
-    ret = add_record (tmp, sizeof (tmp), &off, &p->additional_records[i]);
+    ret = add_record (tmp,
+                     sizeof (tmp),
+                     &off,
+                     &p->additional_records[i]);
     if (GNUNET_SYSERR == ret)
       return GNUNET_SYSERR;
     if (GNUNET_NO == ret)
@@ -1219,11 +1231,15 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
 
   if (GNUNET_YES == trc)
     dns.flags.message_truncated = 1;
-  GNUNET_memcpy (tmp, &dns, sizeof (struct GNUNET_TUN_DnsHeader));
+  GNUNET_memcpy (tmp,
+                &dns,
+                sizeof (struct GNUNET_TUN_DnsHeader));
 
   *buf = GNUNET_malloc (off);
   *buf_length = off;
-  GNUNET_memcpy (*buf, tmp, off);
+  GNUNET_memcpy (*buf,
+                tmp,
+                off);
   if (GNUNET_YES == trc)
     return GNUNET_NO;
   return GNUNET_OK;
index 8a3e37b4911897bd13e0df7c0dc2b798e6217bed..e904b90925f22f9e9445fcabdebf5d6180c51e97 100644 (file)
@@ -211,9 +211,9 @@ expand_tree (struct GNUNET_FS_ShareTreeItem *parent,
     chld->short_filename[slen-1] = '\0';
   chld->is_directory = is_directory;
   if (NULL != parent)
-      GNUNET_CONTAINER_DLL_insert (parent->children_head,
-                                  parent->children_tail,
-                                  chld);
+    GNUNET_CONTAINER_DLL_insert (parent->children_head,
+                                parent->children_tail,
+                                chld);
   return chld;
 }
 
@@ -259,7 +259,8 @@ process_helper_msgs (void *cls,
   size_t left;
 
 #if 0
-  fprintf (stderr, "DMS parses %u-byte message of type %u\n",
+  fprintf (stderr,
+          "DMS parses %u-byte message of type %u\n",
           (unsigned int) ntohs (msg->size),
           (unsigned int) ntohs (msg->type));
 #endif
@@ -277,11 +278,18 @@ process_helper_msgs (void *cls,
                           filename, GNUNET_NO,
                           GNUNET_FS_DIRSCANNER_FILE_START);
     if (NULL == ds->toplevel)
+    {
       ds->toplevel = expand_tree (ds->pos,
-                                 filename, GNUNET_NO);
+                                 filename,
+                                 GNUNET_NO);
+    }
     else
+    {
+      GNUNET_assert (NULL != ds->pos);
       (void) expand_tree (ds->pos,
-                         filename, GNUNET_NO);
+                         filename,
+                         GNUNET_NO);
+    }
     return GNUNET_OK;
   case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY:
     if (filename[left-1] != '\0')
@@ -303,7 +311,8 @@ process_helper_msgs (void *cls,
                           filename, GNUNET_YES,
                           GNUNET_FS_DIRSCANNER_FILE_START);
     ds->pos = expand_tree (ds->pos,
-                          filename, GNUNET_YES);
+                          filename,
+                          GNUNET_YES);
     if (NULL == ds->toplevel)
       ds->toplevel = ds->pos;
     return GNUNET_OK;
@@ -360,11 +369,13 @@ process_helper_msgs (void *cls,
        break;
       }
       ds->progress_callback (ds->progress_callback_cls,
-                            filename, GNUNET_YES,
+                            filename,
+                            GNUNET_YES,
                             GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED);
       if (0 < left)
       {
-       ds->pos->meta = GNUNET_CONTAINER_meta_data_deserialize (end, left);
+       ds->pos->meta = GNUNET_CONTAINER_meta_data_deserialize (end,
+                                                               left);
        if (NULL == ds->pos->meta)
        {
          GNUNET_break (0);
index ce852f2d0bba1922f18b5153af5214ab95b71e22..c2a3d4c5dfdd96131c748b3fee378a7d4677537e 100644 (file)
@@ -37,7 +37,8 @@ static int
 is_recursive_download (struct GNUNET_FS_DownloadContext *dc)
 {
   return (0 != (dc->options & GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE)) &&
-      ( (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (dc->meta)) ||
+      ( (GNUNET_YES ==
+        GNUNET_FS_meta_data_test_for_directory (dc->meta)) ||
         ( (NULL == dc->meta) &&
           ( (NULL == dc->filename) ||
             ( (strlen (dc->filename) >= strlen (GNUNET_FS_DIRECTORY_EXT)) &&
index 83c1eb505e6ee632c595d4a62ba3eb2de77a902a..27266a18aea4e68a96632940efbc05d2e85ed835 100644 (file)
@@ -124,7 +124,8 @@ display_bar (unsigned long long x,
  *         field in the `struct GNUNET_FS_ProgressInfo`
  */
 static void *
-progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
+progress_cb (void *cls,
+            const struct GNUNET_FS_ProgressInfo *info)
 {
   char *s;
   const char *s2;
@@ -134,7 +135,8 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
   {
   case GNUNET_FS_STATUS_DOWNLOAD_START:
     if (verbose > 1)
-      FPRINTF (stderr, _("Starting download `%s'.\n"),
+      FPRINTF (stderr,
+              _("Starting download `%s'.\n"),
                info->value.download.filename);
     break;
   case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS:
@@ -146,8 +148,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
           == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us)
         s2 = _("<unknown time>");
       else
-        s2 = GNUNET_STRINGS_relative_time_to_string (
-                                                    info->value.download.specifics.progress.block_download_duration,
+        s2 = GNUNET_STRINGS_relative_time_to_string (info->value.download.specifics.progress.block_download_duration,
                                                     GNUNET_YES);
       t = GNUNET_STRINGS_byte_size_fancy (info->value.download.completed *
                                           1000LL /
@@ -157,7 +158,10 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
                _("Downloading `%s' at %llu/%llu (%s remaining, %s/s). Block took %s to download\n"),
                info->value.download.filename,
                (unsigned long long) info->value.download.completed,
-               (unsigned long long) info->value.download.size, s, t, s2);
+               (unsigned long long) info->value.download.size,
+              s,
+              t,
+              s2);
       GNUNET_free (s);
       GNUNET_free (t);
     }
@@ -173,7 +177,8 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
     if (0 != isatty (1))
       fprintf (stdout, "\n");
 #else
-    if (FILE_TYPE_CHAR == GetFileType (GetStdHandle (STD_OUTPUT_HANDLE)))
+    if (FILE_TYPE_CHAR ==
+       GetFileType (GetStdHandle (STD_OUTPUT_HANDLE)))
       fprintf (stdout, "\n");
 #endif
     FPRINTF (stderr, _("Error downloading: %s.\n"),
@@ -188,10 +193,12 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
     if (0 != isatty (1))
       fprintf (stdout, "\n");
 #else
-    if (FILE_TYPE_CHAR == GetFileType (GetStdHandle (STD_OUTPUT_HANDLE)))
+    if (FILE_TYPE_CHAR ==
+       GetFileType (GetStdHandle (STD_OUTPUT_HANDLE)))
       fprintf (stdout, "\n");
 #endif
-    FPRINTF (stdout, _("Downloading `%s' done (%s/s).\n"),
+    FPRINTF (stdout,
+            _("Downloading `%s' done (%s/s).\n"),
              info->value.download.filename, s);
     GNUNET_free (s);
     if (info->value.download.dc == dc)
@@ -205,7 +212,9 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
   case GNUNET_FS_STATUS_DOWNLOAD_INACTIVE:
     break;
   default:
-    FPRINTF (stderr, _("Unexpected status: %d\n"), info->status);
+    FPRINTF (stderr,
+            _("Unexpected status: %d\n"),
+            info->status);
     break;
   }
   return NULL;
@@ -221,7 +230,9 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
  * @param c configuration
  */
 static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
+     char *const *args,
+     const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
   struct GNUNET_FS_Uri *uri;
@@ -230,41 +241,55 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   if (NULL == args[0])
   {
-    FPRINTF (stderr, "%s",  _("You need to specify a URI argument.\n"));
+    FPRINTF (stderr,
+            "%s",
+            _("You need to specify a URI argument.\n"));
     return;
   }
   uri = GNUNET_FS_uri_parse (args[0], &emsg);
   if (NULL == uri)
   {
-    FPRINTF (stderr, _("Failed to parse URI: %s\n"), emsg);
+    FPRINTF (stderr,
+            _("Failed to parse URI: %s\n"),
+            emsg);
     GNUNET_free (emsg);
     ret = 1;
     return;
   }
-  if ((!GNUNET_FS_uri_test_chk (uri)) && (!GNUNET_FS_uri_test_loc (uri)))
+  if ( (! GNUNET_FS_uri_test_chk (uri)) &&
+       (! GNUNET_FS_uri_test_loc (uri)))
   {
-    FPRINTF (stderr, "%s",  _("Only CHK or LOC URIs supported.\n"));
+    FPRINTF (stderr,
+            "%s",
+            _("Only CHK or LOC URIs supported.\n"));
     ret = 1;
     GNUNET_FS_uri_destroy (uri);
     return;
   }
   if (NULL == filename)
   {
-    FPRINTF (stderr, "%s",  _("Target filename must be specified.\n"));
+    FPRINTF (stderr,
+            "%s",
+            _("Target filename must be specified.\n"));
     ret = 1;
     GNUNET_FS_uri_destroy (uri);
     return;
   }
   cfg = c;
-  ctx =
-      GNUNET_FS_start (cfg, "gnunet-download", &progress_cb, NULL,
-                       GNUNET_FS_FLAGS_NONE,
-                       GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM, parallelism,
-                       GNUNET_FS_OPTIONS_REQUEST_PARALLELISM,
-                       request_parallelism, GNUNET_FS_OPTIONS_END);
+  ctx = GNUNET_FS_start (cfg,
+                        "gnunet-download",
+                        &progress_cb, NULL,
+                        GNUNET_FS_FLAGS_NONE,
+                        GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM,
+                        parallelism,
+                        GNUNET_FS_OPTIONS_REQUEST_PARALLELISM,
+                        request_parallelism,
+                        GNUNET_FS_OPTIONS_END);
   if (NULL == ctx)
   {
-    FPRINTF (stderr, _("Could not initialize `%s' subsystem.\n"), "FS");
+    FPRINTF (stderr,
+            _("Could not initialize `%s' subsystem.\n"),
+            "FS");
     GNUNET_FS_uri_destroy (uri);
     ret = 1;
     return;
@@ -274,9 +299,17 @@ run (void *cls, char *const *args, const char *cfgfile,
     options |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE;
   if (local_only)
     options |= GNUNET_FS_DOWNLOAD_OPTION_LOOPBACK_ONLY;
-  dc = GNUNET_FS_download_start (ctx, uri, NULL, filename, NULL, 0,
+  dc = GNUNET_FS_download_start (ctx,
+                                uri,
+                                NULL,
+                                filename,
+                                NULL,
+                                0,
                                  GNUNET_FS_uri_chk_get_file_size (uri),
-                                 anonymity, options, NULL, NULL);
+                                 anonymity,
+                                options,
+                                NULL,
+                                NULL);
   GNUNET_FS_uri_destroy (uri);
   if (dc == NULL)
   {
@@ -301,60 +334,58 @@ main (int argc, char *const *argv)
 {
   struct GNUNET_GETOPT_CommandLineOption options[] = {
     GNUNET_GETOPT_option_uint ('a',
-                                   "anonymity",
-                                   "LEVEL",
-                                   gettext_noop ("set the desired LEVEL of receiver-anonymity"),
-                                   &anonymity),
+                              "anonymity",
+                              "LEVEL",
+                              gettext_noop ("set the desired LEVEL of receiver-anonymity"),
+                              &anonymity),
 
     GNUNET_GETOPT_option_flag ('D',
-                                  "delete-incomplete",
-                                  gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"),
-                                  &delete_incomplete),
+                              "delete-incomplete",
+                              gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"),
+                              &delete_incomplete),
 
     GNUNET_GETOPT_option_flag ('n',
-                                  "no-network",
-                                  gettext_noop ("only search the local peer (no P2P network search)"),
-                                  &local_only), 
-
+                              "no-network",
+                              gettext_noop ("only search the local peer (no P2P network search)"),
+                              &local_only), 
     GNUNET_GETOPT_option_string ('o',
                                  "output",
                                  "FILENAME",
                                  gettext_noop ("write the file to FILENAME"),
                                  &filename),
-
     GNUNET_GETOPT_option_uint ('p',
-                                   "parallelism",
-                                   "DOWNLOADS",
-                                   gettext_noop ("set the maximum number of parallel downloads that is allowed"),
-                                   &parallelism),
-
+                              "parallelism",
+                              "DOWNLOADS",
+                              gettext_noop ("set the maximum number of parallel downloads that is allowed"),
+                              &parallelism),
     GNUNET_GETOPT_option_uint ('r',
-                                   "request-parallelism",
-                                   "REQUESTS",
-                                   gettext_noop ("set the maximum number of parallel requests for blocks that is allowed"),
-                                   &request_parallelism), 
-
+                              "request-parallelism",
+                              "REQUESTS",
+                              gettext_noop ("set the maximum number of parallel requests for blocks that is allowed"),
+                              &request_parallelism), 
     GNUNET_GETOPT_option_flag ('R',
-                                  "recursive",
-                                  gettext_noop ("download a GNUnet directory recursively"),
-                                  &do_recursive),
-
+                              "recursive",
+                              gettext_noop ("download a GNUnet directory recursively"),
+                              &do_recursive),
     GNUNET_GETOPT_option_increment_uint ('V',
-                                          "verbose",
-                                          gettext_noop ("be verbose (print progress information)"),
-                                          &verbose), 
-
+                                        "verbose",
+                                        gettext_noop ("be verbose (print progress information)"),
+                                        &verbose), 
     GNUNET_GETOPT_OPTION_END
   };
 
-  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
+  if (GNUNET_OK !=
+      GNUNET_STRINGS_get_utf8_args (argc, argv,
+                                   &argc, &argv))
     return 2;
 
   ret = (GNUNET_OK ==
-        GNUNET_PROGRAM_run (argc, argv, "gnunet-download [OPTIONS] URI",
+        GNUNET_PROGRAM_run (argc, argv,
+                            "gnunet-download [OPTIONS] URI",
                             gettext_noop
                             ("Download files from GNUnet using a GNUnet CHK or LOC URI (gnunet://fs/chk/...)"),
-                            options, &run, NULL)) ? ret : 1;
+                            options,
+                            &run, NULL)) ? ret : 1;
   GNUNET_free ((void*) argv);
   return ret;
 }
index c581905992a0dae6e57c696ad84c79e4ee12c4ff..5bf443267329b13929d9e42d884e1f1402f44968 100644 (file)
@@ -327,7 +327,7 @@ struct GNS_ResolverHandle
   /**
    * ID of a task associated with the resolution process.
    */
-  struct GNUNET_SCHEDULER_Task * task_id;
+  struct GNUNET_SCHEDULER_Task *task_id;
 
   /**
    * The name to resolve
@@ -658,6 +658,8 @@ resolver_lookup_get_next_label (struct GNS_ResolverHandle *rh)
     }
     rh->protocol = pe->p_proto;
     rh->service = se->s_port;
+    GNUNET_free (proto_name);
+    GNUNET_free (srv_name);
   }
   return ret;
 }
@@ -806,10 +808,10 @@ recursive_resolution (void *cls);
  * Begin the resolution process from 'name', starting with
  * the identification of the zone specified by 'name'.
  *
- * @param rh resolution to perform
+ * @param cls closure with `struct GNS_ResolverHandle *rh`
  */
 static void
-start_resolver_lookup (struct GNS_ResolverHandle *rh);
+start_resolver_lookup (void *cls);
 
 
 /**
@@ -833,6 +835,7 @@ dns_result_parser (void *cls,
   unsigned int rd_count;
   unsigned int i;
 
+  (void) rs;
   rh->dns_request = NULL;
   GNUNET_SCHEDULER_cancel (rh->task_id);
   rh->task_id = NULL;
@@ -857,7 +860,8 @@ dns_result_parser (void *cls,
       GNUNET_free (rh->name);
       rh->name = GNUNET_strdup (p->answers[0].data.hostname);
       rh->name_resolution_pos = strlen (rh->name);
-      start_resolver_lookup (rh);
+      rh->task_id = GNUNET_SCHEDULER_add_now (&start_resolver_lookup,
+                                             rh);
       GNUNET_DNSPARSER_free_packet (p);
       return;
     }
@@ -1017,6 +1021,7 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh)
   struct GNUNET_DNSPARSER_Packet *p;
   char *dns_request;
   size_t dns_request_length;
+  int ret;
 
   ac = rh->ac_tail;
   GNUNET_assert (NULL != ac);
@@ -1049,11 +1054,16 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh)
                                               UINT16_MAX);
   p->flags.opcode = GNUNET_TUN_DNS_OPCODE_QUERY;
   p->flags.recursion_desired = 1;
-  if (GNUNET_OK !=
-      GNUNET_DNSPARSER_pack (p, 1024, &dns_request, &dns_request_length))
+  ret = GNUNET_DNSPARSER_pack (p,
+                              1024,
+                              &dns_request,
+                              &dns_request_length);
+  if (GNUNET_OK != ret)
   {
     GNUNET_break (0);
-    rh->proc (rh->proc_cls, 0, NULL);
+    rh->proc (rh->proc_cls,
+             0,
+             NULL);
     GNS_resolver_lookup_cancel (rh);
   }
   else
@@ -1069,7 +1079,8 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh)
                                                &fail_resolution,
                                                rh);
   }
-  GNUNET_free (dns_request);
+  if (GNUNET_SYSERR != ret)
+    GNUNET_free (dns_request);
   GNUNET_DNSPARSER_free_packet (p);
 }
 
@@ -1132,7 +1143,8 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
   GNUNET_free (rh->name);
   rh->name = GNUNET_strdup (cname);
   rh->name_resolution_pos = strlen (rh->name);
-  start_resolver_lookup (rh);
+  rh->task_id = GNUNET_SCHEDULER_add_now (&start_resolver_lookup,
+                                         rh);
 }
 
 
@@ -1460,10 +1472,10 @@ handle_gns_resolution_result (void *cls,
            vpn_ctx->rd_data = GNUNET_malloc (vpn_ctx->rd_data_size);
             vpn_ctx->rd_count = rd_count;
            GNUNET_assert (vpn_ctx->rd_data_size ==
-                           GNUNET_GNSRECORD_records_serialize (rd_count,
-                                                               rd,
-                                                               vpn_ctx->rd_data_size,
-                                                               vpn_ctx->rd_data));
+                           (size_t) GNUNET_GNSRECORD_records_serialize (rd_count,
+                                                                       rd,
+                                                                       vpn_ctx->rd_data_size,
+                                                                       vpn_ctx->rd_data));
            vpn_ctx->vpn_request = GNUNET_VPN_redirect_to_peer (vpn_handle,
                                                                af,
                                                                ntohs (vpn->proto),
@@ -1830,7 +1842,9 @@ handle_gns_resolution_result (void *cls,
         g2dc->rh->options = GNUNET_GNS_LO_DEFAULT;
         g2dc->rh->loop_limiter = rh->loop_limiter + 1;
         rh->g2dc = g2dc;
-        start_resolver_lookup (g2dc->rh);
+        g2dc->rh->task_id
+         = GNUNET_SCHEDULER_add_now (&start_resolver_lookup,
+                                     g2dc->rh);
        return;
       }
     case GNUNET_DNSPARSER_TYPE_CNAME:
@@ -1884,7 +1898,7 @@ namecache_cache_continuation (void *cls,
   struct CacheOps *co = cls;
 
   co->namecache_qe_cache = NULL;
-  if (NULL != emsg)
+  if (GNUNET_OK != success)
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                _("Failed to cache GNS resolution: %s\n"),
                emsg);
@@ -1921,13 +1935,21 @@ handle_dht_response (void *cls,
                     const struct GNUNET_PeerIdentity *put_path,
                     unsigned int put_path_length,
                     enum GNUNET_BLOCK_Type type,
-                    size_t size, const void *data)
+                    size_t size,
+                    const void *data)
 {
   struct GNS_ResolverHandle *rh = cls;
   struct AuthorityChain *ac = rh->ac_tail;
   const struct GNUNET_GNSRECORD_Block *block;
   struct CacheOps *co;
 
+  (void) exp;
+  (void) key;
+  (void) get_path;
+  (void) get_path_length;
+  (void) put_path;
+  (void) put_path_length;
+  (void) type;
   GNUNET_DHT_get_stop (rh->get_handle);
   rh->get_handle = NULL;
   GNUNET_CONTAINER_heap_remove_node (rh->dht_heap_node);
@@ -2230,16 +2252,18 @@ recursive_resolution (void *cls)
  * Begin the resolution process from 'name', starting with
  * the identification of the zone specified by 'name'.
  *
- * @param rh resolution to perform
+ * @param cls the `struct GNS_ResolverHandle` 
  */
 static void
-start_resolver_lookup (struct GNS_ResolverHandle *rh)
+start_resolver_lookup (void *cls)
 {
+  struct GNS_ResolverHandle *rh = cls;
   struct AuthorityChain *ac;
   char *y;
   struct in_addr v4;
   struct in6_addr v6;
 
+  rh->task_id = NULL;
   if (1 == inet_pton (AF_INET,
                       rh->name,
                       &v4))
@@ -2360,7 +2384,8 @@ GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone,
                     uint32_t record_type,
                     const char *name,
                     enum GNUNET_GNS_LocalOptions options,
-                    GNS_ResultProcessor proc, void *proc_cls)
+                    GNS_ResultProcessor proc,
+                    void *proc_cls)
 {
   struct GNS_ResolverHandle *rh;
 
@@ -2378,7 +2403,8 @@ GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone,
   rh->record_type = record_type;
   rh->name = GNUNET_strdup (name);
   rh->name_resolution_pos = strlen (name);
-  start_resolver_lookup (rh);
+  rh->task_id = GNUNET_SCHEDULER_add_now (&start_resolver_lookup,
+                                         rh);
   return rh;
 }
 
index 4e1de36cd10d58794e58ed5faba7feb84ca5681e..711ae76cece7ab3697b269f0ec965956c7058d5d 100644 (file)
@@ -94,11 +94,6 @@ static struct GNUNET_GNS_Handle *gns_handle;
  */
 static struct GNUNET_CREDENTIAL_Handle *credential_handle;
 
-/**
- * Stats handle
- */
-static struct GNUNET_STATISTICS_Handle *stats_handle;
-
 /**
  * Namestore qe
  */
@@ -635,8 +630,6 @@ cleanup()
     GNUNET_NAMESTORE_cancel (ns_qe);
   if (NULL != ns_handle)
     GNUNET_NAMESTORE_disconnect (ns_handle);
-  if (NULL != stats_handle)
-    GNUNET_STATISTICS_destroy (stats_handle, GNUNET_NO);
   GNUNET_free_non_null (token);
   GNUNET_free_non_null (label);
 
@@ -1553,11 +1546,11 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count,
                                parallel_lookup);
   GNUNET_free (parallel_lookup->label);
 
-  GNUNET_STATISTICS_update (stats_handle,
+  GNUNET_STATISTICS_update (stats,
                             "attribute_lookup_time_total",
                             GNUNET_TIME_absolute_get_duration (parallel_lookup->lookup_start_time).rel_value_us,
                             GNUNET_YES);
-  GNUNET_STATISTICS_update (stats_handle,
+  GNUNET_STATISTICS_update (stats,
                             "attribute_lookups_count",
                             1,
                             GNUNET_YES);
@@ -1575,11 +1568,11 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count,
                                             (void**)&data);
     if (GNUNET_SYSERR != attr_len) 
     {
-      GNUNET_STATISTICS_update (stats_handle,
+      GNUNET_STATISTICS_update (stats,
                                 "abe_decrypt_time_total",
                                 GNUNET_TIME_absolute_get_duration (decrypt_duration).rel_value_us,
                                 GNUNET_YES);
-      GNUNET_STATISTICS_update (stats_handle,
+      GNUNET_STATISTICS_update (stats,
                                 "abe_decrypt_count",
                                 1,
                                 GNUNET_YES);
@@ -1700,11 +1693,11 @@ process_consume_abe_key (void *cls, uint32_t rd_count,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Decrypted bytes: %zd Expected bytes: %zd\n",
               size, rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
-  GNUNET_STATISTICS_update (stats_handle,
+  GNUNET_STATISTICS_update (stats,
                             "abe_key_lookup_time_total",
                             GNUNET_TIME_absolute_get_duration (handle->lookup_start_time).rel_value_us,
                             GNUNET_YES);
-  GNUNET_STATISTICS_update (stats_handle,
+  GNUNET_STATISTICS_update (stats,
                             "abe_key_lookups_count",
                             1,
                             GNUNET_YES);
@@ -2392,8 +2385,6 @@ run (void *cls,
   identity_handle = GNUNET_IDENTITY_connect (cfg,
                                              NULL,
                                              NULL);
-  stats_handle = GNUNET_STATISTICS_create ("identity-provider",
-                                           cfg);
   /* Loading DB plugin */
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_string (cfg,
index 5f34d0f1bff3a962c865d5463f8cab195c934aa6..33804143d4a43a74a545f62d4f898cb20ec4dd20 100644 (file)
@@ -593,6 +593,7 @@ ego_edit_cont (struct GNUNET_REST_RequestHandle *con,
   struct GNUNET_JSONAPI_Resource *json_res;
   struct RequestHandle *handle = cls;
   struct EgoEntry *ego_entry;
+  struct EgoEntry *ego_entry_tmp;
   struct MHD_Response *resp;
   json_t *subsys_json;
   json_t *name_json;
@@ -684,12 +685,12 @@ ego_edit_cont (struct GNUNET_REST_RequestHandle *con,
   if ((NULL != name_json) && json_is_string (name_json))
   {
     newname = json_string_value (name_json);
-    for (ego_entry = handle->ego_head;
-         NULL != ego_entry;
-         ego_entry = ego_entry->next)
+    for (ego_entry_tmp = handle->ego_head;
+         NULL != ego_entry_tmp;
+         ego_entry_tmp = ego_entry_tmp->next)
     {
-      if (0 == strcasecmp (newname, ego_entry->identifier) &&
-          0 != strcasecmp (keystring, ego_entry->keystring))
+      if (0 == strcasecmp (newname, ego_entry_tmp->identifier) &&
+          0 != strcasecmp (keystring, ego_entry_tmp->keystring))
       {
         //Ego with same name not allowed
         GNUNET_JSONAPI_document_delete (json_obj);
index 9e692bbbf6c21eacfe536a845e98e9f20328306a..2c344749f3a3dac928438fbea52a9544392cefbf 100644 (file)
@@ -53,7 +53,7 @@ struct GNUNET_NETWORK_FDSet
 {
 
   /**
-   * Maximum number of any socket socket descriptor in the set (plus one)
+   * Maximum number of any socket descriptor in the set (plus one)
    */
   int nsds;
 
index a2999aebcb9851ef4303bf1e1a743bd8944b8077..0c14aa945f2221d7da99e9759d542b84964ae798 100644 (file)
@@ -530,6 +530,7 @@ GNUNET_SET_iterate (struct GNUNET_SET_Handle *set,
                     GNUNET_SET_ElementIterator iter,
                     void *iter_cls);
 
+
 /**
  * Stop iteration over all elements in the given set.  Can only
  * be called before the iteration has "naturally" completed its
@@ -540,6 +541,7 @@ GNUNET_SET_iterate (struct GNUNET_SET_Handle *set,
 void
 GNUNET_SET_iterate_cancel (struct GNUNET_SET_Handle *set);
 
+
 /**
  * Create a copy of an element.  The copy
  * must be GNUNET_free-d by the caller.
@@ -550,6 +552,7 @@ GNUNET_SET_iterate_cancel (struct GNUNET_SET_Handle *set);
 struct GNUNET_SET_Element *
 GNUNET_SET_element_dup (const struct GNUNET_SET_Element *element);
 
+
 /**
  * Hash a set element.
  *
index 379dab9af52ebbebf714b938ddb61ef005c575ab..36c7b5c6cf26983bc29f87a0f84ae016aa46be10 100644 (file)
@@ -1,18 +1,18 @@
 /*
-  This file is part of GNUnet
-  (C) 2015, 2016 GNUnet e.V.
+   This file is part of GNUnet
+   (C) 2015, 2016 GNUnet e.V.
 
-  GNUnet is free software; you can redistribute it and/or modify it under the
-  terms of the GNU General Public License as published by the Free Software
-  Foundation; either version 3, or (at your option) any later version.
+   GNUnet is free software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the Free Software
+   Foundation; either version 3, or (at your option) any later version.
 
-  GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+   GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 
-  You should have received a copy of the GNU General Public License along with
-  GNUnet; see the file COPYING.  If not, If not, see <http://www.gnu.org/licenses/>
-*/
+   You should have received a copy of the GNU General Public License along with
+   GNUnet; see the file COPYING.  If not, If not, see <http://www.gnu.org/licenses/>
+   */
 
 /**
  * @file json/test_jsonapi.c
@@ -24,7 +24,7 @@
 #include "gnunet_jsonapi_lib.h"
 #include "gnunet_json_lib.h"
 
-#define TEST_JSONAPI_DOCUMENT "{\"data\":{\"id\":\"1\",\"type\":\"bar\",\"attributes\":{\"foo\":\"bar\"}}}"
+#define TEST_JSONAPI_DOCUMENT "{\"data\":[{\"id\":\"1\",\"type\":\"bar\",\"attributes\":{\"foo\":\"bar\"}}]}"
 
 #define TEST_JSONAPI_DOCUMENT_ERR "{\"errors\":[{\"id\":\"1\",\"status\":\"403\",\"code\":\"23\", \"title\":\"Error\", \"detail\":\"Error details\"}]}"
 
@@ -74,7 +74,8 @@ test_document ()
   json_t *doc_json;
   json_t *data_js;
   json_error_t err;
-
+  int ret;
+   
   obj = GNUNET_JSONAPI_document_new ();
   res = GNUNET_JSONAPI_resource_new ("bar",
                                      "1");
@@ -94,11 +95,11 @@ test_document ()
                         JSON_DECODE_ANY,
                         &err);
   GNUNET_assert (NULL != data_js);
-  GNUNET_assert (0 != json_equal (data_js, doc_json));
+  ret = json_equal (data_js, doc_json) ? 0 : 1;
   GNUNET_JSONAPI_document_delete (obj);
   json_decref (data_js);
   json_decref (doc_json);
-  return 0;
+  return ret;
 }
 
 static int
@@ -106,6 +107,7 @@ test_serialize ()
 {
   struct GNUNET_JSONAPI_Document *obj;
   char* tmp_data;
+  int ret;
   json_t* data_js;
   json_t* tmp_data_js;
   json_error_t err;
@@ -125,11 +127,11 @@ test_serialize ()
   GNUNET_JSON_parse_free (jsonapispec);
   tmp_data_js = json_loads (tmp_data, JSON_DECODE_ANY, &err);
   GNUNET_assert (NULL != tmp_data_js);
-  GNUNET_assert (0 != json_equal (tmp_data_js, data_js));
+  ret = (1 == json_equal (tmp_data_js, data_js)) ? 0 : 1;
   json_decref (data_js);
   json_decref (tmp_data_js);
   GNUNET_free (tmp_data);
-  return 0;
+  return ret;
 }
 
 /**
index ba1086cc5bf43fe38aa406e9e5d7dba30f425e3e..d01227e2c9675ea82f92a887916be56ddd77431f 100644 (file)
@@ -664,6 +664,7 @@ client_send_random (struct GNUNET_HashCode *pub_key_hash,
   if (n <= 0)
     n = GNUNET_CONTAINER_multihashmap_get_random (members, client_send_member_cb,
                                                    (void *) env);
+  GNUNET_MQ_discard (env);
   return n;
 }
 
index af1eb2d1d6e6566716d559b11676a13f989fbb7f..bdb6e5e0dee8220f76e7409f356b7d83e247a82f 100644 (file)
@@ -198,6 +198,8 @@ count_addresses (void *cls,
 {
   unsigned int *cnt = cls;
 
+  (void) address;
+  (void) expiration;
   (*cnt)++;
   return GNUNET_OK;
 }
@@ -290,7 +292,7 @@ read_host_file (const char *fn,
   const struct GNUNET_HELLO_Message *hello;
   struct GNUNET_HELLO_Message *hello_clean;
   size_t read_pos;
-  int size_hello;
+  uint16_t size_hello;
 
   r->friend_only_hello = NULL;
   r->hello = NULL;
@@ -304,7 +306,8 @@ read_host_file (const char *fn,
               "Read %d bytes from `%s'\n",
               (int) size_total,
               fn);
-  if (size_total < sizeof (struct GNUNET_MessageHeader))
+  if ( (size_total < 0) ||
+       (((size_t) size_total) < sizeof (struct GNUNET_MessageHeader)) )
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                _("Failed to parse HELLO in file `%s': %s\n"),
@@ -320,12 +323,12 @@ read_host_file (const char *fn,
   }
 
   read_pos = 0;
-  while (read_pos < size_total)
+  while (read_pos < (size_t) size_total)
   {
     hello = (const struct GNUNET_HELLO_Message *) &buffer[read_pos];
     size_hello = GNUNET_HELLO_size (hello);
     if ( (0 == size_hello) ||
-         (size_total - read_pos < size_hello) )
+         (((size_t) size_total) - read_pos < size_hello) )
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                   _("Failed to parse HELLO in file `%s'\n"),
@@ -559,11 +562,11 @@ hosts_directory_scan_callback (void *cls,
     if (GNUNET_OK !=
         GNUNET_HELLO_get_id (r.friend_only_hello,
                              &id_friend))
+    {
       if (GNUNET_YES == dsc->remove_files)
-      {
        remove_garbage (fullname);
-       return GNUNET_OK;
-      }
+      return GNUNET_OK;
+    }
     id = id_friend;
   }
   if (NULL != r.hello)
@@ -571,11 +574,11 @@ hosts_directory_scan_callback (void *cls,
     if (GNUNET_OK !=
         GNUNET_HELLO_get_id (r.hello,
                              &id_public))
+    {
       if (GNUNET_YES == dsc->remove_files)
-      {
        remove_garbage (fullname);
-       return GNUNET_OK;
-      }
+      return GNUNET_OK;
+    }
     id = id_public;
   }
 
@@ -640,6 +643,7 @@ cron_scan_directory_data_hosts (void *cls)
   static unsigned int retries;
   struct DirScanContext dsc;
 
+  (void) cls;
   cron_scan = NULL;
   if (GNUNET_SYSERR ==
       GNUNET_DISK_directory_create (networkIdDirectory))
@@ -730,7 +734,7 @@ update_hello (const struct GNUNET_PeerIdentity *peer,
   int friend_hello_type;
   int store_hello;
   int store_friend_hello;
-  int pos;
+  unsigned int pos;
   char *buffer;
 
   host = GNUNET_CONTAINER_multipeermap_get (hostmap, peer);
@@ -849,8 +853,8 @@ update_hello (const struct GNUNET_PeerIdentity *peer,
       if (GNUNET_YES == store_friend_hello)
       {
        GNUNET_memcpy (&buffer[pos],
-                host->friend_only_hello,
-                GNUNET_HELLO_size (host->friend_only_hello));
+                      host->friend_only_hello,
+                      GNUNET_HELLO_size (host->friend_only_hello));
        pos += GNUNET_HELLO_size (host->friend_only_hello);
       }
       GNUNET_assert (pos == size);
@@ -988,16 +992,31 @@ discard_hosts_helper (void *cls,
   unsigned int cnt;
   char *writebuffer;
   uint64_t fsize;
+  
+  if (GNUNET_OK !=
+      GNUNET_DISK_file_size (fn,
+                            &fsize,
+                            GNUNET_YES,
+                            GNUNET_YES))
+  {
+    GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING |
+                             GNUNET_ERROR_TYPE_BULK,
+                             "fstat",
+                             fn);
+    return GNUNET_OK;
+  }
+  read_size = GNUNET_DISK_fn_read (fn,
+                                  buffer,
+                                  sizeof (buffer));
 
-  GNUNET_DISK_file_size (fn, &fsize, GNUNET_YES, GNUNET_YES);
-  read_size = GNUNET_DISK_fn_read (fn, buffer, sizeof (buffer));
-
-  if ((read_size < (int) sizeof (struct GNUNET_MessageHeader)) ||
-      (fsize > GNUNET_MAX_MESSAGE_SIZE))
+  if ( (read_size < (int) sizeof (struct GNUNET_MessageHeader)) ||
+       (fsize > GNUNET_MAX_MESSAGE_SIZE) )
   {
     if (0 != UNLINK (fn))
       GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING |
-                                GNUNET_ERROR_TYPE_BULK, "unlink", fn);
+                                GNUNET_ERROR_TYPE_BULK,
+                               "unlink",
+                               fn);
     return GNUNET_OK;
   }
 
@@ -1074,6 +1093,7 @@ cron_clean_data_hosts (void *cls)
 {
   struct GNUNET_TIME_Absolute now;
 
+  (void) cls;
   cron_clean = NULL;
   now = GNUNET_TIME_absolute_get ();
   GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK,
@@ -1101,6 +1121,7 @@ check_hello (void *cls,
 {
   struct GNUNET_PeerIdentity pid;
 
+  (void) cls;
   if (GNUNET_OK !=
       GNUNET_HELLO_get_id (hello,
                            &pid))
@@ -1252,6 +1273,8 @@ client_connect_cb (void *cls,
                    struct GNUNET_SERVICE_Client *client,
                    struct GNUNET_MQ_Handle *mq)
 {
+  (void) cls;
+  (void) mq;
   return client;
 }
 
@@ -1268,6 +1291,7 @@ client_disconnect_cb (void *cls,
                       struct GNUNET_SERVICE_Client *client,
                       void *app_ctx)
 {
+  (void) cls;
   GNUNET_assert (app_ctx == client);
 }
 
@@ -1287,6 +1311,8 @@ free_host_entry (void *cls,
 {
   struct HostEntry *he = value;
 
+  (void) cls;
+  (void) key;
   GNUNET_free_non_null (he->hello);
   GNUNET_free_non_null (he->friend_only_hello);
   GNUNET_free (he);
@@ -1302,6 +1328,7 @@ free_host_entry (void *cls,
 static void
 shutdown_task (void *cls)
 {
+  (void) cls;
   GNUNET_notification_context_destroy (notify_list);
   notify_list = NULL;
   GNUNET_notification_context_destroy (notify_friend_only_list);
@@ -1353,6 +1380,8 @@ run (void *cls,
   int noio;
   int use_included;
 
+  (void) cls;
+  (void) service;
   hostmap
     = GNUNET_CONTAINER_multipeermap_create (1024,
                                             GNUNET_YES);
index b80dabca0856b5ea982f6500a3665bd8db3de06c..828bb164893f677186c3d38d1e8a61791d6d1089 100644 (file)
@@ -154,23 +154,30 @@ regex_iterator (void *cls,
                     NULL, NULL);
   }
   block = REGEX_BLOCK_create (proof,
-                              num_edges, edges,
+                              num_edges,
+                             edges,
                               accepting,
                               &size);
-  (void)
-  GNUNET_DHT_put (h->dht, key,
-                  DHT_REPLICATION,
-                  DHT_OPT,
-                  GNUNET_BLOCK_TYPE_REGEX,
-                  size, block,
-                  GNUNET_TIME_relative_to_absolute (DHT_TTL),
-                  NULL, NULL);
+  if (NULL == block)
+    return;
+  (void) GNUNET_DHT_put (h->dht,
+                        key,
+                        DHT_REPLICATION,
+                        DHT_OPT,
+                        GNUNET_BLOCK_TYPE_REGEX,
+                        size,
+                        block,
+                        GNUNET_TIME_relative_to_absolute (DHT_TTL),
+                        NULL,
+                        NULL);
   GNUNET_STATISTICS_update (h->stats,
                             "# regex blocks stored",
-                            1, GNUNET_NO);
+                            1,
+                           GNUNET_NO);
   GNUNET_STATISTICS_update (h->stats,
                             "# regex block bytes stored",
-                            size, GNUNET_NO);
+                            size,
+                           GNUNET_NO);
   GNUNET_free (block);
 }
 
index f4025f6529bf13cd2d16a1ce142562f5b8719584..814380246523af01255d3b75493257d4476e04e9 100644 (file)
@@ -99,8 +99,7 @@ c2i (char c, int size)
 static void
 space (int n)
 {
-  int i;
-  for (i = 0; i < n; i++)
+  for (int i = 0; i < n; i++)
     fprintf (stderr, "| ");
 }
 
@@ -114,8 +113,7 @@ space (int n)
 static void
 debugctx (struct RegexCombineCtx *ctx, int level)
 {
-  return;
-  unsigned int i;
+#if DEBUG_REGEX
   if (NULL != ctx->s)
   {
     space (level - 1);
@@ -123,7 +121,7 @@ debugctx (struct RegexCombineCtx *ctx, int level)
   }
   else
     fprintf (stderr, "ROOT (base %u)\n", ctx->size);
-  for (i = 0; i < ctx->size; i++)
+  for (unsigned int i = 0; i < ctx->size; i++)
   {
     if (NULL != ctx->children[i])
     {
@@ -132,6 +130,7 @@ debugctx (struct RegexCombineCtx *ctx, int level)
     }
   }
   fflush(stderr);
+#endif
 }
 
 
@@ -142,7 +141,8 @@ debugctx (struct RegexCombineCtx *ctx, int level)
  * @param regex Regex to add.
  */
 static void
-regex_add (struct RegexCombineCtx *ctx, const char *regex);
+regex_add (struct RegexCombineCtx *ctx,
+          const char *regex);
 
 
 /**
@@ -164,14 +164,18 @@ new_regex_ctx (unsigned int alphabet_size)
   return ctx;
 }
 
+
 static void
-move_children (struct RegexCombineCtx *dst, const struct RegexCombineCtx *src)
+move_children (struct RegexCombineCtx *dst,
+              const struct RegexCombineCtx *src)
 {
   size_t array_size;
 
   array_size = sizeof(struct RegexCombineCtx *) * src->size;
-  memcpy (dst->children, src->children, array_size);
-  for (int i = 0; i < src->size; i++)
+  memcpy (dst->children,
+         src->children,
+         array_size);
+  for (unsigned int i = 0; i < src->size; i++)
   {
     src->children[i] = NULL;
   }
@@ -402,6 +406,7 @@ regex_split (struct RegexCombineCtx *ctx,
     tmp = ctx->children;
     ctx->children = GNUNET_malloc (sizeof(*tmp) * ctx->size);
     regex_add_multiple (ctx, suffix, tmp);
+    GNUNET_free (suffix);
     GNUNET_free (tmp);
     return;
   }
index 8281e9a16614d74ad23ed955f89e1bb7a2ba3990..23f654141820ea76f387d5f46de0896e3e5ff85f 100644 (file)
@@ -759,7 +759,11 @@ handle_revocation_union_request (void *cls,
   {
     peer_entry = new_peer_entry (other_peer);
   }
-  GNUNET_assert (NULL == peer_entry->so);
+  if (NULL != peer_entry->so)
+  {
+    GNUNET_break_op (0);
+    return;
+  }
   peer_entry->so = GNUNET_SET_accept (request,
                                       GNUNET_SET_RESULT_ADDED,
                                       (struct GNUNET_SET_Option[]) {{ 0 }},
@@ -769,8 +773,7 @@ handle_revocation_union_request (void *cls,
       GNUNET_SET_commit (peer_entry->so,
                          revocation_set))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                _("SET service crashed, terminating revocation service\n"));
+    GNUNET_break (0);
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
index 1d0d00b4458b0c0462c199db9e8cd9ca95e6e4fb..cefc6734a442447b65d166fdcf4eea3b74515b5e 100644 (file)
@@ -695,6 +695,7 @@ GNUNET_SET_add_element (struct GNUNET_SET_Handle *set,
        "adding element of type %u to set %p\n",
        (unsigned int) element->element_type,
        set);
+  GNUNET_assert (NULL != set);
   if (GNUNET_YES == set->invalid)
   {
     if (NULL != cont)
@@ -772,6 +773,7 @@ GNUNET_SET_destroy (struct GNUNET_SET_Handle *set)
   /* destroying set while iterator is active is currently
      not supported; we should expand the API to allow
      clients to explicitly cancel the iteration! */
+  GNUNET_assert (NULL != set);
   if ( (NULL != set->ops_head) ||
        (NULL != set->iterator) ||
        (GNUNET_SYSERR == set->destroy_requested) )
@@ -1124,11 +1126,12 @@ GNUNET_SET_commit (struct GNUNET_SET_OperationHandle *oh,
 {
   if (NULL != oh->set)
   {
-    /* Some other set was already commited for this
+    /* Some other set was already committed for this
      * operation, there is a logic bug in the client of this API */
     GNUNET_break (0);
     return GNUNET_OK;
   }
+  GNUNET_assert (NULL != set);
   if (GNUNET_YES == set->invalid)
     return GNUNET_SYSERR;
   LOG (GNUNET_ERROR_TYPE_DEBUG,
index f2f96ee091687d8f013945441552898394608543..3ebe20258b72216f97398a20eb7604dd6730625e 100644 (file)
@@ -190,7 +190,8 @@ run (void *cls,
   char *fname;
 
   if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_filename (c, "PATHS",
+      GNUNET_CONFIGURATION_get_value_filename (c,
+                                              "PATHS",
                                               "GNUNET_HOME",
                                               &shome))
   {
@@ -208,6 +209,7 @@ run (void *cls,
     GNUNET_free (fname);
     return;
   }
+  GNUNET_free (fname);
   GNUNET_asprintf (&fname,
                    "%s/blacklist",
                    shome);
index ac72a667c0a29451e7e24797363ff453a7f7b3e9..8d3e47f94216361697f81932ef75d67fd8e9e87d 100644 (file)
@@ -616,6 +616,8 @@ neighbours_changed_notification (const struct GNUNET_PeerIdentity *peer,
                                  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
                                  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
 {
+  (void) bandwidth_in;
+  (void) bandwidth_out;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Notifying about change for peer `%s' with address `%s' in state `%s' timing out at %s\n",
               GNUNET_i2s (peer),
@@ -993,6 +995,10 @@ send_disconnect_cont (void *cls,
 {
   struct NeighbourMapEntry *n;
 
+  (void) cls;
+  (void) result;
+  (void) payload;
+  (void) physical;
   n = lookup_neighbour (target);
   if (NULL == n)
     return; /* already gone */
@@ -1133,8 +1139,10 @@ disconnect_neighbour (struct NeighbourMapEntry *n)
  *
  * @param n neighbour entry to change qutoa for
  * @param quota new quota
+ * @return #GNUNET_YES if @a n is still valid, @GNUNET_NO if
+ *   @a n was freed
  */
-static void
+static int
 set_incoming_quota (struct NeighbourMapEntry *n,
                     struct GNUNET_BANDWIDTH_Value32NBO quota)
 {
@@ -1158,7 +1166,7 @@ set_incoming_quota (struct NeighbourMapEntry *n,
                                 GNUNET_TIME_UNIT_FOREVER_REL,
                                 GNUNET_NO,
                                 NULL, NULL);
-    return;
+    return GNUNET_YES;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Disconnecting peer `%s' due to SET_QUOTA\n",
@@ -1168,6 +1176,7 @@ set_incoming_quota (struct NeighbourMapEntry *n,
                               gettext_noop ("# disconnects due to quota of 0"),
                               1, GNUNET_NO);
   disconnect_neighbour (n);
+  return GNUNET_NO;
 }
 
 
@@ -1196,8 +1205,10 @@ set_primary_address (struct NeighbourMapEntry *n,
     if (n->primary_address.bandwidth_in.value__ != bandwidth_in.value__)
     {
       n->primary_address.bandwidth_in = bandwidth_in;
-      set_incoming_quota (n,
-                          bandwidth_in);
+      if (GNUNET_YES !=
+         set_incoming_quota (n,
+                             bandwidth_in))
+       return;
     }
     if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__)
     {
@@ -1237,8 +1248,10 @@ set_primary_address (struct NeighbourMapEntry *n,
   /* subsystems about address use */
   GST_validation_set_address_use (n->primary_address.address,
                                   GNUNET_YES);
-  set_incoming_quota (n,
-                      bandwidth_in);
+  if (GNUNET_YES !=
+      set_incoming_quota (n,
+                         bandwidth_in))
+    return;
   send_outbound_quota_to_clients (n);
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Neighbour `%s' switched to address `%s'\n",
@@ -1805,6 +1818,9 @@ send_session_syn_cont (void *cls,
 {
   struct NeighbourMapEntry *n;
 
+  (void) cls;
+  (void) size_payload;
+  (void) size_on_wire;
   n = lookup_neighbour (target);
   if (NULL == n)
   {
@@ -1978,6 +1994,9 @@ send_session_syn_ack_cont (void *cls,
 {
   struct NeighbourMapEntry *n;
 
+  (void) cls;
+  (void) size_payload;
+  (void) size_on_wire;
   n = lookup_neighbour (target);
   if (NULL == n)
   {
@@ -2393,8 +2412,10 @@ try_run_fast_ats_update (const struct GNUNET_HELLO_Address *address,
   if (n->primary_address.bandwidth_in.value__ != bandwidth_in.value__)
   {
     n->primary_address.bandwidth_in = bandwidth_in;
-    set_incoming_quota (n,
-                        bandwidth_in);
+    if (GNUNET_YES !=
+       set_incoming_quota (n,
+                           bandwidth_in))
+      return GNUNET_NO;
   }
   if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__)
   {
@@ -2805,6 +2826,7 @@ send_utilization_data (void *cls,
   uint32_t bps_out;
   struct GNUNET_TIME_Relative delta;
 
+  (void) cls;
   if ( (GNUNET_YES != test_connected (n)) ||
        (NULL == n->primary_address.address) )
     return GNUNET_OK;
@@ -2835,11 +2857,12 @@ send_utilization_data (void *cls,
 /**
  * Task transmitting utilization in a regular interval
  *
- * @param cls the 'struct NeighbourMapEntry' for which we are running
+ * @param cls the `struct NeighbourMapEntry` for which we are running
  */
 static void
 utilization_transmission (void *cls)
 {
+  (void) cls;
   util_transmission_tk = NULL;
   GNUNET_CONTAINER_multipeermap_iterate (neighbours,
                                          &send_utilization_data,
@@ -3095,6 +3118,7 @@ GST_neighbours_handle_session_syn_ack (const struct GNUNET_MessageHeader *messag
   struct GNUNET_TIME_Absolute ts;
   struct NeighbourMapEntry *n;
 
+  (void) session;
   if (ntohs (message->size) != sizeof (struct TransportSynMessage))
   {
     GNUNET_break_op (0);
@@ -3368,6 +3392,7 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
 {
   struct NeighbourMapEntry *n;
 
+  (void) session;
   if (ntohs (message->size) != sizeof (struct GNUNET_MessageHeader))
   {
     GNUNET_break_op (0);
@@ -3641,6 +3666,7 @@ neighbours_iterate (void *cls,
   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
 
+  (void) key;
   if (NULL != n->primary_address.address)
   {
     bandwidth_in = n->primary_address.bandwidth_in;
@@ -3733,6 +3759,7 @@ GST_neighbour_get_current_address (const struct GNUNET_PeerIdentity *peer)
 void
 GST_neighbours_start (unsigned int max_fds)
 {
+  (void) max_fds;
   neighbours = GNUNET_CONTAINER_multipeermap_create (NEIGHBOUR_TABLE_SIZE,
                                                      GNUNET_NO);
   util_transmission_tk = GNUNET_SCHEDULER_add_delayed (UTIL_TRANSMISSION_INTERVAL,
@@ -3756,6 +3783,8 @@ disconnect_all_neighbours (void *cls,
 {
   struct NeighbourMapEntry *n = value;
 
+  (void) cls;
+  (void) key;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Disconnecting peer `%4s' during shutdown\n",
               GNUNET_i2s (&n->id));
index a63013caad6e644451869318074b6eeeb0130197..c5d6e6d345389f384b890e882535cc5ab79a48b0 100644 (file)
@@ -3172,8 +3172,6 @@ handle_tcp_welcome (void *cls,
                    sizeof(struct GNUNET_PeerIdentity)))
   {
     /* refuse connections from ourselves */
-    GNUNET_SERVER_receive_done (client,
-                                GNUNET_SYSERR);
     if (GNUNET_OK ==
         GNUNET_SERVER_client_get_address (client,
                                           &vaddr,
@@ -3185,6 +3183,8 @@ handle_tcp_welcome (void *cls,
            GNUNET_a2s (vaddr, alen));
       GNUNET_free (vaddr);
     }
+    GNUNET_SERVER_receive_done (client,
+                                GNUNET_SYSERR);
     return;
   }
 
@@ -3348,7 +3348,7 @@ handle_tcp_data (void *cls,
   if (NULL == session)
   {
     /* No inbound session found */
-    void *vaddr;
+    void *vaddr = NULL;
     size_t alen;
 
     GNUNET_SERVER_client_get_address (client,
@@ -3369,7 +3369,7 @@ handle_tcp_data (void *cls,
   if (GNUNET_YES == session->expecting_welcome)
   {
     /* Session is expecting WELCOME message */
-    void *vaddr;
+    void *vaddr = NULL;
     size_t alen;
 
     GNUNET_SERVER_client_get_address (client,
@@ -3389,7 +3389,7 @@ handle_tcp_data (void *cls,
 
   session->last_activity = GNUNET_TIME_absolute_get ();
   {
-    void *vaddr;
+    void *vaddr = NULL;
     size_t alen;
 
     GNUNET_SERVER_client_get_address (client,
index 1ff962544f2d226122f9cdbe186b4c7f5f3e9e6f..0daac444310d6959418e586812c86d9593546075 100644 (file)
@@ -1631,6 +1631,7 @@ enqueue (struct Plugin *plugin,
   if (GNUNET_YES == session->in_destroy)
   {
     GNUNET_break (0);
+    GNUNET_free (udpw);
     return;
   }
   if (plugin->bytes_in_buffer > INT64_MAX - udpw->msg_size)
@@ -1913,8 +1914,8 @@ enqueue_fragment (void *cls,
   udpw->qc = &qc_fragment_sent;
   udpw->qc_cls = plugin;
   GNUNET_memcpy (udpw->msg_buf,
-          msg,
-          msg_len);
+                msg,
+                msg_len);
   enqueue (plugin,
            udpw);
   if (session->address->address_length == sizeof (struct IPv4UdpAddress))
@@ -3838,9 +3839,9 @@ libgnunet_plugin_transport_udp_init (void *cls)
   unsigned long long port;
   unsigned long long aport;
   unsigned long long udp_max_bps;
-  unsigned long long enable_v6;
-  unsigned long long enable_broadcasting;
-  unsigned long long enable_broadcasting_recv;
+  int enable_v6;
+  int enable_broadcasting;
+  int enable_broadcasting_recv;
   char *bind4_address;
   char *bind6_address;
   struct GNUNET_TIME_Relative interval;
index 5b219a467c1966d14332bfed33b53a625ced0f0b..17157436dc2fe5fcb64a8e7c1e8405157fdb494e 100644 (file)
@@ -1218,8 +1218,10 @@ RETRY:
  * @param timeout maximum amount of time to wait
  * @param receiver function to call with received data
  * @param receiver_cls closure for @a receiver
+ * @return #GNUNET_SYSERR if @a connection died (receiver was
+ *          called with error)
  */
-void
+int
 GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *connection,
                            size_t max,
                            struct GNUNET_TIME_Relative timeout,
@@ -1241,7 +1243,7 @@ GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *connection,
                                      connection->sock,
                                      &receive_ready,
                                      connection);
-    return;
+    return GNUNET_OK;
   }
   if ((NULL == connection->dns_active) &&
       (NULL == connection->ap_head) &&
@@ -1252,8 +1254,9 @@ GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *connection,
              NULL, 0,
              NULL, 0,
              ETIMEDOUT);
-    return;
+    return GNUNET_SYSERR;
   }
+  return GNUNET_OK;
 }
 
 
index d0ce790fcc3f576ab14df80d4e21c6d55f5d0b48..f75b41e8ca2fde4b195c5eae9fd97bef4b5b3a19 100644 (file)
@@ -1044,11 +1044,13 @@ process_mst (struct GNUNET_SERVER_Client *client,
            "Server re-enters receive loop, timeout: %s.\n",
            GNUNET_STRINGS_relative_time_to_string (client->idle_timeout, GNUNET_YES));
       client->receive_pending = GNUNET_YES;
-      GNUNET_CONNECTION_receive (client->connection,
-                                 GNUNET_MAX_MESSAGE_SIZE - 1,
-                                 client->idle_timeout,
-                                 &process_incoming,
-                                 client);
+      if (GNUNET_OK !=
+         GNUNET_CONNECTION_receive (client->connection,
+                                    GNUNET_MAX_MESSAGE_SIZE - 1,
+                                    client->idle_timeout,
+                                    &process_incoming,
+                                    client))
+       return;
       break;
     }
     LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1287,11 +1289,13 @@ GNUNET_SERVER_connect_socket (struct GNUNET_SERVER_Handle *server,
   for (n = server->connect_notify_list_head; NULL != n; n = n->next)
     n->callback (n->callback_cls, client);
   client->receive_pending = GNUNET_YES;
-  GNUNET_CONNECTION_receive (client->connection,
-                             GNUNET_MAX_MESSAGE_SIZE - 1,
-                             client->idle_timeout,
-                             &process_incoming,
-                             client);
+  if (GNUNET_SYSERR ==
+      GNUNET_CONNECTION_receive (client->connection,
+                                GNUNET_MAX_MESSAGE_SIZE - 1,
+                                client->idle_timeout,
+                                &process_incoming,
+                                client))
+    return NULL;
   return client;
 }
 
index 3e71fa47693a615c9920ceabf21370a0a1b7a7ab..ea543019138127f07b16abb294598d96933fbd1b 100644 (file)
@@ -976,20 +976,25 @@ mylog (enum GNUNET_ErrorType kind,
     }
     else
     {
-      strftime (date2,
-                DATE_STR_SIZE,
-                "%b %d %H:%M:%S-%%020llu",
-                tmptr);
-      snprintf (date,
-                sizeof (date),
-                date2,
-               (long long) (pc.QuadPart /
-                            (performance_frequency.QuadPart / 1000)));
+      if (0 ==
+         strftime (date2,
+                   DATE_STR_SIZE,
+                   "%b %d %H:%M:%S-%%020llu",
+                   tmptr))
+       abort ();
+      if (0 >
+         snprintf (date,
+                   sizeof (date),
+                   date2,
+                   (long long) (pc.QuadPart /
+                                (performance_frequency.QuadPart / 1000))))
+       abort ();
     }
 #else
     struct timeval timeofday;
 
-    gettimeofday (&timeofday, NULL);
+    gettimeofday (&timeofday,
+                 NULL);
     offset = GNUNET_TIME_get_offset ();
     if (offset > 0)
     {
@@ -1022,24 +1027,33 @@ mylog (enum GNUNET_ErrorType kind,
     }
     else
     {
-      strftime (date2,
-                DATE_STR_SIZE,
-                "%b %d %H:%M:%S-%%06u",
-                tmptr);
-      snprintf (date,
-                sizeof (date),
-                date2,
-                timeofday.tv_usec);
+      if (0 ==
+         strftime (date2,
+                   DATE_STR_SIZE,
+                   "%b %d %H:%M:%S-%%06u",
+                   tmptr))
+       abort ();
+      if (0 >
+         snprintf (date,
+                   sizeof (date),
+                   date2,
+                   timeofday.tv_usec))
+       abort ();
     }
 #endif
-    VSNPRINTF (buf, size, message, va);
+    VSNPRINTF (buf,
+              size,
+              message,
+              va);
 #if ! (defined(GNUNET_CULL_LOGGING) || TALER_WALLET_ONLY)
     if (NULL != tmptr)
       (void) setup_log_file (tmptr);
 #endif
     if ((0 != (kind & GNUNET_ERROR_TYPE_BULK)) &&
         (0 != last_bulk_time.abs_value_us) &&
-        (0 == strncmp (buf, last_bulk, sizeof (last_bulk))))
+        (0 == strncmp (buf,
+                      last_bulk,
+                      sizeof (last_bulk))))
     {
       last_bulk_repeat++;
       if ( (GNUNET_TIME_absolute_get_duration (last_bulk_time).rel_value_us >
index fb3b9ebf933c5ad60d59608eccff31ea4aeb2f69..5f7d9fc0dacd0a75a610e8e6b28521bd5c2c9fb0 100644 (file)
@@ -72,12 +72,17 @@ static int rewrite;
  * @param value value of the option
  */
 static void
-print_option (void *cls, const char *section,
+print_option (void *cls,
+             const char *section,
              const char *option,
              const char *value)
 {
+  (void) cls;
+  (void) section;
   fprintf (stdout,
-          "%s = %s\n", option, value);
+          "%s = %s\n",
+          option,
+          value);
 }
 
 
@@ -91,7 +96,10 @@ static void
 print_section_name (void *cls,
                     const char *section)
 {
-  fprintf (stdout, "%s\n", section);
+  (void) cls;
+  fprintf (stdout,
+          "%s\n",
+          section);
 }
 
 
@@ -112,6 +120,8 @@ run (void *cls,
   struct GNUNET_CONFIGURATION_Handle *out = NULL;
   struct GNUNET_CONFIGURATION_Handle *diff = NULL;
 
+  (void) cls;
+  (void) args;
   if (rewrite)
   {
     struct GNUNET_CONFIGURATION_Handle *def;
@@ -221,36 +231,37 @@ run (void *cls,
  * @return 0 ok, 1 on error
  */
 int
-main (int argc, char *const *argv)
+main (int argc,
+      char *const *argv)
 {
   struct GNUNET_GETOPT_CommandLineOption options[] = {
     GNUNET_GETOPT_option_flag ('f',
-                                  "filename",
-                                  gettext_noop ("obtain option of value as a filename (with $-expansion)"),
-                                  &is_filename),
+                              "filename",
+                              gettext_noop ("obtain option of value as a filename (with $-expansion)"),
+                              &is_filename),
     GNUNET_GETOPT_option_string ('s',
-                                     "section",
-                                     "SECTION",
-                                     gettext_noop ("name of the section to access"),
-                                     &section),
+                                "section",
+                                "SECTION",
+                                gettext_noop ("name of the section to access"),
+                                &section),
     GNUNET_GETOPT_option_string ('o',
-                                     "option",
-                                     "OPTION",
-                                     gettext_noop ("name of the option to access"),
-                                     &option),
+                                "option",
+                                "OPTION",
+                                gettext_noop ("name of the option to access"),
+                                &option),
     GNUNET_GETOPT_option_string ('V',
-                                     "value",
-                                     "VALUE",
-                                     gettext_noop ("value to set"),
-                                     &value),
+                                "value",
+                                "VALUE",
+                                gettext_noop ("value to set"),
+                                &value),
     GNUNET_GETOPT_option_flag ('S',
-                                  "list-sections",
-                                  gettext_noop ("print available configuration sections"),
-                                  &list_sections),
+                              "list-sections",
+                              gettext_noop ("print available configuration sections"),
+                              &list_sections),
     GNUNET_GETOPT_option_flag ('w',
-                                  "rewrite",
-                                  gettext_noop ("write configuration file that only contains delta to defaults"),
-                                  &rewrite),
+                              "rewrite",
+                              gettext_noop ("write configuration file that only contains delta to defaults"),
+                              &rewrite),
     GNUNET_GETOPT_OPTION_END
   };
   if (GNUNET_OK !=
index 66a4bd3e9122b6dab2f5c07a0b6f2ddef496457d..59a100a8c3aa3b391c95f15a7c8fae34af19088f 100644 (file)
@@ -281,8 +281,10 @@ print_key (const char *filename)
   uint64_t fs;
   unsigned int total_hostkeys;
   unsigned int c;
+  ssize_t sret;
 
-  if (GNUNET_YES != GNUNET_DISK_file_test (filename))
+  if (GNUNET_YES !=
+      GNUNET_DISK_file_test (filename))
   {
     fprintf (stderr,
              _("Hostkeys file `%s' not found\n"),
@@ -291,7 +293,11 @@ print_key (const char *filename)
   }
 
   /* Check hostkey file size, read entire thing into memory */
-  if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES))
+  if (GNUNET_OK !=
+      GNUNET_DISK_file_size (filename,
+                            &fs,
+                            GNUNET_YES,
+                            GNUNET_YES))
     fs = 0;
   if (0 == fs)
   {
@@ -307,15 +313,22 @@ print_key (const char *filename)
              filename);
     return;
   }
-  fd = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ,
-                                         GNUNET_DISK_PERM_NONE);
+  fd = GNUNET_DISK_file_open (filename,
+                             GNUNET_DISK_OPEN_READ,
+                             GNUNET_DISK_PERM_NONE);
   if (NULL == fd)
   {
-    GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", filename);
+    GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+                             "open",
+                             filename);
     return;
   }
   hostkeys_data = GNUNET_malloc (fs);
-  if (fs != GNUNET_DISK_file_read (fd, hostkeys_data, fs))
+  sret = GNUNET_DISK_file_read (fd,
+                               hostkeys_data,
+                               fs);
+  if ( (sret < 0) ||
+       (fs != (size_t) sret) )
   {
     fprintf (stderr,
              _("Could not read hostkey file: %s\n"),
@@ -351,15 +364,21 @@ print_key (const char *filename)
 /**
  * Main function that will be run by the scheduler.
  *
- * @param cls closure
+ * @param cls closure, NULL
  * @param args remaining command-line arguments
  * @param cfgfile name of the configuration file used (for saving, can be NULL!)
  * @param cfg configuration
  */
 static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
+     char *const *args,
+     const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
+  (void) cls;
+  (void) cfgfile;
+  (void) cfg;
+  
   if (print_examples_flag)
   {
     print_examples ();
index 7ffafee322cb3239c3e8576ef6114026d829035f..4954e039838994e7250fb59f96ed628e762c0907 100644 (file)
@@ -46,9 +46,12 @@ static void
 print_hostname (void *cls,
                const char *hostname)
 {
+  (void) cls;
   if (NULL == hostname)
     return;
-  FPRINTF (stdout, "%s\n", hostname);
+  FPRINTF (stdout,
+          "%s\n",
+          hostname);
 }
 
 
@@ -60,11 +63,17 @@ print_hostname (void *cls,
  * @param addrlen length of the address
  */
 static void
-print_sockaddr (void *cls, const struct sockaddr *addr, socklen_t addrlen)
+print_sockaddr (void *cls,
+               const struct sockaddr *addr,
+               socklen_t addrlen)
 {
+  (void) cls;
   if (NULL == addr)
     return;
-  FPRINTF (stdout, "%s\n", GNUNET_a2s (addr, addrlen));
+  FPRINTF (stdout,
+          "%s\n",
+          GNUNET_a2s (addr,
+                      addrlen));
 }
 
 
@@ -77,7 +86,9 @@ print_sockaddr (void *cls, const struct sockaddr *addr, socklen_t addrlen)
  * @param cfg configuration
  */
 static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
+     char *const *args,
+     const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   const struct sockaddr *sa;
@@ -85,11 +96,18 @@ run (void *cls, char *const *args, const char *cfgfile,
   struct sockaddr_in v4;
   struct sockaddr_in6 v6;
 
-  if (args[0] == NULL)
+  (void) cls;
+  (void) cfgfile;
+  (void) cfg;
+  if (NULL == args[0])
     return;
   if (! reverse)
   {
-    GNUNET_RESOLVER_ip_get (args[0], AF_UNSPEC, GET_TIMEOUT, &print_sockaddr, NULL);
+    GNUNET_RESOLVER_ip_get (args[0],
+                           AF_UNSPEC,
+                           GET_TIMEOUT,
+                           &print_sockaddr,
+                           NULL);
     return;
   }
 
index d26bdd212a92577eb00ef8d206991d28325ec829..ccb5923496299468f4b01639b20c2cd434dc27bc 100644 (file)
@@ -582,7 +582,7 @@ get_ip_from_hostname (struct GNUNET_SERVICE_Client *client,
 /**
  * Verify well-formedness of GET-message.
  *
- * @param cls closure
+ * @param cls closure, unused
  * @param get the actual message
  * @return #GNUNET_OK if @a get is well-formed
  */
@@ -594,6 +594,7 @@ check_get (void *cls,
   int direction;
   int af;
 
+  (void) cls;
   size = ntohs (get->header.size) - sizeof (*get);
   direction = ntohl (get->direction);
   if (GNUNET_NO == direction)
@@ -688,7 +689,7 @@ handle_get (void *cls,
 /**
  * Callback called when a client connects to the service.
  *
- * @param cls closure for the service
+ * @param cls closure for the service, unused
  * @param c the new client that connected to the service
  * @param mq the message queue used to send messages to the client
  * @return @a c
@@ -698,6 +699,9 @@ connect_cb (void *cls,
            struct GNUNET_SERVICE_Client *c,
            struct GNUNET_MQ_Handle *mq)
 {
+  (void) cls;
+  (void) mq;
+
   return c;
 }
 
@@ -714,6 +718,8 @@ disconnect_cb (void *cls,
               struct GNUNET_SERVICE_Client *c,
               void *internal_cls)
 {
+  (void) cls;
+  
   GNUNET_assert (c == internal_cls);
 }
 
index cf5ef3e004ba76df83333c9695368b1975a704e0..973878f93cdd943a6f0cba69625f975f0b151d57 100644 (file)
@@ -1326,9 +1326,10 @@ GNUNET_NETWORK_fdset_handle_set (struct GNUNET_NETWORK_FDSet *fds,
 #else
   int fd;
 
-  GNUNET_DISK_internal_file_handle_ (h,
-                                     &fd,
-                                     sizeof (int));
+  GNUNET_assert (GNUNET_OK ==
+                GNUNET_DISK_internal_file_handle_ (h,
+                                                   &fd,
+                                                   sizeof (int)));
   FD_SET (fd,
           &fds->sds);
   fds->nsds = GNUNET_MAX (fd + 1,
@@ -1737,6 +1738,7 @@ GNUNET_NETWORK_test_port_free (int ipproto,
                                   open_port_str,
                                   &hint,
                                   &ret));
+  bind_status = GNUNET_NO;
   for (ai = ret; NULL != ai; ai = ai->ai_next)
   {
     socket = GNUNET_NETWORK_socket_create (ai->ai_family,
index 1226c59662272be443a1a0bf17a21717ec43d4ab..2e35de6819937b4628ce4eed987230633eeaf1f1 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2006-2016 GNUnet e.V.
+     Copyright (C) 2006-2018 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -152,14 +152,21 @@ get_path_from_proc_exe ()
   ssize_t size;
   char *lep;
 
-  GNUNET_snprintf (fn, sizeof (fn), "/proc/%u/exe", getpid ());
-  size = readlink (fn, lnk, sizeof (lnk) - 1);
+  GNUNET_snprintf (fn,
+                  sizeof (fn),
+                  "/proc/%u/exe",
+                  getpid ());
+  size = readlink (fn,
+                  lnk,
+                  sizeof (lnk) - 1);
   if (size <= 0)
   {
-    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "readlink", fn);
+    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR,
+                      "readlink",
+                      fn);
     return NULL;
   }
-  GNUNET_assert (size < sizeof (lnk));
+  GNUNET_assert ( ((size_t) size) < sizeof (lnk));
   lnk[size] = '\0';
   while ((lnk[size] != '/') && (size > 0))
     size--;
@@ -167,12 +174,13 @@ get_path_from_proc_exe ()
                    "/%s/libexec/",
                    current_pd->project_dirname);
   /* test for being in lib/gnunet/libexec/ or lib/MULTIARCH/gnunet/libexec */
-  if ( (size > strlen (lep)) &&
+  if ( (((size_t) size) > strlen (lep)) &&
        (0 == strcmp (lep,
                     &lnk[size - strlen (lep)])) )
     size -= strlen (lep) - 1;
   GNUNET_free (lep);
-  if ((size < 4) || (lnk[size - 4] != '/'))
+  if ( (size < 4) ||
+       (lnk[size - 4] != '/') )
   {
     /* not installed in "/bin/" -- binary path probably useless */
     return NULL;
@@ -903,6 +911,7 @@ GNUNET_OS_check_helper_binary (const char *binary,
   if (check_suid)
   {
 #ifndef MINGW
+    (void) params;
     if ( (0 != (statbuf.st_mode & S_ISUID)) &&
          (0 == statbuf.st_uid) )
     {
index 2c4f7ca098ad85f750a4f44b74340b0e97f6496b..98998b520320af9813a3c6207d6b1af82977ee17 100644 (file)
@@ -154,6 +154,7 @@ GNUNET_OS_install_parent_control_handler (void *cls)
   struct GNUNET_DISK_FileHandle *control_pipe;
   uint64_t pipe_fd;
 
+  (void) cls;
   if (NULL != pch)
   {
     /* already done, we've been called twice... */
index b637dc229c8dadc6dfaac0c4ef5b8486e0432e66..b1c65fbcf45674677445a98dd398ebeabd29bdd4 100644 (file)
@@ -201,7 +201,8 @@ GNUNET_PEER_change_rc (GNUNET_PEER_Id id, int delta)
     return;
   GNUNET_assert (id < size);
   GNUNET_assert (table[id]->rc > 0);
-  GNUNET_assert ((delta >= 0) || (table[id]->rc >= -delta));
+  GNUNET_assert ( (delta >= 0) ||
+                 (table[id]->rc >= (unsigned int) (-delta)) );
   table[id]->rc += delta;
   if (0 == table[id]->rc)
   {
index 23379238778c8b551a95ccdac5526e02359dee97..9e3037b8b0eeb76fc5e072dfea55ab5cba96c43c 100644 (file)
@@ -74,6 +74,7 @@ struct CommandContext
 static void
 shutdown_task (void *cls)
 {
+  (void) cls;
   GNUNET_SPEEDUP_stop_ ();
 }
 
index 84f541ba04accd06d4f726b2c5717958636bf303..bd46b4fbb237bfebb61d4ad9f20b5268811cdcca 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2009-2016 GNUnet e.V.
+     Copyright (C) 2009-2018 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -214,7 +214,8 @@ check_config ()
   for (unsigned int i = 0;
        NULL != loopback[i];
        i++)
-    if (0 == strcasecmp (loopback[i], hostname))
+    if (0 == strcasecmp (loopback[i],
+                        hostname))
     {
       GNUNET_free (hostname);
       return GNUNET_OK;
@@ -285,6 +286,7 @@ GNUNET_RESOLVER_disconnect ()
 static void
 shutdown_task (void *cls)
 {
+  (void) cls;
   s_task = NULL;
   GNUNET_RESOLVER_disconnect ();
   backoff = GNUNET_TIME_UNIT_MILLISECONDS;
@@ -387,10 +389,12 @@ static void
 mq_error_handler (void *cls,
                   enum GNUNET_MQ_Error error)
 {
+  (void) cls;
   GNUNET_MQ_destroy (mq);
   mq = NULL;
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "MQ error, reconnecting\n");
+       "MQ error %d, reconnecting\n",
+       error);
   reconnect ();
 }
 
@@ -449,6 +453,9 @@ static int
 check_response (void *cls,
                 const struct GNUNET_MessageHeader *msg)
 {
+  (void) cls;
+  (void) msg;
+
   /* implemented in #handle_response() for now */
   return GNUNET_OK;
 }
@@ -470,6 +477,7 @@ handle_response (void *cls,
   uint16_t size;
   char *nret;
 
+  (void) cls;
   GNUNET_assert (NULL != rh);
   size = ntohs (msg->size);
   if (size == sizeof (struct GNUNET_MessageHeader))
@@ -743,6 +751,7 @@ reconnect_task (void *cls)
     GNUNET_MQ_handler_end ()
   };
 
+  (void) cls;
   r_task = NULL;
   if (NULL == req_head)
     return;                     /* no work pending */
index 992f8fdffc6ebddc6736b6a998fc8737477b2d5e..2912dd78bfdaa81ef33e859ababe873f57250d75 100644 (file)
@@ -756,8 +756,8 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
     t->fds = fdi;
     if (1 == read_nh_len)
     {
+      GNUNET_assert (NULL != read_nh);
       fdi->fd = *read_nh;
-      GNUNET_assert (NULL != fdi->fd);
       fdi->et = GNUNET_SCHEDULER_ET_IN;
       fdi->sock = GNUNET_NETWORK_get_fd (*read_nh);
       t->read_fd = fdi->sock;
@@ -765,8 +765,8 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
     }
     else if (1 == write_nh_len)
     {
+      GNUNET_assert (NULL != write_nh);
       fdi->fd = *write_nh;
-      GNUNET_assert (NULL != fdi->fd);
       fdi->et = GNUNET_SCHEDULER_ET_OUT;
       fdi->sock = GNUNET_NETWORK_get_fd (*write_nh);
       t->read_fd = -1;
@@ -774,8 +774,8 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
     }
     else if (1 == read_fh_len)
     {
+      GNUNET_assert (NULL != read_fh);
       fdi->fh = *read_fh;
-      GNUNET_assert (NULL != fdi->fh);
       fdi->et = GNUNET_SCHEDULER_ET_IN;
       fdi->sock = (*read_fh)->fd; // FIXME: does not work under WIN32
       t->read_fd = fdi->sock;
@@ -783,8 +783,8 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
     }
     else
     {
+      GNUNET_assert (NULL != write_fh);
       fdi->fh = *write_fh;
-      GNUNET_assert (NULL != fdi->fh);
       fdi->et = GNUNET_SCHEDULER_ET_OUT;
       fdi->sock = (*write_fh)->fd; // FIXME: does not work under WIN32
       t->read_fd = -1;
@@ -847,20 +847,19 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
  * @param et the event type to be set in each FdInfo after calling
  *           @a driver_func on it, or -1 if no updating not desired.
  */
-void driver_add_multiple (struct GNUNET_SCHEDULER_Task *t,
-                          enum GNUNET_SCHEDULER_EventType et)
+static void
+driver_add_multiple (struct GNUNET_SCHEDULER_Task *t)
 {
   struct GNUNET_SCHEDULER_FdInfo *fdi;
   int success = GNUNET_YES;
 
-  for (int i = 0; i != t->fds_len; ++i)
+  for (unsigned int i = 0; i != t->fds_len; ++i)
   {
     fdi = &t->fds[i];
-    success = scheduler_driver->add (scheduler_driver->cls, t, fdi) && success;
-    if (et != -1)
-    {
-      fdi->et = et;
-    }
+    success = scheduler_driver->add (scheduler_driver->cls,
+                                    t,
+                                    fdi) && success;
+    fdi->et = GNUNET_SCHEDULER_ET_NONE; 
   }
   if (GNUNET_YES != success)
   {
@@ -870,12 +869,13 @@ void driver_add_multiple (struct GNUNET_SCHEDULER_Task *t,
 }
 
 
-void
+static void
 shutdown_cb (void *cls)
 {
   char c;
   const struct GNUNET_DISK_FileHandle *pr;
 
+  (void) cls;
   pr = GNUNET_DISK_pipe_handle (shutdown_pipe_handle,
                                 GNUNET_DISK_PIPE_END_READ);
   GNUNET_assert (! GNUNET_DISK_handle_invalid (pr));
@@ -975,6 +975,8 @@ init_backtrace (struct GNUNET_SCHEDULER_Task *t)
       backtrace_symbols (backtrace_array,
        t->num_backtrace_strings);
   dump_backtrace (t);
+#else
+  (void) t;
 #endif
 }
 
@@ -1375,7 +1377,7 @@ add_without_sets (struct GNUNET_TIME_Relative delay,
   GNUNET_CONTAINER_DLL_insert (pending_head,
                                pending_tail,
                                t);
-  driver_add_multiple (t, GNUNET_SCHEDULER_ET_NONE);
+  driver_add_multiple (t);
   max_priority_added = GNUNET_MAX (max_priority_added,
                                    t->priority);
   init_backtrace (t);
@@ -1664,14 +1666,15 @@ extract_handles (struct GNUNET_SCHEDULER_Task *t,
   // in fdset must be handled separately
   const struct GNUNET_NETWORK_Handle **nhandles;
   const struct GNUNET_DISK_FileHandle **fhandles;
-  unsigned int nhandles_len, fhandles_len;
-  int sock;
+  unsigned int nhandles_len;
+  unsigned int fhandles_len;
 
+  (void) t;
   nhandles = NULL;
   fhandles = NULL;
   nhandles_len = 0;
   fhandles_len = 0;
-  for (sock = 0; sock != fdset->nsds; ++sock)
+  for (int sock = 0; sock != fdset->nsds; ++sock)
   {
     if (GNUNET_YES == GNUNET_NETWORK_fdset_test_native (fdset, sock))
     {
@@ -1747,8 +1750,11 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
   const struct GNUNET_DISK_FileHandle **write_fhandles;
   unsigned int read_nhandles_len, write_nhandles_len,
                read_fhandles_len, write_fhandles_len;
+  int no_fdsets = (NULL == rs) && (NULL == ws);
+  int no_socket_descriptors =
+    ((NULL != rs) && (0 == rs->nsds)) && ((NULL != ws) && (0 == ws->nsds));
 
-  if (((NULL == rs) && (NULL == ws)) || ((0 == rs->nsds) && (0 == ws->nsds)))
+  if (no_fdsets || no_socket_descriptors)
     return GNUNET_SCHEDULER_add_delayed_with_priority (delay,
                                                        prio,
                                                        task,
@@ -1816,7 +1822,7 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
   GNUNET_CONTAINER_DLL_insert (pending_head,
                                pending_tail,
                                t);
-  driver_add_multiple (t, GNUNET_SCHEDULER_ET_NONE);
+  driver_add_multiple (t);
   max_priority_added = GNUNET_MAX (max_priority_added,
            t->priority);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1969,7 +1975,7 @@ GNUNET_SCHEDULER_run_from_driver (struct GNUNET_SCHEDULER_Handle *sh)
     // FIXME: do we have to remove FdInfos from fds if they are not ready?
     tc.fds_len = pos->fds_len;
     tc.fds = pos->fds;
-    for (int i = 0; i != pos->fds_len; ++i)
+    for (unsigned int i = 0; i != pos->fds_len; ++i)
     {
       struct GNUNET_SCHEDULER_FdInfo *fdi = &pos->fds[i];
       if (0 != (GNUNET_SCHEDULER_ET_IN & fdi->et))
index b4eb33caacccf03c76058c3dc2f35ce59bfd46bf..1156093f4c4cce6e136e469d1187e2c6dda2c6fb 100644 (file)
@@ -1978,7 +1978,7 @@ do_send (void *cls)
     GNUNET_MQ_impl_send_in_flight (client->mq);
   }
   client->msg_pos += ret;
-  if (left > ret)
+  if (left > (size_t) ret)
   {
     GNUNET_assert (NULL == client->drop_task);
     client->send_task
@@ -2007,6 +2007,7 @@ service_mq_send (struct GNUNET_MQ_Handle *mq,
 {
   struct GNUNET_SERVICE_Client *client = impl_state;
 
+  (void) mq;
   if (NULL != client->drop_task)
     return; /* we're going down right now, do not try to send */
   GNUNET_assert (NULL == client->send_task);
@@ -2036,6 +2037,7 @@ service_mq_cancel (struct GNUNET_MQ_Handle *mq,
 {
   struct GNUNET_SERVICE_Client *client = impl_state;
 
+  (void) mq;
   GNUNET_assert (0 == client->msg_pos);
   client->msg = NULL;
   GNUNET_SCHEDULER_cancel (client->send_task);
index c6a4cf67859bfaeaf9595ee85e41b875e3fa5509..f5e81f16b6420d8b221db6add748f93a42ccd861 100644 (file)
@@ -42,6 +42,7 @@ do_speedup (void *cls)
 {
   static long long current_offset;
 
+  (void) cls;
   speedup_task = NULL;
   current_offset += delta.rel_value_us;
   GNUNET_TIME_set_offset (current_offset);
index f554a9e83194cd2e393f8fcd4506e756370c3171..4cfcd63b38d9eb9c7d4a811cfd20ec956dfd30c7 100644 (file)
@@ -1069,11 +1069,13 @@ GNUNET_STRINGS_string_to_data (const char *enc, size_t enclen,
  *         (if they weren't NULL).
  */
 int
-GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part,
-    const char **path_part)
+GNUNET_STRINGS_parse_uri (const char *path,
+                         char **scheme_part,
+                         const char **path_part)
 {
   size_t len;
-  int i, end;
+  size_t i;
+  int end;
   int pp_state = 0;
   const char *post_scheme_part = NULL;
   len = strlen (path);
@@ -1082,7 +1084,7 @@ GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part,
     switch (pp_state)
     {
     case 0:
-      if (path[i] == ':' && i > 0)
+      if ( (path[i] == ':') && (i > 0) )
       {
         pp_state += 1;
         continue;