Huffman compression: handle QByteArray's elements as unsigned char
Fixes: QTBUG-86418 Pick-to: 5.15 Change-Id: Ie57ecad2b1fda7c2fc0de60cbdb4304c00e645d0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
fec51be209
commit
3e210dc19a
@ -392,8 +392,10 @@ quint64 huffman_encoded_bit_length(const QByteArray &inputData)
|
||||
|
||||
void huffman_encode_string(const QByteArray &inputData, BitOStream &outputStream)
|
||||
{
|
||||
for (int i = 0, e = inputData.size(); i < e; ++i)
|
||||
write_huffman_code(outputStream, staticHuffmanCodeTable[int(inputData[i])]);
|
||||
for (int i = 0, e = inputData.size(); i < e; ++i) {
|
||||
const auto value = uchar(inputData[i]);
|
||||
write_huffman_code(outputStream, staticHuffmanCodeTable[value]);
|
||||
}
|
||||
|
||||
// Pad bits ...
|
||||
if (outputStream.bitLength() % 8)
|
||||
|
Loading…
Reference in New Issue
Block a user