MCPcopy Create free account
hub / github.com/Snapchat/Valdi / compressWithContentSize

Function compressWithContentSize

valdi/test/runtime/ZStdUtils_tests.cpp:206–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204};
205
206static std::vector<Byte> compressWithContentSize(const Byte* src, size_t srcSize) {
207 auto* cctx = ZSTD_createCCtx();
208 ZSTD_CCtx_setParameter(cctx, ZSTD_c_contentSizeFlag, 1);
209 auto bound = ZSTD_compressBound(srcSize);
210 std::vector<Byte> out(bound);
211 auto sz = ZSTD_compress2(cctx, out.data(), out.size(), src, srcSize);
212 EXPECT_FALSE(ZSTD_isError(sz));
213 out.resize(sz);
214 ZSTD_freeCCtx(cctx);
215 return out;
216}
217
218} // namespace
219

Callers 1

TESTFunction · 0.85

Calls 9

ZSTD_createCCtxFunction · 0.85
ZSTD_CCtx_setParameterFunction · 0.85
ZSTD_compressBoundFunction · 0.85
ZSTD_compress2Function · 0.85
ZSTD_isErrorFunction · 0.85
ZSTD_freeCCtxFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected