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

Function FIO_passThrough

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

FIO_passThrough() : just copy input into output, for compatibility with gzip -df mode @return : 0 (no error) */

Source from the content-addressed store, hash-verified

2020/** FIO_passThrough() : just copy input into output, for compatibility with gzip -df mode
2021 @return : 0 (no error) */
2022static int FIO_passThrough(const FIO_prefs_t* const prefs,
2023 FILE* foutput, FILE* finput,
2024 void* buffer, size_t bufferSize,
2025 size_t alreadyLoaded)
2026{
2027 size_t const blockSize = MIN(64 KB, bufferSize);
2028 size_t readFromInput;
2029 unsigned storedSkips = 0;
2030
2031 /* assumption : ress->srcBufferLoaded bytes already loaded and stored within buffer */
2032 { size_t const sizeCheck = fwrite(buffer, 1, alreadyLoaded, foutput);
2033 if (sizeCheck != alreadyLoaded) {
2034 DISPLAYLEVEL(1, "Pass-through write error : %s\n", strerror(errno));
2035 return 1;
2036 } }
2037
2038 do {
2039 readFromInput = fread(buffer, 1, blockSize, finput);
2040 storedSkips = FIO_fwriteSparse(foutput, buffer, readFromInput, prefs, storedSkips);
2041 } while (readFromInput == blockSize);
2042 if (ferror(finput)) {
2043 DISPLAYLEVEL(1, "Pass-through read error : %s\n", strerror(errno));
2044 return 1;
2045 }
2046 assert(feof(finput));
2047
2048 FIO_fwriteSparseEnd(prefs, foutput, storedSkips);
2049 return 0;
2050}
2051
2052/* FIO_zstdErrorHelp() :
2053 * detailed error message when requested window size is too large */

Callers 1

FIO_decompressFramesFunction · 0.85

Calls 2

FIO_fwriteSparseFunction · 0.85
FIO_fwriteSparseEndFunction · 0.85

Tested by

no test coverage detected