OSDN Git Service

remove redundant QLocalePrivate::bytearrayToLongLong() argument
authorIvailo Monev <xakepa10@gmail.com>
Mon, 18 Jan 2021 11:00:51 +0000 (13:00 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Mon, 18 Jan 2021 11:06:15 +0000 (13:06 +0200)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/core/tools/qlocale.cpp
src/core/tools/qlocale_p.h
src/gui/widgets/qvalidator.cpp

index efa5034..f3d31a9 100644 (file)
@@ -2772,13 +2772,11 @@ double QLocalePrivate::bytearrayToDouble(const char *num, bool *ok, bool *overfl
     return ret;
 }
 
-qlonglong QLocalePrivate::bytearrayToLongLong(const char *num, int base, bool *ok, bool *overflow)
+qlonglong QLocalePrivate::bytearrayToLongLong(const char *num, int base, bool *ok)
 {
     if (*num == '\0') {
         if (ok != Q_NULLPTR)
             *ok = false;
-        if (overflow != Q_NULLPTR)
-            *overflow = false;
         return 0;
     }
 
@@ -2787,11 +2785,6 @@ qlonglong QLocalePrivate::bytearrayToLongLong(const char *num, int base, bool *o
     if ((ret == LLONG_MIN || ret == LLONG_MAX) && (errno == ERANGE || errno == EINVAL)) {
         if (ok != Q_NULLPTR)
             *ok = false;
-        if (overflow != Q_NULLPTR) {
-            // the only way qstrtoll can fail with *endptr != '\0' on a non-empty
-            // input string is overflow
-            *overflow = *endptr != '\0';
-        }
         return 0;
     }
 
@@ -2799,15 +2792,11 @@ qlonglong QLocalePrivate::bytearrayToLongLong(const char *num, int base, bool *o
         // we stopped at a non-digit character after converting some digits
         if (ok != Q_NULLPTR)
             *ok = false;
-        if (overflow != Q_NULLPTR)
-            *overflow = false;
         return 0;
     }
 
     if (ok != Q_NULLPTR)
         *ok = true;
-    if (overflow != Q_NULLPTR)
-        *overflow = false;
     return ret;
 }
 
index 2e693e9..171607d 100644 (file)
@@ -141,7 +141,7 @@ public:
 
 
     static double bytearrayToDouble(const char *num, bool *ok, bool *overflow = Q_NULLPTR);
-    static qint64 bytearrayToLongLong(const char *num, int base, bool *ok, bool *overflow = Q_NULLPTR);
+    static qint64 bytearrayToLongLong(const char *num, int base, bool *ok);
     static quint64 bytearrayToUnsLongLong(const char *num, int base, bool *ok);
 
     typedef QVarLengthArray<char, 256> CharBuff;
index bb78932..4da9623 100644 (file)
@@ -343,9 +343,9 @@ QValidator::State QIntValidator::validate(QString & input, int&) const
     if (buff.size() == 1 && (buff.at(0) == '+' || buff.at(0) == '-'))
         return Intermediate;
 
-    bool ok, overflow;
-    qlonglong entered = QLocalePrivate::bytearrayToLongLong(buff.constData(), 10, &ok, &overflow);
-    if (overflow || !ok)
+    bool ok;
+    qlonglong entered = QLocalePrivate::bytearrayToLongLong(buff.constData(), 10, &ok);
+    if (!ok)
         return Invalid;
 
     if (entered >= b && entered <= t) {
@@ -371,9 +371,9 @@ void QIntValidator::fixup(QString &input) const
         if (!cl.d()->validateChars(input, QLocalePrivate::IntegerMode, &buff))
             return;
     }
-    bool ok, overflow;
-    qlonglong entered = QLocalePrivate::bytearrayToLongLong(buff.constData(), 10, &ok, &overflow);
-    if (ok && !overflow)
+    bool ok;
+    qlonglong entered = QLocalePrivate::bytearrayToLongLong(buff.constData(), 10, &ok);
+    if (ok)
         input = locale().toString(entered);
 }