diff options
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 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"); } } |