From 1a1d6a08897a20ffeddfbaef0eb3c49423aa3f90 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 23 Feb 2015 01:23:21 +0100 Subject: [PATCH] Change returntype of file_cb for zlib_parse_file --- android/phoenix/jni/apk-extract/apk-extract.c | 14 +++++++------- apple/iOS/browser.m | 6 +++--- database_info.c | 4 ++-- file_extract.c | 18 +++++++++--------- file_extract.h | 4 ++-- menu/menu_entries_cbs.c | 8 ++++---- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/android/phoenix/jni/apk-extract/apk-extract.c b/android/phoenix/jni/apk-extract/apk-extract.c index e2312103ad..04765186a9 100644 --- a/android/phoenix/jni/apk-extract/apk-extract.c +++ b/android/phoenix/jni/apk-extract/apk-extract.c @@ -20,7 +20,7 @@ struct userdata 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, unsigned cmode, uint32_t csize, uint32_t size, 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; if (strstr(name, subdir) != name) - return true; + return 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)) { RARCH_ERR("Failed to create dir: %s.\n", path_dir); - return false; + return 0; } 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)) { RARCH_ERR("Failed to write file: %s.\n", path); - return false; + return 0; } break; @@ -62,15 +62,15 @@ static bool zlib_cb(const char *name, const char *valid_exts, csize, size, crc32)) { RARCH_ERR("Failed to deflate to: %s.\n", path); - return false; + return 0; } break; default: - return false; + return 0; } - return true; + return 1; } JNIEXPORT jboolean JNICALL Java_com_retroarch_browser_NativeInterface_extractArchiveTo( diff --git a/apple/iOS/browser.m b/apple/iOS/browser.m index 59a5174fe5..5e50319df5 100644 --- a/apple/iOS/browser.m +++ b/apple/iOS/browser.m @@ -28,7 +28,7 @@ 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, uint32_t crc32, void *userdata) { @@ -46,7 +46,7 @@ static bool zlib_extract_callback(const char *name, const char *valid_exts, // Ignore directories if (name[strlen(name) - 1] == '/') - return true; + return 1; 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; } - return true; + return 1; } static void unzip_file(const char* path, const char* output_directory) diff --git a/database_info.c b/database_info.c index 6e2093001d..7924a2ab90 100644 --- a/database_info.c +++ b/database_info.c @@ -47,13 +47,13 @@ int database_open_cursor(libretrodb_t *db, } #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, uint32_t crc32, void *userdata) { RARCH_LOG("CRC32: 0x%x\n", crc32); - return true; + return 1; } #endif diff --git a/file_extract.c b/file_extract.c index fa9c9a9b7a..1bd01492a0 100644 --- a/file_extract.c +++ b/file_extract.c @@ -231,10 +231,10 @@ static uint32_t read_le(const uint8_t *data, unsigned size) * * 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) { - bool ret = true; + int ret = true; uint32_t real_checksum = 0; z_stream stream = {0}; uint8_t *out_data = (uint8_t*)malloc(size); @@ -383,7 +383,7 @@ struct zip_extract_userdata 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, unsigned cmode, uint32_t csize, uint32_t size, 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); data->found_content = true; - return false; + return 0; } - return false; + return 0; default: - return false; + return 0; } } - return true; + return 1; } /** @@ -481,7 +481,7 @@ end: 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, unsigned cmode, uint32_t csize, uint32_t size, uint32_t checksum, 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); error: string_list_free(ext_list); - return false; + return 0; } /** diff --git a/file_extract.h b/file_extract.h index a9dbe4b0b2..f6e5c0caf6 100644 --- a/file_extract.h +++ b/file_extract.h @@ -30,7 +30,7 @@ #endif /* 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, 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). **/ -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); struct string_list *compressed_file_list_new(const char *filename, diff --git a/menu/menu_entries_cbs.c b/menu/menu_entries_cbs.c index d2d13e2c04..84da85f352 100644 --- a/menu/menu_entries_cbs.c +++ b/menu/menu_entries_cbs.c @@ -1603,7 +1603,7 @@ static int action_ok_save_state(const char *path, * call each other. */ 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, 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)) { RARCH_ERR("Failed to create directory: %s.\n", path); - return false; + return 0; } /* Ignore directories. */ if (name[strlen(name) - 1] == '/' || name[strlen(name) - 1] == '\\') - return true; + return 1; 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; } - return true; + return 1; } int cb_core_updater_download(void *data_, size_t len)