diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-10-12 13:34:36 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-12-23 12:27:46 (GMT) |
commit | d2f10dae860cea0de33b4cb9005ba8d2203ce1d1 (patch) | |
tree | de6159f352035b838abe79ebf372f0141a180b79 /src | |
parent | a8c3ed1dbe209488866e687d1a63c6143a04cfe0 (diff) | |
download | Qt-d2f10dae860cea0de33b4cb9005ba8d2203ce1d1.zip Qt-d2f10dae860cea0de33b4cb9005ba8d2203ce1d1.tar.gz Qt-d2f10dae860cea0de33b4cb9005ba8d2203ce1d1.tar.bz2 |
QImageReader: Avoid errorString creation in the normal case
Deploy the same idiom found in QIODevice::errorString(). Return
"Unknown Error" in case of am empty string. This is a tiny improvement
for QtWebKit.
Reviewed-by: Andreas
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/image/qimagereader.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 074f3eb..4fb07fb 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -471,7 +471,6 @@ QImageReaderPrivate::QImageReaderPrivate(QImageReader *qq) handler = 0; quality = -1; imageReaderError = QImageReader::UnknownError; - errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Unknown error")); q = qq; } @@ -1302,6 +1301,8 @@ QImageReader::ImageReaderError QImageReader::error() const */ QString QImageReader::errorString() const { + if (d->errorString.isEmpty()) + return QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Unknown error")); return d->errorString; } |