diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2013-10-13 19:11:28 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-25 20:54:14 +0100 |
commit | 2af6bf1a5943c2a75dae56d78992eb8ca1826af0 (patch) | |
tree | e5278ae17c3c9664f35bc3e83b89290d5342ff74 /src/gui/image | |
parent | 8a5c261954836e2aeac53f5e6581135ffaa9a2e0 (diff) |
QImageReader: simplify _qt_BuiltInFormats
By construction of the _qt_BuiltInFormatType enum, the .type in
_qt_BuiltInFormats exactly equals its position. So there's no
need to store it explicitly.
Effects on Linux AMD64 GCC 4.9-trunk release stripped:
text: -16B
data: -64B
relocs: +-0 (of course)
Change-Id: Ib68c32de42d264f27bbd8a863538dd78b1ba4507
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qimagereader.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 636d86991b..091837b8b4 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -190,37 +190,36 @@ enum _qt_BuiltInFormatType { struct _qt_BuiltInFormatStruct { - _qt_BuiltInFormatType type; const char *extension; const char *mimeType; }; static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = { #ifndef QT_NO_IMAGEFORMAT_PNG - {_qt_PngFormat, "png", "image/png"}, + {"png", "image/png"}, #endif #ifndef QT_NO_IMAGEFORMAT_JPEG - {_qt_JpgFormat, "jpg", "image/jpeg"}, - {_qt_JpegFormat, "jpeg", "image/jpeg"}, + {"jpg", "image/jpeg"}, + {"jpeg", "image/jpeg"}, #endif #ifdef QT_BUILTIN_GIF_READER - {_qt_GifFormat, "gif", "image/gif"}, + {"gif", "image/gif"}, #endif #ifndef QT_NO_IMAGEFORMAT_BMP - {_qt_BmpFormat, "bmp", "image/bmp"}, + {"bmp", "image/bmp"}, #endif #ifndef QT_NO_IMAGEFORMAT_PPM - {_qt_PpmFormat, "ppm", "image/x-portable-pixmap"}, - {_qt_PgmFormat, "pgm", "image/x-portable-graymap"}, - {_qt_PbmFormat, "pbm", "image/x-portable-bitmap"}, + {"ppm", "image/x-portable-pixmap"}, + {"pgm", "image/x-portable-graymap"}, + {"pbm", "image/x-portable-bitmap"}, #endif #ifndef QT_NO_IMAGEFORMAT_XBM - {_qt_XbmFormat, "xbm", "image/x-xbitmap"}, + {"xbm", "image/x-xbitmap"}, #endif #ifndef QT_NO_IMAGEFORMAT_XPM - {_qt_XpmFormat, "xpm", "image/x-xpixmap"}, + {"xpm", "image/x-xpixmap"}, #endif - {_qt_NoFormat, "", ""} + {"", ""} }; static QImageIOHandler *createReadHandlerHelper(QIODevice *device, @@ -423,10 +422,8 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, QByteArray subType; int numFormats = _qt_NumFormats; while (device && numFormats >= 0) { - const _qt_BuiltInFormatStruct *formatStruct = &_qt_BuiltInFormats[currentFormat]; - const qint64 pos = device->pos(); - switch (formatStruct->type) { + switch (currentFormat) { #ifndef QT_NO_IMAGEFORMAT_PNG case _qt_PngFormat: if (QPngHandler::canRead(device)) @@ -482,7 +479,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, if (handler) { #ifdef QIMAGEREADER_DEBUG - qDebug() << "QImageReader::createReadHandler: the" << formatStruct->extension + qDebug() << "QImageReader::createReadHandler: the" << _qt_BuiltInFormats[currentFormat].extension << "built-in handler can read this data"; #endif break; |