fixed ZSTD_sizeof_?Dict()

This commit is contained in:
Yann Collet
2016-12-23 22:25:03 +01:00
parent 63fcb87b07
commit aca113f4f5
4 changed files with 5 additions and 5 deletions
+1
View File
@@ -1,5 +1,6 @@
v1.1.3 v1.1.3
cli : new : advanced commands for detailed parameters, by Przemyslaw Skibinski cli : new : advanced commands for detailed parameters, by Przemyslaw Skibinski
cli : fix zstdless on Mac OS-X, by Andrew Janke
API : fix : all symbols properly exposed in libzstd, by Nick Terrell API : fix : all symbols properly exposed in libzstd, by Nick Terrell
API : new : ZSTD_create?Dict_byReference(), requested by Bartosz Taudul API : new : ZSTD_create?Dict_byReference(), requested by Bartosz Taudul
API : new : ZDICT_finalizeDictionary() API : new : ZDICT_finalizeDictionary()
+2 -3
View File
@@ -51,8 +51,7 @@ static void ZSTD_resetSeqStore(seqStore_t* ssPtr)
/*-************************************* /*-*************************************
* Context memory management * Context memory management
***************************************/ ***************************************/
struct ZSTD_CCtx_s struct ZSTD_CCtx_s {
{
const BYTE* nextSrc; /* next block here to continue on current prefix */ const BYTE* nextSrc; /* next block here to continue on current prefix */
const BYTE* base; /* All regular indexes relative to this position */ const BYTE* base; /* All regular indexes relative to this position */
const BYTE* dictBase; /* extDict indexes relative to this position */ const BYTE* dictBase; /* extDict indexes relative to this position */
@@ -2742,7 +2741,7 @@ struct ZSTD_CDict_s {
size_t ZSTD_sizeof_CDict(const ZSTD_CDict* cdict) size_t ZSTD_sizeof_CDict(const ZSTD_CDict* cdict)
{ {
if (cdict==NULL) return 0; /* support sizeof on NULL */ if (cdict==NULL) return 0; /* support sizeof on NULL */
return ZSTD_sizeof_CCtx(cdict->refContext) + cdict->dictContentSize; return ZSTD_sizeof_CCtx(cdict->refContext) + (cdict->dictBuffer ? cdict->dictContentSize : 0) + sizeof(*cdict);
} }
ZSTD_CDict* ZSTD_createCDict_advanced(const void* dictBuffer, size_t dictSize, unsigned byReference, ZSTD_CDict* ZSTD_createCDict_advanced(const void* dictBuffer, size_t dictSize, unsigned byReference,
+1 -1
View File
@@ -1792,7 +1792,7 @@ size_t ZSTD_freeDDict(ZSTD_DDict* ddict)
size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict) size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict)
{ {
if (ddict==NULL) return 0; /* support sizeof on NULL */ if (ddict==NULL) return 0; /* support sizeof on NULL */
return sizeof(*ddict) + sizeof(ddict->refContext) + ddict->dictSize; return sizeof(*ddict) + ZSTD_sizeof_DCtx(ddict->refContext) + (ddict->dictBuffer ? ddict->dictSize : 0) ;
} }
/*! ZSTD_getDictID_fromDict() : /*! ZSTD_getDictID_fromDict() :
+1 -1
View File
@@ -60,7 +60,7 @@
#define NOISELENGTH 32 #define NOISELENGTH 32
#define MINRATIO 4 #define MINRATIO 4
static const int g_compressionLevel_default = 5; static const int g_compressionLevel_default = 6;
static const U32 g_selectivity_default = 9; static const U32 g_selectivity_default = 9;
static const size_t g_provision_entropySize = 200; static const size_t g_provision_entropySize = 200;
static const size_t g_min_fast_dictContent = 192; static const size_t g_min_fast_dictContent = 192;