diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2021-07-05 20:10:07 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2021-07-06 16:30:52 +0200 |
commit | de18b3ff370543b5b99bd068b871a2cd677cf9f3 (patch) | |
tree | 2cd67bd934657e2ce92a08af00e73e604d86f02b /tests/auto/corelib/tools | |
parent | 85831bcfe6ce36740c524d641ada79c65aadd89b (diff) |
QCryptographicHash: port addData() to QByteArrayView
Incl. the static hash() function. Remove the QByteArray versions from
the API, but not the ABI.
Adapt some callers.
[ChangeLog][QtCore][QCryptographicHash] Replaced QByteArray with
QByteArrayView in addData() and static hash() functions.
Change-Id: Ia0e9bf726276305e05894d323d76a29e985f39eb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r-- | tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp b/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp index 92a2c3516c..a943280996 100644 --- a/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp +++ b/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp @@ -425,7 +425,7 @@ void tst_QCryptographicHash::hashLength() { QFETCH(const QCryptographicHash::Algorithm, algorithm); - QByteArray output = QCryptographicHash::hash(QByteArrayLiteral("test"), algorithm); + QByteArray output = QCryptographicHash::hash("test", algorithm); QCOMPARE(QCryptographicHash::hashLength(algorithm), output.length()); } @@ -480,22 +480,22 @@ void tst_QCryptographicHash::moreThan4GiBOfData() qDebug() << algorithm << "test finished in" << timer.restart() << "ms"; }); - const auto begin = large.data(); - const auto mid = begin + large.size() / 2; - const auto end = begin + large.size(); + const auto view = QByteArrayView{large}; + const auto first = view.first(view.size() / 2); + const auto last = view.sliced(view.size() / 2); QByteArray single; QByteArray chunked; auto t = MaybeThread{[&] { QCryptographicHash h(algorithm); - h.addData(begin, end - begin); + h.addData(view); single = h.result(); }}; { QCryptographicHash h(algorithm); - h.addData(begin, mid - begin); - h.addData(mid, end - mid); + h.addData(first); + h.addData(last); chunked = h.result(); } t.join(); |