Pass CodeEntry by value
It is a small and trivially copyable type. Found by an Axivion scan. Task-number: QTBUG-125026 Pick-to: 6.7 6.5 Change-Id: If8efe667f8b7a40038d904386ef2fed15cd8f94d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> (cherry picked from commit 9e0c3e85b5d102442ad519a3454d7c63fddf920d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
d6f33a70c8
commit
19b710951f
@ -316,7 +316,7 @@ const CodeEntry staticHuffmanCodeTable[]
|
|||||||
{256, 0xfffffffcul, 30} // EOS 11111111|11111111|11111111|111111
|
{256, 0xfffffffcul, 30} // EOS 11111111|11111111|11111111|111111
|
||||||
};
|
};
|
||||||
|
|
||||||
void write_huffman_code(BitOStream &outputStream, const CodeEntry &code)
|
void write_huffman_code(BitOStream &outputStream, CodeEntry code)
|
||||||
{
|
{
|
||||||
// Append octet by octet.
|
// Append octet by octet.
|
||||||
auto bitLength = code.bitLength;
|
auto bitLength = code.bitLength;
|
||||||
@ -390,7 +390,7 @@ HuffmanDecoder::HuffmanDecoder()
|
|||||||
// Now we sort: by bit length first (in the descending order) and by the symbol
|
// Now we sort: by bit length first (in the descending order) and by the symbol
|
||||||
// value (descending). Descending order: to make sure we do not create prefix tables with
|
// value (descending). Descending order: to make sure we do not create prefix tables with
|
||||||
// short 'indexLength' first and having longer codes that do not fit into such tables later.
|
// short 'indexLength' first and having longer codes that do not fit into such tables later.
|
||||||
std::sort(symbols.begin(), symbols.end(), [](const CodeEntry &code1, const CodeEntry &code2) {
|
std::sort(symbols.begin(), symbols.end(), [](CodeEntry code1, CodeEntry code2) {
|
||||||
if (code1.bitLength == code2.bitLength)
|
if (code1.bitLength == code2.bitLength)
|
||||||
return code1.byteValue > code2.byteValue;
|
return code1.byteValue > code2.byteValue;
|
||||||
return code1.bitLength > code2.bitLength;
|
return code1.bitLength > code2.bitLength;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user