mirror of
https://github.com/google/brotli.git
synced 2024-11-08 21:30:04 +00:00
commit
2f35ffd77a
@ -50,8 +50,9 @@ static const int kDistanceContextBits = 2;
|
|||||||
|
|
||||||
#define HUFFMAN_TABLE_BITS 8
|
#define HUFFMAN_TABLE_BITS 8
|
||||||
#define HUFFMAN_TABLE_MASK 0xff
|
#define HUFFMAN_TABLE_MASK 0xff
|
||||||
/* This is a rough estimate, not an exact bound. */
|
/* Maximum possible Huffman table size for an alphabet size of 704, max code
|
||||||
#define HUFFMAN_MAX_TABLE_SIZE 2048
|
* length 15 and root table bits 8. */
|
||||||
|
#define HUFFMAN_MAX_TABLE_SIZE 1080
|
||||||
|
|
||||||
#define CODE_LENGTH_CODES 18
|
#define CODE_LENGTH_CODES 18
|
||||||
static const uint8_t kCodeLengthCodeOrder[CODE_LENGTH_CODES] = {
|
static const uint8_t kCodeLengthCodeOrder[CODE_LENGTH_CODES] = {
|
||||||
@ -985,7 +986,6 @@ int BrotliDecompress(BrotliInput input, BrotliOutput output) {
|
|||||||
block_type_rb_index, &br);
|
block_type_rb_index, &br);
|
||||||
block_length[2] = ReadBlockLength(
|
block_length[2] = ReadBlockLength(
|
||||||
&block_len_trees[2 * HUFFMAN_MAX_TABLE_SIZE], &br);
|
&block_len_trees[2 * HUFFMAN_MAX_TABLE_SIZE], &br);
|
||||||
dist_htree_index = (uint8_t)block_type[2];
|
|
||||||
dist_context_offset = block_type[2] << kDistanceContextBits;
|
dist_context_offset = block_type[2] << kDistanceContextBits;
|
||||||
dist_context_map_slice = dist_context_map + dist_context_offset;
|
dist_context_map_slice = dist_context_map + dist_context_offset;
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
Size-checked memory allocation.
|
Size-checked memory allocation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef BROTLI_UTILS_UTILS_H_
|
#ifndef BROTLI_DEC_SAFE_MALLOC_H_
|
||||||
#define BROTLI_UTILS_UTILS_H_
|
#define BROTLI_DEC_SAFE_MALLOC_H_
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@ -42,4 +42,4 @@ void* BrotliSafeMalloc(uint64_t nmemb, size_t size);
|
|||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* BROTLI_UTILS_UTILS_H_ */
|
#endif /* BROTLI_DEC_SAFE_MALLOC_H_ */
|
||||||
|
@ -182,7 +182,7 @@ static const Transform kTransforms[] = {
|
|||||||
|
|
||||||
static const int kNumTransforms = sizeof(kTransforms) / sizeof(kTransforms[0]);
|
static const int kNumTransforms = sizeof(kTransforms) / sizeof(kTransforms[0]);
|
||||||
|
|
||||||
static int ToUpperCase(uint8_t *p, int len) {
|
static int ToUpperCase(uint8_t *p) {
|
||||||
if (p[0] < 0xc0) {
|
if (p[0] < 0xc0) {
|
||||||
if (p[0] >= 'a' && p[0] <= 'z') {
|
if (p[0] >= 'a' && p[0] <= 'z') {
|
||||||
p[0] ^= 32;
|
p[0] ^= 32;
|
||||||
@ -220,10 +220,10 @@ static BROTLI_INLINE int TransformDictionaryWord(
|
|||||||
while (i < len) { dst[idx++] = word[i++]; }
|
while (i < len) { dst[idx++] = word[i++]; }
|
||||||
uppercase = &dst[idx - len];
|
uppercase = &dst[idx - len];
|
||||||
if (t == kUppercaseFirst) {
|
if (t == kUppercaseFirst) {
|
||||||
ToUpperCase(uppercase, len);
|
ToUpperCase(uppercase);
|
||||||
} else if (t == kUppercaseAll) {
|
} else if (t == kUppercaseAll) {
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
int step = ToUpperCase(uppercase, len);
|
int step = ToUpperCase(uppercase);
|
||||||
uppercase += step;
|
uppercase += step;
|
||||||
len -= step;
|
len -= step;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user