aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexander Mohr <git@mohr.io>2022-06-11 23:14:56 +0200
committerAlexander Mohr <git@mohr.io>2022-06-11 23:58:03 +0200
commit9a42a9db94ff4c71de5590cae8d0f90339e6733b (patch)
tree3129b8e42c2dbebbbaddf3b1b5189275c588783d /lib
parent3c57d2f185c2b482fde69a4c5f04dbb48bacab58 (diff)
downloadlz4-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.c4
-rw-r--r--lib/lz4.h2
-rw-r--r--lib/lz4hc.c4
-rw-r--r--lib/lz4hc.h2
4 files changed, 6 insertions, 6 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 932e2cd2..289162df 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -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; }
diff --git a/lib/lz4.h b/lib/lz4.h
index f2a529fb..ce2288e8 100644
--- a/lib/lz4.h
+++ b/lib/lz4.h
@@ -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)
}