Merge pull request #6039 from jepler/fix-compression

Fix compression of strings >256 bytes long in UTF-8 encoding
This commit is contained in:
Dan Halbert 2022-02-15 20:12:47 -05:00 committed by GitHub
commit 0d6a27c353
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -87,11 +87,11 @@ STATIC int put_utf8(char *buf, int u) {
}
uint16_t decompress_length(const compressed_string_t *compressed) {
if (compress_max_length_bits <= 8) {
return 1 + (compressed->data >> (8 - compress_max_length_bits));
} else {
return 1 + ((compressed->data * 256 + compressed->tail[0]) >> (16 - compress_max_length_bits));
}
#if (compress_max_length_bits <= 8)
return 1 + (compressed->data >> (8 - compress_max_length_bits));
#else
return 1 + ((compressed->data * 256 + compressed->tail[0]) >> (16 - compress_max_length_bits));
#endif
}
char *decompress(const compressed_string_t *compressed, char *decompressed) {