fixed typecasts and changed Rsrc_load_file to use zip sources
This commit is contained in:
parent
333e40827e
commit
bda9fc6883
|
@ -87,11 +87,12 @@ HRESULT Rsrc_load_file(PCSTR filename, PHRESFILE newhandle)
|
|||
{
|
||||
HRESULT hr = S_OK;
|
||||
PRESFILE pfile = NULL;
|
||||
zip_source_t *source;
|
||||
zip_error_t errinfo;
|
||||
|
||||
if (!newhandle)
|
||||
return E_POINTER;
|
||||
*newhandle = NULL;
|
||||
*newhandle = (HRESFILE)NULL;
|
||||
|
||||
pfile = (PRESFILE)malloc(sizeof(RESFILE));
|
||||
if (!pfile)
|
||||
|
@ -99,7 +100,13 @@ HRESULT Rsrc_load_file(PCSTR filename, PHRESFILE newhandle)
|
|||
memset(pfile, 0, sizeof(RESFILE));
|
||||
|
||||
zip_error_init(&errinfo);
|
||||
pfile->resource = zip_open(filename, ZIP_RDONLY, &errinfo);
|
||||
source = zip_source_file_create(filename, 0, 0, &errinfo);
|
||||
if (source)
|
||||
{
|
||||
pfile->resource = zip_open_from_source(source, ZIP_RDONLY, &errinfo);
|
||||
if (!(pfile->resource))
|
||||
zip_source_free(source);
|
||||
}
|
||||
if (!(pfile->resource))
|
||||
hr = ziperror_to_hresult(&errinfo);
|
||||
zip_error_fini(&errinfo);
|
||||
|
@ -167,7 +174,7 @@ HRESULT Rsrc_find_resource(HRESFILE hfile, PCSTR name, PCSTR type, PHRSRC presou
|
|||
return E_INVALIDARG;
|
||||
if (!presource)
|
||||
return E_POINTER;
|
||||
*presource = NULL;
|
||||
*presource = (HRSRC)NULL;
|
||||
|
||||
index = zip_name_locate(theresource, name, ZIP_FL_NOCASE);
|
||||
if (index < 0)
|
||||
|
|
Loading…
Reference in New Issue
Block a user