Commit b9088071 authored by eustas's avatar eustas Committed by Commit bot

Update Brotli to revision ec03509

This brings in the output streaming decode support.

BUG=472009

Review URL: https://codereview.chromium.org/1061993007

Cr-Commit-Position: refs/heads/master@{#326762}
parent 40d81fd5
Name: Brotli
URL: https://github.com/google/brotli
Version: 9e53d522a34bb8eabfda4a50f7e9da1d1e57a98f
Version: ec03509d6d5d18a57afe1254e713b6787ef1c516
License: Apache 2.0
License File: LICENSE
Security Critical: yes
......
......@@ -2,7 +2,7 @@
include ../shared.mk
CPPFLAGS += -Wall
CFLAGS += -Wall
OBJS = bit_reader.o decode.o huffman.o safe_malloc.o state.o streams.o
......
This diff is collapsed.
......@@ -32,7 +32,9 @@ typedef enum {
/* Successfully completely done */
BROTLI_RESULT_SUCCESS = 1,
/* Partially done, but must be called again with more input */
BROTLI_RESULT_PARTIAL = 2
BROTLI_RESULT_NEEDS_MORE_INPUT = 2,
/* Partially done, but must be called again with more output */
BROTLI_RESULT_NEEDS_MORE_OUTPUT = 3
} BrotliResult;
/* Sets *decoded_size to the decompressed size of the given encoded stream. */
......
......@@ -39,7 +39,12 @@ typedef enum {
BROTLI_STATE_BLOCK_DISTANCE = 15,
BROTLI_STATE_BLOCK_POST = 16,
BROTLI_STATE_UNCOMPRESSED = 17,
BROTLI_STATE_METADATA = 18,
BROTLI_STATE_BLOCK_INNER_WRITE = 19,
BROTLI_STATE_METABLOCK_DONE = 20,
BROTLI_STATE_BLOCK_POST_WRITE_1 = 21,
BROTLI_STATE_BLOCK_POST_WRITE_2 = 22,
BROTLI_STATE_BLOCK_POST_CONTINUE = 23,
BROTLI_STATE_HUFFMAN_CODE_0 = 30,
BROTLI_STATE_HUFFMAN_CODE_1 = 31,
BROTLI_STATE_HUFFMAN_CODE_2 = 32,
......@@ -51,6 +56,9 @@ typedef enum {
BROTLI_STATE_SUB_UNCOMPRESSED_FILL = 52,
BROTLI_STATE_SUB_UNCOMPRESSED_COPY = 53,
BROTLI_STATE_SUB_UNCOMPRESSED_WARMUP = 54,
BROTLI_STATE_SUB_UNCOMPRESSED_WRITE_1 = 55,
BROTLI_STATE_SUB_UNCOMPRESSED_WRITE_2 = 56,
BROTLI_STATE_SUB_UNCOMPRESSED_WRITE_3 = 57,
BROTLI_STATE_SUB_HUFFMAN_LENGTH_BEGIN = 60,
BROTLI_STATE_SUB_HUFFMAN_LENGTH_SYMBOLS = 61,
BROTLI_STATE_SUB_HUFFMAN_DONE = 62,
......@@ -91,6 +99,7 @@ typedef struct {
int trivial_literal_context;
int meta_block_remaining_len;
int is_metadata;
int is_uncompressed;
int block_length[3];
int block_type[3];
......@@ -131,6 +140,9 @@ typedef struct {
/* For CopyUncompressedBlockToOutput */
int nbytes;
/* For partial write operations */
int partially_written;
/* For HuffmanTreeGroupDecode */
int htrees_decoded;
......
......@@ -51,8 +51,9 @@ BrotliInput BrotliInitMemInput(const uint8_t* buffer, size_t length,
int BrotliMemOutputFunction(void* data, const uint8_t* buf, size_t count) {
BrotliMemOutput* output = (BrotliMemOutput*)data;
if (output->pos + count > output->length) {
return -1;
size_t limit = output->length - output->pos;
if (count > limit) {
count = limit;
}
memcpy(output->buffer + output->pos, buf, count);
output->pos += count;
......
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