summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-10-14 18:12:30 +0200
committerMarc Mutz <marc.mutz@kdab.com>2017-02-03 23:07:26 +0000
commit314ea3029ab9108e51a39b8f038043fd83fefe17 (patch)
tree6fe50caa0f2f773a624cae2c23be5adffb97bba8
parentcc0e9432848750689e8a9e48e318b5ef9c6874ff (diff)
QTgaFile: fix Coverity warning re:mixing enum types
Coverity complained that the 'bytes' variable was first compared to a QTgaFile::HeaderOffset, then, later, to a QTgaFile::FooterOffset. This is of course a false positive, but one that's trivial to fix, by not using a variable in the first place. Adjust to Qt coding standard as a drive-by. Coverity-Id: 22048 Change-Id: If1a45aa5b0c8ea23cab2cefeccb2f1dfe5f03375 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 33b9fc4e062537a5ab8d4c60c72573f868ab3f13)
-rw-r--r--src/plugins/imageformats/tga/qtgafile.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/plugins/imageformats/tga/qtgafile.cpp b/src/plugins/imageformats/tga/qtgafile.cpp
index b248b3a..4c6038b 100644
--- a/src/plugins/imageformats/tga/qtgafile.cpp
+++ b/src/plugins/imageformats/tga/qtgafile.cpp
@@ -138,9 +138,7 @@ QTgaFile::QTgaFile(QIODevice *device)
mErrorMessage = tr("Seek file/device for image read failed");
return;
}
- int bytes = device->read((char*)mHeader, HeaderSize);
- if (bytes != HeaderSize)
- {
+ if (device->read(reinterpret_cast<char*>(mHeader), HeaderSize) != HeaderSize) {
mErrorMessage = tr("Image header read failed");
return;
}
@@ -164,9 +162,7 @@ QTgaFile::QTgaFile(QIODevice *device)
return;
}
char footer[FooterSize];
- bytes = mDevice->read((char*)footer, FooterSize);
- if (bytes != FooterSize)
- {
+ if (mDevice->read(reinterpret_cast<char*>(footer), FooterSize) != FooterSize) {
mErrorMessage = tr("Could not read footer");
}
if (qstrncmp(&footer[SignatureOffset], "TRUEVISION-XFILE", 16) != 0)