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) */
| 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) */ |
| 24843 | unsigned 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 | |
| 24861 | static size_t readSkippableFrameSize(void const* src, size_t srcSize) |
| 24862 | { |
no test coverage detected