summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-06-24 14:41:36 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-06-28 00:24:54 +0200
commit8f0e3ad5188d17c88f624eeea9a67ab17e55cc6f (patch)
treea48ea0ae35f31f4f0ae51065bfb35ceb4e5d8f83 /tests/auto
parent94bee657c1d6d1207c82cdb5eddef8945f262618 (diff)
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 <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/tools/collections/tst_collections.cpp2
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp2
2 files changed, 2 insertions, 2 deletions
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<QString, QString> 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<QString, QString> 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) {