added case for when file is not compressed with zstd (incorrect magic number)

This commit is contained in:
Paul Cruz 2017-06-15 17:00:59 -07:00
parent ddd1ab710c
commit 60a2e55e2e

View File

@ -874,7 +874,7 @@ typedef struct {
/* /*
* Reads information from file, stores in *info * Reads information from file, stores in *info
* if successful, returns 0, otherwise returns 1 * if successful, returns 0, returns 1 for frame analysis error, returns 2 for file not compressed with zstd
*/ */
static int getFileInfo(fileInfo_t* info, const char* inFileName){ static int getFileInfo(fileInfo_t* info, const char* inFileName){
int detectError = 0; int detectError = 0;
@ -998,6 +998,10 @@ static int getFileInfo(fileInfo_t* info, const char* inFileName){
} }
info->numSkippableFrames++; info->numSkippableFrames++;
} }
else {
detectError = 2;
break;
}
} }
} }
fclose(srcFile); fclose(srcFile);
@ -1043,8 +1047,12 @@ int FIO_listFile(const char* inFileName, int displayLevel){
{ {
int const error = getFileInfo(&info, inFileName); int const error = getFileInfo(&info, inFileName);
if (error == 1) { if (error == 1) {
/* display error, but provide output */
DISPLAY("An error occurred with getting file info\n"); DISPLAY("An error occurred with getting file info\n");
return 1; }
else if (error == 2) {
DISPLAYOUT("File %s not compressed with zstd\n\n", inFileName);
return 0;
} }
} }
displayInfo(inFileName, &info, displayLevel); displayInfo(inFileName, &info, displayLevel);