mirror of
https://github.com/facebook/zstd.git
synced 2025-12-08 00:03:24 -05:00
added display for compressed size
This commit is contained in:
parent
4128f67a4a
commit
0f06f4f266
@ -862,13 +862,23 @@ int FIO_compressFilename(const char* dstFileName, const char* srcFileName,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FIO_listFile(const char* infilename){
|
int FIO_listFile(const char* infilename, int displayLevel){
|
||||||
DISPLAY("FILE DETECTED: %s\n", infilename);
|
DISPLAY("FILE DETECTED: %s\n", infilename);
|
||||||
const char* const suffixPtr = strrchr(infilename, '.');
|
const char* const suffixPtr = strrchr(infilename, '.');
|
||||||
if(!suffixPtr || strcmp(suffixPtr, ZSTD_EXTENSION)){
|
if(!suffixPtr || strcmp(suffixPtr, ZSTD_EXTENSION)){
|
||||||
DISPLAYLEVEL(1, "file %s was not compressed with zstd -- ignoring\n", infilename);
|
DISPLAYLEVEL(1, "file %s was not compressed with zstd -- ignoring\n", infilename);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
U64 const compSize = UTIL_getFileSize(infilename);
|
||||||
|
if(displayLevel<=2){
|
||||||
|
DISPLAY("Skippable Non-Skippable Compressed Uncompressed Ratio Check Filename\n");
|
||||||
|
DISPLAY(" %7.2f MB\n", (double)compSize/(1 MB));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
DISPLAY("Compressed Size: %.2f MB (%llu B)\n", (double)compSize/(1 MB), compSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@ int FIO_compressFilename (const char* outfilename, const char* infilename, const
|
|||||||
@return : 0 == ok; 1 == pb with src file. */
|
@return : 0 == ok; 1 == pb with src file. */
|
||||||
int FIO_decompressFilename (const char* outfilename, const char* infilename, const char* dictFileName);
|
int FIO_decompressFilename (const char* outfilename, const char* infilename, const char* dictFileName);
|
||||||
|
|
||||||
int FIO_listFile(const char* infilename);
|
int FIO_listFile(const char* infilename, int displayLevel);
|
||||||
|
|
||||||
/*-*************************************
|
/*-*************************************
|
||||||
* Multiple File functions
|
* Multiple File functions
|
||||||
|
|||||||
@ -680,7 +680,7 @@ int main(int argCount, const char* argv[])
|
|||||||
unsigned u;
|
unsigned u;
|
||||||
DISPLAY("Number of files listed: %d\n", filenameIdx);
|
DISPLAY("Number of files listed: %d\n", filenameIdx);
|
||||||
for(u=0; u<filenameIdx;u++){
|
for(u=0; u<filenameIdx;u++){
|
||||||
FIO_listFile(filenameTable[u]);
|
FIO_listFile(filenameTable[u],g_displayLevel);
|
||||||
}
|
}
|
||||||
CLEAN_RETURN(0);
|
CLEAN_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user