aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-25 21:42:11 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-25 21:42:11 +0000
commit78ad97319349e9881653684f276dd620a0a423e9 (patch)
treecded8f0063f6848429706a36bd51174e62417b7e
parentb968c5926b205c3cdd467474753746ef21522b32 (diff)
downloadgnunet-78ad97319349e9881653684f276dd620a0a423e9.tar.gz
gnunet-78ad97319349e9881653684f276dd620a0a423e9.zip
-misc fixes based on cppcheck
-rw-r--r--src/exit/gnunet-helper-exit-windows.c14
-rw-r--r--src/experimentation/gnunet-daemon-experimentation_nodes.c24
-rw-r--r--src/experimentation/gnunet-daemon-experimentation_scheduler.c25
-rw-r--r--src/fs/fs_test_lib.c10
-rw-r--r--src/fs/gnunet-daemon-fsprofiler.c2
-rw-r--r--src/integration-tests/connection_watchdog.c18
-rw-r--r--src/mesh/mesh_api.c20
-rw-r--r--src/mesh/mesh_api_enc.c1
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c24
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c2
-rw-r--r--src/nat/gnunet-helper-nat-client-windows.c23
-rw-r--r--src/nat/gnunet-helper-nat-server-windows.c15
-rw-r--r--src/nse/gnunet-nse-profiler.c45
-rw-r--r--src/regex/gnunet-regex-profiler.c6
-rw-r--r--src/testing/testing.c8
-rw-r--r--src/transport/gnunet-helper-transport-bluetooth.c8
-rw-r--r--src/util/program.c2
-rw-r--r--src/util/strings.c2
-rw-r--r--src/vpn/gnunet-helper-vpn-windows.c20
19 files changed, 132 insertions, 137 deletions
diff --git a/src/exit/gnunet-helper-exit-windows.c b/src/exit/gnunet-helper-exit-windows.c
index eb7c4f435..461494480 100644
--- a/src/exit/gnunet-helper-exit-windows.c
+++ b/src/exit/gnunet-helper-exit-windows.c
@@ -357,7 +357,7 @@ remove_address6 (const char *address)
357 */ 357 */
358 snprintf (command, LINE_LEN, 358 snprintf (command, LINE_LEN,
359 "netsh interface ipv6 delete address \"%s\" store=persistent", 359 "netsh interface ipv6 delete address \"%s\" store=persistent",
360 device_visible_name, address); 360 device_visible_name);
361 /* 361 /*
362 * Set the address 362 * Set the address
363 */ 363 */
@@ -432,7 +432,7 @@ remove_address4 (const char *address)
432 */ 432 */
433 snprintf (command, LINE_LEN, 433 snprintf (command, LINE_LEN,
434 "netsh interface ipv4 delete address \"%s\" gateway=all store=persistent", 434 "netsh interface ipv4 delete address \"%s\" gateway=all store=persistent",
435 device_visible_name, address); 435 device_visible_name);
436 /* 436 /*
437 * Set the address 437 * Set the address
438 */ 438 */
@@ -1450,6 +1450,8 @@ teardown_final:
1450 1450
1451 CloseHandle (tap_handle); 1451 CloseHandle (tap_handle);
1452} 1452}
1453
1454
1453/** 1455/**
1454 * Open VPN tunnel interface. 1456 * Open VPN tunnel interface.
1455 * 1457 *
@@ -1475,14 +1477,18 @@ main (int argc, char **argv)
1475 1477
1476 if ( (1 < argc) && (0 != strcmp (argv[1], "-d"))){ 1478 if ( (1 < argc) && (0 != strcmp (argv[1], "-d"))){
1477 privilege_testing = TRUE; 1479 privilege_testing = TRUE;
1478 fprintf (stderr, "DEBUG: Running binary in privilege testing mode.", argv[0]); 1480 fprintf (stderr,
1481 "%s",
1482 "DEBUG: Running binary in privilege testing mode.");
1479 argv++; 1483 argv++;
1480 argc--; 1484 argc--;
1481 } 1485 }
1482 1486
1483 if (6 != argc) 1487 if (6 != argc)
1484 { 1488 {
1485 fprintf (stderr, "FATAL: must supply 6 arguments\nUsage:\ngnunet-helper-exit [-d] <if name prefix> <uplink-interface name> <address6 or \"-\"> <netbits6> <address4 or \"-\"> <netmask4>\n", argv[0]); 1489 fprintf (stderr,
1490 "%s",
1491 "FATAL: must supply 6 arguments\nUsage:\ngnunet-helper-exit [-d] <if name prefix> <uplink-interface name> <address6 or \"-\"> <netbits6> <address4 or \"-\"> <netmask4>\n");
1486 return 1; 1492 return 1;
1487 } 1493 }
1488 1494
diff --git a/src/experimentation/gnunet-daemon-experimentation_nodes.c b/src/experimentation/gnunet-daemon-experimentation_nodes.c
index a4da92d50..37b0eba45 100644
--- a/src/experimentation/gnunet-daemon-experimentation_nodes.c
+++ b/src/experimentation/gnunet-daemon-experimentation_nodes.c
@@ -260,17 +260,17 @@ remove_request (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
260 * @param buf the buffer to copy to 260 * @param buf the buffer to copy to
261 * @return bytes passed 261 * @return bytes passed
262 */ 262 */
263size_t send_experimentation_request_cb (void *cls, size_t bufsize, void *buf) 263static size_t
264send_experimentation_request_cb (void *cls, size_t bufsize, void *buf)
264{ 265{
265 struct Node *n = cls; 266 struct Node *n = cls;
266 struct Experimentation_Request msg; 267 struct Experimentation_Request msg;
267 size_t msg_size = sizeof (msg); 268 size_t msg_size = sizeof (msg);
268 size_t ri_size = sizeof (struct Experimentation_Issuer) * GSE_my_issuer_count; 269 size_t ri_size = sizeof (struct Experimentation_Issuer) * GSE_my_issuer_count;
269 size_t total_size = msg_size + ri_size; 270 size_t total_size = msg_size + ri_size;
270 271
271 memset (buf, '\0', bufsize); 272 n->cth = NULL;
272 n->cth = NULL; 273 if (NULL == buf)
273 if (buf == NULL)
274 { 274 {
275 /* client disconnected */ 275 /* client disconnected */
276 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client disconnected\n"); 276 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client disconnected\n");
@@ -279,6 +279,7 @@ size_t send_experimentation_request_cb (void *cls, size_t bufsize, void *buf)
279 GNUNET_SCHEDULER_add_now (&remove_request, n); 279 GNUNET_SCHEDULER_add_now (&remove_request, n);
280 return 0; 280 return 0;
281 } 281 }
282 memset (buf, '\0', bufsize);
282 GNUNET_assert (bufsize >= total_size); 283 GNUNET_assert (bufsize >= total_size);
283 284
284 msg.msg.size = htons (total_size); 285 msg.msg.size = htons (total_size);
@@ -299,7 +300,8 @@ size_t send_experimentation_request_cb (void *cls, size_t bufsize, void *buf)
299 * 300 *
300 * @param peer the peer to send to 301 * @param peer the peer to send to
301 */ 302 */
302static void send_experimentation_request (const struct GNUNET_PeerIdentity *peer) 303static void
304send_experimentation_request (const struct GNUNET_PeerIdentity *peer)
303{ 305{
304 struct Node *n; 306 struct Node *n;
305 struct NodeComCtx *e_ctx; 307 struct NodeComCtx *e_ctx;
diff --git a/src/experimentation/gnunet-daemon-experimentation_scheduler.c b/src/experimentation/gnunet-daemon-experimentation_scheduler.c
index 34142fabb..aef97ee48 100644
--- a/src/experimentation/gnunet-daemon-experimentation_scheduler.c
+++ b/src/experimentation/gnunet-daemon-experimentation_scheduler.c
@@ -227,21 +227,20 @@ static void run_experiment_outbound (void *cls,const struct GNUNET_SCHEDULER_Tas
227void 227void
228GED_scheduler_handle_start (struct Node *n, struct Experiment *e) 228GED_scheduler_handle_start (struct Node *n, struct Experiment *e)
229{ 229{
230 struct ScheduledExperiment *se; 230 if ((NULL != find_experiment (waiting_in_head, waiting_in_tail, n, e, GNUNET_NO)) ||
231 231 (NULL != find_experiment (running_in_head, running_in_tail, n, e, GNUNET_NO)))
232 if ((NULL != (se = find_experiment (waiting_in_head, waiting_in_tail, n, e, GNUNET_NO))) || 232 {
233 (NULL != (se = find_experiment (running_in_head, running_in_tail, n, e, GNUNET_NO)))) 233 GNUNET_break_op (0);
234 { 234 return;
235 GNUNET_break_op (0); 235 }
236 return; 236
237 } 237 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
238 238 "Received %s message from peer %s for experiment `%s'\n",
239 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %s message from peer %s for experiment `%s'\n", 239 "START", GNUNET_i2s (&n->id), e->name);
240 "START", GNUNET_i2s (&n->id), e->name); 240 GED_scheduler_add (n, e, GNUNET_NO);
241
242 GED_scheduler_add (n, e, GNUNET_NO);
243} 241}
244 242
243
245/** 244/**
246 * Handle a START_ACK message from a remote node 245 * Handle a START_ACK message from a remote node
247 * 246 *
diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c
index 758220f5f..0fc36e7ac 100644
--- a/src/fs/fs_test_lib.c
+++ b/src/fs/fs_test_lib.c
@@ -217,10 +217,7 @@ publish_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
217 po->publish_timeout_task = GNUNET_SCHEDULER_NO_TASK; 217 po->publish_timeout_task = GNUNET_SCHEDULER_NO_TASK;
218 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 218 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
219 "Timeout while trying to publish data\n"); 219 "Timeout while trying to publish data\n");
220 if (NULL == po->fs) 220 GNUNET_TESTBED_operation_done (po->fs_op);
221 GNUNET_TESTBED_operation_done (po->fs_op);
222 else
223 GNUNET_TESTBED_operation_done (po->fs_op);
224 GNUNET_FS_publish_stop (po->publish_context); 221 GNUNET_FS_publish_stop (po->publish_context);
225 po->publish_cont (po->publish_cont_cls, NULL, NULL); 222 po->publish_cont (po->publish_cont_cls, NULL, NULL);
226 (void) GNUNET_DISK_directory_remove (po->publish_tmp_file); 223 (void) GNUNET_DISK_directory_remove (po->publish_tmp_file);
@@ -492,10 +489,7 @@ download_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
492 GNUNET_SCHEDULER_add_continuation (dop->download_cont, 489 GNUNET_SCHEDULER_add_continuation (dop->download_cont,
493 dop->download_cont_cls, 490 dop->download_cont_cls,
494 GNUNET_SCHEDULER_REASON_TIMEOUT); 491 GNUNET_SCHEDULER_REASON_TIMEOUT);
495 if (NULL == dop->fs) 492 GNUNET_TESTBED_operation_done (dop->fs_op);
496 GNUNET_TESTBED_operation_done (dop->fs_op);
497 else
498 GNUNET_TESTBED_operation_done (dop->fs_op);
499 GNUNET_FS_uri_destroy (dop->uri); 493 GNUNET_FS_uri_destroy (dop->uri);
500 GNUNET_free (dop); 494 GNUNET_free (dop);
501} 495}
diff --git a/src/fs/gnunet-daemon-fsprofiler.c b/src/fs/gnunet-daemon-fsprofiler.c
index 30a127559..a19fa1ef6 100644
--- a/src/fs/gnunet-daemon-fsprofiler.c
+++ b/src/fs/gnunet-daemon-fsprofiler.c
@@ -186,7 +186,7 @@ parse_pattern (struct Pattern **head,
186 "(%llu,%llu,%llu)", 186 "(%llu,%llu,%llu)",
187 &x, &y, &t)) 187 &x, &y, &t))
188 { 188 {
189 p = GNUNET_malloc (sizeof (struct Pattern)); 189 p = GNUNET_new (struct Pattern);
190 p->x = x; 190 p->x = x;
191 p->y = y; 191 p->y = y;
192 p->delay.rel_value_us = (uint64_t) t; 192 p->delay.rel_value_us = (uint64_t) t;
diff --git a/src/integration-tests/connection_watchdog.c b/src/integration-tests/connection_watchdog.c
index e519f0f82..73c86d8e4 100644
--- a/src/integration-tests/connection_watchdog.c
+++ b/src/integration-tests/connection_watchdog.c
@@ -205,17 +205,18 @@ stats_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
205static int 205static int
206check_lowlevel_connections (int port, int protocol) 206check_lowlevel_connections (int port, int protocol)
207{ 207{
208#ifdef MINGW
209 /* not supported */
210 return count;
211#else
208 FILE *f; 212 FILE *f;
209 char * cmdline; 213 char * cmdline;
210 char * proto; 214 char * proto;
211 char line[1024]; 215 char line[1024];
212 int count = -1; 216 int count = -1;
213#ifdef MINGW
214 /* not supported */
215 return count;
216#else
217 217
218 switch (protocol) { 218 switch (protocol)
219 {
219 case tcp: 220 case tcp:
220 proto = "-t"; 221 proto = "-t";
221 break; 222 break;
@@ -252,11 +253,12 @@ check_lowlevel_connections (int port, int protocol)
252 { 253 {
253 /* read */ 254 /* read */
254 //printf ("%s", line); 255 //printf ("%s", line);
255 count ++; 256 count++;
256 } 257 }
257 258
258 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%i TCP connections established with port %u\n", 259 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
259 count, port); 260 "%i TCP connections established with port %u\n",
261 count, port);
260 262
261 pclose (f); 263 pclose (f);
262 GNUNET_free (cmdline); 264 GNUNET_free (cmdline);
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c
index ade5a4111..135e1e869 100644
--- a/src/mesh/mesh_api.c
+++ b/src/mesh/mesh_api.c
@@ -229,9 +229,9 @@ struct GNUNET_MESH_Handle
229 */ 229 */
230struct GNUNET_MESH_Peer 230struct GNUNET_MESH_Peer
231{ 231{
232 /** 232 /**
233 * ID of the peer in short form 233 * ID of the peer in short form
234 */ 234 */
235 GNUNET_PEER_Id id; 235 GNUNET_PEER_Id id;
236 236
237 /** 237 /**
@@ -241,6 +241,7 @@ struct GNUNET_MESH_Peer
241 241
242 /** 242 /**
243 * Flag indicating whether service has informed about its connection 243 * Flag indicating whether service has informed about its connection
244 * FIXME-BART: is this flag used? Seems dead right now...
244 */ 245 */
245 int connected; 246 int connected;
246 247
@@ -478,13 +479,14 @@ destroy_tunnel (struct GNUNET_MESH_Tunnel *t, int call_cleaner)
478 struct GNUNET_MESH_TransmitHandle *th; 479 struct GNUNET_MESH_TransmitHandle *th;
479 struct GNUNET_MESH_TransmitHandle *next; 480 struct GNUNET_MESH_TransmitHandle *next;
480 481
481 LOG (GNUNET_ERROR_TYPE_DEBUG, "destroy_tunnel %X\n", t->tid);
482
483 if (NULL == t) 482 if (NULL == t)
484 { 483 {
485 GNUNET_break (0); 484 GNUNET_break (0);
486 return; 485 return;
487 } 486 }
487 LOG (GNUNET_ERROR_TYPE_DEBUG,
488 "destroy_tunnel %X\n",
489 t->tid);
488 h = t->mesh; 490 h = t->mesh;
489 491
490 GNUNET_CONTAINER_DLL_remove (h->tunnels_head, h->tunnels_tail, t); 492 GNUNET_CONTAINER_DLL_remove (h->tunnels_head, h->tunnels_tail, t);
@@ -904,15 +906,17 @@ process_incoming_data (struct GNUNET_MESH_Handle *h,
904 906
905 t = retrieve_tunnel (h, ntohl (dmsg->tid)); 907 t = retrieve_tunnel (h, ntohl (dmsg->tid));
906 payload = (struct GNUNET_MessageHeader *) &dmsg[1]; 908 payload = (struct GNUNET_MessageHeader *) &dmsg[1];
907 LOG (GNUNET_ERROR_TYPE_DEBUG, " %s data on tunnel %s [%X]\n",
908 t->tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV ? "fwd" : "bck",
909 GNUNET_i2s (GNUNET_PEER_resolve2(t->peer)), ntohl (dmsg->tid));
910 if (NULL == t) 909 if (NULL == t)
911 { 910 {
912 /* Tunnel was ignored/destroyed, probably service didn't get it yet */ 911 /* Tunnel was ignored/destroyed, probably service didn't get it yet */
913 LOG (GNUNET_ERROR_TYPE_DEBUG, " ignored!\n"); 912 LOG (GNUNET_ERROR_TYPE_DEBUG, " ignored!\n");
914 return; 913 return;
915 } 914 }
915 LOG (GNUNET_ERROR_TYPE_DEBUG,
916 " %s data on tunnel %s [%X]\n",
917 t->tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV ? "fwd" : "bck",
918 GNUNET_i2s (GNUNET_PEER_resolve2(t->peer)),
919 ntohl (dmsg->tid));
916 type = ntohs (payload->type); 920 type = ntohs (payload->type);
917 LOG (GNUNET_ERROR_TYPE_DEBUG, " payload type %u\n", type); 921 LOG (GNUNET_ERROR_TYPE_DEBUG, " payload type %u\n", type);
918 for (i = 0; i < h->n_handlers; i++) 922 for (i = 0; i < h->n_handlers; i++)
diff --git a/src/mesh/mesh_api_enc.c b/src/mesh/mesh_api_enc.c
index da972c72a..38c82244c 100644
--- a/src/mesh/mesh_api_enc.c
+++ b/src/mesh/mesh_api_enc.c
@@ -226,6 +226,7 @@ struct GNUNET_MESH_Peer
226 226
227 /** 227 /**
228 * Flag indicating whether service has informed about its connection 228 * Flag indicating whether service has informed about its connection
229 * FIXME-BART: is this flag used? Seems dead right now...
229 */ 230 */
230 int connected; 231 int connected;
231 232
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c
index ae79fe09c..dbe701fd8 100644
--- a/src/namestore/test_namestore_api_zone_iteration.c
+++ b/src/namestore/test_namestore_api_zone_iteration.c
@@ -354,26 +354,26 @@ empty_zone_proc (void *cls,
354 char *hostkey_file; 354 char *hostkey_file;
355 355
356 GNUNET_assert (nsh == cls); 356 GNUNET_assert (nsh == cls);
357 if (NULL != zone) 357 if (NULL != zone)
358 { 358 {
359 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 359 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
360 _("Expected empty zone but received zone private key\n")); 360 _("Expected empty zone but received zone private key\n"));
361 GNUNET_break (0); 361 GNUNET_break (0);
362 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) 362 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
363 GNUNET_SCHEDULER_cancel (endbadly_task); 363 GNUNET_SCHEDULER_cancel (endbadly_task);
364 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); 364 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
365 return; 365 return;
366 } 366 }
367 if ((NULL != label) || (NULL != rd) || (0 != rd)) 367 if ((NULL != label) || (NULL != rd) || (0 != rd_count))
368 { 368 {
369 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 369 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
370 _("Expected no zone content but received data\n")); 370 _("Expected no zone content but received data\n"));
371 GNUNET_break (0); 371 GNUNET_break (0);
372 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) 372 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
373 GNUNET_SCHEDULER_cancel (endbadly_task); 373 GNUNET_SCHEDULER_cancel (endbadly_task);
374 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); 374 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
375 return; 375 return;
376 } 376 }
377 377
378 378
379 zi = NULL; 379 zi = NULL;
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
index 299a8bbd8..2b96d501e 100644
--- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
+++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
@@ -342,7 +342,7 @@ empty_zone_proc (void *cls,
342 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); 342 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
343 return; 343 return;
344 } 344 }
345 if ((NULL != label) || (NULL != rd) || (0 != rd)) 345 if ((NULL != label) || (NULL != rd) || (0 != rd_count))
346 { 346 {
347 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 347 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
348 _("Expected no zone content but received data\n")); 348 _("Expected no zone content but received data\n"));
diff --git a/src/nat/gnunet-helper-nat-client-windows.c b/src/nat/gnunet-helper-nat-client-windows.c
index b28b28584..9121e7943 100644
--- a/src/nat/gnunet-helper-nat-client-windows.c
+++ b/src/nat/gnunet-helper-nat-client-windows.c
@@ -471,7 +471,9 @@ main (int argc, char *const *argv)
471 471
472 if (argc > 1 && 0 != strcmp (argv[1], "-d")){ 472 if (argc > 1 && 0 != strcmp (argv[1], "-d")){
473 privilege_testing = TRUE; 473 privilege_testing = TRUE;
474 fprintf (stderr, "DEBUG: Running binary in privilege testing mode.", argv[0]); 474 fprintf (stderr,
475 "%s",
476 "DEBUG: Running binary in privilege testing mode.");
475 argv++; 477 argv++;
476 argc--; 478 argc--;
477 } 479 }
@@ -479,30 +481,39 @@ main (int argc, char *const *argv)
479 if (argc != 4) 481 if (argc != 4)
480 { 482 {
481 fprintf (stderr, 483 fprintf (stderr,
482 "This program must be started with our IP, the targets external IP, and our port as arguments.\n"); 484 "%s",
485 "This program must be started with our IP, the targets external IP, and our port as arguments.\n");
483 return 1; 486 return 1;
484 } 487 }
485 if ((1 != inet_pton (AF_INET, argv[1], &external)) || 488 if ((1 != inet_pton (AF_INET, argv[1], &external)) ||
486 (1 != inet_pton (AF_INET, argv[2], &target))) 489 (1 != inet_pton (AF_INET, argv[2], &target)))
487 { 490 {
488 fprintf (stderr, "Error parsing IPv4 address: %s\n", strerror (errno)); 491 fprintf (stderr,
492 "Error parsing IPv4 address: %s\n",
493 strerror (errno));
489 return 1; 494 return 1;
490 } 495 }
491 if ((1 != sscanf (argv[3], "%u", &p)) || (0 == p) || (0xFFFF < p)) 496 if ((1 != sscanf (argv[3], "%u", &p)) || (0 == p) || (0xFFFF < p))
492 { 497 {
493 fprintf (stderr, "Error parsing port value `%s'\n", argv[3]); 498 fprintf (stderr,
499 "Error parsing port value `%s'\n",
500 argv[3]);
494 return 1; 501 return 1;
495 } 502 }
496 port = (uint16_t) p; 503 port = (uint16_t) p;
497 504
498 if (0 != WSAStartup (MAKEWORD (2, 1), &wsaData)) 505 if (0 != WSAStartup (MAKEWORD (2, 1), &wsaData))
499 { 506 {
500 fprintf (stderr, "Failed to find Winsock 2.1 or better.\n"); 507 fprintf (stderr,
508 "%s",
509 "Failed to find Winsock 2.1 or better.\n");
501 return 2; 510 return 2;
502 } 511 }
503 if (1 != inet_pton (AF_INET, DUMMY_IP, &dummy)) 512 if (1 != inet_pton (AF_INET, DUMMY_IP, &dummy))
504 { 513 {
505 fprintf (stderr, "Internal error converting dummy IP to binary.\n"); 514 fprintf (stderr,
515 "%s",
516 "Internal error converting dummy IP to binary.\n");
506 return 2; 517 return 2;
507 } 518 }
508 if (-1 == (rawsock = make_raw_socket ())) 519 if (-1 == (rawsock = make_raw_socket ()))
diff --git a/src/nat/gnunet-helper-nat-server-windows.c b/src/nat/gnunet-helper-nat-server-windows.c
index fb564a188..7962e3071 100644
--- a/src/nat/gnunet-helper-nat-server-windows.c
+++ b/src/nat/gnunet-helper-nat-server-windows.c
@@ -533,12 +533,15 @@ main (int argc, char *const *argv)
533 WSADATA wsaData; 533 WSADATA wsaData;
534 unsigned int alt = 0; 534 unsigned int alt = 0;
535 535
536 if (argc > 1 && 0 != strcmp (argv[1], "-d")){ 536 if ( (argc > 1) && (0 != strcmp (argv[1], "-d")))
537 privilege_testing = TRUE; 537 {
538 fprintf (stderr, "DEBUG: Running binary in privilege testing mode.", argv[0]); 538 privilege_testing = TRUE;
539 argv++; 539 fprintf (stderr,
540 argc--; 540 "%s",
541 } 541 "DEBUG: Running binary in privilege testing mode.");
542 argv++;
543 argc--;
544 }
542 545
543 if (2 != argc) 546 if (2 != argc)
544 { 547 {
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c
index e03da6d6e..fa0b97440 100644
--- a/src/nse/gnunet-nse-profiler.c
+++ b/src/nse/gnunet-nse-profiler.c
@@ -84,39 +84,6 @@ struct NSEPeer
84 84
85 85
86/** 86/**
87 * Context for the stats task?
88 */
89struct StatsContext
90{
91
92 /**
93 * How many messages have peers received during the test.
94 */
95 unsigned long long total_nse_received_messages;
96
97 /**
98 * How many messages have peers send during the test (should be == received).
99 */
100 unsigned long long total_nse_transmitted_messages;
101
102 /**
103 * How many messages have travelled an edge in both directions.
104 */
105 unsigned long long total_nse_cross;
106
107 /**
108 * How many extra messages per edge (corrections) have been received.
109 */
110 unsigned long long total_nse_extra;
111
112 /**
113 * How many messages have been discarded.
114 */
115 unsigned long long total_discarded;
116};
117
118
119/**
120 * Operation map entry 87 * Operation map entry
121 */ 88 */
122struct OpListEntry 89struct OpListEntry
@@ -413,16 +380,18 @@ nse_disconnect_adapter (void *cls,
413/** 380/**
414 * Callback function to process statistic values. 381 * Callback function to process statistic values.
415 * 382 *
416 * @param cls struct StatsContext 383 * @param cls `struct NSEPeer`
417 * @param subsystem name of subsystem that created the statistic 384 * @param subsystem name of subsystem that created the statistic
418 * @param name the name of the datum 385 * @param name the name of the datum
419 * @param value the current value 386 * @param value the current value
420 * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not 387 * @param is_persistent #GNUNET_YES if the value is persistent, #GNUNET_NO if not
421 * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration 388 * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
422 */ 389 */
423static int 390static int
424stat_iterator (void *cls, const char *subsystem, const char *name, 391stat_iterator (void *cls,
425 uint64_t value, int is_persistent) 392 const char *subsystem,
393 const char *name,
394 uint64_t value, int is_persistent)
426{ 395{
427 char *output_buffer; 396 char *output_buffer;
428 struct GNUNET_TIME_Absolute now; 397 struct GNUNET_TIME_Absolute now;
diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c
index dffa64d7a..343019347 100644
--- a/src/regex/gnunet-regex-profiler.c
+++ b/src/regex/gnunet-regex-profiler.c
@@ -1328,7 +1328,7 @@ run (void *cls, char *const *args, const char *cfgfile,
1328 shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); 1328 shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
1329 return; 1329 return;
1330 } 1330 }
1331 if (-1 == (num_peers = GNUNET_DISK_directory_scan (policy_dir, NULL, NULL))) 1331 if (0 >= (int) (num_peers = GNUNET_DISK_directory_scan (policy_dir, NULL, NULL)))
1332 { 1332 {
1333 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1333 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1334 _("No files found in `%s'\n"), 1334 _("No files found in `%s'\n"),
@@ -1357,7 +1357,7 @@ run (void *cls, char *const *args, const char *cfgfile,
1357 shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); 1357 shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
1358 return; 1358 return;
1359 } 1359 }
1360 if (0 >= num_peers || NULL == search_strings) 1360 if ( (0 == num_peers) || (NULL == search_strings))
1361 { 1361 {
1362 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1362 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1363 _("Error loading search strings. Exiting.\n")); 1363 _("Error loading search strings. Exiting.\n"));
@@ -1388,9 +1388,7 @@ run (void *cls, char *const *args, const char *cfgfile,
1388 /* Initialize peers */ 1388 /* Initialize peers */
1389 peers = GNUNET_malloc (sizeof (struct RegexPeer) * num_peers); 1389 peers = GNUNET_malloc (sizeof (struct RegexPeer) * num_peers);
1390 for (i = 0; i < num_peers; i++) 1390 for (i = 0; i < num_peers; i++)
1391 {
1392 peers[i].id = i; 1391 peers[i].id = i;
1393 }
1394 1392
1395 GNUNET_CONFIGURATION_set_value_number (cfg, 1393 GNUNET_CONFIGURATION_set_value_number (cfg,
1396 "TESTBED", "OVERLAY_RANDOM_LINKS", 1394 "TESTBED", "OVERLAY_RANDOM_LINKS",
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 8f32d2409..8502809f3 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -687,7 +687,7 @@ GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system,
687 * GNUnet source code. 687 * GNUnet source code.
688 * 688 *
689 * This is primarily a helper function used internally 689 * This is primarily a helper function used internally
690 * by 'GNUNET_TESTING_peer_configure'. 690 * by #GNUNET_TESTING_peer_configure.
691 * 691 *
692 * @param system the testing system handle 692 * @param system the testing system handle
693 * @param key_number desired pre-created hostkey to obtain 693 * @param key_number desired pre-created hostkey to obtain
@@ -716,12 +716,6 @@ GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
716 system->hostkeys_data + 716 system->hostkeys_data +
717 (key_number * GNUNET_TESTING_HOSTKEYFILESIZE), 717 (key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
718 GNUNET_TESTING_HOSTKEYFILESIZE); 718 GNUNET_TESTING_HOSTKEYFILESIZE);
719 if (NULL == private_key)
720 {
721 LOG (GNUNET_ERROR_TYPE_ERROR,
722 _("Error while decoding key %u\n"), key_number);
723 return NULL;
724 }
725 GNUNET_CRYPTO_ecc_key_get_public_for_signature (private_key, &public_key); 719 GNUNET_CRYPTO_ecc_key_get_public_for_signature (private_key, &public_key);
726 GNUNET_CRYPTO_hash (&public_key, 720 GNUNET_CRYPTO_hash (&public_key,
727 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), 721 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
diff --git a/src/transport/gnunet-helper-transport-bluetooth.c b/src/transport/gnunet-helper-transport-bluetooth.c
index d46b818a6..43eccf0aa 100644
--- a/src/transport/gnunet-helper-transport-bluetooth.c
+++ b/src/transport/gnunet-helper-transport-bluetooth.c
@@ -1960,8 +1960,10 @@ main (int argc, char *argv[])
1960 read (i, readbuf, sizeof (readbuf)); 1960 read (i, readbuf, sizeof (readbuf));
1961 if (0 > ret) 1961 if (0 > ret)
1962 { 1962 {
1963 fprintf (stderr, "Read error from STDIN: %s\n", strerror (errno)); 1963 fprintf (stderr,
1964 break; break; 1964 "Read error from STDIN: %s\n",
1965 strerror (errno));
1966 break;
1965 } 1967 }
1966 if (0 == ret) 1968 if (0 == ret)
1967 { 1969 {
@@ -2443,4 +2445,4 @@ main (int argc, char *argv[])
2443 WSACleanup(); 2445 WSACleanup();
2444 #endif 2446 #endif
2445 return 1; /* we never exit 'normally' */ 2447 return 1; /* we never exit 'normally' */
2446} \ No newline at end of file 2448}
diff --git a/src/util/program.c b/src/util/program.c
index 9d2e0a40d..16a2f5086 100644
--- a/src/util/program.c
+++ b/src/util/program.c
@@ -146,7 +146,9 @@ GNUNET_PROGRAM_run2 (int argc, char *const *argv, const char *binaryName,
146 int run_without_scheduler) 146 int run_without_scheduler)
147{ 147{
148 struct CommandContext cc; 148 struct CommandContext cc;
149#if ENABLE_NLS
149 char *path; 150 char *path;
151#endif
150 char *loglev; 152 char *loglev;
151 char *logfile; 153 char *logfile;
152 int ret; 154 int ret;
diff --git a/src/util/strings.c b/src/util/strings.c
index da02a9c4f..6380ea5ec 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -1275,7 +1275,7 @@ GNUNET_STRINGS_get_utf8_args (int argc, char *const *argv, int *u8argc, char *co
1275 size_t strl; 1275 size_t strl;
1276 /* Hopefully it will allocate us NUL-terminated strings... */ 1276 /* Hopefully it will allocate us NUL-terminated strings... */
1277 split_u8argv[i] = (char *) u16_to_u8 (wargv[i], wcslen (wargv[i]) + 1, NULL, &strl); 1277 split_u8argv[i] = (char *) u16_to_u8 (wargv[i], wcslen (wargv[i]) + 1, NULL, &strl);
1278 if (split_u8argv == NULL) 1278 if (NULL == split_u8argv[i])
1279 { 1279 {
1280 int j; 1280 int j;
1281 for (j = 0; j < i; j++) 1281 for (j = 0; j < i; j++)
diff --git a/src/vpn/gnunet-helper-vpn-windows.c b/src/vpn/gnunet-helper-vpn-windows.c
index 0d31ee399..15dc5a667 100644
--- a/src/vpn/gnunet-helper-vpn-windows.c
+++ b/src/vpn/gnunet-helper-vpn-windows.c
@@ -357,7 +357,7 @@ remove_address6 (const char *address)
357 */ 357 */
358 snprintf (command, LINE_LEN, 358 snprintf (command, LINE_LEN,
359 "netsh interface ipv6 delete address \"%s\" store=persistent", 359 "netsh interface ipv6 delete address \"%s\" store=persistent",
360 device_visible_name, address); 360 device_visible_name);
361 /* 361 /*
362 * Set the address 362 * Set the address
363 */ 363 */
@@ -365,7 +365,9 @@ remove_address6 (const char *address)
365 365
366 /* Did it work?*/ 366 /* Did it work?*/
367 if (0 != ret) 367 if (0 != ret)
368 fprintf (stderr, "FATAL: removing IPv6 address failed: %s\n", strerror (ret)); 368 fprintf (stderr,
369 "FATAL: removing IPv6 address failed: %s\n",
370 strerror (ret));
369} 371}
370 372
371 373
@@ -408,7 +410,9 @@ set_address4 (const char *address, const char *mask)
408 410
409 /* Did it work?*/ 411 /* Did it work?*/
410 if (0 != ret) 412 if (0 != ret)
411 fprintf (stderr, "FATAL: Setting IPv4 address failed: %s\n", strerror (ret)); 413 fprintf (stderr,
414 "FATAL: Setting IPv4 address failed: %s\n",
415 strerror (ret));
412 return ret; 416 return ret;
413} 417}
414 418
@@ -431,7 +435,7 @@ remove_address4 (const char *address)
431 */ 435 */
432 snprintf (command, LINE_LEN, 436 snprintf (command, LINE_LEN,
433 "netsh interface ipv4 delete address \"%s\" gateway=all store=persistent", 437 "netsh interface ipv4 delete address \"%s\" gateway=all store=persistent",
434 device_visible_name, address); 438 device_visible_name);
435 /* 439 /*
436 * Set the address 440 * Set the address
437 */ 441 */
@@ -1471,14 +1475,18 @@ main (int argc, char **argv)
1471 1475
1472 if (argc > 1 && 0 != strcmp (argv[1], "-d")){ 1476 if (argc > 1 && 0 != strcmp (argv[1], "-d")){
1473 privilege_testing = TRUE; 1477 privilege_testing = TRUE;
1474 fprintf (stderr, "DEBUG: Running binary in privilege testing mode.", argv[0]); 1478 fprintf (stderr,
1479 "%s",
1480 "DEBUG: Running binary in privilege testing mode.");
1475 argv++; 1481 argv++;
1476 argc--; 1482 argc--;
1477 } 1483 }
1478 1484
1479 if (6 != argc) 1485 if (6 != argc)
1480 { 1486 {
1481 fprintf (stderr, "FATAL: must supply 5 arguments\nUsage:\ngnunet-helper-vpn [-d] <if name prefix> <address6 or \"-\"> <netbits6> <address4 or \"-\"> <netmask4>\n", argv[0]); 1487 fprintf (stderr,
1488 "%s",
1489 "FATAL: must supply 5 arguments\nUsage:\ngnunet-helper-vpn [-d] <if name prefix> <address6 or \"-\"> <netbits6> <address4 or \"-\"> <netmask4>\n");
1482 return 1; 1490 return 1;
1483 } 1491 }
1484 1492