diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-08-27 15:48:12 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-08-30 17:46:00 +0200 |
commit | 88b54cc22a45f9724c201e7249ac79deb55ff48a (patch) | |
tree | e6538e9bc7f6633ffbd7868c10e85923e84f6d35 /src/gui/util | |
parent | 7d33779a795afb54af1a96c0da93b532f9db3ba2 (diff) |
Rework QLocalePrivate::bytearrayToU?LongLong()
Change it to take a QByteArrayView instead of a plain char *; all its
callers do know the size and propagating it enables the implementation
to call strntou?ll() rather than strtou?ll(), thereby escaping the
need for '\0'-termination.
Fixes: QTBUG-74286
Change-Id: Ie9394786e9fcf25c1d1be2421805f47c018d13bb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: MĂ„rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/gui/util')
-rw-r--r-- | src/gui/util/qvalidator.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp index f15057801b..95d8b2a542 100644 --- a/src/gui/util/qvalidator.cpp +++ b/src/gui/util/qvalidator.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Copyright (C) 2012 KlarÀlvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> ** Contact: https://www.qt.io/licensing/ ** @@ -421,7 +421,7 @@ QValidator::State QIntValidator::validate(QString & input, int&) const return Intermediate; bool ok; - qlonglong entered = QLocaleData::bytearrayToLongLong(buff.constData(), 10, &ok); + qlonglong entered = QLocaleData::bytearrayToLongLong(buff, 10, &ok); if (!ok) return Invalid; @@ -456,7 +456,7 @@ void QIntValidator::fixup(QString &input) const return; } bool ok; - qlonglong entered = QLocaleData::bytearrayToLongLong(buff.constData(), 10, &ok); + qlonglong entered = QLocaleData::bytearrayToLongLong(buff, 10, &ok); if (ok) input = locale().toString(entered); } |