mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 07:20:36 +00:00
Rename file_extract functions
This commit is contained in:
parent
552e78c9bc
commit
3c2a45d923
@ -98,7 +98,7 @@ static bool read_content_file(unsigned i, const char *path, void **buf,
|
||||
#ifdef HAVE_ZLIB
|
||||
content_ctl(CONTENT_CTL_GET_CRC, &content_crc_ptr);
|
||||
|
||||
*content_crc_ptr = zlib_crc32_calculate(0, ret_buf, *length);
|
||||
*content_crc_ptr = file_archive_crc32_calculate(0, ret_buf, *length);
|
||||
|
||||
RARCH_LOG("CRC32: 0x%x .\n", (unsigned)*content_crc_ptr);
|
||||
#endif
|
||||
@ -612,7 +612,7 @@ static bool init_content_file_extract(
|
||||
strlcpy(temp_content, content->elems[i].data,
|
||||
sizeof(temp_content));
|
||||
|
||||
if (!zlib_extract_first_content_file(temp_content,
|
||||
if (!file_archive_extract_first_content_file(temp_content,
|
||||
sizeof(temp_content), valid_ext,
|
||||
*settings->cache_directory ?
|
||||
settings->cache_directory : NULL,
|
||||
|
@ -517,7 +517,7 @@ void core_info_list_get_supported_cores(core_info_list_t *core_info_list,
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
if (string_is_equal_noncase(path_get_extension(path), "zip"))
|
||||
list = zlib_get_file_list(path, NULL);
|
||||
list = file_archive_get_file_list(path, NULL);
|
||||
core_info_tmp_list = list;
|
||||
#endif
|
||||
|
||||
|
12
file_ops.c
12
file_ops.c
@ -393,14 +393,14 @@ static int zip_file_decompressed(const char *name, const char *valid_exts,
|
||||
{
|
||||
int ret = 0;
|
||||
zlib_file_handle_t handle = {0};
|
||||
if (!zlib_inflate_data_to_file_init(&handle, cdata, csize, size))
|
||||
if (!file_archive_inflate_data_to_file_init(&handle, cdata, csize, size))
|
||||
return false;
|
||||
|
||||
do{
|
||||
ret = zlib_inflate_data_to_file_iterate(handle.stream);
|
||||
ret = file_archive_inflate_data_to_file_iterate(handle.stream);
|
||||
}while(ret == 0);
|
||||
|
||||
handle.real_checksum = zlib_crc32_calculate(0, handle.data, size);
|
||||
handle.real_checksum = file_archive_crc32_calculate(0, handle.data, size);
|
||||
|
||||
if (handle.real_checksum != crc32)
|
||||
{
|
||||
@ -445,13 +445,13 @@ static int read_zip_file(const char *path,
|
||||
|
||||
do
|
||||
{
|
||||
ret = zlib_parse_file_iterate(&zlib, &returnerr, path,
|
||||
ret = file_archive_parse_file_iterate(&zlib, &returnerr, path,
|
||||
"", zip_file_decompressed, &st);
|
||||
if (!returnerr)
|
||||
break;
|
||||
}while(ret == 0 && !st.found);
|
||||
|
||||
zlib_parse_file_iterate_stop(&zlib);
|
||||
file_archive_parse_file_iterate_stop(&zlib);
|
||||
|
||||
if (st.opt_file)
|
||||
free(st.opt_file);
|
||||
@ -570,7 +570,7 @@ struct string_list *compressed_file_list_new(const char *path,
|
||||
#endif
|
||||
#ifdef HAVE_ZLIB
|
||||
if (string_is_equal_noncase(file_ext, "zip"))
|
||||
return zlib_get_file_list(path, ext);
|
||||
return file_archive_get_file_list(path, ext);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ enum zlib_compression_mode
|
||||
ZLIB_MODE_DEFLATE = 8
|
||||
};
|
||||
|
||||
static const struct zlib_file_backend *zlib_get_default_file_backend(void)
|
||||
static const struct zlib_file_backend *file_archive_get_default_file_backend(void)
|
||||
{
|
||||
return &zlib_backend;
|
||||
}
|
||||
@ -100,7 +100,7 @@ void zlib_deflate_init(void *data, int level)
|
||||
deflateInit(stream, level);
|
||||
}
|
||||
|
||||
bool zlib_inflate_init(void *data)
|
||||
bool file_archive_inflate_init(void *data)
|
||||
{
|
||||
z_stream *stream = (z_stream*)data;
|
||||
|
||||
@ -125,7 +125,7 @@ void zlib_stream_deflate_free(void *data)
|
||||
deflateEnd(ret);
|
||||
}
|
||||
|
||||
bool zlib_inflate_data_to_file_init(
|
||||
bool file_archive_inflate_data_to_file_init(
|
||||
zlib_file_handle_t *handle,
|
||||
const uint8_t *cdata, uint32_t csize, uint32_t size)
|
||||
{
|
||||
@ -184,7 +184,7 @@ int zlib_deflate_data_to_file(void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int zlib_inflate_data_to_file_iterate(void *data)
|
||||
int file_archive_inflate_data_to_file_iterate(void *data)
|
||||
{
|
||||
int zstatus;
|
||||
z_stream *stream = (z_stream*)data;
|
||||
@ -203,13 +203,13 @@ int zlib_inflate_data_to_file_iterate(void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t zlib_crc32_calculate(uint32_t crc, const uint8_t *data, size_t length)
|
||||
uint32_t file_archive_crc32_calculate(uint32_t crc, const uint8_t *data, size_t length)
|
||||
{
|
||||
return crc32(crc, data, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* zlib_inflate_data_to_file:
|
||||
* file_archive_inflate_data_to_file:
|
||||
* @path : filename path of archive.
|
||||
* @valid_exts : Valid extensions of archive to be parsed.
|
||||
* If NULL, allow all.
|
||||
@ -222,7 +222,7 @@ uint32_t zlib_crc32_calculate(uint32_t crc, const uint8_t *data, size_t length)
|
||||
*
|
||||
* Returns: true (1) on success, otherwise false (0).
|
||||
**/
|
||||
int zlib_inflate_data_to_file(zlib_file_handle_t *handle,
|
||||
int file_archive_inflate_data_to_file(zlib_file_handle_t *handle,
|
||||
int ret, const char *path, const char *valid_exts,
|
||||
const uint8_t *cdata, uint32_t csize, uint32_t size, uint32_t checksum)
|
||||
{
|
||||
@ -238,7 +238,7 @@ int zlib_inflate_data_to_file(zlib_file_handle_t *handle,
|
||||
goto end;
|
||||
}
|
||||
|
||||
handle->real_checksum = zlib_crc32_calculate(0, handle->data, size);
|
||||
handle->real_checksum = file_archive_crc32_calculate(0, handle->data, size);
|
||||
|
||||
#if 0
|
||||
if (handle->real_checksum != checksum)
|
||||
@ -261,7 +261,7 @@ end:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int zlib_parse_file_iterate_step_internal(
|
||||
static int file_archive_parse_file_iterate_step_internal(
|
||||
zlib_transfer_t *state, char *filename,
|
||||
const uint8_t **cdata,
|
||||
unsigned *cmode, uint32_t *size, uint32_t *csize,
|
||||
@ -300,8 +300,8 @@ static int zlib_parse_file_iterate_step_internal(
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int zlib_parse_file_iterate_step(zlib_transfer_t *state,
|
||||
const char *valid_exts, void *userdata, zlib_file_cb file_cb)
|
||||
static int file_archive_parse_file_iterate_step(zlib_transfer_t *state,
|
||||
const char *valid_exts, void *userdata, file_archive_file_cb file_cb)
|
||||
{
|
||||
const uint8_t *cdata = NULL;
|
||||
uint32_t checksum = 0;
|
||||
@ -310,7 +310,7 @@ static int zlib_parse_file_iterate_step(zlib_transfer_t *state,
|
||||
unsigned cmode = 0;
|
||||
unsigned payload = 0;
|
||||
char filename[PATH_MAX_LENGTH] = {0};
|
||||
int ret = zlib_parse_file_iterate_step_internal(state, filename,
|
||||
int ret = file_archive_parse_file_iterate_step_internal(state, filename,
|
||||
&cdata, &cmode, &size, &csize,
|
||||
&checksum, &payload);
|
||||
|
||||
@ -331,10 +331,10 @@ static int zlib_parse_file_iterate_step(zlib_transfer_t *state,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int zlib_parse_file_init(zlib_transfer_t *state,
|
||||
static int file_archive_parse_file_init(zlib_transfer_t *state,
|
||||
const char *file)
|
||||
{
|
||||
state->backend = zlib_get_default_file_backend();
|
||||
state->backend = file_archive_get_default_file_backend();
|
||||
|
||||
if (!state->backend)
|
||||
return -1;
|
||||
@ -367,8 +367,8 @@ static int zlib_parse_file_init(zlib_transfer_t *state,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int zlib_parse_file_iterate(void *data, bool *returnerr, const char *file,
|
||||
const char *valid_exts, zlib_file_cb file_cb, void *userdata)
|
||||
int file_archive_parse_file_iterate(void *data, bool *returnerr, const char *file,
|
||||
const char *valid_exts, file_archive_file_cb file_cb, void *userdata)
|
||||
{
|
||||
zlib_transfer_t *state = (zlib_transfer_t*)data;
|
||||
|
||||
@ -380,14 +380,14 @@ int zlib_parse_file_iterate(void *data, bool *returnerr, const char *file,
|
||||
case ZLIB_TRANSFER_NONE:
|
||||
break;
|
||||
case ZLIB_TRANSFER_INIT:
|
||||
if (zlib_parse_file_init(state, file) == 0)
|
||||
if (file_archive_parse_file_init(state, file) == 0)
|
||||
state->type = ZLIB_TRANSFER_ITERATE;
|
||||
else
|
||||
state->type = ZLIB_TRANSFER_DEINIT_ERROR;
|
||||
break;
|
||||
case ZLIB_TRANSFER_ITERATE:
|
||||
{
|
||||
int ret2 = zlib_parse_file_iterate_step(state,
|
||||
int ret2 = file_archive_parse_file_iterate_step(state,
|
||||
valid_exts, userdata, file_cb);
|
||||
if (ret2 != 1)
|
||||
state->type = ZLIB_TRANSFER_DEINIT;
|
||||
@ -413,18 +413,18 @@ int zlib_parse_file_iterate(void *data, bool *returnerr, const char *file,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void zlib_parse_file_iterate_stop(void *data)
|
||||
void file_archive_parse_file_iterate_stop(void *data)
|
||||
{
|
||||
zlib_transfer_t *state = (zlib_transfer_t*)data;
|
||||
if (!state || !state->handle)
|
||||
return;
|
||||
|
||||
state->type = ZLIB_TRANSFER_DEINIT;
|
||||
zlib_parse_file_iterate(data, NULL, NULL, NULL, NULL, NULL);
|
||||
file_archive_parse_file_iterate(data, NULL, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* zlib_parse_file:
|
||||
* file_archive_parse_file:
|
||||
* @file : filename path of archive
|
||||
* @valid_exts : Valid extensions of archive to be parsed.
|
||||
* If NULL, allow all.
|
||||
@ -436,8 +436,8 @@ void zlib_parse_file_iterate_stop(void *data)
|
||||
*
|
||||
* Returns: true (1) on success, otherwise false (0).
|
||||
**/
|
||||
bool zlib_parse_file(const char *file, const char *valid_exts,
|
||||
zlib_file_cb file_cb, void *userdata)
|
||||
bool file_archive_parse_file(const char *file, const char *valid_exts,
|
||||
file_archive_file_cb file_cb, void *userdata)
|
||||
{
|
||||
zlib_transfer_t state = {0};
|
||||
bool returnerr = true;
|
||||
@ -446,7 +446,7 @@ bool zlib_parse_file(const char *file, const char *valid_exts,
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int ret = zlib_parse_file_iterate(&state, &returnerr, file,
|
||||
int ret = file_archive_parse_file_iterate(&state, &returnerr, file,
|
||||
valid_exts, file_cb, userdata);
|
||||
|
||||
if (ret != 0)
|
||||
@ -456,7 +456,7 @@ bool zlib_parse_file(const char *file, const char *valid_exts,
|
||||
return returnerr;
|
||||
}
|
||||
|
||||
int zlib_parse_file_progress(void *data)
|
||||
int file_archive_parse_file_progress(void *data)
|
||||
{
|
||||
/* FIXME: this estimate is worse than before */
|
||||
zlib_transfer_t *state = (zlib_transfer_t*)data;
|
||||
@ -465,7 +465,7 @@ int zlib_parse_file_progress(void *data)
|
||||
}
|
||||
|
||||
|
||||
static int zip_extract_cb(const char *name, const char *valid_exts,
|
||||
static int file_archive_extract_cb(const char *name, const char *valid_exts,
|
||||
const uint8_t *cdata,
|
||||
unsigned cmode, uint32_t csize, uint32_t size,
|
||||
uint32_t checksum, void *userdata)
|
||||
@ -486,7 +486,7 @@ static int zip_extract_cb(const char *name, const char *valid_exts,
|
||||
path_basename(name), sizeof(new_path));
|
||||
|
||||
data->first_extracted_file_path = strdup(new_path);
|
||||
data->found_content = zlib_perform_mode(new_path,
|
||||
data->found_content = file_archive_perform_mode(new_path,
|
||||
valid_exts, cdata, cmode, csize, size,
|
||||
0, NULL);
|
||||
return 0;
|
||||
@ -496,7 +496,7 @@ static int zip_extract_cb(const char *name, const char *valid_exts,
|
||||
}
|
||||
|
||||
/**
|
||||
* zlib_extract_first_content_file:
|
||||
* file_archive_extract_first_content_file:
|
||||
* @zip_path : filename path to ZIP archive.
|
||||
* @zip_path_size : size of ZIP archive.
|
||||
* @valid_exts : valid extensions for a content file.
|
||||
@ -507,7 +507,7 @@ static int zip_extract_cb(const char *name, const char *valid_exts,
|
||||
*
|
||||
* Returns : true (1) on success, otherwise false (0).
|
||||
**/
|
||||
bool zlib_extract_first_content_file(char *zip_path, size_t zip_path_size,
|
||||
bool file_archive_extract_first_content_file(char *zip_path, size_t zip_path_size,
|
||||
const char *valid_exts, const char *extraction_directory,
|
||||
char *out_path, size_t len)
|
||||
{
|
||||
@ -534,9 +534,9 @@ bool zlib_extract_first_content_file(char *zip_path, size_t zip_path_size,
|
||||
userdata.extraction_directory = extraction_directory;
|
||||
userdata.ext = list;
|
||||
|
||||
if (!zlib_parse_file(zip_path, valid_exts, zip_extract_cb, &userdata))
|
||||
if (!file_archive_parse_file(zip_path, valid_exts, file_archive_extract_cb, &userdata))
|
||||
{
|
||||
/* Parsing ZIP failed. */
|
||||
/* Parsing file archive failed. */
|
||||
ret = false;
|
||||
goto end;
|
||||
}
|
||||
@ -560,7 +560,7 @@ end:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int zlib_get_file_list_cb(const char *path, const char *valid_exts,
|
||||
static int file_archive_get_file_list_cb(const char *path, const char *valid_exts,
|
||||
const uint8_t *cdata,
|
||||
unsigned cmode, uint32_t csize, uint32_t size, uint32_t checksum,
|
||||
void *userdata)
|
||||
@ -610,20 +610,20 @@ error:
|
||||
}
|
||||
|
||||
/**
|
||||
* zlib_get_file_list:
|
||||
* file_archive_get_file_list:
|
||||
* @path : filename path of archive
|
||||
*
|
||||
* Returns: string listing of files from archive on success, otherwise NULL.
|
||||
**/
|
||||
struct string_list *zlib_get_file_list(const char *path, const char *valid_exts)
|
||||
struct string_list *file_archive_get_file_list(const char *path, const char *valid_exts)
|
||||
{
|
||||
struct string_list *list = string_list_new();
|
||||
|
||||
if (!list)
|
||||
goto error;
|
||||
|
||||
if (!zlib_parse_file(path, valid_exts,
|
||||
zlib_get_file_list_cb, list))
|
||||
if (!file_archive_parse_file(path, valid_exts,
|
||||
file_archive_get_file_list_cb, list))
|
||||
goto error;
|
||||
|
||||
return list;
|
||||
@ -634,7 +634,7 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool zlib_perform_mode(const char *path, const char *valid_exts,
|
||||
bool file_archive_perform_mode(const char *path, const char *valid_exts,
|
||||
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
||||
uint32_t crc32, void *userdata)
|
||||
{
|
||||
@ -649,14 +649,14 @@ bool zlib_perform_mode(const char *path, const char *valid_exts,
|
||||
{
|
||||
int ret = 0;
|
||||
zlib_file_handle_t handle = {0};
|
||||
if (!zlib_inflate_data_to_file_init(&handle, cdata, csize, size))
|
||||
if (!file_archive_inflate_data_to_file_init(&handle, cdata, csize, size))
|
||||
return false;
|
||||
|
||||
do{
|
||||
ret = zlib_inflate_data_to_file_iterate(handle.stream);
|
||||
ret = file_archive_inflate_data_to_file_iterate(handle.stream);
|
||||
}while(ret == 0);
|
||||
|
||||
if (!zlib_inflate_data_to_file(&handle, ret, path, valid_exts,
|
||||
if (!file_archive_inflate_data_to_file(&handle, ret, path, valid_exts,
|
||||
cdata, csize, size, crc32))
|
||||
return false;
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ static int rpng_load_image_argb_process_inflate_init(rpng_t *rpng,
|
||||
if (!to_continue)
|
||||
goto end;
|
||||
|
||||
zstatus = zlib_inflate_data_to_file_iterate(rpng->process.stream);
|
||||
zstatus = file_archive_inflate_data_to_file_iterate(rpng->process.stream);
|
||||
|
||||
switch (zstatus)
|
||||
{
|
||||
@ -790,7 +790,7 @@ static bool rpng_load_image_argb_process_init(rpng_t *rpng,
|
||||
if (!rpng->process.stream)
|
||||
return false;
|
||||
|
||||
if (!zlib_inflate_init(rpng->process.stream))
|
||||
if (!file_archive_inflate_init(rpng->process.stream))
|
||||
return false;
|
||||
|
||||
rpng->process.inflate_buf = (uint8_t*)malloc(rpng->process.inflate_buf_size);
|
||||
|
@ -48,7 +48,7 @@ static void dword_write_be(uint8_t *buf, uint32_t val)
|
||||
static bool png_write_crc(RFILE *file, const uint8_t *data, size_t size)
|
||||
{
|
||||
uint8_t crc_raw[4] = {0};
|
||||
uint32_t crc = zlib_crc32_calculate(0, data, size);
|
||||
uint32_t crc = file_archive_crc32_calculate(0, data, size);
|
||||
|
||||
dword_write_be(crc_raw, crc);
|
||||
return retro_fwrite(file, crc_raw, sizeof(crc_raw)) == sizeof(crc_raw);
|
||||
|
@ -69,11 +69,11 @@ struct zlib_file_backend
|
||||
};
|
||||
|
||||
/* Returns true when parsing should continue. False to stop. */
|
||||
typedef int (*zlib_file_cb)(const char *name, const char *valid_exts,
|
||||
typedef int (*file_archive_file_cb)(const char *name, const char *valid_exts,
|
||||
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
||||
uint32_t crc32, void *userdata);
|
||||
|
||||
uint32_t zlib_crc32_calculate(uint32_t crc, const uint8_t *data, size_t length);
|
||||
uint32_t file_archive_crc32_calculate(uint32_t crc, const uint8_t *data, size_t length);
|
||||
|
||||
/**
|
||||
* zlib_parse_file:
|
||||
@ -88,19 +88,19 @@ uint32_t zlib_crc32_calculate(uint32_t crc, const uint8_t *data, size_t length);
|
||||
*
|
||||
* Returns: true (1) on success, otherwise false (0).
|
||||
**/
|
||||
bool zlib_parse_file(const char *file, const char *valid_exts,
|
||||
zlib_file_cb file_cb, void *userdata);
|
||||
bool file_archive_parse_file(const char *file, const char *valid_exts,
|
||||
file_archive_file_cb file_cb, void *userdata);
|
||||
|
||||
int zlib_parse_file_iterate(void *data, bool *returnerr,
|
||||
int file_archive_parse_file_iterate(void *data, bool *returnerr,
|
||||
const char *file,
|
||||
const char *valid_exts, zlib_file_cb file_cb, void *userdata);
|
||||
const char *valid_exts, file_archive_file_cb file_cb, void *userdata);
|
||||
|
||||
void zlib_parse_file_iterate_stop(void *data);
|
||||
void file_archive_parse_file_iterate_stop(void *data);
|
||||
|
||||
int zlib_parse_file_progress(void *data);
|
||||
int file_archive_parse_file_progress(void *data);
|
||||
|
||||
/**
|
||||
* zlib_extract_first_content_file:
|
||||
* file_archive_extract_first_content_file:
|
||||
* @zip_path : filename path to ZIP archive.
|
||||
* @zip_path_size : size of ZIP archive.
|
||||
* @valid_exts : valid extensions for a content file.
|
||||
@ -111,28 +111,28 @@ int zlib_parse_file_progress(void *data);
|
||||
*
|
||||
* Returns : true (1) on success, otherwise false (0).
|
||||
**/
|
||||
bool zlib_extract_first_content_file(char *zip_path, size_t zip_path_size,
|
||||
bool file_archive_extract_first_content_file(char *zip_path, size_t zip_path_size,
|
||||
const char *valid_exts, const char *extraction_dir,
|
||||
char *out_path, size_t len);
|
||||
|
||||
/**
|
||||
* zlib_get_file_list:
|
||||
* file_archive_get_file_list:
|
||||
* @path : filename path of archive
|
||||
* @valid_exts : Valid extensions of archive to be parsed.
|
||||
* If NULL, allow all.
|
||||
*
|
||||
* Returns: string listing of files from archive on success, otherwise NULL.
|
||||
**/
|
||||
struct string_list *zlib_get_file_list(const char *path, const char *valid_exts);
|
||||
struct string_list *file_archive_get_file_list(const char *path, const char *valid_exts);
|
||||
|
||||
bool zlib_inflate_data_to_file_init(
|
||||
bool file_archive_inflate_data_to_file_init(
|
||||
zlib_file_handle_t *handle,
|
||||
const uint8_t *cdata, uint32_t csize, uint32_t size);
|
||||
|
||||
int zlib_inflate_data_to_file_iterate(void *data);
|
||||
int file_archive_inflate_data_to_file_iterate(void *data);
|
||||
|
||||
/**
|
||||
* zlib_inflate_data_to_file:
|
||||
* file_archive_inflate_data_to_file:
|
||||
* @path : filename path of archive.
|
||||
* @cdata : input data.
|
||||
* @csize : size of input data.
|
||||
@ -143,11 +143,11 @@ int zlib_inflate_data_to_file_iterate(void *data);
|
||||
*
|
||||
* Returns: true (1) on success, otherwise false (0).
|
||||
**/
|
||||
int zlib_inflate_data_to_file(zlib_file_handle_t *handle,
|
||||
int file_archive_inflate_data_to_file(zlib_file_handle_t *handle,
|
||||
int ret, const char *path, const char *valid_exts,
|
||||
const uint8_t *cdata, uint32_t csize, uint32_t size, uint32_t checksum);
|
||||
|
||||
bool zlib_perform_mode(const char *name, const char *valid_exts,
|
||||
bool file_archive_perform_mode(const char *name, const char *valid_exts,
|
||||
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
||||
uint32_t crc32, void *userdata);
|
||||
|
||||
@ -164,7 +164,7 @@ int zlib_deflate_data_to_file(void *data);
|
||||
|
||||
void zlib_stream_deflate_free(void *data);
|
||||
|
||||
bool zlib_inflate_init(void *data);
|
||||
bool file_archive_inflate_init(void *data);
|
||||
|
||||
void zlib_set_stream(void *data,
|
||||
uint32_t avail_in,
|
||||
|
12
patch.c
12
patch.c
@ -55,7 +55,7 @@ static uint8_t bps_read(struct bps_data *bps)
|
||||
{
|
||||
uint8_t data = bps->modify_data[bps->modify_offset++];
|
||||
#ifdef HAVE_ZLIB
|
||||
bps->modify_checksum = ~zlib_crc32_calculate(~bps->modify_checksum, &data, 1);
|
||||
bps->modify_checksum = ~file_archive_crc32_calculate(~bps->modify_checksum, &data, 1);
|
||||
#endif
|
||||
return data;
|
||||
}
|
||||
@ -84,7 +84,7 @@ static void bps_write(struct bps_data *bps, uint8_t data)
|
||||
|
||||
bps->target_data[bps->output_offset++] = data;
|
||||
#ifdef HAVE_ZLIB
|
||||
bps->target_checksum = ~zlib_crc32_calculate(~bps->target_checksum, &data, 1);
|
||||
bps->target_checksum = ~file_archive_crc32_calculate(~bps->target_checksum, &data, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ patch_error_t bps_apply_patch(
|
||||
modify_modify_checksum |= bps_read(&bps) << i;
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
bps.source_checksum = zlib_crc32_calculate(0, bps.source_data, bps.source_length);
|
||||
bps.source_checksum = file_archive_crc32_calculate(0, bps.source_data, bps.source_length);
|
||||
#else
|
||||
return PATCH_PATCH_CHECKSUM_INVALID;
|
||||
#endif
|
||||
@ -220,7 +220,7 @@ static uint8_t ups_patch_read(struct ups_data *data)
|
||||
{
|
||||
uint8_t n = data->patch_data[data->patch_offset++];
|
||||
#ifdef HAVE_ZLIB
|
||||
data->patch_checksum = ~zlib_crc32_calculate(~data->patch_checksum, &n, 1);
|
||||
data->patch_checksum = ~file_archive_crc32_calculate(~data->patch_checksum, &n, 1);
|
||||
#endif
|
||||
return n;
|
||||
}
|
||||
@ -233,7 +233,7 @@ static uint8_t ups_source_read(struct ups_data *data)
|
||||
{
|
||||
uint8_t n = data->source_data[data->source_offset++];
|
||||
#ifdef HAVE_ZLIB
|
||||
data->source_checksum = ~zlib_crc32_calculate(~data->source_checksum, &n, 1);
|
||||
data->source_checksum = ~file_archive_crc32_calculate(~data->source_checksum, &n, 1);
|
||||
#endif
|
||||
return n;
|
||||
}
|
||||
@ -246,7 +246,7 @@ static void ups_target_write(struct ups_data *data, uint8_t n)
|
||||
{
|
||||
data->target_data[data->target_offset] = n;
|
||||
#ifdef HAVE_ZLIB
|
||||
data->target_checksum = ~zlib_crc32_calculate(~data->target_checksum, &n, 1);
|
||||
data->target_checksum = ~file_archive_crc32_calculate(~data->target_checksum, &n, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ static int database_info_iterate_playlist(
|
||||
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
db_state->crc = zlib_crc32_calculate(0, db_state->buf, ret);
|
||||
db_state->crc = file_archive_crc32_calculate(0, db_state->buf, ret);
|
||||
#endif
|
||||
db->type = DATABASE_TYPE_CRC_LOOKUP;
|
||||
}
|
||||
@ -386,13 +386,13 @@ static int database_info_iterate_playlist_zip(
|
||||
return database_info_iterate_crc_lookup(db_state, db, db_state->zip_name);
|
||||
else
|
||||
{
|
||||
if (zlib_parse_file_iterate(&db->state,
|
||||
if (file_archive_parse_file_iterate(&db->state,
|
||||
&returnerr, name, NULL, zlib_compare_crc32,
|
||||
(void*)db_state) != 0)
|
||||
return 0;
|
||||
|
||||
if (db_state->crc)
|
||||
zlib_parse_file_iterate_stop(&db->state);
|
||||
file_archive_parse_file_iterate_stop(&db->state);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -72,7 +72,7 @@ static int file_decompressed_subdir(const char *name, const char *valid_exts,
|
||||
if (!path_mkdir(path_dir))
|
||||
goto error;
|
||||
|
||||
if (!zlib_perform_mode(path, valid_exts,
|
||||
if (!file_archive_perform_mode(path, valid_exts,
|
||||
cdata, cmode, csize, size, crc32, userdata))
|
||||
goto error;
|
||||
|
||||
@ -108,7 +108,7 @@ static int file_decompressed(const char *name, const char *valid_exts,
|
||||
|
||||
fill_pathname_join(path, dec->target_dir, name, sizeof(path));
|
||||
|
||||
if (!zlib_perform_mode(path, valid_exts,
|
||||
if (!file_archive_perform_mode(path, valid_exts,
|
||||
cdata, cmode, csize, size, crc32, userdata))
|
||||
goto error;
|
||||
|
||||
@ -156,15 +156,15 @@ static void rarch_task_decompress_handler(rarch_task_t *task)
|
||||
{
|
||||
bool returnerr;
|
||||
decompress_state_t *dec = (decompress_state_t*)task->state;
|
||||
int ret = zlib_parse_file_iterate(&dec->zlib, &returnerr, dec->source_file,
|
||||
int ret = file_archive_parse_file_iterate(&dec->zlib, &returnerr, dec->source_file,
|
||||
dec->valid_ext, file_decompressed, dec);
|
||||
|
||||
task->progress = zlib_parse_file_progress(&dec->zlib);
|
||||
task->progress = file_archive_parse_file_progress(&dec->zlib);
|
||||
|
||||
if (task->cancelled || ret != 0)
|
||||
{
|
||||
task->error = dec->callback_error;
|
||||
zlib_parse_file_iterate_stop(&dec->zlib);
|
||||
file_archive_parse_file_iterate_stop(&dec->zlib);
|
||||
|
||||
rarch_task_decompress_handler_finished(task, dec);
|
||||
}
|
||||
@ -174,15 +174,15 @@ static void rarch_task_decompress_handler_target_file(rarch_task_t *task)
|
||||
{
|
||||
bool returnerr;
|
||||
decompress_state_t *dec = (decompress_state_t*)task->state;
|
||||
int ret = zlib_parse_file_iterate(&dec->zlib, &returnerr, dec->source_file,
|
||||
int ret = file_archive_parse_file_iterate(&dec->zlib, &returnerr, dec->source_file,
|
||||
dec->valid_ext, file_decompressed_target_file, dec);
|
||||
|
||||
task->progress = zlib_parse_file_progress(&dec->zlib);
|
||||
task->progress = file_archive_parse_file_progress(&dec->zlib);
|
||||
|
||||
if (task->cancelled || ret != 0)
|
||||
{
|
||||
task->error = dec->callback_error;
|
||||
zlib_parse_file_iterate_stop(&dec->zlib);
|
||||
file_archive_parse_file_iterate_stop(&dec->zlib);
|
||||
|
||||
rarch_task_decompress_handler_finished(task, dec);
|
||||
}
|
||||
@ -192,15 +192,15 @@ static void rarch_task_decompress_handler_subdir(rarch_task_t *task)
|
||||
{
|
||||
bool returnerr;
|
||||
decompress_state_t *dec = (decompress_state_t*)task->state;
|
||||
int ret = zlib_parse_file_iterate(&dec->zlib, &returnerr, dec->source_file,
|
||||
int ret = file_archive_parse_file_iterate(&dec->zlib, &returnerr, dec->source_file,
|
||||
dec->valid_ext, file_decompressed_subdir, dec);
|
||||
|
||||
task->progress = zlib_parse_file_progress(&dec->zlib);
|
||||
task->progress = file_archive_parse_file_progress(&dec->zlib);
|
||||
|
||||
if (task->cancelled || ret != 0)
|
||||
{
|
||||
task->error = dec->callback_error;
|
||||
zlib_parse_file_iterate_stop(&dec->zlib);
|
||||
file_archive_parse_file_iterate_stop(&dec->zlib);
|
||||
|
||||
rarch_task_decompress_handler_finished(task, dec);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user