add missing arg to Crc32_FromFile function
This commit is contained in:
parent
a7b8e2e80f
commit
f9fa3b0fa2
3 changed files with 14 additions and 16 deletions
26
src/crc32.c
26
src/crc32.c
|
@ -77,28 +77,26 @@ unsigned long Crc32_ComputeBuf( unsigned long inCrc32, const void *buf,
|
|||
return( crc32 ^ 0xFFFFFFFF );
|
||||
}
|
||||
|
||||
unsigned long Crc32_FromFile(char* filename)
|
||||
unsigned long Crc32_FromFile(unsigned long crc32, char* filename)
|
||||
{
|
||||
if (!filename)
|
||||
return 0;
|
||||
|
||||
unsigned long crc32 = 0;
|
||||
|
||||
FILE* fp = fopen(filename, "rb");
|
||||
if (fp)
|
||||
if (!fp)
|
||||
return 0;
|
||||
|
||||
char buf[1024];
|
||||
for (size_t s = 0; (s = fread(buf, 1, sizeof(buf), fp)) && !ferror(fp);)
|
||||
{
|
||||
char buf[1024];
|
||||
for (size_t s = 0; (s = fread(buf, 1, sizeof(buf), fp)) && !ferror(fp);)
|
||||
{
|
||||
crc32 = Crc32_ComputeBuf(crc32, buf, s);
|
||||
}
|
||||
|
||||
if (ferror(fp))
|
||||
crc32 = 0;
|
||||
|
||||
fclose(fp);
|
||||
crc32 = Crc32_ComputeBuf(crc32, buf, s);
|
||||
}
|
||||
|
||||
if (ferror(fp))
|
||||
crc32 = 0;
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return crc32;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue