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

Function FIO_zstdErrorHelp

freebsd/contrib/zstd/programs/fileio.c:2054–2082  ·  view source on GitHub ↗

FIO_zstdErrorHelp() : * detailed error message when requested window size is too large */

Source from the content-addressed store, hash-verified

2052/* FIO_zstdErrorHelp() :
2053 * detailed error message when requested window size is too large */
2054static void
2055FIO_zstdErrorHelp(const FIO_prefs_t* const prefs,
2056 const dRess_t* ress,
2057 size_t err, const char* srcFileName)
2058{
2059 ZSTD_frameHeader header;
2060
2061 /* Help message only for one specific error */
2062 if (ZSTD_getErrorCode(err) != ZSTD_error_frameParameter_windowTooLarge)
2063 return;
2064
2065 /* Try to decode the frame header */
2066 err = ZSTD_getFrameHeader(&header, ress->srcBuffer, ress->srcBufferLoaded);
2067 if (err == 0) {
2068 unsigned long long const windowSize = header.windowSize;
2069 unsigned const windowLog = FIO_highbit64(windowSize) + ((windowSize & (windowSize - 1)) != 0);
2070 assert(prefs->memLimit > 0);
2071 DISPLAYLEVEL(1, "%s : Window size larger than maximum : %llu > %u \n",
2072 srcFileName, windowSize, prefs->memLimit);
2073 if (windowLog <= ZSTD_WINDOWLOG_MAX) {
2074 unsigned const windowMB = (unsigned)((windowSize >> 20) + ((windowSize & ((1 MB) - 1)) != 0));
2075 assert(windowSize < (U64)(1ULL << 52)); /* ensure now overflow for windowMB */
2076 DISPLAYLEVEL(1, "%s : Use --long=%u or --memory=%uMB \n",
2077 srcFileName, windowLog, windowMB);
2078 return;
2079 } }
2080 DISPLAYLEVEL(1, "%s : Window log larger than ZSTD_WINDOWLOG_MAX=%u; not supported \n",
2081 srcFileName, ZSTD_WINDOWLOG_MAX);
2082}
2083
2084/** FIO_decompressFrame() :
2085 * @return : size of decoded zstd frame, or an error code

Callers 1

FIO_decompressZstdFrameFunction · 0.85

Calls 3

FIO_highbit64Function · 0.85
ZSTD_getErrorCodeFunction · 0.50
ZSTD_getFrameHeaderFunction · 0.50

Tested by

no test coverage detected