summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-11-23 07:12:07 +0100
committerLiang Qi <liang.qi@qt.io>2016-11-23 09:24:36 +0100
commit38c1057f696c4e3f168305091413428d99007c43 (patch)
tree49c3ef009cc723151298bfc9eef85bb6fa5910be /src/gui/image
parent48d7db6b3119ee27d9ae6b1bd0fdb24333f44756 (diff)
parente2b856d56290e9b3eaaf889b3e0a08badbaa6046 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
This also reverts commit 0d2f0164f45cb626c40a7c95026ba00fa56ac249. Conflicts: header.BSD-NEW qmake/Makefile.win32 src/openglextensions/qopenglextensions.cpp src/openglextensions/qopenglextensions.h src/winmain/qtmain_win.cpp src/winmain/qtmain_winrt.cpp tools/configure/configureapp.cpp util/glgen/qopenglextensions.cpp.header util/glgen/qopenglextensions.h.header Change-Id: If26c6f4111b342378dd88bbdc657e322d2ab6ad8
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qxbmhandler.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp
index eda816f0f2..19015c5dcd 100644
--- a/src/gui/image/qxbmhandler.cpp
+++ b/src/gui/image/qxbmhandler.cpp
@@ -124,17 +124,18 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage)
qint64 readBytes = 0;
+ char *p;
+
// scan for database
- for (;;) {
+ do {
if ((readBytes = device->readLine(buf, buflen)) <= 0) {
// end of file
return false;
}
buf[readBytes] = '\0';
- if (QByteArray::fromRawData(buf, readBytes).contains("0x"))
- break;
- }
+ p = strstr(buf, "0x");
+ } while (!p);
if (outImage->size() != QSize(w, h) || outImage->format() != QImage::Format_MonoLSB) {
*outImage = QImage(w, h, QImage::Format_MonoLSB);
@@ -148,7 +149,6 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage)
int x = 0, y = 0;
uchar *b = outImage->scanLine(0);
- char *p = buf + QByteArray::fromRawData(buf, readBytes).indexOf("0x");
w = (w+7)/8; // byte width
while (y < h) { // for all encoded bytes...
@@ -163,7 +163,8 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage)
} else { // read another line
if ((readBytes = device->readLine(buf,buflen)) <= 0) // EOF ==> truncated image
break;
- p = buf + QByteArray::fromRawData(buf, readBytes).indexOf("0x");
+ buf[readBytes] = '\0';
+ p = strstr(buf, "0x");
}
}