diff options
author | Alexander Mohr <git@mohr.io> | 2022-06-11 23:14:56 +0200 |
---|---|---|
committer | Alexander Mohr <git@mohr.io> | 2022-06-11 23:58:03 +0200 |
commit | 9a42a9db94ff4c71de5590cae8d0f90339e6733b (patch) | |
tree | 3129b8e42c2dbebbbaddf3b1b5189275c588783d /lib | |
parent | 3c57d2f185c2b482fde69a4c5f04dbb48bacab58 (diff) | |
download | lz4-9a42a9db94ff4c71de5590cae8d0f90339e6733b.tar.gz |
dict-size: make lz4 context const
change the context to const to make
clear that the context is not modified
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lz4.c | 4 | ||||
-rw-r--r-- | lib/lz4.h | 2 | ||||
-rw-r--r-- | lib/lz4hc.c | 4 | ||||
-rw-r--r-- | lib/lz4hc.h | 2 |
4 files changed, 6 insertions, 6 deletions
@@ -1689,9 +1689,9 @@ int LZ4_compress_forceExtDict (LZ4_stream_t* LZ4_dict, const char* source, char* * @param dictSize The maximum dictionary size. (Normally 64 KB). * @return The size of the dictionary. */ -int LZ4_getDictSize (LZ4_stream_t* LZ4_dict, int dictSize) +int LZ4_getDictSize (const LZ4_stream_t* LZ4_dict, int dictSize) { - LZ4_stream_t_internal* const dict = &LZ4_dict->internal_donotuse; + const LZ4_stream_t_internal* const dict = &LZ4_dict->internal_donotuse; if ((U32)dictSize > 64 KB) { dictSize = 64 KB; } /* useless to define a dictionary > 64 KB */ if ((U32)dictSize > dict->dictSize) { dictSize = (int)dict->dictSize; } @@ -519,7 +519,7 @@ LZ4LIB_STATIC_API void LZ4_attach_dictionary(LZ4_stream_t* workingStream, const * @param dictSize The maximum dictionary size. (Normally 64 KB). * @return The size of the dictionary. */ -LZ4LIB_STATIC_API int LZ4_getDictSize (LZ4_stream_t* LZ4_dict, int dictSize); +LZ4LIB_STATIC_API int LZ4_getDictSize (const LZ4_stream_t* LZ4_dict, int dictSize); /*! In-place compression and decompression * diff --git a/lib/lz4hc.c b/lib/lz4hc.c index bf6294df..b5bc880e 100644 --- a/lib/lz4hc.c +++ b/lib/lz4hc.c @@ -1164,8 +1164,8 @@ int LZ4_compress_HC_continue_destSize (LZ4_streamHC_t* LZ4_streamHCPtr, const ch * @param dictSize The maximum dictionary size. (Normally 64 KB). * @return The size of the dictionary. */ -int LZ4_getDictHCSize(LZ4_streamHC_t* LZ4_streamHCPtr, int dictSize) { - LZ4HC_CCtx_internal* const streamPtr = &LZ4_streamHCPtr->internal_donotuse; +int LZ4_getDictHCSize(const LZ4_streamHC_t* LZ4_streamHCPtr, int dictSize) { + const LZ4HC_CCtx_internal* const streamPtr = &LZ4_streamHCPtr->internal_donotuse; int const prefixSize = (int)(streamPtr->end - (streamPtr->base + streamPtr->dictLimit)); DEBUGLOG(5, "LZ4_saveDictHC(%p, %p, %d)", LZ4_streamHCPtr, safeBuffer, dictSize); assert(prefixSize >= 0); diff --git a/lib/lz4hc.h b/lib/lz4hc.h index e62dfa7d..3b31624a 100644 --- a/lib/lz4hc.h +++ b/lib/lz4hc.h @@ -415,7 +415,7 @@ LZ4LIB_STATIC_API void LZ4_attach_HC_dictionary( * @param dictSize The maximum dictionary size. (Normally 64 KB). * @return The size of the dictionary. */ -LZ4LIB_STATIC_API int LZ4_getDictHCSize(LZ4_streamHC_t* LZ4_streamHCPtr, int dictSize); +LZ4LIB_STATIC_API int LZ4_getDictHCSize(const LZ4_streamHC_t* LZ4_streamHCPtr, int dictSize); #if defined (__cplusplus) } |