summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-08-05 23:05:40 +0300
committerMarc Mutz <marc.mutz@kdab.com>2016-08-06 14:49:16 +0000
commite38064f698b03a3357943ed4c8e0d25fa6695418 (patch)
tree7a76f221d44a85b51c47da8ed5d576f219125ec3
parentc0b6e16ffa0edf0ed76cfdfeb71ec3aae99c98dd (diff)
tst_utf8: use QScopedPointer, not QSharedPointer
There's no sharing, and the use of QSharedPointer(T*) triggers my tree's static analyzer. Easiest fix is to port to QScopedPointer, which is the correct smart pointer to begin with. Change-Id: I105c1a334c3d6712a475600c8394b0bebc420677 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--tests/auto/corelib/codecs/utf8/tst_utf8.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
index 16265c6187..5666726a8c 100644
--- a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
+++ b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
@@ -29,7 +29,7 @@
#include <QtTest/QtTest>
#include <qtextcodec.h>
-#include <qsharedpointer.h>
+#include <QScopedPointer>
static const char utf8bom[] = "\xEF\xBB\xBF";
@@ -180,7 +180,7 @@ void tst_Utf8::charByChar()
{
// from utf16 to utf8 char by char:
- QSharedPointer<QTextEncoder> encoder = QSharedPointer<QTextEncoder>(codec->makeEncoder());
+ const QScopedPointer<QTextEncoder> encoder(codec->makeEncoder());
QByteArray encoded;
for (int i = 0; i < utf16.length(); ++i) {
@@ -194,7 +194,7 @@ void tst_Utf8::charByChar()
}
{
// from utf8 to utf16 char by char:
- QSharedPointer<QTextDecoder> decoder = QSharedPointer<QTextDecoder>(codec->makeDecoder());
+ const QScopedPointer<QTextDecoder> decoder(codec->makeDecoder());
QString decoded;
for (int i = 0; i < utf8.length(); ++i) {
@@ -219,7 +219,7 @@ void tst_Utf8::invalidUtf8()
QFETCH(QByteArray, utf8);
QFETCH_GLOBAL(bool, useLocale);
- QSharedPointer<QTextDecoder> decoder = QSharedPointer<QTextDecoder>(codec->makeDecoder());
+ const QScopedPointer<QTextDecoder> decoder(codec->makeDecoder());
decoder->toUnicode(utf8);
// Only enforce correctness on our UTF-8 decoder
@@ -280,7 +280,7 @@ void tst_Utf8::nonCharacters()
QFETCH(QString, utf16);
QFETCH_GLOBAL(bool, useLocale);
- QSharedPointer<QTextDecoder> decoder = QSharedPointer<QTextDecoder>(codec->makeDecoder());
+ const QScopedPointer<QTextDecoder> decoder(codec->makeDecoder());
decoder->toUnicode(utf8);
// Only enforce correctness on our UTF-8 decoder
@@ -289,7 +289,7 @@ void tst_Utf8::nonCharacters()
else if (decoder->hasFailure())
qWarning("System codec reports failure when it shouldn't. Should report bug upstream.");
- QSharedPointer<QTextEncoder> encoder(codec->makeEncoder());
+ const QScopedPointer<QTextEncoder> encoder(codec->makeEncoder());
encoder->fromUnicode(utf16);
if (!useLocale)
QVERIFY(!encoder->hasFailure());