MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / GetCompressedFileSize

Method GetCompressedFileSize

CrySystem/CompressedFile.cpp:39–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37};
38
39unsigned int CSystem::GetCompressedFileSize(char *filename)
40{
41 FILE *pFile=fxopen(filename, "rb");
42 if (!pFile)
43 return 0;
44
45 fseek(pFile,0,SEEK_END);
46 long nLen=ftell(pFile);
47 fseek(pFile,0,SEEK_SET);
48 if (nLen<=0)
49 {
50 // gzread works incorrectly if the filesize is 0
51 fclose(pFile);
52 return (0);
53 }
54
55 fclose(pFile);
56 pFile=fxopen(filename, "rb");
57 if (!pFile)
58 return 0;
59
60 unsigned int bitlen;
61 gzFile f = gzdopen(fileno(pFile), "rb9");
62 gzread(f, &bitlen, sizeof(int));
63 gzclose(f);
64 fclose(pFile);
65 return bitlen;
66}
67
68unsigned int CSystem::ReadCompressedFile(char *filename, void *data, unsigned int maxbitlen)
69{

Callers 2

LoadMethod · 0.80
GetSaveGameListMethod · 0.80

Calls 3

fxopenFunction · 0.50
gzdopenFunction · 0.50
gzcloseFunction · 0.50

Tested by

no test coverage detected