diff options
author | Evgenii Kliuchnikov <eustas@google.com> | 2025-08-11 01:27:34 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2025-08-11 01:28:09 -0700 |
commit | 7b345944d60ac6d78c56913d57803547a66cdfc2 (patch) | |
tree | adf58c974c9d7e4393d271e5dcedcfaf360a232b /c | |
parent | 6a4c96b1104c361c8d1d8b93db08943a6c459770 (diff) | |
download | brotli-master.zip brotli-master.tar.gz brotli-master.tar.bz2 |
PiperOrigin-RevId: 793535397
Diffstat (limited to 'c')
-rw-r--r-- | c/common/platform.h | 5 | ||||
-rw-r--r-- | c/dec/decode.c | 9 | ||||
-rw-r--r-- | c/enc/block_splitter.c | 15 | ||||
-rw-r--r-- | c/enc/brotli_bit_stream.c | 6 | ||||
-rw-r--r-- | c/enc/brotli_bit_stream.h | 4 | ||||
-rw-r--r-- | c/enc/encode.c | 4 | ||||
-rw-r--r-- | c/enc/encoder_dict.c | 4 | ||||
-rw-r--r-- | c/include/brotli/port.h | 3 |
8 files changed, 24 insertions, 26 deletions
diff --git a/c/common/platform.h b/c/common/platform.h index cf48338..056811a 100644 --- a/c/common/platform.h +++ b/c/common/platform.h @@ -594,4 +594,9 @@ BROTLI_UNUSED_FUNCTION void BrotliSuppressUnusedFunctions(void) { #define BROTLI_CRASH() (void)abort() #endif +/* Make BROTLI_TEST=0 act same as undefined. */ +#if defined(BROTLI_TEST) && ((1-BROTLI_TEST-1) == 0) +#undef BROTLI_TEST +#endif + #endif /* BROTLI_COMMON_PLATFORM_H_ */ diff --git a/c/dec/decode.c b/c/dec/decode.c index c53cbb8..c266cdf 100644 --- a/c/dec/decode.c +++ b/c/dec/decode.c @@ -2937,16 +2937,15 @@ void BrotliDecoderSetMetadataCallbacks( /* Escalate internal functions visibility; for testing purposes only. */ #if defined(BROTLI_TEST) -BROTLI_BOOL SafeReadSymbolForTest( +BROTLI_BOOL BrotliSafeReadSymbolForTest( const HuffmanCode*, BrotliBitReader*, brotli_reg_t*); -BROTLI_BOOL SafeReadSymbolForTest( +BROTLI_BOOL BrotliSafeReadSymbolForTest( const HuffmanCode* table, BrotliBitReader* br, brotli_reg_t* result) { return SafeReadSymbol(table, br, result); } - -void InverseMoveToFrontTransformForTest( +void BrotliInverseMoveToFrontTransformForTest( uint8_t*, brotli_reg_t, BrotliDecoderState*); -void InverseMoveToFrontTransformForTest( +void BrotliInverseMoveToFrontTransformForTest( uint8_t* v, brotli_reg_t l, BrotliDecoderState* s) { InverseMoveToFrontTransform(v, l, s); } diff --git a/c/enc/block_splitter.c b/c/enc/block_splitter.c index 470fabb..13e924f 100644 --- a/c/enc/block_splitter.c +++ b/c/enc/block_splitter.c @@ -196,16 +196,15 @@ void BrotliSplitBlock(MemoryManager* m, } #if defined(BROTLI_TEST) -size_t CountLiteralsForTest(const Command*, const size_t); -size_t CountLiteralsForTest(const Command* cmds, const size_t num_commands) { +size_t BrotliCountLiteralsForTest(const Command*, size_t); +size_t BrotliCountLiteralsForTest(const Command* cmds, size_t num_commands) { return CountLiterals(cmds, num_commands); } - -void CopyLiteralsToByteArrayForTest(const Command*, - const size_t, const uint8_t*, const size_t, const size_t, uint8_t*); -void CopyLiteralsToByteArrayForTest(const Command* cmds, - const size_t num_commands, const uint8_t* data, const size_t offset, - const size_t mask, uint8_t* literals) { +void BrotliCopyLiteralsToByteArrayForTest( + const Command*, size_t, const uint8_t*, size_t, size_t, uint8_t*); +void BrotliCopyLiteralsToByteArrayForTest(const Command* cmds, + size_t num_commands, const uint8_t* data, size_t offset, size_t mask, + uint8_t* literals) { CopyLiteralsToByteArray(cmds, num_commands, data, offset, mask, literals); } #endif diff --git a/c/enc/brotli_bit_stream.c b/c/enc/brotli_bit_stream.c index 779c843..ec0421a 100644 --- a/c/enc/brotli_bit_stream.c +++ b/c/enc/brotli_bit_stream.c @@ -1321,8 +1321,10 @@ void BrotliStoreUncompressedMetaBlock(BROTLI_BOOL is_final_block, } #if defined(BROTLI_TEST) -void GetBlockLengthPrefixCodeForTest(uint32_t len, size_t* code, - uint32_t* n_extra, uint32_t* extra) { +void BrotliGetBlockLengthPrefixCodeForTest(uint32_t len, size_t* code, + uint32_t* n_extra, uint32_t* extra); +void BrotliGetBlockLengthPrefixCodeForTest(uint32_t len, size_t* code, + uint32_t* n_extra, uint32_t* extra) { GetBlockLengthPrefixCode(len, code, n_extra, extra); } #endif diff --git a/c/enc/brotli_bit_stream.h b/c/enc/brotli_bit_stream.h index 9ca493d..7b72bdc 100644 --- a/c/enc/brotli_bit_stream.h +++ b/c/enc/brotli_bit_stream.h @@ -76,10 +76,6 @@ BROTLI_INTERNAL void BrotliStoreUncompressedMetaBlock( size_t position, size_t mask, size_t len, size_t* BROTLI_RESTRICT storage_ix, uint8_t* BROTLI_RESTRICT storage); -#if defined(BROTLI_TEST) -void GetBlockLengthPrefixCodeForTest(uint32_t, size_t*, uint32_t*, uint32_t*); -#endif - #if defined(__cplusplus) || defined(c_plusplus) } /* extern "C" */ #endif diff --git a/c/enc/encode.c b/c/enc/encode.c index 5a7641d..0d76f8a 100644 --- a/c/enc/encode.c +++ b/c/enc/encode.c @@ -1994,8 +1994,8 @@ size_t BrotliEncoderGetPreparedDictionarySize( } #if defined(BROTLI_TEST) -size_t MakeUncompressedStreamForTest(const uint8_t*, size_t, uint8_t*); -size_t MakeUncompressedStreamForTest( +size_t BrotliMakeUncompressedStreamForTest(const uint8_t*, size_t, uint8_t*); +size_t BrotliMakeUncompressedStreamForTest( const uint8_t* input, size_t input_size, uint8_t* output) { return MakeUncompressedStream(input, input_size, output); } diff --git a/c/enc/encoder_dict.c b/c/enc/encoder_dict.c index 26ffda8..bc4e0e6 100644 --- a/c/enc/encoder_dict.c +++ b/c/enc/encoder_dict.c @@ -632,8 +632,8 @@ void BrotliDestroyManagedDictionary(ManagedDictionary* dictionary) { /* Escalate internal functions visibility; for testing purposes only. */ #if defined(BROTLI_TEST) -void InitEncoderDictionaryForTest(BrotliEncoderDictionary*); -void InitEncoderDictionaryForTest(BrotliEncoderDictionary* d) { +void BrotliInitEncoderDictionaryForTest(BrotliEncoderDictionary*); +void BrotliInitEncoderDictionaryForTest(BrotliEncoderDictionary* d) { InitEncoderDictionary(d); } #endif diff --git a/c/include/brotli/port.h b/c/include/brotli/port.h index 0d50019..0c486d9 100644 --- a/c/include/brotli/port.h +++ b/c/include/brotli/port.h @@ -239,8 +239,6 @@ #define BROTLI_PUBLIC #endif -/* BROTLI_INTERNAL could be defined to override visibility, e.g. for tests. */ -#if !defined(BROTLI_INTERNAL) #if defined(_WIN32) || defined(__CYGWIN__) #define BROTLI_INTERNAL #elif BROTLI_GNUC_VERSION_CHECK(3, 3, 0) || \ @@ -255,7 +253,6 @@ #else #define BROTLI_INTERNAL #endif -#endif #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ !defined(__STDC_NO_VLA__) && !defined(__cplusplus) && \ |