Change returntype of file_cb for zlib_parse_file
This commit is contained in:
parent
93b48c4d96
commit
1a1d6a0889
|
@ -20,7 +20,7 @@ struct userdata
|
||||||
const char *dest;
|
const char *dest;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool zlib_cb(const char *name, const char *valid_exts,
|
static int zlib_cb(const char *name, const char *valid_exts,
|
||||||
const uint8_t *cdata,
|
const uint8_t *cdata,
|
||||||
unsigned cmode, uint32_t csize, uint32_t size,
|
unsigned cmode, uint32_t csize, uint32_t size,
|
||||||
uint32_t crc32, void *userdata)
|
uint32_t crc32, void *userdata)
|
||||||
|
@ -32,7 +32,7 @@ static bool zlib_cb(const char *name, const char *valid_exts,
|
||||||
const char *dest = user->dest;
|
const char *dest = user->dest;
|
||||||
|
|
||||||
if (strstr(name, subdir) != name)
|
if (strstr(name, subdir) != name)
|
||||||
return true;
|
return 1;
|
||||||
|
|
||||||
name += strlen(subdir) + 1;
|
name += strlen(subdir) + 1;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ static bool zlib_cb(const char *name, const char *valid_exts,
|
||||||
if (!path_mkdir(path_dir))
|
if (!path_mkdir(path_dir))
|
||||||
{
|
{
|
||||||
RARCH_ERR("Failed to create dir: %s.\n", path_dir);
|
RARCH_ERR("Failed to create dir: %s.\n", path_dir);
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RARCH_LOG("Extracting %s -> %s ...\n", name, path);
|
RARCH_LOG("Extracting %s -> %s ...\n", name, path);
|
||||||
|
@ -53,7 +53,7 @@ static bool zlib_cb(const char *name, const char *valid_exts,
|
||||||
if (!write_file(path, cdata, size))
|
if (!write_file(path, cdata, size))
|
||||||
{
|
{
|
||||||
RARCH_ERR("Failed to write file: %s.\n", path);
|
RARCH_ERR("Failed to write file: %s.\n", path);
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -62,15 +62,15 @@ static bool zlib_cb(const char *name, const char *valid_exts,
|
||||||
csize, size, crc32))
|
csize, size, crc32))
|
||||||
{
|
{
|
||||||
RARCH_ERR("Failed to deflate to: %s.\n", path);
|
RARCH_ERR("Failed to deflate to: %s.\n", path);
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_com_retroarch_browser_NativeInterface_extractArchiveTo(
|
JNIEXPORT jboolean JNICALL Java_com_retroarch_browser_NativeInterface_extractArchiveTo(
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
static const void* const associated_module_key = &associated_module_key;
|
static const void* const associated_module_key = &associated_module_key;
|
||||||
|
|
||||||
static bool zlib_extract_callback(const char *name, const char *valid_exts,
|
static int zlib_extract_callback(const char *name, const char *valid_exts,
|
||||||
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
||||||
uint32_t crc32, void *userdata)
|
uint32_t crc32, void *userdata)
|
||||||
{
|
{
|
||||||
|
@ -46,7 +46,7 @@ static bool zlib_extract_callback(const char *name, const char *valid_exts,
|
||||||
|
|
||||||
// Ignore directories
|
// Ignore directories
|
||||||
if (name[strlen(name) - 1] == '/')
|
if (name[strlen(name) - 1] == '/')
|
||||||
return true;
|
return 1;
|
||||||
|
|
||||||
fill_pathname_join(path, (const char*)userdata, name, sizeof(path));
|
fill_pathname_join(path, (const char*)userdata, name, sizeof(path));
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ static bool zlib_extract_callback(const char *name, const char *valid_exts,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unzip_file(const char* path, const char* output_directory)
|
static void unzip_file(const char* path, const char* output_directory)
|
||||||
|
|
|
@ -47,13 +47,13 @@ int database_open_cursor(libretrodb_t *db,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_ZLIB
|
#ifdef HAVE_ZLIB
|
||||||
static bool zlib_compare_crc32(const char *name, const char *valid_exts,
|
static int zlib_compare_crc32(const char *name, const char *valid_exts,
|
||||||
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
||||||
uint32_t crc32, void *userdata)
|
uint32_t crc32, void *userdata)
|
||||||
{
|
{
|
||||||
RARCH_LOG("CRC32: 0x%x\n", crc32);
|
RARCH_LOG("CRC32: 0x%x\n", crc32);
|
||||||
|
|
||||||
return true;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -231,10 +231,10 @@ static uint32_t read_le(const uint8_t *data, unsigned size)
|
||||||
*
|
*
|
||||||
* Returns: true (1) on success, otherwise false (0).
|
* Returns: true (1) on success, otherwise false (0).
|
||||||
**/
|
**/
|
||||||
bool zlib_inflate_data_to_file(const char *path, const char *valid_exts,
|
int zlib_inflate_data_to_file(const char *path, const char *valid_exts,
|
||||||
const uint8_t *cdata, uint32_t csize, uint32_t size, uint32_t checksum)
|
const uint8_t *cdata, uint32_t csize, uint32_t size, uint32_t checksum)
|
||||||
{
|
{
|
||||||
bool ret = true;
|
int ret = true;
|
||||||
uint32_t real_checksum = 0;
|
uint32_t real_checksum = 0;
|
||||||
z_stream stream = {0};
|
z_stream stream = {0};
|
||||||
uint8_t *out_data = (uint8_t*)malloc(size);
|
uint8_t *out_data = (uint8_t*)malloc(size);
|
||||||
|
@ -383,7 +383,7 @@ struct zip_extract_userdata
|
||||||
bool found_content;
|
bool found_content;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool zip_extract_cb(const char *name, const char *valid_exts,
|
static int zip_extract_cb(const char *name, const char *valid_exts,
|
||||||
const uint8_t *cdata,
|
const uint8_t *cdata,
|
||||||
unsigned cmode, uint32_t csize, uint32_t size,
|
unsigned cmode, uint32_t csize, uint32_t size,
|
||||||
uint32_t checksum, void *userdata)
|
uint32_t checksum, void *userdata)
|
||||||
|
@ -417,16 +417,16 @@ static bool zip_extract_cb(const char *name, const char *valid_exts,
|
||||||
{
|
{
|
||||||
strlcpy(data->zip_path, new_path, data->zip_path_size);
|
strlcpy(data->zip_path, new_path, data->zip_path_size);
|
||||||
data->found_content = true;
|
data->found_content = true;
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
return false;
|
return 0;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -481,7 +481,7 @@ end:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool zlib_get_file_list_cb(const char *path, const char *valid_exts,
|
static int zlib_get_file_list_cb(const char *path, const char *valid_exts,
|
||||||
const uint8_t *cdata,
|
const uint8_t *cdata,
|
||||||
unsigned cmode, uint32_t csize, uint32_t size, uint32_t checksum,
|
unsigned cmode, uint32_t csize, uint32_t size, uint32_t checksum,
|
||||||
void *userdata)
|
void *userdata)
|
||||||
|
@ -528,7 +528,7 @@ static bool zlib_get_file_list_cb(const char *path, const char *valid_exts,
|
||||||
return string_list_append(list, path, attr);
|
return string_list_append(list, path, attr);
|
||||||
error:
|
error:
|
||||||
string_list_free(ext_list);
|
string_list_free(ext_list);
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Returns true when parsing should continue. False to stop. */
|
/* Returns true when parsing should continue. False to stop. */
|
||||||
typedef bool (*zlib_file_cb)(const char *name, const char *valid_exts,
|
typedef int (*zlib_file_cb)(const char *name, const char *valid_exts,
|
||||||
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
||||||
uint32_t crc32, void *userdata);
|
uint32_t crc32, void *userdata);
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ struct string_list *zlib_get_file_list(const char *path, const char *valid_exts)
|
||||||
*
|
*
|
||||||
* Returns: true (1) on success, otherwise false (0).
|
* Returns: true (1) on success, otherwise false (0).
|
||||||
**/
|
**/
|
||||||
bool zlib_inflate_data_to_file(const char *path, const char *valid_exts,
|
int zlib_inflate_data_to_file(const char *path, const char *valid_exts,
|
||||||
const uint8_t *data, uint32_t csize, uint32_t size, uint32_t crc32);
|
const uint8_t *data, uint32_t csize, uint32_t size, uint32_t crc32);
|
||||||
|
|
||||||
struct string_list *compressed_file_list_new(const char *filename,
|
struct string_list *compressed_file_list_new(const char *filename,
|
||||||
|
|
|
@ -1603,7 +1603,7 @@ static int action_ok_save_state(const char *path,
|
||||||
* call each other. */
|
* call each other. */
|
||||||
static char core_updater_path[PATH_MAX_LENGTH];
|
static char core_updater_path[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
static bool zlib_extract_core_callback(const char *name, const char *valid_exts,
|
static int zlib_extract_core_callback(const char *name, const char *valid_exts,
|
||||||
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
||||||
uint32_t crc32, void *userdata)
|
uint32_t crc32, void *userdata)
|
||||||
{
|
{
|
||||||
|
@ -1616,12 +1616,12 @@ static bool zlib_extract_core_callback(const char *name, const char *valid_exts,
|
||||||
if (!path_mkdir(path))
|
if (!path_mkdir(path))
|
||||||
{
|
{
|
||||||
RARCH_ERR("Failed to create directory: %s.\n", path);
|
RARCH_ERR("Failed to create directory: %s.\n", path);
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ignore directories. */
|
/* Ignore directories. */
|
||||||
if (name[strlen(name) - 1] == '/' || name[strlen(name) - 1] == '\\')
|
if (name[strlen(name) - 1] == '/' || name[strlen(name) - 1] == '\\')
|
||||||
return true;
|
return 1;
|
||||||
|
|
||||||
fill_pathname_join(path, (const char*)userdata, name, sizeof(path));
|
fill_pathname_join(path, (const char*)userdata, name, sizeof(path));
|
||||||
|
|
||||||
|
@ -1637,7 +1637,7 @@ static bool zlib_extract_core_callback(const char *name, const char *valid_exts,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cb_core_updater_download(void *data_, size_t len)
|
int cb_core_updater_download(void *data_, size_t len)
|
||||||
|
|
Loading…
Reference in New Issue