MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ZSTD_getFrameContentSize

Function ZSTD_getFrameContentSize

freebsd/contrib/openzfs/module/zstd/lib/zstd.c:24843–24859  ·  view source on GitHub ↗

ZSTD_getFrameContentSize() : * compatible with legacy mode * @return : decompressed size of the single frame pointed to be `src` if known, otherwise * - ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined * - ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too small) */

Source from the content-addressed store, hash-verified

24841 * - ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined
24842 * - ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too small) */
24843unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcSize)
24844{
24845#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1)
24846 if (ZSTD_isLegacy(src, srcSize)) {
24847 unsigned long long const ret = ZSTD_getDecompressedSize_legacy(src, srcSize);
24848 return ret == 0 ? ZSTD_CONTENTSIZE_UNKNOWN : ret;
24849 }
24850#endif
24851 { ZSTD_frameHeader zfh;
24852 if (ZSTD_getFrameHeader(&zfh, src, srcSize) != 0)
24853 return ZSTD_CONTENTSIZE_ERROR;
24854 if (zfh.frameType == ZSTD_skippableFrame) {
24855 return 0;
24856 } else {
24857 return zfh.frameContentSize;
24858 } }
24859}
24860
24861static size_t readSkippableFrameSize(void const* src, size_t srcSize)
24862{

Callers 2

ZSTD_getDecompressedSizeFunction · 0.70

Calls 3

ZSTD_isLegacyFunction · 0.70
ZSTD_getFrameHeaderFunction · 0.70

Tested by

no test coverage detected