Style nits

This commit is contained in:
twinaphex 2020-09-16 18:32:13 +02:00
parent 95a1f1c64f
commit 95dbd11546

View File

@ -286,14 +286,13 @@ static size_t state_manager_raw_compress(const void *src,
num16s -= skip;
if (skip > UINT16_MAX)
{
if (skip > UINT32_MAX)
{
/* This will make it scan the entire thing again,
* but it only hits on 8GB unchanged data anyways,
* and if you're doing that, you've got bigger problems. */
if (skip > UINT32_MAX)
skip = UINT32_MAX;
}
*compressed16++ = 0;
*compressed16++ = skip;
*compressed16++ = skip >> 16;
@ -320,7 +319,7 @@ static size_t state_manager_raw_compress(const void *src,
compressed16[1] = 0;
compressed16[2] = 0;
return (uint8_t*)(compressed16+3) - (uint8_t*)patch;
return (uint8_t*)(compressed16 + 3) - (uint8_t*)patch;
}
/*
@ -337,9 +336,6 @@ static void state_manager_raw_decompress(const void *patch,
uint16_t *out16 = (uint16_t*)data;
const uint16_t *patch16 = (const uint16_t*)patch;
(void)patchlen;
(void)datalen;
for (;;)
{
uint16_t numchanged = *(patch16++);
@ -429,7 +425,8 @@ static void state_manager_free(state_manager_t *state)
state->nextblock = NULL;
}
static state_manager_t *state_manager_new(size_t state_size, size_t buffer_size)
static state_manager_t *state_manager_new(
size_t state_size, size_t buffer_size)
{
size_t max_comp_size, block_size;
uint8_t *next_block = NULL;
@ -441,7 +438,6 @@ static state_manager_t *state_manager_new(size_t state_size, size_t buffer_size)
return NULL;
block_size = (state_size + sizeof(uint16_t) - 1) & -sizeof(uint16_t);
/* the compressed data is surrounded by pointers to the other side */
max_comp_size = state_manager_raw_maxsize(state_size) + sizeof(size_t) * 2;
state_data = (uint8_t*)malloc(buffer_size);
@ -503,7 +499,6 @@ static bool state_manager_pop(state_manager_t *state, const void **data)
start = read_size_t(state->head - sizeof(size_t));
state->head = state->data + start;
compressed = state->data + start + sizeof(size_t);
out = state->thisblock;
@ -553,7 +548,6 @@ static void state_manager_push_do(state_manager_t *state)
return;
recheckcapacity:;
headpos = state->head - state->data;
tailpos = state->tail - state->data;
remaining = (tailpos + state->capacity -