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>
This commit is contained in:
Friedemann Kleint 2019-06-24 14:41:36 +02:00
parent 94bee657c1
commit 8f0e3ad518
2 changed files with 2 additions and 2 deletions

View File

@ -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) {

View File

@ -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) {