Skip to content

Commit

Permalink
Merge pull request #6039 from jepler/fix-compression
Browse files Browse the repository at this point in the history
Fix compression of strings >256 bytes long in UTF-8 encoding
  • Loading branch information
dhalbert authored Feb 16, 2022
2 parents 947a53c + 860f793 commit 0d6a27c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions supervisor/shared/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0d6a27c

Please sign in to comment.