diff options
author | Eugene Kliuchnikov <eustas@google.com> | 2017-03-09 17:34:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-09 17:34:16 +0100 |
commit | 52ce8670ebcf03cb7ff54b28761e4cd55e9dd259 (patch) | |
tree | 919f15a4857d1bd1afcc904c6c4bd61b83c901ba | |
parent | cdca91b6f59dd7632985667d2cd585ab68937b48 (diff) | |
download | brotli-52ce8670ebcf03cb7ff54b28761e4cd55e9dd259.zip brotli-52ce8670ebcf03cb7ff54b28761e4cd55e9dd259.tar.gz brotli-52ce8670ebcf03cb7ff54b28761e4cd55e9dd259.tar.bz2 |
Fix typos (#521)
-rw-r--r-- | common/dictionary.h | 2 | ||||
-rwxr-xr-x | common/version.h | 2 | ||||
-rw-r--r-- | dec/state.c | 15 | ||||
-rw-r--r-- | dec/state.h | 2 | ||||
-rwxr-xr-x | enc/backward_references_hq.c | 3 | ||||
-rw-r--r-- | enc/block_splitter_inc.h | 2 | ||||
-rw-r--r-- | enc/encode.c | 1 | ||||
-rwxr-xr-x | enc/hash_to_binary_tree_inc.h | 4 | ||||
-rw-r--r-- | enc/literal_cost.c | 5 | ||||
-rwxr-xr-x | include/brotli/port.h | 1 |
10 files changed, 12 insertions, 25 deletions
diff --git a/common/dictionary.h b/common/dictionary.h index 3436362..fc47c1e 100644 --- a/common/dictionary.h +++ b/common/dictionary.h @@ -38,7 +38,7 @@ typedef struct BrotliDictionary { uint8_t data[122784]; } BrotliDictionary; -BROTLI_COMMON_API extern const BrotliDictionary* BrotliGetDictionary(); +BROTLI_COMMON_API extern const BrotliDictionary* BrotliGetDictionary(void); #define BROTLI_MIN_DICTIONARY_WORD_LENGTH 4 #define BROTLI_MAX_DICTIONARY_WORD_LENGTH 24 diff --git a/common/version.h b/common/version.h index 2cf6133..10fe01f 100755 --- a/common/version.h +++ b/common/version.h @@ -13,7 +13,7 @@ If library is dynamically linked, use BrotliDecoderVersion and BrotliEncoderVersion methods. */ -/* Semantic version, claculated as (MAJOR << 24) | (MINOR << 12) | PATCH */ +/* Semantic version, calculated as (MAJOR << 24) | (MINOR << 12) | PATCH */ #define BROTLI_VERSION 0x1000000 #endif /* BROTLI_COMMON_VERSION_H_ */ diff --git a/dec/state.c b/dec/state.c index bb37c77..27f4129 100644 --- a/dec/state.c +++ b/dec/state.c @@ -137,10 +137,9 @@ void BrotliDecoderStateCleanupAfterMetablock(BrotliDecoderState* s) { BROTLI_FREE(s, s->context_modes); BROTLI_FREE(s, s->context_map); BROTLI_FREE(s, s->dist_context_map); - - BrotliDecoderHuffmanTreeGroupRelease(s, &s->literal_hgroup); - BrotliDecoderHuffmanTreeGroupRelease(s, &s->insert_copy_hgroup); - BrotliDecoderHuffmanTreeGroupRelease(s, &s->distance_hgroup); + BROTLI_FREE(s, s->literal_hgroup.htrees); + BROTLI_FREE(s, s->insert_copy_hgroup.htrees); + BROTLI_FREE(s, s->distance_hgroup.htrees); } void BrotliDecoderStateCleanup(BrotliDecoderState* s) { @@ -160,17 +159,11 @@ BROTLI_BOOL BrotliDecoderHuffmanTreeGroupInit(BrotliDecoderState* s, HuffmanCode** p = (HuffmanCode**)BROTLI_ALLOC(s, code_size + htree_size); group->alphabet_size = (uint16_t)alphabet_size; group->num_htrees = (uint16_t)ntrees; - group->htrees = (HuffmanCode**)p; + group->htrees = p; group->codes = (HuffmanCode*)(&p[ntrees]); return !!p; } -void BrotliDecoderHuffmanTreeGroupRelease( - BrotliDecoderState* s, HuffmanTreeGroup* group) { - BROTLI_FREE(s, group->htrees); - group->htrees = NULL; -} - #if defined(__cplusplus) || defined(c_plusplus) } /* extern "C" */ #endif diff --git a/dec/state.h b/dec/state.h index ace6002..5946124 100644 --- a/dec/state.h +++ b/dec/state.h @@ -242,8 +242,6 @@ BROTLI_INTERNAL void BrotliDecoderStateCleanupAfterMetablock( BROTLI_INTERNAL BROTLI_BOOL BrotliDecoderHuffmanTreeGroupInit( BrotliDecoderState* s, HuffmanTreeGroup* group, uint32_t alphabet_size, uint32_t ntrees); -BROTLI_INTERNAL void BrotliDecoderHuffmanTreeGroupRelease( - BrotliDecoderState* s, HuffmanTreeGroup* group); #if defined(__cplusplus) || defined(c_plusplus) } /* extern "C" */ diff --git a/enc/backward_references_hq.c b/enc/backward_references_hq.c index 6640faa..5150ae1 100755 --- a/enc/backward_references_hq.c +++ b/enc/backward_references_hq.c @@ -519,6 +519,7 @@ static size_t ComputeShortestPathFromNodes(size_t num_bytes, return num_commands; } +/* REQUIRES: nodes != NULL and len(nodes) >= num_bytes + 1 */ void BrotliZopfliCreateCommands(const size_t num_bytes, const size_t block_start, const size_t max_backward_limit, @@ -609,7 +610,7 @@ static size_t ZopfliIterate(size_t num_bytes, return ComputeShortestPathFromNodes(num_bytes, nodes); } - +/* REQUIRES: nodes != NULL and len(nodes) >= num_bytes + 1 */ size_t BrotliZopfliComputeShortestPath(MemoryManager* m, const BrotliDictionary* dictionary, size_t num_bytes, diff --git a/enc/block_splitter_inc.h b/enc/block_splitter_inc.h index 8574fb9..f932740 100644 --- a/enc/block_splitter_inc.h +++ b/enc/block_splitter_inc.h @@ -214,7 +214,6 @@ static void FN(ClusterBlocks)(MemoryManager* m, size_t num_final_clusters; static const uint32_t kInvalidIndex = BROTLI_UINT32_MAX; uint32_t* new_index; - uint8_t max_type = 0; size_t i; uint32_t sizes[HISTOGRAMS_PER_BATCH] = { 0 }; uint32_t new_clusters[HISTOGRAMS_PER_BATCH] = { 0 }; @@ -337,6 +336,7 @@ static void FN(ClusterBlocks)(MemoryManager* m, { uint32_t cur_length = 0; size_t block_idx = 0; + uint8_t max_type = 0; for (i = 0; i < num_blocks; ++i) { cur_length += block_lengths[i]; if (i + 1 == num_blocks || diff --git a/enc/encode.c b/enc/encode.c index e16002c..dc0ddc1 100644 --- a/enc/encode.c +++ b/enc/encode.c @@ -1067,7 +1067,6 @@ static BROTLI_BOOL BrotliCompressBufferQuality10( 0, hasher_eff_size, BROTLI_TRUE); if (BROTLI_IS_OOM(m)) goto oom; - while (ok && metablock_start < input_size) { const size_t metablock_end = BROTLI_MIN(size_t, input_size, metablock_start + max_metablock_size); diff --git a/enc/hash_to_binary_tree_inc.h b/enc/hash_to_binary_tree_inc.h index b2d5ea2..0b2554c 100755 --- a/enc/hash_to_binary_tree_inc.h +++ b/enc/hash_to_binary_tree_inc.h @@ -197,7 +197,7 @@ static BROTLI_INLINE BackwardMatch* FN(StoreAndFindMatches)( sorted by strictly increasing length and (non-strictly) increasing distance. */ static BROTLI_INLINE size_t FN(FindAllMatches)(HasherHandle handle, - const BrotliDictionary* dicionary, const uint8_t* data, + const BrotliDictionary* dictionary, const uint8_t* data, const size_t ring_buffer_mask, const size_t cur_ix, const size_t max_length, const size_t max_backward, const BrotliEncoderParams* params, BackwardMatch* matches) { @@ -240,7 +240,7 @@ static BROTLI_INLINE size_t FN(FindAllMatches)(HasherHandle handle, } { size_t minlen = BROTLI_MAX(size_t, 4, best_len + 1); - if (BrotliFindAllStaticDictionaryMatches(dicionary, + if (BrotliFindAllStaticDictionaryMatches(dictionary, &data[cur_ix_masked], minlen, max_length, &dict_matches[0])) { size_t maxlen = BROTLI_MIN( size_t, BROTLI_MAX_STATIC_DICTIONARY_MATCH_LEN, max_length); diff --git a/enc/literal_cost.c b/enc/literal_cost.c index 2e78600..91c691c 100644 --- a/enc/literal_cost.c +++ b/enc/literal_cost.c @@ -38,12 +38,10 @@ static size_t DecideMultiByteStatsLevel(size_t pos, size_t len, size_t mask, size_t counts[3] = { 0 }; size_t max_utf8 = 1; /* should be 2, but 1 compresses better. */ size_t last_c = 0; - size_t utf8_pos = 0; size_t i; for (i = 0; i < len; ++i) { size_t c = data[(pos + i) & mask]; - utf8_pos = UTF8Position(last_c, c, 2); - ++counts[utf8_pos]; + ++counts[UTF8Position(last_c, c, 2)]; last_c = c; } if (counts[2] < 500) { @@ -65,7 +63,6 @@ static void EstimateBitCostsForLiteralsUTF8(size_t pos, size_t len, size_t mask, size_t in_window = BROTLI_MIN(size_t, window_half, len); size_t in_window_utf8[3] = { 0 }; - size_t i; { /* Bootstrap histograms. */ size_t last_c = 0; diff --git a/include/brotli/port.h b/include/brotli/port.h index ecb1db2..16c31d4 100755 --- a/include/brotli/port.h +++ b/include/brotli/port.h @@ -135,7 +135,6 @@ OR: #define BROTLI_NOINLINE #endif - #if BROTLI_MODERN_COMPILER || __has_attribute(deprecated) #define BROTLI_DEPRECATED __attribute__((deprecated)) #else |