More style fixes. Fix C++ build.
This commit is contained in:
parent
5e1d558bb2
commit
a7588fdc0c
18
rewind.c
18
rewind.c
|
@ -110,7 +110,7 @@ struct state_manager {
|
|||
|
||||
state_manager_t *state_manager_new(size_t state_size, size_t buffer_size)
|
||||
{
|
||||
state_manager_t *state=malloc(sizeof(*state));
|
||||
state_manager_t *state = (state_manager_t*)malloc(sizeof(*state));
|
||||
|
||||
state->capacity = 0;
|
||||
state->blocksize = 0;
|
||||
|
@ -122,10 +122,10 @@ state_manager_t *state_manager_new(size_t state_size, size_t buffer_size)
|
|||
const int maxcblks = (state->blocksize+maxcblkcover-1)/maxcblkcover;
|
||||
state->maxcompsize = state->blocksize + maxcblks*sizeof(uint16_t)*2 + sizeof(uint16_t)+sizeof(uint32_t) + sizeof(size_t)*2;
|
||||
|
||||
state->data=malloc(buffer_size);
|
||||
state->data = (char*)malloc(buffer_size);
|
||||
|
||||
state->thisblock=calloc(state->blocksize+sizeof(uint16_t)*8, 1);
|
||||
state->nextblock=calloc(state->blocksize+sizeof(uint16_t)*8, 1);
|
||||
state->thisblock = (char*)calloc(state->blocksize+sizeof(uint16_t)*8, 1);
|
||||
state->nextblock = (char*)calloc(state->blocksize+sizeof(uint16_t)*8, 1);
|
||||
if (!state->data || !state->thisblock || !state->nextblock)
|
||||
{
|
||||
free(state->data);
|
||||
|
@ -246,13 +246,13 @@ bool state_manager_push_do(state_manager_t *state)
|
|||
goto recheckcapacity;
|
||||
}
|
||||
|
||||
const char *old=state->thisblock;
|
||||
const char *new=state->nextblock;
|
||||
const char *oldb = state->thisblock;
|
||||
const char *newb = state->nextblock;
|
||||
char *compressed = state->head+sizeof(size_t);
|
||||
|
||||
//Begin compression code; 'compressed' will point to the end of the compressed data (excluding the prev pointer).
|
||||
const uint16_t *old16=(const uint16_t*)old;
|
||||
const uint16_t *new16=(const uint16_t*)new;
|
||||
const uint16_t *old16 = (const uint16_t*)oldb;
|
||||
const uint16_t *new16 = (const uint16_t*)newb;
|
||||
uint16_t *compressed16 = (uint16_t*)compressed;
|
||||
size_t num16s = state->blocksize/sizeof(uint16_t);
|
||||
while (num16s)
|
||||
|
@ -293,6 +293,8 @@ bool state_manager_push_do(state_manager_t *state)
|
|||
{
|
||||
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.
|
||||
old16 -= skip;
|
||||
new16 -= skip;
|
||||
skip = UINT32_MAX;
|
||||
|
|
Loading…
Reference in New Issue