diff options
| author | Liang Qi <liang.qi@qt.io> | 2016-11-24 09:36:06 +0000 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2016-11-24 11:18:22 +0000 |
| commit | 3966ab51ff140f173f1f0c23fa3a9ef985c73d27 (patch) | |
| tree | f30302c2c40e8d1b30e3ab589917eca5883aa3a2 /src/gui/image/qxbmhandler.cpp | |
| parent | 0861c2176c6dc1c69b733c1a843c2db5ec8ea786 (diff) | |
| parent | 4783de0473a288fdff7e5354c12315ba025ec7e0 (diff) | |
Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8
Diffstat (limited to 'src/gui/image/qxbmhandler.cpp')
| -rw-r--r-- | src/gui/image/qxbmhandler.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp index eda816f0f2a..19015c5dcde 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"); } } |
