Change returntype of file_cb for zlib_parse_file

This commit is contained in:
twinaphex 2015-02-23 01:23:21 +01:00
parent 93b48c4d96
commit 1a1d6a0889
6 changed files with 27 additions and 27 deletions

View File

@ -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(

View File

@ -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)

View File

@ -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

View File

@ -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;
}
/**

View File

@ -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,

View File

@ -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)