Skip to content

Commit

Permalink
add missing arg to Crc32_FromFile function
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Sep 30, 2024
1 parent a7b8e2e commit f9fa3b0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion inc/crc32.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@


unsigned long Crc32_ComputeBuf(unsigned long inCrc32, const void* buf, size_t bufLen);
unsigned long Crc32_FromFile(char* filename);
unsigned long Crc32_FromFile(unsigned long crc32, char* filename);

#endif
24 changes: 11 additions & 13 deletions src/crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,25 @@ 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);
}
crc32 = Crc32_ComputeBuf(crc32, buf, s);
}

if (ferror(fp))
crc32 = 0;
if (ferror(fp))
crc32 = 0;

fclose(fp);
}
fclose(fp);

return crc32;
}
Expand Down
2 changes: 1 addition & 1 deletion src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void dbg_init()
TRACE("Wine sysname = %s, release = %s\n", sysname, release);
}

TRACE("crc32 = %08X\n", Crc32_FromFile(exe_path));
TRACE("crc32 = %08X\n", Crc32_FromFile(0, exe_path));

DWORD timestamp = util_get_timestamp(GetModuleHandleA(NULL));
if (timestamp)
Expand Down

0 comments on commit f9fa3b0

Please sign in to comment.