diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-08-12 09:36:33 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-08-12 09:36:33 +0200 |
commit | 99f8204531ebb4d388eec7919afd4b7a3ae0b096 (patch) | |
tree | 8c606540b59d1cf0d8ee23114b54112c271af400 /src | |
parent | be3bbfb4728669698ad7dabb5e0d8648d31a43a8 (diff) | |
download | gnunet-99f8204531ebb4d388eec7919afd4b7a3ae0b096.tar.gz gnunet-99f8204531ebb4d388eec7919afd4b7a3ae0b096.zip |
fix: GNUNET_is_zero(ptr) should return enum GNUNET_GenericReturnValue. Fixes #6475.
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/ats_api_performance.c | 2 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.c | 2 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.c | 2 | ||||
-rw-r--r-- | src/include/gnunet_common.h | 6 | ||||
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 4 | ||||
-rw-r--r-- | src/namestore/namestore_api_monitor.c | 2 | ||||
-rw-r--r-- | src/transport/gnunet-service-tng.c | 2 | ||||
-rw-r--r-- | src/util/common_allocation.c | 8 | ||||
-rw-r--r-- | src/util/service.c | 2 | ||||
-rw-r--r-- | src/util/test_peer.c | 3 |
10 files changed, 16 insertions, 17 deletions
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c index acc9356ed..7349fb989 100644 --- a/src/ats/ats_api_performance.c +++ b/src/ats/ats_api_performance.c | |||
@@ -496,7 +496,7 @@ handle_address_list (void *cls, | |||
496 | return; /* was canceled */ | 496 | return; /* was canceled */ |
497 | 497 | ||
498 | memset (&allzeros, '\0', sizeof(allzeros)); | 498 | memset (&allzeros, '\0', sizeof(allzeros)); |
499 | if ((0 == GNUNET_is_zero (&pi->peer)) && | 499 | if ((GNUNET_YES == GNUNET_is_zero (&pi->peer)) && |
500 | (0 == plugin_name_length) && | 500 | (0 == plugin_name_length) && |
501 | (0 == plugin_address_length)) | 501 | (0 == plugin_address_length)) |
502 | { | 502 | { |
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index e8a95c65e..3cd831a39 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c | |||
@@ -685,7 +685,7 @@ GAS_handle_request_address_list (struct GNUNET_SERVICE_Client *client, | |||
685 | memset (&allzeros, | 685 | memset (&allzeros, |
686 | '\0', | 686 | '\0', |
687 | sizeof(struct GNUNET_PeerIdentity)); | 687 | sizeof(struct GNUNET_PeerIdentity)); |
688 | if (0 == GNUNET_is_zero (&alrm->peer)) | 688 | if (GNUNET_YES == GNUNET_is_zero (&alrm->peer)) |
689 | { | 689 | { |
690 | /* Return addresses for all peers */ | 690 | /* Return addresses for all peers */ |
691 | GAS_addresses_get_peer_info (NULL, | 691 | GAS_addresses_get_peer_info (NULL, |
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index a2068b31b..221364c5d 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -245,7 +245,7 @@ GCP_2s (const struct CadetPeer *cp) | |||
245 | char *ret; | 245 | char *ret; |
246 | 246 | ||
247 | if ((NULL == cp) || | 247 | if ((NULL == cp) || |
248 | (0 == GNUNET_is_zero (&cp->pid.public_key))) | 248 | (GNUNET_YES == GNUNET_is_zero (&cp->pid.public_key))) |
249 | return "NULL"; | 249 | return "NULL"; |
250 | 250 | ||
251 | ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&cp->pid.public_key); | 251 | ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&cp->pid.public_key); |
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index b2f99cd55..fcaae1026 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -1173,9 +1173,9 @@ GNUNET_memcmp_ct_ (const void *b1, | |||
1173 | * @param a pointer to @a n bytes which should be tested for the | 1173 | * @param a pointer to @a n bytes which should be tested for the |
1174 | * entire memory being zero'ed out. | 1174 | * entire memory being zero'ed out. |
1175 | * @param n number of bytes in @a to be tested | 1175 | * @param n number of bytes in @a to be tested |
1176 | * @return 0 if a is zero, non-zero otherwise | 1176 | * @return GNUNET_YES if a is zero, GNUNET_NO otherwise |
1177 | */ | 1177 | */ |
1178 | int | 1178 | enum GNUNET_GenericReturnValue |
1179 | GNUNET_is_zero_ (const void *a, | 1179 | GNUNET_is_zero_ (const void *a, |
1180 | size_t n); | 1180 | size_t n); |
1181 | 1181 | ||
@@ -1185,7 +1185,7 @@ GNUNET_is_zero_ (const void *a, | |||
1185 | * | 1185 | * |
1186 | * @param a pointer to a struct which should be tested for the | 1186 | * @param a pointer to a struct which should be tested for the |
1187 | * entire memory being zero'ed out. | 1187 | * entire memory being zero'ed out. |
1188 | * @return 0 if a is zero, non-zero otherwise | 1188 | * @return GNUNET_YES if a is zero, GNUNET_NO otherwise |
1189 | */ | 1189 | */ |
1190 | #define GNUNET_is_zero(a) \ | 1190 | #define GNUNET_is_zero(a) \ |
1191 | GNUNET_is_zero_ (a, sizeof (*a)) | 1191 | GNUNET_is_zero_ (a, sizeof (*a)) |
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index bb8138e23..b24bb2952 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -1809,7 +1809,7 @@ run_zone_iteration_round (struct ZoneIteration *zi, uint64_t limit) | |||
1809 | start = GNUNET_TIME_absolute_get (); | 1809 | start = GNUNET_TIME_absolute_get (); |
1810 | GNUNET_break (GNUNET_SYSERR != | 1810 | GNUNET_break (GNUNET_SYSERR != |
1811 | GSN_database->iterate_records (GSN_database->cls, | 1811 | GSN_database->iterate_records (GSN_database->cls, |
1812 | (0 == GNUNET_is_zero (&zi->zone)) | 1812 | (GNUNET_YES == GNUNET_is_zero (&zi->zone)) |
1813 | ? NULL | 1813 | ? NULL |
1814 | : &zi->zone, | 1814 | : &zi->zone, |
1815 | zi->seq, | 1815 | zi->seq, |
@@ -2083,7 +2083,7 @@ monitor_iteration_next (void *cls) | |||
2083 | else | 2083 | else |
2084 | zm->iteration_cnt = zm->limit; /* use it all */ | 2084 | zm->iteration_cnt = zm->limit; /* use it all */ |
2085 | ret = GSN_database->iterate_records (GSN_database->cls, | 2085 | ret = GSN_database->iterate_records (GSN_database->cls, |
2086 | (0 == GNUNET_is_zero (&zm->zone)) | 2086 | (GNUNET_YES == GNUNET_is_zero (&zm->zone)) |
2087 | ? NULL | 2087 | ? NULL |
2088 | : &zm->zone, | 2088 | : &zm->zone, |
2089 | zm->seq, | 2089 | zm->seq, |
diff --git a/src/namestore/namestore_api_monitor.c b/src/namestore/namestore_api_monitor.c index ab6140328..9dc955544 100644 --- a/src/namestore/namestore_api_monitor.c +++ b/src/namestore/namestore_api_monitor.c | |||
@@ -139,7 +139,7 @@ check_result (void *cls, const struct RecordResultMessage *lrm) | |||
139 | 139 | ||
140 | (void) cls; | 140 | (void) cls; |
141 | if ((0 != GNUNET_memcmp (&lrm->private_key, &zm->zone)) && | 141 | if ((0 != GNUNET_memcmp (&lrm->private_key, &zm->zone)) && |
142 | (0 != GNUNET_is_zero (&zm->zone))) | 142 | (GNUNET_NO == GNUNET_is_zero (&zm->zone))) |
143 | { | 143 | { |
144 | GNUNET_break (0); | 144 | GNUNET_break (0); |
145 | return GNUNET_SYSERR; | 145 | return GNUNET_SYSERR; |
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c index baefdfa88..2f6e17f3b 100644 --- a/src/transport/gnunet-service-tng.c +++ b/src/transport/gnunet-service-tng.c | |||
@@ -3209,7 +3209,7 @@ notify_monitors (const struct GNUNET_PeerIdentity *peer, | |||
3209 | continue; | 3209 | continue; |
3210 | if (tc->details.monitor.one_shot) | 3210 | if (tc->details.monitor.one_shot) |
3211 | continue; | 3211 | continue; |
3212 | if ((0 != GNUNET_is_zero (&tc->details.monitor.peer)) && | 3212 | if ((GNUNET_NO == GNUNET_is_zero (&tc->details.monitor.peer)) && |
3213 | (0 != GNUNET_memcmp (&tc->details.monitor.peer, peer))) | 3213 | (0 != GNUNET_memcmp (&tc->details.monitor.peer, peer))) |
3214 | continue; | 3214 | continue; |
3215 | notify_monitor (tc, peer, address, nt, me); | 3215 | notify_monitor (tc, peer, address, nt, me); |
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c index 4aad49777..a404a1627 100644 --- a/src/util/common_allocation.c +++ b/src/util/common_allocation.c | |||
@@ -538,9 +538,9 @@ GNUNET_copy_message (const struct GNUNET_MessageHeader *msg) | |||
538 | * @param a pointer to @a n bytes which should be tested for the | 538 | * @param a pointer to @a n bytes which should be tested for the |
539 | * entire memory being zero'ed out. | 539 | * entire memory being zero'ed out. |
540 | * @param n number of bytes in @a to be tested | 540 | * @param n number of bytes in @a to be tested |
541 | * @return 0 if a is zero, non-zero otherwise | 541 | * @return GNUNET_YES if a is zero, GNUNET_NO otherwise |
542 | */ | 542 | */ |
543 | int | 543 | enum GNUNET_GenericReturnValue |
544 | GNUNET_is_zero_ (const void *a, | 544 | GNUNET_is_zero_ (const void *a, |
545 | size_t n) | 545 | size_t n) |
546 | { | 546 | { |
@@ -548,8 +548,8 @@ GNUNET_is_zero_ (const void *a, | |||
548 | 548 | ||
549 | for (size_t i = 0; i < n; i++) | 549 | for (size_t i = 0; i < n; i++) |
550 | if (b[i]) | 550 | if (b[i]) |
551 | return 1; | 551 | return GNUNET_NO; |
552 | return 0; | 552 | return GNUNET_YES; |
553 | } | 553 | } |
554 | 554 | ||
555 | 555 | ||
diff --git a/src/util/service.c b/src/util/service.c index e6bbe855f..ddd31181d 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -473,7 +473,7 @@ check_ipv6_listed (const struct GNUNET_STRINGS_IPv6NetworkPolicy *list, | |||
473 | return GNUNET_NO; | 473 | return GNUNET_NO; |
474 | i = 0; | 474 | i = 0; |
475 | NEXT: | 475 | NEXT: |
476 | while (0 != GNUNET_is_zero (&list[i].network)) | 476 | while (GNUNET_NO == GNUNET_is_zero (&list[i].network)) |
477 | { | 477 | { |
478 | for (unsigned int j = 0; j < sizeof(struct in6_addr) / sizeof(int); j++) | 478 | for (unsigned int j = 0; j < sizeof(struct in6_addr) / sizeof(int); j++) |
479 | if (((((int *) ip)[j] & ((int *) &list[i].netmask)[j])) != | 479 | if (((((int *) ip)[j] & ((int *) &list[i].netmask)[j])) != |
diff --git a/src/util/test_peer.c b/src/util/test_peer.c index 320746c76..bb0bc48dc 100644 --- a/src/util/test_peer.c +++ b/src/util/test_peer.c | |||
@@ -106,8 +106,7 @@ check () | |||
106 | * is expected to be set to zero | 106 | * is expected to be set to zero |
107 | */GNUNET_log_skip (1, GNUNET_YES); | 107 | */GNUNET_log_skip (1, GNUNET_YES); |
108 | GNUNET_PEER_resolve (0, &res); | 108 | GNUNET_PEER_resolve (0, &res); |
109 | GNUNET_assert (0 == | 109 | GNUNET_assert (GNUNET_YES == GNUNET_is_zero (&res)); |
110 | GNUNET_is_zero (&res)); | ||
111 | 110 | ||
112 | /* Removing peer entries 1 and 3 from table using the list decrement function */ | 111 | /* Removing peer entries 1 and 3 from table using the list decrement function */ |
113 | /* If count = 0, nothing should be done whatsoever */ | 112 | /* If count = 0, nothing should be done whatsoever */ |