From 108444d29b36b8e55d6baf9b7737b1e3a9ab6da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sat, 25 Feb 2023 11:06:14 +0100 Subject: [PATCH] Fix multiple MSVC warnings --- src/data/geojsonparser.cpp | 2 +- src/map/IMG/huffmantext.cpp | 2 +- src/map/IMG/subfile.h | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/data/geojsonparser.cpp b/src/data/geojsonparser.cpp index bcc2c91a..02ce9ae2 100644 --- a/src/data/geojsonparser.cpp +++ b/src/data/geojsonparser.cpp @@ -45,7 +45,7 @@ static void setAreaProperties(Area &area, const QJsonValue &properties) if (o["fill-opacity"].isDouble()) fillColor.setAlphaF(o["fill-opacity"].toDouble()); else - fillColor.setAlphaF(0.6); + fillColor.setAlphaF(0.6f); } area.setStyle(PolygonStyle(fillColor, strokeColor, strokeWidth)); diff --git a/src/map/IMG/huffmantext.cpp b/src/map/IMG/huffmantext.cpp index e026b420..0d209452 100644 --- a/src/map/IMG/huffmantext.cpp +++ b/src/map/IMG/huffmantext.cpp @@ -21,7 +21,7 @@ bool HuffmanText::decode(const SubFile *file, SubFile::Handle &hdl, quint32 sym; while (hs.readSymbol(sym)) { - for (quint32 i = 0; i < (_table.symbolBits() >> 3); i++) { + for (int i = 0; i < (_table.symbolBits() >> 3); i++) { str.append((quint8)sym); if (((quint8)sym == '\0')) return true; diff --git a/src/map/IMG/subfile.h b/src/map/IMG/subfile.h index 066b8949..bdfcdf9d 100644 --- a/src/map/IMG/subfile.h +++ b/src/map/IMG/subfile.h @@ -24,7 +24,7 @@ public: if (!subFile) return; - _data.resize(1U<blockBits()); + _data.resize(subFile->blockSize()); _file.setFileName(subFile->fileName()); _file.open(QIODevice::ReadOnly | QIODevice::Unbuffered); } @@ -144,7 +144,10 @@ public: bool readVBitfield32(Handle &hdl, quint32 &bitfield) const; const QString &fileName() const {return _path ? *_path : _img->fileName();} - unsigned blockBits() const {return _path ? BLOCK_BITS : _img->blockBits();} + int blockSize() const + { + return _path ? 1U<blockBits(); + } protected: quint32 _gmpOffset;