diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 13:23:58 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:54:55 +0200 |
commit | 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch) | |
tree | a27e497da7104dd0a64f98a04fa3067668735e91 /core/io/ip_address.cpp | |
parent | 710b34b70227becdc652b4ae027fe0ac47409642 (diff) |
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.
This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.
There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).
Part of #33027.
Diffstat (limited to 'core/io/ip_address.cpp')
-rw-r--r-- | core/io/ip_address.cpp | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/core/io/ip_address.cpp b/core/io/ip_address.cpp index f5fd8ae205..817c2f060a 100644 --- a/core/io/ip_address.cpp +++ b/core/io/ip_address.cpp @@ -39,7 +39,6 @@ IP_Address::operator Variant() const { #include <string.h> IP_Address::operator String() const { - if (wildcard) return "*"; @@ -61,10 +60,8 @@ IP_Address::operator String() const { } static void _parse_hex(const String &p_string, int p_start, uint8_t *p_dst) { - uint16_t ret = 0; for (int i = p_start; i < p_start + 4; i++) { - if (i >= p_string.length()) { break; }; @@ -72,7 +69,6 @@ static void _parse_hex(const String &p_string, int p_start, uint8_t *p_dst) { int n = 0; CharType c = p_string[i]; if (c >= '0' && c <= '9') { - n = c - '0'; } else if (c >= 'a' && c <= 'f') { n = 10 + (c - 'a'); @@ -92,7 +88,6 @@ static void _parse_hex(const String &p_string, int p_start, uint8_t *p_dst) { }; void IP_Address::_parse_ipv6(const String &p_string) { - static const int parts_total = 8; int parts[parts_total] = { 0 }; int parts_count = 0; @@ -102,10 +97,8 @@ void IP_Address::_parse_ipv6(const String &p_string) { int parts_idx = 0; for (int i = 0; i < p_string.length(); i++) { - CharType c = p_string[i]; if (c == ':') { - if (i == 0) { continue; // next must be a ":" }; @@ -115,7 +108,6 @@ void IP_Address::_parse_ipv6(const String &p_string) { }; part_found = false; } else if (c == '.') { - part_ipv4 = true; } else if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')) { @@ -136,9 +128,7 @@ void IP_Address::_parse_ipv6(const String &p_string) { int idx = 0; for (int i = 0; i < parts_idx; i++) { - if (parts[i] == -1) { - for (int j = 0; j < parts_extra; j++) { field16[idx++] = 0; }; @@ -154,7 +144,6 @@ void IP_Address::_parse_ipv6(const String &p_string) { }; void IP_Address::_parse_ipv4(const String &p_string, int p_start, uint8_t *p_ret) { - String ip; if (p_start != 0) { ip = p_string.substr(p_start, p_string.length() - p_start); @@ -170,7 +159,6 @@ void IP_Address::_parse_ipv4(const String &p_string, int p_start, uint8_t *p_ret }; void IP_Address::clear() { - memset(&field8[0], 0, sizeof(field8)); valid = false; wildcard = false; @@ -204,7 +192,6 @@ void IP_Address::set_ipv6(const uint8_t *p_buf) { } IP_Address::IP_Address(const String &p_string) { - clear(); if (p_string == "*") { @@ -228,7 +215,6 @@ IP_Address::IP_Address(const String &p_string) { } _FORCE_INLINE_ static void _32_to_buf(uint8_t *p_dst, uint32_t p_n) { - p_dst[0] = (p_n >> 24) & 0xff; p_dst[1] = (p_n >> 16) & 0xff; p_dst[2] = (p_n >> 8) & 0xff; @@ -236,7 +222,6 @@ _FORCE_INLINE_ static void _32_to_buf(uint8_t *p_dst, uint32_t p_n) { }; IP_Address::IP_Address(uint32_t p_a, uint32_t p_b, uint32_t p_c, uint32_t p_d, bool is_v6) { - clear(); valid = true; if (!is_v6) { @@ -247,7 +232,6 @@ IP_Address::IP_Address(uint32_t p_a, uint32_t p_b, uint32_t p_c, uint32_t p_d, b field8[14] = p_c; field8[15] = p_d; } else { - _32_to_buf(&field8[0], p_a); _32_to_buf(&field8[4], p_b); _32_to_buf(&field8[8], p_c); |