From f9fa3b0fa2482f94eb8cc1deb259b8d1104e4f1d Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Mon, 30 Sep 2024 23:53:41 +0200 Subject: [PATCH] add missing arg to Crc32_FromFile function --- inc/crc32.h | 2 +- src/crc32.c | 24 +++++++++++------------- src/debug.c | 2 +- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/inc/crc32.h b/inc/crc32.h index f2ddf4bdd2..9b0728d20a 100644 --- a/inc/crc32.h +++ b/inc/crc32.h @@ -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 diff --git a/src/crc32.c b/src/crc32.c index 0befe8e903..e7ff75dfc0 100644 --- a/src/crc32.c +++ b/src/crc32.c @@ -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; } diff --git a/src/debug.c b/src/debug.c index ce8fe857f2..52382c1649 100644 --- a/src/debug.c +++ b/src/debug.c @@ -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)