Skip to content

Commit 7c7ee2e

Browse files
update the calSize of gz file
1 parent 7bb0dbd commit 7c7ee2e

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/SketchInfo.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,24 @@ void calSize(bool sketchByFile, string inputFile, int threads, uint64_t &maxSize
220220
ifstream ifs(inputFile);
221221
string line;
222222
while(getline(ifs, line)){
223-
struct stat statbuf;
224-
stat(line.c_str(), &statbuf);
225-
uint64_t curSize = statbuf.st_size;
223+
uint64_t curSize;
224+
string fileSuffix = line.substr(line.length()-2);
225+
if(fileSuffix == "gz")//gz file
226+
{
227+
FILE *fp = fopen(line.c_str(), "r");
228+
fseek(fp, -4, SEEK_END);
229+
int nUnCompress = 0;
230+
fread(&nUnCompress, sizeof(int), 1, fp);
231+
curSize = nUnCompress;
232+
fclose(fp);
233+
//cerr << "compressed fileLength is: " << fileLength << endl;
234+
}
235+
else
236+
{
237+
struct stat statbuf;
238+
stat(line.c_str(), &statbuf);
239+
curSize = statbuf.st_size;
240+
}
226241
if(curSize < 10000){
227242
badNumber++;
228243
continue;

0 commit comments

Comments
 (0)