diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-03-03 10:12:53 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-03-03 10:12:53 +0100 |
commit | b28847dc83950fffad1c91672dc5c2c6a3d79c38 (patch) | |
tree | e29115822c078e56ef177b77bf2e5b3721bfa50a | |
parent | 0c7c8cb1641d227a446da6e5e509c080f8b0f26d (diff) |
revert to simpler size_t, add minimal test for parsing '::1;' policy
-rw-r--r-- | src/lib/util/gnunet_error_codes.c | 1 | ||||
-rw-r--r-- | src/lib/util/strings.c | 26 | ||||
-rw-r--r-- | src/lib/util/test_strings.c | 7 |
3 files changed, 19 insertions, 15 deletions
diff --git a/src/lib/util/gnunet_error_codes.c b/src/lib/util/gnunet_error_codes.c index c286f2e52..11ce2d0c8 100644 --- a/src/lib/util/gnunet_error_codes.c +++ b/src/lib/util/gnunet_error_codes.c @@ -17,7 +17,6 @@ SPDX-License-Identifier: AGPL3.0-or-later */ -#include "platform.h" #include "gnunet_error_codes.h" #include <stddef.h> #include <microhttpd.h> diff --git a/src/lib/util/strings.c b/src/lib/util/strings.c index da899f124..fe7a030dd 100644 --- a/src/lib/util/strings.c +++ b/src/lib/util/strings.c @@ -37,7 +37,7 @@ #define LOG(kind, ...) GNUNET_log_from (kind, "util-strings", __VA_ARGS__) #define LOG_STRERROR(kind, syscall) \ - GNUNET_log_from_strerror (kind, "util-strings", syscall) + GNUNET_log_from_strerror (kind, "util-strings", syscall) size_t @@ -1504,8 +1504,8 @@ GNUNET_STRINGS_parse_ipv6_policy (const char *routeListX) pos = 0; for (size_t i = 0; i < count; i++) { - ssize_t start; - ssize_t slash; + size_t start; + size_t slash; start = pos; while (';' != routeList[pos]) @@ -1699,7 +1699,7 @@ GNUNET_STRINGS_base64url_encode (const void *in, #define cvtfind(a) \ - ((((a) >= 'A') && ((a) <= 'Z')) \ + ((((a) >= 'A') && ((a) <= 'Z')) \ ? (a) - 'A' \ : (((a) >= 'a') && ((a) <= 'z')) \ ? (a) - 'a' + 26 \ @@ -1709,15 +1709,15 @@ GNUNET_STRINGS_base64url_encode (const void *in, #define CHECK_CRLF \ - while ( (data[i] == '\r') || (data[i] == '\n') ) \ - { \ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, \ - "ignoring CR/LF\n"); \ - i++; \ - if (i >= len) { \ - goto END; \ - } \ - } + while ( (data[i] == '\r') || (data[i] == '\n') ) \ + { \ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, \ + "ignoring CR/LF\n"); \ + i++; \ + if (i >= len) { \ + goto END; \ + } \ + } size_t diff --git a/src/lib/util/test_strings.c b/src/lib/util/test_strings.c index b39028f45..806324be3 100644 --- a/src/lib/util/test_strings.c +++ b/src/lib/util/test_strings.c @@ -43,7 +43,7 @@ #define URLENCODE_TEST_VECTOR_PLAIN "Asbjlaw=ljsdlasjd?人aslkdsa" #define URLENCODE_TEST_VECTOR_ENCODED \ - "Asbjlaw\%3Dljsdlasjd\%3F\%E4\%BA\%BAaslkdsa" + "Asbjlaw\%3Dljsdlasjd\%3F\%E4\%BA\%BAaslkdsa" int main (int argc, char *argv[]) @@ -57,6 +57,11 @@ main (int argc, char *argv[]) struct GNUNET_TIME_Relative rt; struct GNUNET_TIME_Relative rtx; const char *hdir; + struct GNUNET_STRINGS_IPv6NetworkPolicy *pol; + + pol = GNUNET_STRINGS_parse_ipv6_policy ("::1;"); + GNUNET_assert (NULL != pol); + GNUNET_free (pol); GNUNET_log_setup ("test_strings", "ERROR", NULL); sprintf (buf, "4 %s", _ (/* size unit */ "b")); |