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

Method decompress

valdi/src/valdi/runtime/Resources/ValdiModuleArchive.cpp:71–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71Result<ValdiModuleArchive> ValdiModuleArchive::decompress(const Byte* data, size_t len) {
72 if (ZStdUtils::isZstdFile(data, len)) {
73 auto decompressed = ZStdUtils::decompress(data, len);
74 if (!decompressed) {
75 return decompressed.moveError();
76 }
77
78 return ValdiModuleArchive::deserialize(decompressed.value()->toBytesView());
79 } else {
80 return ValdiModuleArchive::deserialize(BytesView(nullptr, data, len));
81 }
82}
83
84// Future optimization: reuse cached mmap files across launches.
85// The compiler can append a ZStd skippable frame (magic 0x184D2A50, 8-byte header + 32-byte

Callers

nothing calls this directly

Calls 4

valueMethod · 0.65
BytesViewClass · 0.50
toBytesViewMethod · 0.45
removingLastComponentMethod · 0.45

Tested by

no test coverage detected