| 24385 | |
| 24386 | |
| 24387 | const ZSTD_DDict* ZSTD_initStaticDDict( |
| 24388 | void* sBuffer, size_t sBufferSize, |
| 24389 | const void* dict, size_t dictSize, |
| 24390 | ZSTD_dictLoadMethod_e dictLoadMethod, |
| 24391 | ZSTD_dictContentType_e dictContentType) |
| 24392 | { |
| 24393 | size_t const neededSpace = sizeof(ZSTD_DDict) |
| 24394 | + (dictLoadMethod == ZSTD_dlm_byRef ? 0 : dictSize); |
| 24395 | ZSTD_DDict* const ddict = (ZSTD_DDict*)sBuffer; |
| 24396 | assert(sBuffer != NULL); |
| 24397 | assert(dict != NULL); |
| 24398 | if ((size_t)sBuffer & 7) return NULL; /* 8-aligned */ |
| 24399 | if (sBufferSize < neededSpace) return NULL; |
| 24400 | if (dictLoadMethod == ZSTD_dlm_byCopy) { |
| 24401 | memcpy(ddict+1, dict, dictSize); /* local copy */ |
| 24402 | dict = ddict+1; |
| 24403 | } |
| 24404 | if (ZSTD_isError( ZSTD_initDDict_internal(ddict, |
| 24405 | dict, dictSize, |
| 24406 | ZSTD_dlm_byRef, dictContentType) )) |
| 24407 | return NULL; |
| 24408 | return ddict; |
| 24409 | } |
| 24410 | |
| 24411 | |
| 24412 | size_t ZSTD_freeDDict(ZSTD_DDict* ddict) |
nothing calls this directly
no test coverage detected