1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-31 09:05:14 +01:00

Make the table pointers const

This commit is contained in:
Martin Tůma 2021-10-23 17:28:06 +02:00
parent 37dddbb18c
commit c487d9c66b
2 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ bool HuffmanTable::load(const RGNFile *rgn, SubFile::Handle &rgnHdl)
_aclEntryBytes = _symbolBytes + 1; _aclEntryBytes = _symbolBytes + 1;
_indexBytes = vs(_buffer.at(4)); _indexBytes = vs(_buffer.at(4));
_bsrchEntryBytes = _symBytes + _indexBytes + 1; _bsrchEntryBytes = _symBytes + _indexBytes + 1;
_bsrchTable = (quint8*)(_buffer.data()) + 4 + _indexBytes; _bsrchTable = (const quint8*)(_buffer.constData()) + 4 + _indexBytes;
_aclTable = _bsrchTable + _bsrchEntryBytes * _bsrchEntries; _aclTable = _bsrchTable + _bsrchEntryBytes * _bsrchEntries;
_huffmanTable = _aclTable + (_aclEntryBytes << _aclBits); _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 HuffmanTable::symbol(quint32 data, quint8 &size) const
{ {
quint32 lo, hi; quint32 lo, hi;
quint8 *tp; const quint8 *tp;
if (!_aclBits) { if (!_aclBits) {
@ -62,7 +62,7 @@ quint32 HuffmanTable::symbol(quint32 data, quint8 &size) const
data >>= 32 - _symBits; data >>= 32 - _symBits;
while (lo < hi) { while (lo < hi) {
quint8 *prev = tp; const quint8 *prev = tp;
quint32 m = (lo + 1 + hi) >> 1; quint32 m = (lo + 1 + hi) >> 1;
tp = _bsrchTable + (m * _bsrchEntryBytes); tp = _bsrchTable + (m * _bsrchEntryBytes);
quint32 nd = readVUint32(tp, _symBytes); quint32 nd = readVUint32(tp, _symBytes);

View File

@ -19,7 +19,7 @@ public:
private: private:
HuffmanBuffer _buffer; HuffmanBuffer _buffer;
quint8 *_aclTable, *_bsrchTable, *_huffmanTable; const quint8 *_aclTable, *_bsrchTable, *_huffmanTable;
quint8 _aclBits, _aclEntryBytes, _symBits, _symBytes, _indexBytes, quint8 _aclBits, _aclEntryBytes, _symBits, _symBytes, _indexBytes,
_bsrchEntryBytes, _bsrchEntries, _symbolBits, _symbolBytes; _bsrchEntryBytes, _bsrchEntries, _symbolBits, _symbolBytes;
bool _huffman; bool _huffman;