| 246 | } |
| 247 | |
| 248 | Result<DCtxPtr> CreateDCtx() const { |
| 249 | DCtxPtr dctx{ZSTD_createDCtx(), ZSTD_freeDCtx}; |
| 250 | if (dctx == nullptr) { |
| 251 | return Status::OutOfMemory("ZSTD_DCtx create failed"); |
| 252 | } |
| 253 | for (auto& [key, value] : decompression_context_params_) { |
| 254 | auto ret = |
| 255 | ZSTD_DCtx_setParameter(dctx.get(), static_cast<ZSTD_dParameter>(key), value); |
| 256 | if (ZSTD_isError(ret)) { |
| 257 | return ZSTDError(ret, "ZSTD_DCtx create failed: "); |
| 258 | } |
| 259 | } |
| 260 | return dctx; |
| 261 | } |
| 262 | |
| 263 | const int compression_level_; |
| 264 | const std::vector<std::pair<int, int>> compression_context_params_; |
nothing calls this directly
no test coverage detected