diff options
author | ng0 <ng0@n0.is> | 2018-01-04 23:23:53 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2018-01-04 23:23:53 +0000 |
commit | df31a65d963dcd50da8fef9213e5af9d54c344ff (patch) | |
tree | ee98712984c853d59e7c2f6e723ce36f61ccbd8e /src/util | |
parent | 808aaae0cc2ed4f41ab21563c33759f563bcd5cc (diff) | |
parent | 646c4e4b4a5ebbdc1208e0608e397f5653768329 (diff) | |
download | gnunet-df31a65d963dcd50da8fef9213e5af9d54c344ff.tar.gz gnunet-df31a65d963dcd50da8fef9213e5af9d54c344ff.zip |
Merge branch 'master' of gnunet.org:gnunet
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/disk.c | 27 | ||||
-rw-r--r-- | src/util/getopt_helpers.c | 79 | ||||
-rw-r--r-- | src/util/gnunet-config.c | 61 | ||||
-rw-r--r-- | src/util/gnunet-ecc.c | 35 | ||||
-rw-r--r-- | src/util/gnunet-resolver.c | 30 | ||||
-rw-r--r-- | src/util/gnunet-service-resolver.c | 10 | ||||
-rw-r--r-- | src/util/network.c | 7 | ||||
-rw-r--r-- | src/util/os_installation.c | 23 | ||||
-rw-r--r-- | src/util/os_priority.c | 1 | ||||
-rw-r--r-- | src/util/peer.c | 3 | ||||
-rw-r--r-- | src/util/program.c | 1 | ||||
-rw-r--r-- | src/util/resolver_api.c | 15 | ||||
-rw-r--r-- | src/util/scheduler.c | 47 | ||||
-rw-r--r-- | src/util/service.c | 4 | ||||
-rw-r--r-- | src/util/speedup.c | 1 | ||||
-rw-r--r-- | src/util/strings.c | 10 |
16 files changed, 237 insertions, 117 deletions
diff --git a/src/util/disk.c b/src/util/disk.c index d536ec897..8fd689070 100644 --- a/src/util/disk.c +++ b/src/util/disk.c | |||
@@ -1324,6 +1324,7 @@ static int | |||
1324 | remove_helper (void *unused, | 1324 | remove_helper (void *unused, |
1325 | const char *fn) | 1325 | const char *fn) |
1326 | { | 1326 | { |
1327 | (void) unused; | ||
1327 | (void) GNUNET_DISK_directory_remove (fn); | 1328 | (void) GNUNET_DISK_directory_remove (fn); |
1328 | return GNUNET_OK; | 1329 | return GNUNET_OK; |
1329 | } | 1330 | } |
@@ -1396,6 +1397,7 @@ GNUNET_DISK_file_copy (const char *src, | |||
1396 | uint64_t pos; | 1397 | uint64_t pos; |
1397 | uint64_t size; | 1398 | uint64_t size; |
1398 | size_t len; | 1399 | size_t len; |
1400 | ssize_t sret; | ||
1399 | struct GNUNET_DISK_FileHandle *in; | 1401 | struct GNUNET_DISK_FileHandle *in; |
1400 | struct GNUNET_DISK_FileHandle *out; | 1402 | struct GNUNET_DISK_FileHandle *out; |
1401 | 1403 | ||
@@ -1425,9 +1427,17 @@ GNUNET_DISK_file_copy (const char *src, | |||
1425 | len = COPY_BLK_SIZE; | 1427 | len = COPY_BLK_SIZE; |
1426 | if (len > size - pos) | 1428 | if (len > size - pos) |
1427 | len = size - pos; | 1429 | len = size - pos; |
1428 | if (len != GNUNET_DISK_file_read (in, buf, len)) | 1430 | sret = GNUNET_DISK_file_read (in, |
1431 | buf, | ||
1432 | len); | ||
1433 | if ( (sret < 0) || | ||
1434 | (len != (size_t) sret) ) | ||
1429 | goto FAIL; | 1435 | goto FAIL; |
1430 | if (len != GNUNET_DISK_file_write (out, buf, len)) | 1436 | sret = GNUNET_DISK_file_write (out, |
1437 | buf, | ||
1438 | len); | ||
1439 | if ( (sret < 0) || | ||
1440 | (len != (size_t) sret) ) | ||
1431 | goto FAIL; | 1441 | goto FAIL; |
1432 | pos += len; | 1442 | pos += len; |
1433 | } | 1443 | } |
@@ -1457,7 +1467,8 @@ GNUNET_DISK_filename_canonicalize (char *fn) | |||
1457 | { | 1467 | { |
1458 | c = *idx; | 1468 | c = *idx; |
1459 | 1469 | ||
1460 | if (c == '/' || c == '\\' || c == ':' || c == '*' || c == '?' || c == '"' || | 1470 | if (c == '/' || c == '\\' || c == ':' || |
1471 | c == '*' || c == '?' || c == '"' || | ||
1461 | c == '<' || c == '>' || c == '|') | 1472 | c == '<' || c == '>' || c == '|') |
1462 | { | 1473 | { |
1463 | *idx = '_'; | 1474 | *idx = '_'; |
@@ -2236,18 +2247,24 @@ create_selectable_pipe (PHANDLE read_pipe_ptr, PHANDLE write_pipe_ptr, | |||
2236 | * @return handle to the new pipe, NULL on error | 2247 | * @return handle to the new pipe, NULL on error |
2237 | */ | 2248 | */ |
2238 | struct GNUNET_DISK_PipeHandle * | 2249 | struct GNUNET_DISK_PipeHandle * |
2239 | GNUNET_DISK_pipe (int blocking_read, int blocking_write, int inherit_read, int inherit_write) | 2250 | GNUNET_DISK_pipe (int blocking_read, |
2251 | int blocking_write, | ||
2252 | int inherit_read, | ||
2253 | int inherit_write) | ||
2240 | { | 2254 | { |
2241 | #ifndef MINGW | 2255 | #ifndef MINGW |
2242 | int fd[2]; | 2256 | int fd[2]; |
2243 | int ret; | 2257 | int ret; |
2244 | int eno; | 2258 | int eno; |
2245 | 2259 | ||
2260 | (void) inherit_read; | ||
2261 | (void) inherit_write; | ||
2246 | ret = pipe (fd); | 2262 | ret = pipe (fd); |
2247 | if (ret == -1) | 2263 | if (ret == -1) |
2248 | { | 2264 | { |
2249 | eno = errno; | 2265 | eno = errno; |
2250 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "pipe"); | 2266 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, |
2267 | "pipe"); | ||
2251 | errno = eno; | 2268 | errno = eno; |
2252 | return NULL; | 2269 | return NULL; |
2253 | } | 2270 | } |
diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c index c3d0e4c7c..c836c9055 100644 --- a/src/util/getopt_helpers.c +++ b/src/util/getopt_helpers.c | |||
@@ -46,6 +46,8 @@ print_version (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
46 | { | 46 | { |
47 | const char *version = scls; | 47 | const char *version = scls; |
48 | 48 | ||
49 | (void) option; | ||
50 | (void) value; | ||
49 | printf ("%s v%s\n", | 51 | printf ("%s v%s\n", |
50 | ctx->binaryName, | 52 | ctx->binaryName, |
51 | version); | 53 | version); |
@@ -104,6 +106,8 @@ format_help (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
104 | const struct GNUNET_GETOPT_CommandLineOption *opt; | 106 | const struct GNUNET_GETOPT_CommandLineOption *opt; |
105 | const struct GNUNET_OS_ProjectData *pd; | 107 | const struct GNUNET_OS_ProjectData *pd; |
106 | 108 | ||
109 | (void) option; | ||
110 | (void) value; | ||
107 | if (NULL != about) | 111 | if (NULL != about) |
108 | { | 112 | { |
109 | printf ("%s\n%s\n", ctx->binaryOptions, gettext (about)); | 113 | printf ("%s\n%s\n", ctx->binaryOptions, gettext (about)); |
@@ -112,7 +116,7 @@ format_help (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
112 | } | 116 | } |
113 | i = 0; | 117 | i = 0; |
114 | opt = ctx->allOptions; | 118 | opt = ctx->allOptions; |
115 | while (opt[i].description != NULL) | 119 | while (NULL != opt[i].description) |
116 | { | 120 | { |
117 | if (opt[i].shortName == '\0') | 121 | if (opt[i].shortName == '\0') |
118 | printf (" "); | 122 | printf (" "); |
@@ -120,7 +124,7 @@ format_help (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
120 | printf (" -%c, ", opt[i].shortName); | 124 | printf (" -%c, ", opt[i].shortName); |
121 | printf ("--%s", opt[i].name); | 125 | printf ("--%s", opt[i].name); |
122 | slen = 8 + strlen (opt[i].name); | 126 | slen = 8 + strlen (opt[i].name); |
123 | if (opt[i].argumentHelp != NULL) | 127 | if (NULL != opt[i].argumentHelp) |
124 | { | 128 | { |
125 | printf ("=%s", opt[i].argumentHelp); | 129 | printf ("=%s", opt[i].argumentHelp); |
126 | slen += 1 + strlen (opt[i].argumentHelp); | 130 | slen += 1 + strlen (opt[i].argumentHelp); |
@@ -144,7 +148,7 @@ format_help (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
144 | OUTER: | 148 | OUTER: |
145 | while (ml - p > 78 - slen) | 149 | while (ml - p > 78 - slen) |
146 | { | 150 | { |
147 | for (j = p + 78 - slen; j > p; j--) | 151 | for (j = p + 78 - slen; j > (int) p; j--) |
148 | { | 152 | { |
149 | if (isspace ((unsigned char) trans[j])) | 153 | if (isspace ((unsigned char) trans[j])) |
150 | { | 154 | { |
@@ -227,6 +231,9 @@ increment_value (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
227 | { | 231 | { |
228 | unsigned int *val = scls; | 232 | unsigned int *val = scls; |
229 | 233 | ||
234 | (void) ctx; | ||
235 | (void) option; | ||
236 | (void) value; | ||
230 | (*val)++; | 237 | (*val)++; |
231 | return GNUNET_OK; | 238 | return GNUNET_OK; |
232 | } | 239 | } |
@@ -243,9 +250,9 @@ increment_value (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
243 | */ | 250 | */ |
244 | struct GNUNET_GETOPT_CommandLineOption | 251 | struct GNUNET_GETOPT_CommandLineOption |
245 | GNUNET_GETOPT_option_increment_uint (char shortName, | 252 | GNUNET_GETOPT_option_increment_uint (char shortName, |
246 | const char *name, | 253 | const char *name, |
247 | const char *description, | 254 | const char *description, |
248 | unsigned int *val) | 255 | unsigned int *val) |
249 | { | 256 | { |
250 | struct GNUNET_GETOPT_CommandLineOption clo = { | 257 | struct GNUNET_GETOPT_CommandLineOption clo = { |
251 | .shortName = shortName, | 258 | .shortName = shortName, |
@@ -302,6 +309,9 @@ set_one (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
302 | { | 309 | { |
303 | int *val = scls; | 310 | int *val = scls; |
304 | 311 | ||
312 | (void) ctx; | ||
313 | (void) option; | ||
314 | (void) value; | ||
305 | *val = 1; | 315 | *val = 1; |
306 | return GNUNET_OK; | 316 | return GNUNET_OK; |
307 | } | 317 | } |
@@ -319,9 +329,9 @@ set_one (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
319 | */ | 329 | */ |
320 | struct GNUNET_GETOPT_CommandLineOption | 330 | struct GNUNET_GETOPT_CommandLineOption |
321 | GNUNET_GETOPT_option_flag (char shortName, | 331 | GNUNET_GETOPT_option_flag (char shortName, |
322 | const char *name, | 332 | const char *name, |
323 | const char *description, | 333 | const char *description, |
324 | int *val) | 334 | int *val) |
325 | { | 335 | { |
326 | struct GNUNET_GETOPT_CommandLineOption clo = { | 336 | struct GNUNET_GETOPT_CommandLineOption clo = { |
327 | .shortName = shortName, | 337 | .shortName = shortName, |
@@ -357,6 +367,8 @@ set_string (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
357 | { | 367 | { |
358 | char **val = scls; | 368 | char **val = scls; |
359 | 369 | ||
370 | (void) ctx; | ||
371 | (void) option; | ||
360 | GNUNET_assert (NULL != value); | 372 | GNUNET_assert (NULL != value); |
361 | GNUNET_free_non_null (*val); | 373 | GNUNET_free_non_null (*val); |
362 | *val = GNUNET_strdup (value); | 374 | *val = GNUNET_strdup (value); |
@@ -436,6 +448,8 @@ set_filename (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
436 | { | 448 | { |
437 | char **val = scls; | 449 | char **val = scls; |
438 | 450 | ||
451 | (void) ctx; | ||
452 | (void) option; | ||
439 | GNUNET_assert (NULL != value); | 453 | GNUNET_assert (NULL != value); |
440 | GNUNET_free_non_null (*val); | 454 | GNUNET_free_non_null (*val); |
441 | *val = GNUNET_STRINGS_filename_expand (value); | 455 | *val = GNUNET_STRINGS_filename_expand (value); |
@@ -454,10 +468,10 @@ set_filename (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
454 | */ | 468 | */ |
455 | struct GNUNET_GETOPT_CommandLineOption | 469 | struct GNUNET_GETOPT_CommandLineOption |
456 | GNUNET_GETOPT_option_filename (char shortName, | 470 | GNUNET_GETOPT_option_filename (char shortName, |
457 | const char *name, | 471 | const char *name, |
458 | const char *argumentHelp, | 472 | const char *argumentHelp, |
459 | const char *description, | 473 | const char *description, |
460 | char **str) | 474 | char **str) |
461 | { | 475 | { |
462 | struct GNUNET_GETOPT_CommandLineOption clo = { | 476 | struct GNUNET_GETOPT_CommandLineOption clo = { |
463 | .shortName = shortName, | 477 | .shortName = shortName, |
@@ -538,6 +552,7 @@ set_ulong (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
538 | { | 552 | { |
539 | unsigned long long *val = scls; | 553 | unsigned long long *val = scls; |
540 | 554 | ||
555 | (void) ctx; | ||
541 | if (1 != SSCANF (value, | 556 | if (1 != SSCANF (value, |
542 | "%llu", | 557 | "%llu", |
543 | val)) | 558 | val)) |
@@ -562,10 +577,10 @@ set_ulong (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
562 | */ | 577 | */ |
563 | struct GNUNET_GETOPT_CommandLineOption | 578 | struct GNUNET_GETOPT_CommandLineOption |
564 | GNUNET_GETOPT_option_ulong (char shortName, | 579 | GNUNET_GETOPT_option_ulong (char shortName, |
565 | const char *name, | 580 | const char *name, |
566 | const char *argumentHelp, | 581 | const char *argumentHelp, |
567 | const char *description, | 582 | const char *description, |
568 | unsigned long long *val) | 583 | unsigned long long *val) |
569 | { | 584 | { |
570 | struct GNUNET_GETOPT_CommandLineOption clo = { | 585 | struct GNUNET_GETOPT_CommandLineOption clo = { |
571 | .shortName = shortName, | 586 | .shortName = shortName, |
@@ -601,7 +616,8 @@ set_relative_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
601 | const char *value) | 616 | const char *value) |
602 | { | 617 | { |
603 | struct GNUNET_TIME_Relative *val = scls; | 618 | struct GNUNET_TIME_Relative *val = scls; |
604 | 619 | ||
620 | (void) ctx; | ||
605 | if (GNUNET_OK != | 621 | if (GNUNET_OK != |
606 | GNUNET_STRINGS_fancy_time_to_relative (value, | 622 | GNUNET_STRINGS_fancy_time_to_relative (value, |
607 | val)) | 623 | val)) |
@@ -627,10 +643,10 @@ set_relative_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
627 | */ | 643 | */ |
628 | struct GNUNET_GETOPT_CommandLineOption | 644 | struct GNUNET_GETOPT_CommandLineOption |
629 | GNUNET_GETOPT_option_relative_time (char shortName, | 645 | GNUNET_GETOPT_option_relative_time (char shortName, |
630 | const char *name, | 646 | const char *name, |
631 | const char *argumentHelp, | 647 | const char *argumentHelp, |
632 | const char *description, | 648 | const char *description, |
633 | struct GNUNET_TIME_Relative *val) | 649 | struct GNUNET_TIME_Relative *val) |
634 | { | 650 | { |
635 | struct GNUNET_GETOPT_CommandLineOption clo = { | 651 | struct GNUNET_GETOPT_CommandLineOption clo = { |
636 | .shortName = shortName, | 652 | .shortName = shortName, |
@@ -667,6 +683,7 @@ set_absolute_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
667 | { | 683 | { |
668 | struct GNUNET_TIME_Absolute *val = scls; | 684 | struct GNUNET_TIME_Absolute *val = scls; |
669 | 685 | ||
686 | (void) ctx; | ||
670 | if (GNUNET_OK != | 687 | if (GNUNET_OK != |
671 | GNUNET_STRINGS_fancy_time_to_absolute (value, | 688 | GNUNET_STRINGS_fancy_time_to_absolute (value, |
672 | val)) | 689 | val)) |
@@ -692,10 +709,10 @@ set_absolute_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
692 | */ | 709 | */ |
693 | struct GNUNET_GETOPT_CommandLineOption | 710 | struct GNUNET_GETOPT_CommandLineOption |
694 | GNUNET_GETOPT_option_absolute_time (char shortName, | 711 | GNUNET_GETOPT_option_absolute_time (char shortName, |
695 | const char *name, | 712 | const char *name, |
696 | const char *argumentHelp, | 713 | const char *argumentHelp, |
697 | const char *description, | 714 | const char *description, |
698 | struct GNUNET_TIME_Absolute *val) | 715 | struct GNUNET_TIME_Absolute *val) |
699 | { | 716 | { |
700 | struct GNUNET_GETOPT_CommandLineOption clo = { | 717 | struct GNUNET_GETOPT_CommandLineOption clo = { |
701 | .shortName = shortName, | 718 | .shortName = shortName, |
@@ -732,6 +749,7 @@ set_uint (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
732 | { | 749 | { |
733 | unsigned int *val = scls; | 750 | unsigned int *val = scls; |
734 | 751 | ||
752 | (void) ctx; | ||
735 | if (1 != SSCANF (value, | 753 | if (1 != SSCANF (value, |
736 | "%u", | 754 | "%u", |
737 | val)) | 755 | val)) |
@@ -756,10 +774,10 @@ set_uint (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
756 | */ | 774 | */ |
757 | struct GNUNET_GETOPT_CommandLineOption | 775 | struct GNUNET_GETOPT_CommandLineOption |
758 | GNUNET_GETOPT_option_uint (char shortName, | 776 | GNUNET_GETOPT_option_uint (char shortName, |
759 | const char *name, | 777 | const char *name, |
760 | const char *argumentHelp, | 778 | const char *argumentHelp, |
761 | const char *description, | 779 | const char *description, |
762 | unsigned int *val) | 780 | unsigned int *val) |
763 | { | 781 | { |
764 | struct GNUNET_GETOPT_CommandLineOption clo = { | 782 | struct GNUNET_GETOPT_CommandLineOption clo = { |
765 | .shortName = shortName, | 783 | .shortName = shortName, |
@@ -813,6 +831,7 @@ set_base32 (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
813 | { | 831 | { |
814 | struct Base32Context *bc = scls; | 832 | struct Base32Context *bc = scls; |
815 | 833 | ||
834 | (void) ctx; | ||
816 | if (GNUNET_OK != | 835 | if (GNUNET_OK != |
817 | GNUNET_STRINGS_string_to_data (value, | 836 | GNUNET_STRINGS_string_to_data (value, |
818 | strlen (value), | 837 | strlen (value), |
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index fb3b9ebf9..5f7d9fc0d 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c | |||
@@ -72,12 +72,17 @@ static int rewrite; | |||
72 | * @param value value of the option | 72 | * @param value value of the option |
73 | */ | 73 | */ |
74 | static void | 74 | static void |
75 | print_option (void *cls, const char *section, | 75 | print_option (void *cls, |
76 | const char *section, | ||
76 | const char *option, | 77 | const char *option, |
77 | const char *value) | 78 | const char *value) |
78 | { | 79 | { |
80 | (void) cls; | ||
81 | (void) section; | ||
79 | fprintf (stdout, | 82 | fprintf (stdout, |
80 | "%s = %s\n", option, value); | 83 | "%s = %s\n", |
84 | option, | ||
85 | value); | ||
81 | } | 86 | } |
82 | 87 | ||
83 | 88 | ||
@@ -91,7 +96,10 @@ static void | |||
91 | print_section_name (void *cls, | 96 | print_section_name (void *cls, |
92 | const char *section) | 97 | const char *section) |
93 | { | 98 | { |
94 | fprintf (stdout, "%s\n", section); | 99 | (void) cls; |
100 | fprintf (stdout, | ||
101 | "%s\n", | ||
102 | section); | ||
95 | } | 103 | } |
96 | 104 | ||
97 | 105 | ||
@@ -112,6 +120,8 @@ run (void *cls, | |||
112 | struct GNUNET_CONFIGURATION_Handle *out = NULL; | 120 | struct GNUNET_CONFIGURATION_Handle *out = NULL; |
113 | struct GNUNET_CONFIGURATION_Handle *diff = NULL; | 121 | struct GNUNET_CONFIGURATION_Handle *diff = NULL; |
114 | 122 | ||
123 | (void) cls; | ||
124 | (void) args; | ||
115 | if (rewrite) | 125 | if (rewrite) |
116 | { | 126 | { |
117 | struct GNUNET_CONFIGURATION_Handle *def; | 127 | struct GNUNET_CONFIGURATION_Handle *def; |
@@ -221,36 +231,37 @@ run (void *cls, | |||
221 | * @return 0 ok, 1 on error | 231 | * @return 0 ok, 1 on error |
222 | */ | 232 | */ |
223 | int | 233 | int |
224 | main (int argc, char *const *argv) | 234 | main (int argc, |
235 | char *const *argv) | ||
225 | { | 236 | { |
226 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 237 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
227 | GNUNET_GETOPT_option_flag ('f', | 238 | GNUNET_GETOPT_option_flag ('f', |
228 | "filename", | 239 | "filename", |
229 | gettext_noop ("obtain option of value as a filename (with $-expansion)"), | 240 | gettext_noop ("obtain option of value as a filename (with $-expansion)"), |
230 | &is_filename), | 241 | &is_filename), |
231 | GNUNET_GETOPT_option_string ('s', | 242 | GNUNET_GETOPT_option_string ('s', |
232 | "section", | 243 | "section", |
233 | "SECTION", | 244 | "SECTION", |
234 | gettext_noop ("name of the section to access"), | 245 | gettext_noop ("name of the section to access"), |
235 | §ion), | 246 | §ion), |
236 | GNUNET_GETOPT_option_string ('o', | 247 | GNUNET_GETOPT_option_string ('o', |
237 | "option", | 248 | "option", |
238 | "OPTION", | 249 | "OPTION", |
239 | gettext_noop ("name of the option to access"), | 250 | gettext_noop ("name of the option to access"), |
240 | &option), | 251 | &option), |
241 | GNUNET_GETOPT_option_string ('V', | 252 | GNUNET_GETOPT_option_string ('V', |
242 | "value", | 253 | "value", |
243 | "VALUE", | 254 | "VALUE", |
244 | gettext_noop ("value to set"), | 255 | gettext_noop ("value to set"), |
245 | &value), | 256 | &value), |
246 | GNUNET_GETOPT_option_flag ('S', | 257 | GNUNET_GETOPT_option_flag ('S', |
247 | "list-sections", | 258 | "list-sections", |
248 | gettext_noop ("print available configuration sections"), | 259 | gettext_noop ("print available configuration sections"), |
249 | &list_sections), | 260 | &list_sections), |
250 | GNUNET_GETOPT_option_flag ('w', | 261 | GNUNET_GETOPT_option_flag ('w', |
251 | "rewrite", | 262 | "rewrite", |
252 | gettext_noop ("write configuration file that only contains delta to defaults"), | 263 | gettext_noop ("write configuration file that only contains delta to defaults"), |
253 | &rewrite), | 264 | &rewrite), |
254 | GNUNET_GETOPT_OPTION_END | 265 | GNUNET_GETOPT_OPTION_END |
255 | }; | 266 | }; |
256 | if (GNUNET_OK != | 267 | if (GNUNET_OK != |
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c index 66a4bd3e9..59a100a8c 100644 --- a/src/util/gnunet-ecc.c +++ b/src/util/gnunet-ecc.c | |||
@@ -281,8 +281,10 @@ print_key (const char *filename) | |||
281 | uint64_t fs; | 281 | uint64_t fs; |
282 | unsigned int total_hostkeys; | 282 | unsigned int total_hostkeys; |
283 | unsigned int c; | 283 | unsigned int c; |
284 | ssize_t sret; | ||
284 | 285 | ||
285 | if (GNUNET_YES != GNUNET_DISK_file_test (filename)) | 286 | if (GNUNET_YES != |
287 | GNUNET_DISK_file_test (filename)) | ||
286 | { | 288 | { |
287 | fprintf (stderr, | 289 | fprintf (stderr, |
288 | _("Hostkeys file `%s' not found\n"), | 290 | _("Hostkeys file `%s' not found\n"), |
@@ -291,7 +293,11 @@ print_key (const char *filename) | |||
291 | } | 293 | } |
292 | 294 | ||
293 | /* Check hostkey file size, read entire thing into memory */ | 295 | /* Check hostkey file size, read entire thing into memory */ |
294 | if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES)) | 296 | if (GNUNET_OK != |
297 | GNUNET_DISK_file_size (filename, | ||
298 | &fs, | ||
299 | GNUNET_YES, | ||
300 | GNUNET_YES)) | ||
295 | fs = 0; | 301 | fs = 0; |
296 | if (0 == fs) | 302 | if (0 == fs) |
297 | { | 303 | { |
@@ -307,15 +313,22 @@ print_key (const char *filename) | |||
307 | filename); | 313 | filename); |
308 | return; | 314 | return; |
309 | } | 315 | } |
310 | fd = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, | 316 | fd = GNUNET_DISK_file_open (filename, |
311 | GNUNET_DISK_PERM_NONE); | 317 | GNUNET_DISK_OPEN_READ, |
318 | GNUNET_DISK_PERM_NONE); | ||
312 | if (NULL == fd) | 319 | if (NULL == fd) |
313 | { | 320 | { |
314 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", filename); | 321 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, |
322 | "open", | ||
323 | filename); | ||
315 | return; | 324 | return; |
316 | } | 325 | } |
317 | hostkeys_data = GNUNET_malloc (fs); | 326 | hostkeys_data = GNUNET_malloc (fs); |
318 | if (fs != GNUNET_DISK_file_read (fd, hostkeys_data, fs)) | 327 | sret = GNUNET_DISK_file_read (fd, |
328 | hostkeys_data, | ||
329 | fs); | ||
330 | if ( (sret < 0) || | ||
331 | (fs != (size_t) sret) ) | ||
319 | { | 332 | { |
320 | fprintf (stderr, | 333 | fprintf (stderr, |
321 | _("Could not read hostkey file: %s\n"), | 334 | _("Could not read hostkey file: %s\n"), |
@@ -351,15 +364,21 @@ print_key (const char *filename) | |||
351 | /** | 364 | /** |
352 | * Main function that will be run by the scheduler. | 365 | * Main function that will be run by the scheduler. |
353 | * | 366 | * |
354 | * @param cls closure | 367 | * @param cls closure, NULL |
355 | * @param args remaining command-line arguments | 368 | * @param args remaining command-line arguments |
356 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | 369 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) |
357 | * @param cfg configuration | 370 | * @param cfg configuration |
358 | */ | 371 | */ |
359 | static void | 372 | static void |
360 | run (void *cls, char *const *args, const char *cfgfile, | 373 | run (void *cls, |
374 | char *const *args, | ||
375 | const char *cfgfile, | ||
361 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 376 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
362 | { | 377 | { |
378 | (void) cls; | ||
379 | (void) cfgfile; | ||
380 | (void) cfg; | ||
381 | |||
363 | if (print_examples_flag) | 382 | if (print_examples_flag) |
364 | { | 383 | { |
365 | print_examples (); | 384 | print_examples (); |
diff --git a/src/util/gnunet-resolver.c b/src/util/gnunet-resolver.c index 7ffafee32..4954e0398 100644 --- a/src/util/gnunet-resolver.c +++ b/src/util/gnunet-resolver.c | |||
@@ -46,9 +46,12 @@ static void | |||
46 | print_hostname (void *cls, | 46 | print_hostname (void *cls, |
47 | const char *hostname) | 47 | const char *hostname) |
48 | { | 48 | { |
49 | (void) cls; | ||
49 | if (NULL == hostname) | 50 | if (NULL == hostname) |
50 | return; | 51 | return; |
51 | FPRINTF (stdout, "%s\n", hostname); | 52 | FPRINTF (stdout, |
53 | "%s\n", | ||
54 | hostname); | ||
52 | } | 55 | } |
53 | 56 | ||
54 | 57 | ||
@@ -60,11 +63,17 @@ print_hostname (void *cls, | |||
60 | * @param addrlen length of the address | 63 | * @param addrlen length of the address |
61 | */ | 64 | */ |
62 | static void | 65 | static void |
63 | print_sockaddr (void *cls, const struct sockaddr *addr, socklen_t addrlen) | 66 | print_sockaddr (void *cls, |
67 | const struct sockaddr *addr, | ||
68 | socklen_t addrlen) | ||
64 | { | 69 | { |
70 | (void) cls; | ||
65 | if (NULL == addr) | 71 | if (NULL == addr) |
66 | return; | 72 | return; |
67 | FPRINTF (stdout, "%s\n", GNUNET_a2s (addr, addrlen)); | 73 | FPRINTF (stdout, |
74 | "%s\n", | ||
75 | GNUNET_a2s (addr, | ||
76 | addrlen)); | ||
68 | } | 77 | } |
69 | 78 | ||
70 | 79 | ||
@@ -77,7 +86,9 @@ print_sockaddr (void *cls, const struct sockaddr *addr, socklen_t addrlen) | |||
77 | * @param cfg configuration | 86 | * @param cfg configuration |
78 | */ | 87 | */ |
79 | static void | 88 | static void |
80 | run (void *cls, char *const *args, const char *cfgfile, | 89 | run (void *cls, |
90 | char *const *args, | ||
91 | const char *cfgfile, | ||
81 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 92 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
82 | { | 93 | { |
83 | const struct sockaddr *sa; | 94 | const struct sockaddr *sa; |
@@ -85,11 +96,18 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
85 | struct sockaddr_in v4; | 96 | struct sockaddr_in v4; |
86 | struct sockaddr_in6 v6; | 97 | struct sockaddr_in6 v6; |
87 | 98 | ||
88 | if (args[0] == NULL) | 99 | (void) cls; |
100 | (void) cfgfile; | ||
101 | (void) cfg; | ||
102 | if (NULL == args[0]) | ||
89 | return; | 103 | return; |
90 | if (! reverse) | 104 | if (! reverse) |
91 | { | 105 | { |
92 | GNUNET_RESOLVER_ip_get (args[0], AF_UNSPEC, GET_TIMEOUT, &print_sockaddr, NULL); | 106 | GNUNET_RESOLVER_ip_get (args[0], |
107 | AF_UNSPEC, | ||
108 | GET_TIMEOUT, | ||
109 | &print_sockaddr, | ||
110 | NULL); | ||
93 | return; | 111 | return; |
94 | } | 112 | } |
95 | 113 | ||
diff --git a/src/util/gnunet-service-resolver.c b/src/util/gnunet-service-resolver.c index d26bdd212..ccb592349 100644 --- a/src/util/gnunet-service-resolver.c +++ b/src/util/gnunet-service-resolver.c | |||
@@ -582,7 +582,7 @@ get_ip_from_hostname (struct GNUNET_SERVICE_Client *client, | |||
582 | /** | 582 | /** |
583 | * Verify well-formedness of GET-message. | 583 | * Verify well-formedness of GET-message. |
584 | * | 584 | * |
585 | * @param cls closure | 585 | * @param cls closure, unused |
586 | * @param get the actual message | 586 | * @param get the actual message |
587 | * @return #GNUNET_OK if @a get is well-formed | 587 | * @return #GNUNET_OK if @a get is well-formed |
588 | */ | 588 | */ |
@@ -594,6 +594,7 @@ check_get (void *cls, | |||
594 | int direction; | 594 | int direction; |
595 | int af; | 595 | int af; |
596 | 596 | ||
597 | (void) cls; | ||
597 | size = ntohs (get->header.size) - sizeof (*get); | 598 | size = ntohs (get->header.size) - sizeof (*get); |
598 | direction = ntohl (get->direction); | 599 | direction = ntohl (get->direction); |
599 | if (GNUNET_NO == direction) | 600 | if (GNUNET_NO == direction) |
@@ -688,7 +689,7 @@ handle_get (void *cls, | |||
688 | /** | 689 | /** |
689 | * Callback called when a client connects to the service. | 690 | * Callback called when a client connects to the service. |
690 | * | 691 | * |
691 | * @param cls closure for the service | 692 | * @param cls closure for the service, unused |
692 | * @param c the new client that connected to the service | 693 | * @param c the new client that connected to the service |
693 | * @param mq the message queue used to send messages to the client | 694 | * @param mq the message queue used to send messages to the client |
694 | * @return @a c | 695 | * @return @a c |
@@ -698,6 +699,9 @@ connect_cb (void *cls, | |||
698 | struct GNUNET_SERVICE_Client *c, | 699 | struct GNUNET_SERVICE_Client *c, |
699 | struct GNUNET_MQ_Handle *mq) | 700 | struct GNUNET_MQ_Handle *mq) |
700 | { | 701 | { |
702 | (void) cls; | ||
703 | (void) mq; | ||
704 | |||
701 | return c; | 705 | return c; |
702 | } | 706 | } |
703 | 707 | ||
@@ -714,6 +718,8 @@ disconnect_cb (void *cls, | |||
714 | struct GNUNET_SERVICE_Client *c, | 718 | struct GNUNET_SERVICE_Client *c, |
715 | void *internal_cls) | 719 | void *internal_cls) |
716 | { | 720 | { |
721 | (void) cls; | ||
722 | |||
717 | GNUNET_assert (c == internal_cls); | 723 | GNUNET_assert (c == internal_cls); |
718 | } | 724 | } |
719 | 725 | ||
diff --git a/src/util/network.c b/src/util/network.c index cf5ef3e00..d7059a057 100644 --- a/src/util/network.c +++ b/src/util/network.c | |||
@@ -1326,9 +1326,10 @@ GNUNET_NETWORK_fdset_handle_set (struct GNUNET_NETWORK_FDSet *fds, | |||
1326 | #else | 1326 | #else |
1327 | int fd; | 1327 | int fd; |
1328 | 1328 | ||
1329 | GNUNET_DISK_internal_file_handle_ (h, | 1329 | GNUNET_assert (GNUNET_OK == |
1330 | &fd, | 1330 | GNUNET_DISK_internal_file_handle_ (h, |
1331 | sizeof (int)); | 1331 | &fd, |
1332 | sizeof (int))); | ||
1332 | FD_SET (fd, | 1333 | FD_SET (fd, |
1333 | &fds->sds); | 1334 | &fds->sds); |
1334 | fds->nsds = GNUNET_MAX (fd + 1, | 1335 | fds->nsds = GNUNET_MAX (fd + 1, |
diff --git a/src/util/os_installation.c b/src/util/os_installation.c index 1226c5966..2e35de681 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2006-2016 GNUnet e.V. | 3 | Copyright (C) 2006-2018 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -152,14 +152,21 @@ get_path_from_proc_exe () | |||
152 | ssize_t size; | 152 | ssize_t size; |
153 | char *lep; | 153 | char *lep; |
154 | 154 | ||
155 | GNUNET_snprintf (fn, sizeof (fn), "/proc/%u/exe", getpid ()); | 155 | GNUNET_snprintf (fn, |
156 | size = readlink (fn, lnk, sizeof (lnk) - 1); | 156 | sizeof (fn), |
157 | "/proc/%u/exe", | ||
158 | getpid ()); | ||
159 | size = readlink (fn, | ||
160 | lnk, | ||
161 | sizeof (lnk) - 1); | ||
157 | if (size <= 0) | 162 | if (size <= 0) |
158 | { | 163 | { |
159 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "readlink", fn); | 164 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, |
165 | "readlink", | ||
166 | fn); | ||
160 | return NULL; | 167 | return NULL; |
161 | } | 168 | } |
162 | GNUNET_assert (size < sizeof (lnk)); | 169 | GNUNET_assert ( ((size_t) size) < sizeof (lnk)); |
163 | lnk[size] = '\0'; | 170 | lnk[size] = '\0'; |
164 | while ((lnk[size] != '/') && (size > 0)) | 171 | while ((lnk[size] != '/') && (size > 0)) |
165 | size--; | 172 | size--; |
@@ -167,12 +174,13 @@ get_path_from_proc_exe () | |||
167 | "/%s/libexec/", | 174 | "/%s/libexec/", |
168 | current_pd->project_dirname); | 175 | current_pd->project_dirname); |
169 | /* test for being in lib/gnunet/libexec/ or lib/MULTIARCH/gnunet/libexec */ | 176 | /* test for being in lib/gnunet/libexec/ or lib/MULTIARCH/gnunet/libexec */ |
170 | if ( (size > strlen (lep)) && | 177 | if ( (((size_t) size) > strlen (lep)) && |
171 | (0 == strcmp (lep, | 178 | (0 == strcmp (lep, |
172 | &lnk[size - strlen (lep)])) ) | 179 | &lnk[size - strlen (lep)])) ) |
173 | size -= strlen (lep) - 1; | 180 | size -= strlen (lep) - 1; |
174 | GNUNET_free (lep); | 181 | GNUNET_free (lep); |
175 | if ((size < 4) || (lnk[size - 4] != '/')) | 182 | if ( (size < 4) || |
183 | (lnk[size - 4] != '/') ) | ||
176 | { | 184 | { |
177 | /* not installed in "/bin/" -- binary path probably useless */ | 185 | /* not installed in "/bin/" -- binary path probably useless */ |
178 | return NULL; | 186 | return NULL; |
@@ -903,6 +911,7 @@ GNUNET_OS_check_helper_binary (const char *binary, | |||
903 | if (check_suid) | 911 | if (check_suid) |
904 | { | 912 | { |
905 | #ifndef MINGW | 913 | #ifndef MINGW |
914 | (void) params; | ||
906 | if ( (0 != (statbuf.st_mode & S_ISUID)) && | 915 | if ( (0 != (statbuf.st_mode & S_ISUID)) && |
907 | (0 == statbuf.st_uid) ) | 916 | (0 == statbuf.st_uid) ) |
908 | { | 917 | { |
diff --git a/src/util/os_priority.c b/src/util/os_priority.c index 2c4f7ca09..98998b520 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c | |||
@@ -154,6 +154,7 @@ GNUNET_OS_install_parent_control_handler (void *cls) | |||
154 | struct GNUNET_DISK_FileHandle *control_pipe; | 154 | struct GNUNET_DISK_FileHandle *control_pipe; |
155 | uint64_t pipe_fd; | 155 | uint64_t pipe_fd; |
156 | 156 | ||
157 | (void) cls; | ||
157 | if (NULL != pch) | 158 | if (NULL != pch) |
158 | { | 159 | { |
159 | /* already done, we've been called twice... */ | 160 | /* already done, we've been called twice... */ |
diff --git a/src/util/peer.c b/src/util/peer.c index b637dc229..b1c65fbcf 100644 --- a/src/util/peer.c +++ b/src/util/peer.c | |||
@@ -201,7 +201,8 @@ GNUNET_PEER_change_rc (GNUNET_PEER_Id id, int delta) | |||
201 | return; | 201 | return; |
202 | GNUNET_assert (id < size); | 202 | GNUNET_assert (id < size); |
203 | GNUNET_assert (table[id]->rc > 0); | 203 | GNUNET_assert (table[id]->rc > 0); |
204 | GNUNET_assert ((delta >= 0) || (table[id]->rc >= -delta)); | 204 | GNUNET_assert ( (delta >= 0) || |
205 | (table[id]->rc >= (unsigned int) (-delta)) ); | ||
205 | table[id]->rc += delta; | 206 | table[id]->rc += delta; |
206 | if (0 == table[id]->rc) | 207 | if (0 == table[id]->rc) |
207 | { | 208 | { |
diff --git a/src/util/program.c b/src/util/program.c index 233792387..9e3037b8b 100644 --- a/src/util/program.c +++ b/src/util/program.c | |||
@@ -74,6 +74,7 @@ struct CommandContext | |||
74 | static void | 74 | static void |
75 | shutdown_task (void *cls) | 75 | shutdown_task (void *cls) |
76 | { | 76 | { |
77 | (void) cls; | ||
77 | GNUNET_SPEEDUP_stop_ (); | 78 | GNUNET_SPEEDUP_stop_ (); |
78 | } | 79 | } |
79 | 80 | ||
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index 84f541ba0..bd46b4fbb 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2016 GNUnet e.V. | 3 | Copyright (C) 2009-2018 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -214,7 +214,8 @@ check_config () | |||
214 | for (unsigned int i = 0; | 214 | for (unsigned int i = 0; |
215 | NULL != loopback[i]; | 215 | NULL != loopback[i]; |
216 | i++) | 216 | i++) |
217 | if (0 == strcasecmp (loopback[i], hostname)) | 217 | if (0 == strcasecmp (loopback[i], |
218 | hostname)) | ||
218 | { | 219 | { |
219 | GNUNET_free (hostname); | 220 | GNUNET_free (hostname); |
220 | return GNUNET_OK; | 221 | return GNUNET_OK; |
@@ -285,6 +286,7 @@ GNUNET_RESOLVER_disconnect () | |||
285 | static void | 286 | static void |
286 | shutdown_task (void *cls) | 287 | shutdown_task (void *cls) |
287 | { | 288 | { |
289 | (void) cls; | ||
288 | s_task = NULL; | 290 | s_task = NULL; |
289 | GNUNET_RESOLVER_disconnect (); | 291 | GNUNET_RESOLVER_disconnect (); |
290 | backoff = GNUNET_TIME_UNIT_MILLISECONDS; | 292 | backoff = GNUNET_TIME_UNIT_MILLISECONDS; |
@@ -387,10 +389,12 @@ static void | |||
387 | mq_error_handler (void *cls, | 389 | mq_error_handler (void *cls, |
388 | enum GNUNET_MQ_Error error) | 390 | enum GNUNET_MQ_Error error) |
389 | { | 391 | { |
392 | (void) cls; | ||
390 | GNUNET_MQ_destroy (mq); | 393 | GNUNET_MQ_destroy (mq); |
391 | mq = NULL; | 394 | mq = NULL; |
392 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 395 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
393 | "MQ error, reconnecting\n"); | 396 | "MQ error %d, reconnecting\n", |
397 | error); | ||
394 | reconnect (); | 398 | reconnect (); |
395 | } | 399 | } |
396 | 400 | ||
@@ -449,6 +453,9 @@ static int | |||
449 | check_response (void *cls, | 453 | check_response (void *cls, |
450 | const struct GNUNET_MessageHeader *msg) | 454 | const struct GNUNET_MessageHeader *msg) |
451 | { | 455 | { |
456 | (void) cls; | ||
457 | (void) msg; | ||
458 | |||
452 | /* implemented in #handle_response() for now */ | 459 | /* implemented in #handle_response() for now */ |
453 | return GNUNET_OK; | 460 | return GNUNET_OK; |
454 | } | 461 | } |
@@ -470,6 +477,7 @@ handle_response (void *cls, | |||
470 | uint16_t size; | 477 | uint16_t size; |
471 | char *nret; | 478 | char *nret; |
472 | 479 | ||
480 | (void) cls; | ||
473 | GNUNET_assert (NULL != rh); | 481 | GNUNET_assert (NULL != rh); |
474 | size = ntohs (msg->size); | 482 | size = ntohs (msg->size); |
475 | if (size == sizeof (struct GNUNET_MessageHeader)) | 483 | if (size == sizeof (struct GNUNET_MessageHeader)) |
@@ -743,6 +751,7 @@ reconnect_task (void *cls) | |||
743 | GNUNET_MQ_handler_end () | 751 | GNUNET_MQ_handler_end () |
744 | }; | 752 | }; |
745 | 753 | ||
754 | (void) cls; | ||
746 | r_task = NULL; | 755 | r_task = NULL; |
747 | if (NULL == req_head) | 756 | if (NULL == req_head) |
748 | return; /* no work pending */ | 757 | return; /* no work pending */ |
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index b96e4e6c4..fecbc0de5 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -513,14 +513,14 @@ static void | |||
513 | dump_backtrace (struct GNUNET_SCHEDULER_Task *t) | 513 | dump_backtrace (struct GNUNET_SCHEDULER_Task *t) |
514 | { | 514 | { |
515 | #if EXECINFO | 515 | #if EXECINFO |
516 | unsigned int i; | 516 | for (unsigned int i = 0; i < t->num_backtrace_strings; i++) |
517 | |||
518 | for (i = 0; i < t->num_backtrace_strings; i++) | ||
519 | LOG (GNUNET_ERROR_TYPE_WARNING, | 517 | LOG (GNUNET_ERROR_TYPE_WARNING, |
520 | "Task %p trace %u: %s\n", | 518 | "Task %p trace %u: %s\n", |
521 | t, | 519 | t, |
522 | i, | 520 | i, |
523 | t->backtrace_strings[i]); | 521 | t->backtrace_strings[i]); |
522 | #else | ||
523 | (void) t; | ||
524 | #endif | 524 | #endif |
525 | } | 525 | } |
526 | 526 | ||
@@ -847,20 +847,19 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t, | |||
847 | * @param et the event type to be set in each FdInfo after calling | 847 | * @param et the event type to be set in each FdInfo after calling |
848 | * @a driver_func on it, or -1 if no updating not desired. | 848 | * @a driver_func on it, or -1 if no updating not desired. |
849 | */ | 849 | */ |
850 | void driver_add_multiple (struct GNUNET_SCHEDULER_Task *t, | 850 | static void |
851 | enum GNUNET_SCHEDULER_EventType et) | 851 | driver_add_multiple (struct GNUNET_SCHEDULER_Task *t) |
852 | { | 852 | { |
853 | struct GNUNET_SCHEDULER_FdInfo *fdi; | 853 | struct GNUNET_SCHEDULER_FdInfo *fdi; |
854 | int success = GNUNET_YES; | 854 | int success = GNUNET_YES; |
855 | 855 | ||
856 | for (int i = 0; i != t->fds_len; ++i) | 856 | for (unsigned int i = 0; i != t->fds_len; ++i) |
857 | { | 857 | { |
858 | fdi = &t->fds[i]; | 858 | fdi = &t->fds[i]; |
859 | success = scheduler_driver->add (scheduler_driver->cls, t, fdi) && success; | 859 | success = scheduler_driver->add (scheduler_driver->cls, |
860 | if (et != -1) | 860 | t, |
861 | { | 861 | fdi) && success; |
862 | fdi->et = et; | 862 | fdi->et = GNUNET_SCHEDULER_ET_NONE; |
863 | } | ||
864 | } | 863 | } |
865 | if (GNUNET_YES != success) | 864 | if (GNUNET_YES != success) |
866 | { | 865 | { |
@@ -870,12 +869,13 @@ void driver_add_multiple (struct GNUNET_SCHEDULER_Task *t, | |||
870 | } | 869 | } |
871 | 870 | ||
872 | 871 | ||
873 | void | 872 | static void |
874 | shutdown_cb (void *cls) | 873 | shutdown_cb (void *cls) |
875 | { | 874 | { |
876 | char c; | 875 | char c; |
877 | const struct GNUNET_DISK_FileHandle *pr; | 876 | const struct GNUNET_DISK_FileHandle *pr; |
878 | 877 | ||
878 | (void) cls; | ||
879 | pr = GNUNET_DISK_pipe_handle (shutdown_pipe_handle, | 879 | pr = GNUNET_DISK_pipe_handle (shutdown_pipe_handle, |
880 | GNUNET_DISK_PIPE_END_READ); | 880 | GNUNET_DISK_PIPE_END_READ); |
881 | GNUNET_assert (! GNUNET_DISK_handle_invalid (pr)); | 881 | GNUNET_assert (! GNUNET_DISK_handle_invalid (pr)); |
@@ -975,6 +975,8 @@ init_backtrace (struct GNUNET_SCHEDULER_Task *t) | |||
975 | backtrace_symbols (backtrace_array, | 975 | backtrace_symbols (backtrace_array, |
976 | t->num_backtrace_strings); | 976 | t->num_backtrace_strings); |
977 | dump_backtrace (t); | 977 | dump_backtrace (t); |
978 | #else | ||
979 | (void) t; | ||
978 | #endif | 980 | #endif |
979 | } | 981 | } |
980 | 982 | ||
@@ -1375,7 +1377,7 @@ add_without_sets (struct GNUNET_TIME_Relative delay, | |||
1375 | GNUNET_CONTAINER_DLL_insert (pending_head, | 1377 | GNUNET_CONTAINER_DLL_insert (pending_head, |
1376 | pending_tail, | 1378 | pending_tail, |
1377 | t); | 1379 | t); |
1378 | driver_add_multiple (t, GNUNET_SCHEDULER_ET_NONE); | 1380 | driver_add_multiple (t); |
1379 | max_priority_added = GNUNET_MAX (max_priority_added, | 1381 | max_priority_added = GNUNET_MAX (max_priority_added, |
1380 | t->priority); | 1382 | t->priority); |
1381 | init_backtrace (t); | 1383 | init_backtrace (t); |
@@ -1664,14 +1666,15 @@ extract_handles (struct GNUNET_SCHEDULER_Task *t, | |||
1664 | // in fdset must be handled separately | 1666 | // in fdset must be handled separately |
1665 | const struct GNUNET_NETWORK_Handle **nhandles; | 1667 | const struct GNUNET_NETWORK_Handle **nhandles; |
1666 | const struct GNUNET_DISK_FileHandle **fhandles; | 1668 | const struct GNUNET_DISK_FileHandle **fhandles; |
1667 | unsigned int nhandles_len, fhandles_len; | 1669 | unsigned int nhandles_len; |
1668 | int sock; | 1670 | unsigned int fhandles_len; |
1669 | 1671 | ||
1672 | (void) t; | ||
1670 | nhandles = NULL; | 1673 | nhandles = NULL; |
1671 | fhandles = NULL; | 1674 | fhandles = NULL; |
1672 | nhandles_len = 0; | 1675 | nhandles_len = 0; |
1673 | fhandles_len = 0; | 1676 | fhandles_len = 0; |
1674 | for (sock = 0; sock != fdset->nsds; ++sock) | 1677 | for (int sock = 0; sock != fdset->nsds; ++sock) |
1675 | { | 1678 | { |
1676 | if (GNUNET_YES == GNUNET_NETWORK_fdset_test_native (fdset, sock)) | 1679 | if (GNUNET_YES == GNUNET_NETWORK_fdset_test_native (fdset, sock)) |
1677 | { | 1680 | { |
@@ -1816,7 +1819,7 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, | |||
1816 | GNUNET_CONTAINER_DLL_insert (pending_head, | 1819 | GNUNET_CONTAINER_DLL_insert (pending_head, |
1817 | pending_tail, | 1820 | pending_tail, |
1818 | t); | 1821 | t); |
1819 | driver_add_multiple (t, GNUNET_SCHEDULER_ET_NONE); | 1822 | driver_add_multiple (t); |
1820 | max_priority_added = GNUNET_MAX (max_priority_added, | 1823 | max_priority_added = GNUNET_MAX (max_priority_added, |
1821 | t->priority); | 1824 | t->priority); |
1822 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1825 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1969,7 +1972,7 @@ GNUNET_SCHEDULER_run_from_driver (struct GNUNET_SCHEDULER_Handle *sh) | |||
1969 | // FIXME: do we have to remove FdInfos from fds if they are not ready? | 1972 | // FIXME: do we have to remove FdInfos from fds if they are not ready? |
1970 | tc.fds_len = pos->fds_len; | 1973 | tc.fds_len = pos->fds_len; |
1971 | tc.fds = pos->fds; | 1974 | tc.fds = pos->fds; |
1972 | for (int i = 0; i != pos->fds_len; ++i) | 1975 | for (unsigned int i = 0; i != pos->fds_len; ++i) |
1973 | { | 1976 | { |
1974 | struct GNUNET_SCHEDULER_FdInfo *fdi = &pos->fds[i]; | 1977 | struct GNUNET_SCHEDULER_FdInfo *fdi = &pos->fds[i]; |
1975 | if (0 != (GNUNET_SCHEDULER_ET_IN & fdi->et)) | 1978 | if (0 != (GNUNET_SCHEDULER_ET_IN & fdi->et)) |
diff --git a/src/util/service.c b/src/util/service.c index b4eb33caa..1156093f4 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -1978,7 +1978,7 @@ do_send (void *cls) | |||
1978 | GNUNET_MQ_impl_send_in_flight (client->mq); | 1978 | GNUNET_MQ_impl_send_in_flight (client->mq); |
1979 | } | 1979 | } |
1980 | client->msg_pos += ret; | 1980 | client->msg_pos += ret; |
1981 | if (left > ret) | 1981 | if (left > (size_t) ret) |
1982 | { | 1982 | { |
1983 | GNUNET_assert (NULL == client->drop_task); | 1983 | GNUNET_assert (NULL == client->drop_task); |
1984 | client->send_task | 1984 | client->send_task |
@@ -2007,6 +2007,7 @@ service_mq_send (struct GNUNET_MQ_Handle *mq, | |||
2007 | { | 2007 | { |
2008 | struct GNUNET_SERVICE_Client *client = impl_state; | 2008 | struct GNUNET_SERVICE_Client *client = impl_state; |
2009 | 2009 | ||
2010 | (void) mq; | ||
2010 | if (NULL != client->drop_task) | 2011 | if (NULL != client->drop_task) |
2011 | return; /* we're going down right now, do not try to send */ | 2012 | return; /* we're going down right now, do not try to send */ |
2012 | GNUNET_assert (NULL == client->send_task); | 2013 | GNUNET_assert (NULL == client->send_task); |
@@ -2036,6 +2037,7 @@ service_mq_cancel (struct GNUNET_MQ_Handle *mq, | |||
2036 | { | 2037 | { |
2037 | struct GNUNET_SERVICE_Client *client = impl_state; | 2038 | struct GNUNET_SERVICE_Client *client = impl_state; |
2038 | 2039 | ||
2040 | (void) mq; | ||
2039 | GNUNET_assert (0 == client->msg_pos); | 2041 | GNUNET_assert (0 == client->msg_pos); |
2040 | client->msg = NULL; | 2042 | client->msg = NULL; |
2041 | GNUNET_SCHEDULER_cancel (client->send_task); | 2043 | GNUNET_SCHEDULER_cancel (client->send_task); |
diff --git a/src/util/speedup.c b/src/util/speedup.c index c6a4cf678..f5e81f16b 100644 --- a/src/util/speedup.c +++ b/src/util/speedup.c | |||
@@ -42,6 +42,7 @@ do_speedup (void *cls) | |||
42 | { | 42 | { |
43 | static long long current_offset; | 43 | static long long current_offset; |
44 | 44 | ||
45 | (void) cls; | ||
45 | speedup_task = NULL; | 46 | speedup_task = NULL; |
46 | current_offset += delta.rel_value_us; | 47 | current_offset += delta.rel_value_us; |
47 | GNUNET_TIME_set_offset (current_offset); | 48 | GNUNET_TIME_set_offset (current_offset); |
diff --git a/src/util/strings.c b/src/util/strings.c index f554a9e83..4cfcd63b3 100644 --- a/src/util/strings.c +++ b/src/util/strings.c | |||
@@ -1069,11 +1069,13 @@ GNUNET_STRINGS_string_to_data (const char *enc, size_t enclen, | |||
1069 | * (if they weren't NULL). | 1069 | * (if they weren't NULL). |
1070 | */ | 1070 | */ |
1071 | int | 1071 | int |
1072 | GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part, | 1072 | GNUNET_STRINGS_parse_uri (const char *path, |
1073 | const char **path_part) | 1073 | char **scheme_part, |
1074 | const char **path_part) | ||
1074 | { | 1075 | { |
1075 | size_t len; | 1076 | size_t len; |
1076 | int i, end; | 1077 | size_t i; |
1078 | int end; | ||
1077 | int pp_state = 0; | 1079 | int pp_state = 0; |
1078 | const char *post_scheme_part = NULL; | 1080 | const char *post_scheme_part = NULL; |
1079 | len = strlen (path); | 1081 | len = strlen (path); |
@@ -1082,7 +1084,7 @@ GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part, | |||
1082 | switch (pp_state) | 1084 | switch (pp_state) |
1083 | { | 1085 | { |
1084 | case 0: | 1086 | case 0: |
1085 | if (path[i] == ':' && i > 0) | 1087 | if ( (path[i] == ':') && (i > 0) ) |
1086 | { | 1088 | { |
1087 | pp_state += 1; | 1089 | pp_state += 1; |
1088 | continue; | 1090 | continue; |