Minor clean-ups noticed during string-parsing improvements

Simplify a conditional to save some repetition, purge some spurious
parentheses.

Change-Id: I727d22ce81733e765c4ee951475ccdb599063399
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Edward Welbourne 2021-08-27 16:01:06 +02:00
parent 9c58870423
commit dd5fc20e90
2 changed files with 3 additions and 5 deletions

View File

@ -115,10 +115,8 @@ static bool parseIp4Internal(IPv4Address &address, const char *ptr, bool acceptL
}
address |= x;
if (dotCount == 3 && *endptr != '\0')
return false;
else if (dotCount == 3 || *endptr == '\0')
return true;
if (dotCount == 3 || *endptr == '\0')
return *endptr == '\0';
if (*endptr != '.')
return false;

View File

@ -452,7 +452,7 @@ static QVersionNumber from_string(QLatin1String string, qsizetype *suffixIndex)
seg.append(int(value));
start = end + 1;
lastGoodEnd = end;
} while (start < endOfString && (end < endOfString && *end == '.'));
} while (start < endOfString && end < endOfString && *end == '.');
if (suffixIndex)
*suffixIndex = lastGoodEnd - string.begin();