From 700accb3c78eb919d9c05eacad12cf3cbdb1a8a5 Mon Sep 17 00:00:00 2001 From: iphydf Date: Tue, 9 Oct 2018 01:00:19 +0000 Subject: Use `bool` for IPv6 flag in test programs and `DHT_bootstrap`. --- other/DHT_bootstrap.c | 2 +- testing/DHT_test.c | 2 +- testing/Messenger_test.c | 2 +- testing/misc_tools.c | 6 +++--- testing/misc_tools.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c index 9cbcca62..2c47ee8f 100644 --- a/other/DHT_bootstrap.c +++ b/other/DHT_bootstrap.c @@ -137,7 +137,7 @@ int main(int argc, char *argv[]) } /* let user override default by cmdline */ - uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; /* x */ + bool ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; /* x */ int argvoffset = cmdline_parsefor_ipv46(argc, argv, &ipv6enabled); if (argvoffset < 0) { diff --git a/testing/DHT_test.c b/testing/DHT_test.c index c2d6fe66..7e9a4a5f 100644 --- a/testing/DHT_test.c +++ b/testing/DHT_test.c @@ -177,7 +177,7 @@ int main(int argc, char *argv[]) } /* let user override default by cmdline */ - uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; /* x */ + bool ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; /* x */ int argvoffset = cmdline_parsefor_ipv46(argc, argv, &ipv6enabled); if (argvoffset < 0) { diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c index 70ee6578..5abb3998 100644 --- a/testing/Messenger_test.c +++ b/testing/Messenger_test.c @@ -92,7 +92,7 @@ static void print_request(Messenger *m2, const uint8_t *public_key, const uint8_ int main(int argc, char *argv[]) { /* let user override default by cmdline */ - uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; /* x */ + bool ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; /* x */ int argvoffset = cmdline_parsefor_ipv46(argc, argv, &ipv6enabled); if (argvoffset < 0) { diff --git a/testing/misc_tools.c b/testing/misc_tools.c index 8991a222..22fa0d0c 100644 --- a/testing/misc_tools.c +++ b/testing/misc_tools.c @@ -121,7 +121,7 @@ int tox_strncasecmp(const char *s1, const char *s2, size_t n) return 0; } -int cmdline_parsefor_ipv46(int argc, char **argv, uint8_t *ipv6enabled) +int cmdline_parsefor_ipv46(int argc, char **argv, bool *ipv6enabled) { int argvoffset = 0, argi; @@ -131,9 +131,9 @@ int cmdline_parsefor_ipv46(int argc, char **argv, uint8_t *ipv6enabled) char c = argv[argi][5]; if (c == '4') { - *ipv6enabled = 0; + *ipv6enabled = false; } else if (c == '6') { - *ipv6enabled = 1; + *ipv6enabled = true; } else { printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]); return -1; diff --git a/testing/misc_tools.h b/testing/misc_tools.h index e7060551..b9c3ca3e 100644 --- a/testing/misc_tools.h +++ b/testing/misc_tools.h @@ -15,7 +15,7 @@ void c_sleep(uint32_t x); uint8_t *hex_string_to_bin(const char *hex_string); void to_hex(char *out, uint8_t *in, int size); int tox_strncasecmp(const char *s1, const char *s2, size_t n); -int cmdline_parsefor_ipv46(int argc, char **argv, uint8_t *ipv6enabled); +int cmdline_parsefor_ipv46(int argc, char **argv, bool *ipv6enabled); void print_debug_log(Tox *m, Tox_Log_Level level, const char *file, uint32_t line, const char *func, const char *message, void *user_data); -- cgit v1.2.3