Simplify zip_extract_cb
This commit is contained in:
parent
e86f77692d
commit
365b27caac
|
@ -648,35 +648,9 @@ static int zip_extract_cb(const char *name, const char *valid_exts,
|
||||||
fill_pathname_resolve_relative(new_path, data->zip_path,
|
fill_pathname_resolve_relative(new_path, data->zip_path,
|
||||||
path_basename(name), sizeof(new_path));
|
path_basename(name), sizeof(new_path));
|
||||||
|
|
||||||
switch (cmode)
|
data->found_content = zlib_perform_mode(new_path, valid_exts, cdata, cmode, csize, size,
|
||||||
{
|
0, NULL);
|
||||||
case ZLIB_MODE_UNCOMPRESSED:
|
return 0;
|
||||||
data->found_content = retro_write_file(new_path, cdata, size);
|
|
||||||
return false;
|
|
||||||
case ZLIB_MODE_DEFLATE:
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
zlib_file_handle_t handle = {0};
|
|
||||||
if (!zlib_inflate_data_to_file_init(&handle, cdata, csize, size))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
do{
|
|
||||||
ret = zlib_inflate_data_to_file_iterate(handle.stream);
|
|
||||||
}while(ret == 0);
|
|
||||||
|
|
||||||
if (zlib_inflate_data_to_file(&handle, ret, new_path, valid_exts,
|
|
||||||
cdata, csize, size, checksum))
|
|
||||||
{
|
|
||||||
strlcpy(data->zip_path, new_path, data->zip_path_size);
|
|
||||||
data->found_content = true;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue