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-01-05 15:02:35 +0000
commit33b9fc4e062537a5ab8d4c60c72573f868ab3f13 (patch)
treed5639fee64dbc300563df09d4193d438a1a2c301
parent2483c3f9bced06196864a2a637d6bf24d8abe209 (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>
-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 14a7a74..e2f20a7 100644
--- a/src/plugins/imageformats/tga/qtgafile.cpp
+++ b/src/plugins/imageformats/tga/qtgafile.cpp
@@ -144,9 +144,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;
}
@@ -170,9 +168,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)