diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-01-23 12:03:36 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-02-12 19:40:04 +0000 |
commit | 05c38a9111320da311e5993faf12ce8e1f1713e8 (patch) | |
tree | b1ca051511120d113e891333b8918f8d5a4748ef /tests/auto/corelib/tools | |
parent | abcb5471b75fe9879775ec16f0f12a1e30422789 (diff) |
QtCore: assorted migrations to QString::asprintf
Change-Id: Ie99d3eeeced89dd8336717954fd5ca7117bb20b4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r-- | tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp | 8 | ||||
-rw-r--r-- | tests/auto/corelib/tools/qchar/tst_qchar.cpp | 2 | ||||
-rw-r--r-- | tests/auto/corelib/tools/qregexp/tst_qregexp.cpp | 3 |
3 files changed, 6 insertions, 7 deletions
diff --git a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp index 0a06129ab1..9bce948140 100644 --- a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp +++ b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp @@ -1054,22 +1054,22 @@ void tst_QAlgorithms::popCount_data_impl(size_t sizeof_T_Int) const uint bits = bitsSetInByte(byte); const quint64 value = static_cast<quint64>(byte); const quint64 input = value << ((i % sizeof_T_Int) * 8U); - newRow(qPrintable(QString().sprintf("0x%016llx", input))) << input << bits; + newRow(qPrintable(QString::asprintf("0x%016llx", input))) << input << bits; } // and some random ones: if (sizeof_T_Int >= 8) for (size_t i = 0; i < 1000; ++i) { const quint64 input = quint64(qrand()) << 32 | quint32(qrand()); - newRow(qPrintable(QString().sprintf("0x%016llx", input))) << input << bitsSetInInt64(input); + newRow(qPrintable(QString::asprintf("0x%016llx", input))) << input << bitsSetInInt64(input); } else if (sizeof_T_Int >= 2) for (size_t i = 0; i < 1000 ; ++i) { const quint32 input = qrand(); if (sizeof_T_Int >= 4) - newRow(qPrintable(QString().sprintf("0x%08x", input))) << quint64(input) << bitsSetInInt(input); + newRow(qPrintable(QString::asprintf("0x%08x", input))) << quint64(input) << bitsSetInInt(input); else - newRow(qPrintable(QString().sprintf("0x%04x", quint16(input & 0xFFFF)))) << quint64(input & 0xFFFF) << bitsSetInShort(input & 0xFFFF); + newRow(qPrintable(QString::asprintf("0x%04x", quint16(input & 0xFFFF)))) << quint64(input & 0xFFFF) << bitsSetInShort(input & 0xFFFF); } } diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index e729338819..1ca7a213ad 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -108,7 +108,7 @@ void tst_QChar::operators_data() for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) - QTest::newRow(qPrintable(QString().sprintf("'\\%d' (op) '\\%d'", i, j))) + QTest::newRow(qPrintable(QString::asprintf("'\\%d' (op) '\\%d'", i, j))) << QChar(ushort(i)) << QChar(ushort(j)); } } diff --git a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp index a9f9ca363d..fefdec7496 100644 --- a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp +++ b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp @@ -316,8 +316,7 @@ void tst_QRegExp::indexIn_addMoreRows(const QByteArray &stri) while ( squareRegExp[ii] != 0 ) { for ( int j = 0; j < 100; j++ ) { - QString name; - name.sprintf( "square%.1d%.2d", ii, j ); + const QString name = QString::asprintf( "square%.1d%.2d", ii, j ); QString target = ""; target.fill( 'a', j ); |