Added ZSTD_initStaticCDict()

This commit is contained in:
Yann Collet
2017-05-25 18:05:49 -07:00
parent 57827f906f
commit cdf7e82222
5 changed files with 145 additions and 37 deletions
+2 -1
View File
@@ -2053,7 +2053,8 @@ ZSTD_DDict* ZSTD_initStaticDDict(void* workspace, size_t workspaceSize,
{
size_t const neededSpace = sizeof(ZSTD_DDict) + (byReference ? 0 : dictSize);
ZSTD_DDict* const ddict = (ZSTD_DDict*)workspace;
if (workspaceSize < neededSpace) return NULL; /* minimum size */
if ((size_t)workspace & 7) return NULL; /* 8-aligned */
if (workspaceSize < neededSpace) return NULL;
if (!byReference) {
memcpy(ddict+1, dict, dictSize); /* local copy */
dict = ddict+1;