align with main brotli code

This commit is contained in:
elkir 2020-08-15 18:21:33 +03:00
parent 85da9f653b
commit f1f207b89c
4 changed files with 10 additions and 2 deletions

View File

@ -1802,6 +1802,7 @@ static BROTLI_INLINE BrotliDecoderErrorCode ProcessCommandsInternal(
int i = s->loop_counter;
BrotliDecoderErrorCode result = BROTLI_DECODER_SUCCESS;
BrotliBitReader* br = &s->br;
if (!CheckInputAmount(safe, br, 28)) {
result = BROTLI_DECODER_NEEDS_MORE_INPUT;
goto saveStateAndReturn;

View File

@ -272,8 +272,6 @@ BROTLI_BOOL BrotliEnsureCapacityBlockSplits(
return BROTLI_TRUE;
}
#if defined(__cplusplus) || defined(c_plusplus)
} /* extern "C" */
#endif

View File

@ -1086,6 +1086,7 @@ static BROTLI_BOOL EncodeData(
if (s->num_commands_ && s->last_insert_len_ == 0) {
ExtendLastCommand(s, &bytes, &wrapped_last_processed_pos);
}
if (s->params.quality == ZOPFLIFICATION_QUALITY) {
BROTLI_DCHECK(s->params.hasher.type == 10);
BrotliCreateZopfliBackwardReferences(m, bytes, wrapped_last_processed_pos,

View File

@ -6,6 +6,11 @@
/* Command line interface for Brotli library. */
/* Mute strerror/strcpy warnings. */
#if !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
@ -803,6 +808,8 @@ static void InitializeBuffers(Context* context) {
context->total_out = 0;
}
/* This method might give the false-negative result.
However, after an empty / incomplete read it should tell the truth. */
static BROTLI_BOOL HasMoreInput(Context* context) {
return feof(context->fin) ? BROTLI_FALSE : BROTLI_TRUE;
}
@ -901,6 +908,7 @@ static BROTLI_BOOL DecompressFile(Context* context, BrotliDecoderState* s) {
PrintablePath(context->current_input_path));
return BROTLI_FALSE;
}
result = BrotliDecoderDecompressStream(s, &context->available_in,
&context->next_in, &context->available_out, &context->next_out, 0);
}