fixed error where extremely small files were not being detected as not compressed with zstd

This commit is contained in:
Paul Cruz 2017-06-20 14:04:46 -07:00
parent 3701dde3ba
commit 0765602903

View File

@ -889,10 +889,15 @@ static int getFileInfo(fileInfo_t* info, const char* inFileName){
BYTE headerBuffer[ZSTD_FRAMEHEADERSIZE_MAX];
size_t const numBytesRead = fread(headerBuffer, 1, sizeof(headerBuffer), srcFile);
if (numBytesRead < ZSTD_frameHeaderSize_min) {
if (feof(srcFile)) {
if (feof(srcFile) && numBytesRead == 0) {
break;
}
else{
else if (feof(srcFile)) {
DISPLAY("Error: reached end of file with incomplete frame\n");
detectError = 2;
break;
}
else {
DISPLAY("Error: did not reach end of file but ran out of frames\n");
detectError = 1;
break;