diff options
author | Evgenii Kliuchnikov <eustas@google.com> | 2023-08-18 02:55:01 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-08-18 02:55:33 -0700 |
commit | 3ebb2d30ab221abdc235cad602fc5c97c9de5b33 (patch) | |
tree | dd74f7411e5e262136bd9401e5382ab3570ffb3b /c/common | |
parent | 0f2157cc5e7f6a28bf648738c208ca825917589a (diff) | |
download | brotli-3ebb2d30ab221abdc235cad602fc5c97c9de5b33.zip brotli-3ebb2d30ab221abdc235cad602fc5c97c9de5b33.tar.gz brotli-3ebb2d30ab221abdc235cad602fc5c97c9de5b33.tar.bz2 |
Move serialized dictionary feature behind the flag.
BROTLI_SHARED_DICTIONARY_SERIALIZED enum value is a part of API,
but it should not be used (will cause failures).
Changing how serialized dictionaries work won't be considered as an API change, until this feature is enabled.
Enabling this feature in the future will be considered as a "compatible" change.
PiperOrigin-RevId: 558091676
Diffstat (limited to 'c/common')
-rw-r--r-- | c/common/shared_dictionary.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/c/common/shared_dictionary.c b/c/common/shared_dictionary.c index 3ca40c0..49f1c9b 100644 --- a/c/common/shared_dictionary.c +++ b/c/common/shared_dictionary.c @@ -20,6 +20,8 @@ extern "C" { #endif +#if defined(BROTLI_EXPERIMENTAL) + #define BROTLI_NUM_ENCODED_LENGTHS (SHARED_BROTLI_MAX_DICTIONARY_WORD_LENGTH \ - SHARED_BROTLI_MIN_DICTIONARY_WORD_LENGTH + 1) @@ -442,6 +444,8 @@ static BROTLI_BOOL DecodeSharedDictionary( return ParseDictionary(encoded, size, dict); } +#endif /* BROTLI_EXPERIMENTAL */ + void BrotliSharedDictionaryDestroyInstance( BrotliSharedDictionary* dict) { if (!dict) { @@ -464,9 +468,12 @@ BROTLI_BOOL BrotliSharedDictionaryAttach( if (!dict) { return BROTLI_FALSE; } +#if defined(BROTLI_EXPERIMENTAL) if (type == BROTLI_SHARED_DICTIONARY_SERIALIZED) { return DecodeSharedDictionary(data, data_size, dict); - } else if (type == BROTLI_SHARED_DICTIONARY_RAW) { + } +#endif /* BROTLI_EXPERIMENTAL */ + if (type == BROTLI_SHARED_DICTIONARY_RAW) { if (dict->num_prefix >= SHARED_BROTLI_MAX_COMPOUND_DICTS) { return BROTLI_FALSE; } @@ -474,9 +481,8 @@ BROTLI_BOOL BrotliSharedDictionaryAttach( dict->prefix[dict->num_prefix] = data; dict->num_prefix++; return BROTLI_TRUE; - } else { - return BROTLI_FALSE; } + return BROTLI_FALSE; } BrotliSharedDictionary* BrotliSharedDictionaryCreateInstance( |