UINT32 type needs to be used

This commit is contained in:
Amy G. Bowersox 2021-08-29 22:00:42 -06:00
parent bcd4ec7bd2
commit 333e40827e
2 changed files with 13 additions and 13 deletions

View File

@ -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);

View File

@ -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);