diff options
Diffstat (limited to 'src/analysis/db/misc')
-rw-r--r-- | src/analysis/db/misc/rlestr.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/analysis/db/misc/rlestr.c b/src/analysis/db/misc/rlestr.c index bb81b55..b93304b 100644 --- a/src/analysis/db/misc/rlestr.c +++ b/src/analysis/db/misc/rlestr.c @@ -29,6 +29,9 @@ #include <string.h> +#include "../../../common/leb128.h" + + /****************************************************************************** * * @@ -276,16 +279,16 @@ int cmp_rle_string(const rle_string *s1, const rle_string *s2) bool unpack_rle_string(rle_string *str, packed_buffer_t *pbuf) { bool result; /* Bilan à retourner */ - uint32_t tmp32; /* Valeur sur 32 bits */ + uleb128_t len; /* Quantité de caractères */ unset_rle_string(str); - result = extract_packed_buffer(pbuf, &tmp32, sizeof(uint32_t), true); - - str->length = tmp32; + result = unpack_uleb128(&len, pbuf); if (result && str->length > 0) { + str->length = len; + str->data = malloc(str->length + 1); str->dynamic = true; @@ -321,7 +324,7 @@ bool pack_rle_string(const rle_string *str, packed_buffer_t *pbuf) { bool result; /* Bilan à retourner */ - result = extend_packed_buffer(pbuf, (uint32_t []) { str->length }, sizeof(uint32_t), true); + result = pack_uleb128((uleb128_t []){ str->length }, pbuf); if (result && str->length > 0) result = extend_packed_buffer(pbuf, str->data, str->length + 1, false); |