From 940b36850d8b825493615ac6cf1a7c382a76a214 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 25 Apr 2017 09:19:35 +0200 Subject: QLocaleData: remove unused bool *overflow arguments ... from bytearrayToDouble() and bytearrayToLongLong() (bytearrayToUnsLongLong() didn't have one). The only user, QIntValidator, always checked them in conjunction with 'ok'. Since 'overflow' was true only if 'ok' was false, too, there's no point in carrying both. We can bring this code back with QParsedNumber, when it will not cost anything anymore. I actually was hoping that the overflow argument would inform the design of QParsedNumber, but it turned out to be unused, leading to this commit instead. Change-Id: I841d0d1cc36c13c5425ac0338323721d90b3b24c Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- src/corelib/tools/qlocale.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'src/corelib/tools/qlocale.cpp') diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index d5a024177d..0a573e77dc 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -3564,7 +3564,7 @@ qulonglong QLocaleData::stringToUnsLongLong(QStringView str, int base, bool *ok, return bytearrayToUnsLongLong(buff.constData(), base, ok); } -double QLocaleData::bytearrayToDouble(const char *num, bool *ok, bool *overflow) +double QLocaleData::bytearrayToDouble(const char *num, bool *ok) { bool nonNullOk = false; int len = static_cast(strlen(num)); @@ -3573,12 +3573,10 @@ double QLocaleData::bytearrayToDouble(const char *num, bool *ok, bool *overflow) double d = asciiToDouble(num, len, nonNullOk, processed); if (ok) *ok = nonNullOk; - if (overflow) - *overflow = processed < len; return d; } -qlonglong QLocaleData::bytearrayToLongLong(const char *num, int base, bool *ok, bool *overflow) +qlonglong QLocaleData::bytearrayToLongLong(const char *num, int base, bool *ok) { bool _ok; const char *endptr; @@ -3586,8 +3584,6 @@ qlonglong QLocaleData::bytearrayToLongLong(const char *num, int base, bool *ok, if (*num == '\0') { if (ok != 0) *ok = false; - if (overflow != 0) - *overflow = false; return 0; } @@ -3596,11 +3592,6 @@ qlonglong QLocaleData::bytearrayToLongLong(const char *num, int base, bool *ok, if (!_ok) { if (ok != 0) *ok = false; - if (overflow != 0) { - // the only way qstrtoll can fail with *endptr != '\0' on a non-empty - // input string is overflow - *overflow = *endptr != '\0'; - } return 0; } @@ -3608,15 +3599,11 @@ qlonglong QLocaleData::bytearrayToLongLong(const char *num, int base, bool *ok, // we stopped at a non-digit character after converting some digits if (ok != 0) *ok = false; - if (overflow != 0) - *overflow = false; return 0; } if (ok != 0) *ok = true; - if (overflow != 0) - *overflow = false; return l; } -- cgit v1.2.3