if (!address.string[i]) continue;
if ((uint16_t) (address.string[i] - 'a') < 6 || (uint16_t) (address.string[i] - 'A') < 6 || (uint16_t) (address.string[i] - '0') < 10) {
- if (address.string[i] < f_string_ascii_0_s.string[0] || address.string[i] > f_string_ascii_9_s.string[0]) {
+ if ((uint16_t) (address.string[i] - '0') > 9) {
flag = 0x1;
}
continue;
}
- if (address.string[i] == f_string_ascii_period_s.string[0]) {
+ if (address.string[i] == '.') {
// An IPv4 looking address with a hexidecimal letter.
if (flag & 0x1) {
break;
}
- if (address.string[i] == f_string_ascii_colon_s.string[0]) {
+ if (address.string[i] == ':') {
flag = 0x1;
count = 0;
break;
}
- if (address.string[i] == f_string_ascii_bracket_open_s.string[0]) {
+ if (address.string[i] == '[') {
if (flag) {
state->status = F_false;
if (++count > 4) return;
if (flag & 0x4) {
- if (address.string[i] < f_string_ascii_0_s.string[0] || address.string[i] > f_string_ascii_9_s.string[0] || count > 3) return;
+ if ((uint16_t) (address.string[i] - '0') > 9 || count > 3) return;
}
}
- else if (address.string[i] == f_string_ascii_colon_s.string[0]) {
+ else if (address.string[i] == ':') {
if (flag & 0x4) return;
at.start_2 = i + 1;
if (at.start_2 == address.used) return;
- if (address.string[at.start_2] == f_string_ascii_colon_s.string[0]) {
+ if (address.string[at.start_2] == ':') {
if (flag & 0x8) return;
flag |= 0x8;
}
// Colons must be followed by a hexidecimal digit.
- if (!((uint16_t) (address.string[at.start_2] - 'a') < 6 || (uint16_t) (address.string[at.start_2] - 'A') < 6 || (uint16_t) (address.string[at.start_2] - '0') < 10)) return;
+ if ((uint16_t) (address.string[at.start_2] - 'a') > 5 && (uint16_t) (address.string[at.start_2] - 'A') > 5 && (uint16_t) (address.string[at.start_2] - '0') > 9) return;
// When double-colons lead, then set the start position at this digit.
if (!count && !set) {
count = 0;
at.start_2 = 1;
}
- else if (address.string[i] == f_string_ascii_slash_forward_s.string[0]) {
+ else if (address.string[i] == '/') {
if (flag & 0x4) return;
flag |= 0x4;
}
- else if (address.string[i] == f_string_ascii_bracket_close_s.string[0]) {
+ else if (address.string[i] == ']') {
if (!(flag & 0x2)) return;
at.stop_1 = i - 1;
} // for
if (at.start_2 < address.used) {
- if (address.string[at.start_2] == f_string_ascii_colon_s.string[0]) {
+ if (address.string[at.start_2] == ':') {
// Skip past NULL characters.
while (++at.start_2 < address.used && !address.string[at.start_2]) {
}
if (!address.string[at.stop_2]) continue;
- if ((uint16_t) (address.string[at.stop_2] - '0') < 10) return;
+ if ((uint16_t) (address.string[at.stop_2] - '0') > 9) return;
} // for
// The double colon either must exist when set is smaller than 7 or the double colon must not exist at all.
if (++count > 3) return;
}
}
- else if (address.string[i] == f_string_ascii_period_s.string[0]) {
+ else if (address.string[i] == '.') {
if ((flag & 0x6) || !count || ++set > 3) return;
count = 0;
}
- else if (address.string[i] == f_string_ascii_colon_s.string[0]) {
+ else if (address.string[i] == ':') {
if (set != 3 || (flag & 0x2)) return;
// The address ends before the colon.
// Save the position that might represent the start of the port number.
at.start_2 = i + 1;
}
- else if (address.string[i] == f_string_ascii_slash_forward_s.string[0]) {
+ else if (address.string[i] == '/') {
if ((flag & 0x4) || set != 3) return;
flag |= 0x4;