Merge pull request #175 from szabadka/master

Fix a bug in uncompressed block handling.
This commit is contained in:
szabadka 2015-09-25 12:51:52 +02:00
commit 6dd53d6183
3 changed files with 14 additions and 1 deletions

View File

@ -838,7 +838,6 @@ BrotliResult BROTLI_NOINLINE CopyUncompressedBlockToOutput(BrotliOutput output,
break;
}
if (s->substate_uncompressed == BROTLI_STATE_UNCOMPRESSED_WRITE_1) {
s->meta_block_remaining_len -= s->ringbuffer_size;
/* If we wrote past the logical end of the ringbuffer, copy the tail
of the ringbuffer to its beginning and flush the ringbuffer to the
output. */

View File

@ -93,6 +93,16 @@ BrotliOutput BrotliFileOutput(FILE* f) {
return out;
}
int BrotliNullOutputFunction(void* data, const uint8_t* buf, size_t count) {
return (int)count;
}
BrotliOutput BrotliNullOutput() {
BrotliOutput out;
out.cb_ = BrotliNullOutputFunction;
out.data_ = NULL;
return out;
}
#if defined(__cplusplus) || defined(c_plusplus)
} /* extern "C" */

View File

@ -93,6 +93,10 @@ BrotliInput BrotliFileInput(FILE* f);
int BrotliFileOutputFunction(void* data, const uint8_t* buf, size_t count);
BrotliOutput BrotliFileOutput(FILE* f);
/* Output callback that does nothing, always consumes the whole input. */
int BrotliNullOutputFunction(void* data, const uint8_t* buf, size_t count);
BrotliOutput BrotliNullOutput();
#if defined(__cplusplus) || defined(c_plusplus)
} /* extern "C" */
#endif