# define ZDICT_STATIC_LINKING_ONLY
#endif
#include "zdict.h"
+#include "decompress/zstd_decompress_internal.h" /* ZSTD_entropyDTables_t */
/*-*************************************
return MEM_readLE32((const char*)dictBuffer + 4);
}
+size_t ZDICT_getDictHeaderSize(const void* dictBuffer, size_t dictSize)
+{
+ if (dictSize <= 8 || MEM_readLE32(dictBuffer) != ZSTD_MAGIC_DICTIONARY) return 0;
+
+ { ZSTD_entropyDTables_t dummyEntropyTables;
+ size_t headerSize;
+ dummyEntropyTables.hufTable[0] = (HUF_DTable)((HufLog)*0x1000001);
+ headerSize = ZSTD_loadDEntropy(&dummyEntropyTables, dictBuffer, dictSize);
+ return ZSTD_isError(headerSize) ? 0 : headerSize;
+ }
+}
/*-********************************************************
* Dictionary training functions
/*====== Helper functions ======*/
ZDICTLIB_API unsigned ZDICT_getDictID(const void* dictBuffer, size_t dictSize); /**< extracts dictID; @return zero if error (not a valid dictionary) */
+ZDICTLIB_API size_t ZDICT_getDictHeaderSize(const void* dictBuffer, size_t dictSize); /* returns dict header size; returns zero if error (not a valid dictionary) */
ZDICTLIB_API unsigned ZDICT_isError(size_t errorCode);
ZDICTLIB_API const char* ZDICT_getErrorName(size_t errorCode);