From 8f0e3ad5188d17c88f624eeea9a67ab17e55cc6f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 24 Jun 2019 14:41:36 +0200 Subject: Corelib tests: Fix out of bounds string access Fix warnings: Using QCharRef with an index pointing outside the valid range of a QString. The corresponding behavior is deprecated, and will be changed in a future version of Qt. introduced by qtbase/c2d2757bccc68e1b981df059786c2e76f2969530 (5.14). Change-Id: Ie6f0e2e3bb198a95dd40e7416adc8ffb29f3b2ba Reviewed-by: Giuseppe D'Angelo Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/collections/tst_collections.cpp | 2 +- tests/auto/corelib/tools/qhash/tst_qhash.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp index b911be3ffb..2a8b264998 100644 --- a/tests/auto/corelib/tools/collections/tst_collections.cpp +++ b/tests/auto/corelib/tools/collections/tst_collections.cpp @@ -1370,7 +1370,7 @@ void tst_Collections::hash() { typedef QHash Hash; Hash hash; - QString key; + QString key = QLatin1String(" "); for (int i = 0; i < 10; ++i) { key[0] = i + '0'; for (int j = 0; j < 10; ++j) { diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index d70d488e96..f0aaad98bd 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -273,7 +273,7 @@ void tst_QHash::insert1() { typedef QHash Hash; Hash hash; - QString key; + QString key = QLatin1String(" "); for (int i = 0; i < 10; ++i) { key[0] = i + '0'; for (int j = 0; j < 10; ++j) { -- cgit v1.2.3