From eec8ed4818fe4178df5443dc96afccb3925723c4 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@digia.com>
Date: Mon, 13 May 2013 12:48:52 +0200
Subject: [PATCH] TGA-Reader: Bail out of check if the device is not seekable.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Suppress warning
'QIODevice::seek: Cannot call seek on a sequential device'
which is emitted further down when attempting to restore
the position of the file.

Task-number: QTBUG-31081
Change-Id: Ib6a4b3eecaa61905a29020e5dd428f1516bfba7f
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
---
 src/plugins/imageformats/tga/qtgahandler.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/plugins/imageformats/tga/qtgahandler.cpp b/src/plugins/imageformats/tga/qtgahandler.cpp
index fe1b09bc..f446db10 100644
--- a/src/plugins/imageformats/tga/qtgahandler.cpp
+++ b/src/plugins/imageformats/tga/qtgahandler.cpp
@@ -80,6 +80,8 @@ bool QTgaHandler::canRead(QIODevice *device)
 
     // TGA reader implementation needs a seekable QIODevice, so
     // sequential devices are not supported
+    if (device->isSequential())
+        return false;
     qint64 pos = device->pos();
     bool isValid;
     {
-- 
GitLab