From 0ef4edacab4520c1fdc24f7e8b645c502c8025d5 Mon Sep 17 00:00:00 2001 From: Eugene Kliuchnikov Date: Mon, 25 Jul 2016 10:36:36 +0200 Subject: [PATCH] Do not use "static inline" for deprecated API. --- dec/decode.c | 39 +++++++++++++++++++++++++++++++++++++++ dec/decode.h | 47 +++++++++++++---------------------------------- 2 files changed, 52 insertions(+), 34 deletions(-) diff --git a/dec/decode.c b/dec/decode.c index c8a466e..91e1d1b 100644 --- a/dec/decode.c +++ b/dec/decode.c @@ -2303,6 +2303,45 @@ const char* BrotliDecoderErrorString(BrotliDecoderErrorCode c) { } } +/* DEPRECATED >>> */ +BrotliState* BrotliCreateState( + brotli_alloc_func alloc, brotli_free_func free, void* opaque) { + return (BrotliState*)BrotliDecoderCreateInstance(alloc, free, opaque); +} +void BrotliDestroyState(BrotliState* state) { + BrotliDecoderDestroyInstance((BrotliDecoderState*)state); +} +BrotliResult BrotliDecompressBuffer( + size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size, + uint8_t* decoded_buffer) { + return (BrotliResult)BrotliDecoderDecompress( + encoded_size, encoded_buffer, decoded_size, decoded_buffer); +} +BrotliResult BrotliDecompressStream( + size_t* available_in, const uint8_t** next_in, size_t* available_out, + uint8_t** next_out, size_t* total_out, BrotliState* s) { + return (BrotliResult)BrotliDecoderDecompressStream((BrotliDecoderState*)s, + available_in, next_in, available_out, next_out, total_out); +} +void BrotliSetCustomDictionary( + size_t size, const uint8_t* dict, BrotliState* s) { + BrotliDecoderSetCustomDictionary((BrotliDecoderState*)s, size, dict); +} +BROTLI_BOOL BrotliStateIsStreamStart(const BrotliState* s) { + return !BrotliDecoderIsUsed((const BrotliDecoderState*)s); +} +BROTLI_BOOL BrotliStateIsStreamEnd(const BrotliState* s) { + return BrotliDecoderIsFinished((const BrotliDecoderState*)s); +} +BrotliErrorCode BrotliGetErrorCode(const BrotliState* s) { + return (BrotliErrorCode)BrotliDecoderGetErrorCode( + (const BrotliDecoderState*)s); +} +const char* BrotliErrorString(BrotliErrorCode c) { + return BrotliDecoderErrorString((BrotliDecoderErrorCode)c); +} +/* <<< DEPRECATED */ + #if defined(__cplusplus) || defined(c_plusplus) } /* extern "C" */ #endif diff --git a/dec/decode.h b/dec/decode.h index 5df396b..405c463 100644 --- a/dec/decode.h +++ b/dec/decode.h @@ -162,44 +162,23 @@ typedef enum { #undef _BROTLI_COMMA } BrotliErrorCode; typedef struct BrotliStateStruct BrotliState; -static inline BrotliState* BrotliCreateState( - brotli_alloc_func alloc, brotli_free_func free, void* opaque) { - return (BrotliState*)BrotliDecoderCreateInstance(alloc, free, opaque); -} -static inline void BrotliDestroyState(BrotliState* state) { - BrotliDecoderDestroyInstance((BrotliDecoderState*)state); -} +BrotliState* BrotliCreateState( + brotli_alloc_func alloc, brotli_free_func free, void* opaque); +void BrotliDestroyState(BrotliState* state); BROTLI_BOOL BrotliDecompressedSize( size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size); -static inline BrotliResult BrotliDecompressBuffer( +BrotliResult BrotliDecompressBuffer( size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size, - uint8_t* decoded_buffer) { - return (BrotliResult)BrotliDecoderDecompress( - encoded_size, encoded_buffer, decoded_size, decoded_buffer); -} -static inline BrotliResult BrotliDecompressStream( + uint8_t* decoded_buffer); +BrotliResult BrotliDecompressStream( size_t* available_in, const uint8_t** next_in, size_t* available_out, - uint8_t** next_out, size_t* total_out, BrotliState* s) { - return (BrotliResult)BrotliDecoderDecompressStream((BrotliDecoderState*)s, - available_in, next_in, available_out, next_out, total_out); -} -static inline void BrotliSetCustomDictionary( - size_t size, const uint8_t* dict, BrotliState* s) { - BrotliDecoderSetCustomDictionary((BrotliDecoderState*)s, size, dict); -} -static inline BROTLI_BOOL BrotliStateIsStreamStart(const BrotliState* s) { - return !BrotliDecoderIsUsed((const BrotliDecoderState*)s); -} -static inline BROTLI_BOOL BrotliStateIsStreamEnd(const BrotliState* s) { - return BrotliDecoderIsFinished((const BrotliDecoderState*)s); -} -static inline BrotliErrorCode BrotliGetErrorCode(const BrotliState* s) { - return (BrotliErrorCode)BrotliDecoderGetErrorCode( - (const BrotliDecoderState*)s); -} -static inline const char* BrotliErrorString(BrotliErrorCode c) { - return BrotliDecoderErrorString((BrotliDecoderErrorCode)c); -} + uint8_t** next_out, size_t* total_out, BrotliState* s); +void BrotliSetCustomDictionary( + size_t size, const uint8_t* dict, BrotliState* s); +BROTLI_BOOL BrotliStateIsStreamStart(const BrotliState* s); +BROTLI_BOOL BrotliStateIsStreamEnd(const BrotliState* s); +BrotliErrorCode BrotliGetErrorCode(const BrotliState* s); +const char* BrotliErrorString(BrotliErrorCode c); /* <<< DEPRECATED */ #if defined(__cplusplus) || defined(c_plusplus)