| 179 | |
| 180 | |
| 181 | static ZWRAP_CCtx* ZWRAP_createCCtx(z_streamp strm) |
| 182 | { |
| 183 | ZWRAP_CCtx* zwc; |
| 184 | ZSTD_customMem customMem = { NULL, NULL, NULL }; |
| 185 | |
| 186 | if (strm->zalloc && strm->zfree) { |
| 187 | customMem.customAlloc = ZWRAP_allocFunction; |
| 188 | customMem.customFree = ZWRAP_freeFunction; |
| 189 | } |
| 190 | customMem.opaque = strm; |
| 191 | |
| 192 | zwc = (ZWRAP_CCtx*)ZWRAP_customCalloc(sizeof(ZWRAP_CCtx), customMem); |
| 193 | if (zwc == NULL) return NULL; |
| 194 | zwc->allocFunc = *strm; |
| 195 | customMem.opaque = &zwc->allocFunc; |
| 196 | zwc->customMem = customMem; |
| 197 | |
| 198 | return zwc; |
| 199 | } |
| 200 | |
| 201 | |
| 202 | static int ZWRAP_initializeCStream(ZWRAP_CCtx* zwc, const void* dict, size_t dictSize, unsigned long long pledgedSrcSize) |
no test coverage detected