From 333e40827e961fecc45353394bdbb2485fb63b03 Mon Sep 17 00:00:00 2001 From: Amy Gale Ruth Bowersox Date: Sun, 29 Aug 2021 22:00:42 -0600 Subject: [PATCH] UINT32 type needs to be used --- src/resources.c | 22 +++++++++++----------- src/resources.h | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/resources.c b/src/resources.c index a04786c..d49e32f 100644 --- a/src/resources.c +++ b/src/resources.c @@ -203,22 +203,22 @@ HRESULT Rsrc_free_resource(HRSRC resource) return S_OK; } -UINT Rsrc_sizeof_resource(HRSRC resource) +UINT32 Rsrc_sizeof_resource(HRSRC resource) { PRESOURCEINFO p = (PRESOURCEINFO)resource; if (!p) return 0; if (p->entryinfo.valid & ZIP_STAT_SIZE) - return (UINT)(p->entryinfo.size); + return (UINT32)(p->entryinfo.size); return 0; } -HRESULT Rsrc_read_resource_here(HRSRC resource, PVOID buffer, UINT size, PUINT actual_read) +HRESULT Rsrc_read_resource_here(HRSRC resource, PVOID buffer, UINT32 size, PUINT32 actual_read) { HRESULT hr = S_OK; PRESOURCEINFO p = (PRESOURCEINFO)resource; - UINT max_size = size; - UINT already_read = 0; + UINT32 max_size = size; + UINT32 already_read = 0; PBYTE pbuffer = (PBYTE)buffer; zip_int64_t nread; zip_file_t *fp; @@ -229,9 +229,9 @@ HRESULT Rsrc_read_resource_here(HRSRC resource, PVOID buffer, UINT size, PUINT a return E_POINTER; if (p->entryinfo.valid & ZIP_STAT_SIZE) { - if ((UINT)(p->entryinfo.size) < max_size) - max_size = (UINT)(p->entryinfo.size); - else if ((UINT)(p->entryinfo.size) > max_size) + if ((UINT32)(p->entryinfo.size) < max_size) + max_size = (UINT32)(p->entryinfo.size); + else if ((UINT32)(p->entryinfo.size) > max_size) hr = UPIWIN_S_PARTIALRSRC; } @@ -247,8 +247,8 @@ HRESULT Rsrc_read_resource_here(HRSRC resource, PVOID buffer, UINT size, PUINT a break; } pbuffer += (UINT_PTR)nread; - max_size -= (UINT)nread; - already_read += (UINT)nread; + max_size -= (UINT32)nread; + already_read += (UINT32)nread; } zip_fclose(fp); } @@ -273,7 +273,7 @@ HRESULT Rsrc_setup(void) zip_source_t *syssource; zip_error_t errinfo; - Log(LDEBUG, "system resource length = %u", (UINT)(&_binary_sysresources_zip_size)); + Log(LDEBUG, "system resource length = %u", (UINT_PTR)(&_binary_sysresources_zip_size)); zip_error_init(&errinfo); syssource = zip_source_buffer_create(_binary_sysresources_zip_start, (UINT_PTR)(&_binary_sysresources_zip_size), 0, &errinfo); diff --git a/src/resources.h b/src/resources.h index 082a3a2..6f3be8f 100644 --- a/src/resources.h +++ b/src/resources.h @@ -32,8 +32,8 @@ extern HRESULT Rsrc_load_file(PCSTR filename, PHRESFILE newhandle); extern HRESULT Rsrc_close_file(HRESFILE handle); extern HRESULT Rsrc_find_resource(HRESFILE hfile, PCSTR name, PCSTR type, PHRSRC presource); extern HRESULT Rsrc_free_resource(HRSRC resource); -extern UINT Rsrc_sizeof_resource(HRSRC resource); -extern HRESULT Rsrc_read_resource_here(HRSRC resource, PVOID buffer, UINT size, PUINT actual_read); +extern UINT32 Rsrc_sizeof_resource(HRSRC resource); +extern HRESULT Rsrc_read_resource_here(HRSRC resource, PVOID buffer, UINT32 size, PUINT32 actual_read); extern HRESULT Rsrc_setup(void);