Commit 480fd72f authored by Jonathan Beck's avatar Jonathan Beck

Do not write 3 byte integer nodes. Use standard 4bytes integer instead.

parent bb3097cb
...@@ -589,7 +589,11 @@ static gboolean free_index(gpointer key, gpointer value, gpointer user_data) ...@@ -589,7 +589,11 @@ static gboolean free_index(gpointer key, gpointer value, gpointer user_data)
static void write_int(GByteArray * bplist, uint64_t val) static void write_int(GByteArray * bplist, uint64_t val)
{ {
uint64_t size = get_needed_bytes(val); uint64_t size = get_needed_bytes(val);
uint8_t *buff = (uint8_t *) malloc(sizeof(uint8_t) + size); uint8_t *buff = NULL;
//do not write 3bytes int node
if (size == 3)
size++;
buff = (uint8_t *) malloc(sizeof(uint8_t) + size);
buff[0] = BPLIST_UINT | Log2(size); buff[0] = BPLIST_UINT | Log2(size);
memcpy(buff + 1, &val, size); memcpy(buff + 1, &val, size);
byte_convert(buff + 1, size); byte_convert(buff + 1, size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment