From c487d9c66b92ba5f63b88344b9eb7f2c3d6b69cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sat, 23 Oct 2021 17:28:06 +0200 Subject: [PATCH] Make the table pointers const --- src/map/IMG/huffmantable.cpp | 6 +++--- src/map/IMG/huffmantable.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/map/IMG/huffmantable.cpp b/src/map/IMG/huffmantable.cpp index 2af67c9b..ee82c902 100644 --- a/src/map/IMG/huffmantable.cpp +++ b/src/map/IMG/huffmantable.cpp @@ -29,7 +29,7 @@ bool HuffmanTable::load(const RGNFile *rgn, SubFile::Handle &rgnHdl) _aclEntryBytes = _symbolBytes + 1; _indexBytes = vs(_buffer.at(4)); _bsrchEntryBytes = _symBytes + _indexBytes + 1; - _bsrchTable = (quint8*)(_buffer.data()) + 4 + _indexBytes; + _bsrchTable = (const quint8*)(_buffer.constData()) + 4 + _indexBytes; _aclTable = _bsrchTable + _bsrchEntryBytes * _bsrchEntries; _huffmanTable = _aclTable + (_aclEntryBytes << _aclBits); @@ -39,7 +39,7 @@ bool HuffmanTable::load(const RGNFile *rgn, SubFile::Handle &rgnHdl) quint32 HuffmanTable::symbol(quint32 data, quint8 &size) const { quint32 lo, hi; - quint8 *tp; + const quint8 *tp; if (!_aclBits) { @@ -62,7 +62,7 @@ quint32 HuffmanTable::symbol(quint32 data, quint8 &size) const data >>= 32 - _symBits; while (lo < hi) { - quint8 *prev = tp; + const quint8 *prev = tp; quint32 m = (lo + 1 + hi) >> 1; tp = _bsrchTable + (m * _bsrchEntryBytes); quint32 nd = readVUint32(tp, _symBytes); diff --git a/src/map/IMG/huffmantable.h b/src/map/IMG/huffmantable.h index ef84e6c2..973e684a 100644 --- a/src/map/IMG/huffmantable.h +++ b/src/map/IMG/huffmantable.h @@ -19,7 +19,7 @@ public: private: HuffmanBuffer _buffer; - quint8 *_aclTable, *_bsrchTable, *_huffmanTable; + const quint8 *_aclTable, *_bsrchTable, *_huffmanTable; quint8 _aclBits, _aclEntryBytes, _symBits, _symBytes, _indexBytes, _bsrchEntryBytes, _bsrchEntries, _symbolBits, _symbolBytes; bool _huffman;