summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Mohr <git@mohr.io>2022-06-11 21:14:56 (GMT)
committerAlexander Mohr <git@mohr.io>2022-06-11 21:58:03 (GMT)
commit9a42a9db94ff4c71de5590cae8d0f90339e6733b (patch)
tree3129b8e42c2dbebbbaddf3b1b5189275c588783d
parent3c57d2f185c2b482fde69a4c5f04dbb48bacab58 (diff)
downloadlz4-9a42a9db94ff4c71de5590cae8d0f90339e6733b.zip
lz4-9a42a9db94ff4c71de5590cae8d0f90339e6733b.tar.gz
lz4-9a42a9db94ff4c71de5590cae8d0f90339e6733b.tar.bz2
dict-size: make lz4 context const
change the context to const to make clear that the context is not modified
-rw-r--r--doc/lz4_manual.html2
-rw-r--r--lib/lz4.c4
-rw-r--r--lib/lz4.h2
-rw-r--r--lib/lz4hc.c4
-rw-r--r--lib/lz4hc.h2
5 files changed, 7 insertions, 7 deletions
diff --git a/doc/lz4_manual.html b/doc/lz4_manual.html
index 13c1ae6..700cb84 100644
--- a/doc/lz4_manual.html
+++ b/doc/lz4_manual.html
@@ -391,7 +391,7 @@ int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);
</p></pre><BR>
-<pre><b>LZ4LIB_STATIC_API int LZ4_getDictSize (LZ4_stream_t* LZ4_dict, int dictSize);
+<pre><b>LZ4LIB_STATIC_API int LZ4_getDictSize (const LZ4_stream_t* LZ4_dict, int dictSize);
</b><p> Get the size of the dictionary. This can be used for adding data without
compression to the LZ4 archive. If linked blocked mode is used the memory
of the dictionary is kept free.
diff --git a/lib/lz4.c b/lib/lz4.c
index 932e2cd..289162d 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 f2a529f..ce2288e 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 bf6294d..b5bc880 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 e62dfa7..3b31624 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)
}