diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-08-27 16:01:06 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2022-03-03 18:50:59 +0100 |
commit | dd5fc20e902187356538d1c993d9ece729f6f505 (patch) | |
tree | afecfbc5076d51a4c0c295e7aa2b3b6ca08fc4ad /src | |
parent | 9c588704237e924a8e2e45c37abd74ca82c1068a (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qipaddress.cpp | 6 | ||||
-rw-r--r-- | src/corelib/tools/qversionnumber.cpp | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/src/corelib/io/qipaddress.cpp b/src/corelib/io/qipaddress.cpp index 93a74ccd09..911d1a54b9 100644 --- a/src/corelib/io/qipaddress.cpp +++ b/src/corelib/io/qipaddress.cpp @@ -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; diff --git a/src/corelib/tools/qversionnumber.cpp b/src/corelib/tools/qversionnumber.cpp index 1d05fdd89c..466a8cc64e 100644 --- a/src/corelib/tools/qversionnumber.cpp +++ b/src/corelib/tools/qversionnumber.cpp @@ -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(); |