diff --git a/content.c b/content.c index 4798c2b9b3..63637ec9c4 100644 --- a/content.c +++ b/content.c @@ -42,7 +42,7 @@ #endif static bool apply_patch_content(uint8_t **buf, - size_t *size, const char *patch_desc, const char *patch_path, + ssize_t *size, const char *patch_desc, const char *patch_path, patch_func_t func) { void *patch_data = NULL; @@ -52,7 +52,7 @@ static bool apply_patch_content(uint8_t **buf, uint8_t *patched_content = NULL; ssize_t ret_size = *size; uint8_t *ret_buf = *buf; - size_t patch_size; + ssize_t patch_size; if (!read_file(patch_desc, &patch_data, &patch_size)) return false; @@ -105,7 +105,7 @@ error: return false; } -static bool try_bps_patch(uint8_t **buf, size_t *size) +static bool try_bps_patch(uint8_t **buf, ssize_t *size) { bool allow_bps = !g_extern.ups_pref && !g_extern.ips_pref; @@ -118,7 +118,7 @@ static bool try_bps_patch(uint8_t **buf, size_t *size) bps_apply_patch); } -static bool try_ups_patch(uint8_t **buf, size_t *size) +static bool try_ups_patch(uint8_t **buf, ssize_t *size) { bool allow_ups = !g_extern.bps_pref && !g_extern.ips_pref; @@ -131,7 +131,7 @@ static bool try_ups_patch(uint8_t **buf, size_t *size) ups_apply_patch); } -static bool try_ips_patch(uint8_t **buf, size_t *size) +static bool try_ips_patch(uint8_t **buf, ssize_t *size) { bool allow_ips = !g_extern.ups_pref && !g_extern.bps_pref; @@ -152,7 +152,7 @@ static bool try_ips_patch(uint8_t **buf, size_t *size) * Apply patch to the content file in-memory. * **/ -static void patch_content(uint8_t **buf, size_t *size) +static void patch_content(uint8_t **buf, ssize_t *size) { if (g_extern.ups_pref + g_extern.bps_pref + g_extern.ips_pref > 1) { @@ -179,7 +179,7 @@ static void patch_content(uint8_t **buf, size_t *size) * Returns: true if successful, false on error. **/ static bool read_content_file(const char *path, void **buf, - size_t *length) + ssize_t *length) { uint8_t *ret_buf = NULL; @@ -307,7 +307,7 @@ bool load_state(const char *path) bool ret = true; void *buf = NULL; struct sram_block *blocks = NULL; - size_t size; + ssize_t size; ret = read_file(path, &buf, &size); @@ -383,7 +383,7 @@ bool load_state(const char *path) */ void load_ram_file(const char *path, int type) { - size_t rc; + ssize_t rc; bool ret = false; void *buf = NULL; size_t size = pretro_get_memory_size(type); @@ -486,7 +486,7 @@ static bool load_content(const struct retro_subsystem_info *special, if (!need_fullpath && *path) { - size_t len; + ssize_t len; /* Load the content into memory. */ /* First content file is significant, attempt to do patching, @@ -518,7 +518,7 @@ static bool load_content(const struct retro_subsystem_info *special, if (need_fullpath && path_contains_compressed_file(path)) { bool ret = false; - size_t len; + ssize_t len; char new_path[PATH_MAX_LENGTH], new_basedir[PATH_MAX_LENGTH]; union string_list_elem_attr attributes; diff --git a/database_info.c b/database_info.c index 03d390bf4a..c56cd20e37 100644 --- a/database_info.c +++ b/database_info.c @@ -92,7 +92,7 @@ int database_info_write_rdl(const char *dir) else #endif { - size_t ret; + ssize_t ret; uint32_t crc, target_crc = 0; uint8_t *ret_buf = NULL; bool read_from = false; diff --git a/file_extract.c b/file_extract.c index e10d40bf97..fa9c9a9b7a 100644 --- a/file_extract.c +++ b/file_extract.c @@ -158,7 +158,7 @@ static size_t zlib_file_size(void *handle) static void *zlib_file_open(const char *path) { - size_t ret = -1; + ssize_t ret = -1; bool read_from_file = false; zlib_file_data_t *data = (zlib_file_data_t*)calloc(1, sizeof(*data)); diff --git a/file_ops.c b/file_ops.c index d41d813e3d..5bbc3a72dd 100644 --- a/file_ops.c +++ b/file_ops.c @@ -75,7 +75,7 @@ * * Returns: true (1) on success, false (0) otherwise. */ -bool write_file(const char *path, const void *data, size_t size) +bool write_file(const char *path, const void *data, ssize_t size) { bool ret = false; FILE *file = fopen(path, "wb"); @@ -97,7 +97,7 @@ bool write_file(const char *path, const void *data, size_t size) * * Returns: number of items read, -1 on error. */ -static bool read_generic_file(const char *path, void **buf, size_t *len) +static bool read_generic_file(const char *path, void **buf, ssize_t *len) { long ret = 0, _len = 0; void *rom_buf = NULL; @@ -148,7 +148,7 @@ error: * Then extracts to optional_filename and leaves buf alone. */ bool read_compressed_file(const char * path, void **buf, - const char* optional_filename, size_t *length) + const char* optional_filename, ssize_t *length) { const char* file_ext; char archive_path[PATH_MAX_LENGTH], *archive_found = NULL; @@ -224,7 +224,7 @@ bool read_compressed_file(const char * path, void **buf, * * Returns: true if file read, false on error. */ -bool read_file(const char *path, void **buf, size_t *length) +bool read_file(const char *path, void **buf, ssize_t *length) { #ifdef HAVE_COMPRESSION /* Here we check, whether the file, we are about to read is diff --git a/file_ops.h b/file_ops.h index 845d4a04ac..50dcfa0641 100644 --- a/file_ops.h +++ b/file_ops.h @@ -34,7 +34,7 @@ extern "C" { * Then extracts to optional_filename and leaves buf alone. */ bool read_compressed_file(const char * path, void **buf, - const char* optional_filename, size_t *length); + const char* optional_filename, ssize_t *length); #endif /** @@ -49,7 +49,7 @@ bool read_compressed_file(const char * path, void **buf, * * Returns: true if file read, false on error. */ -bool read_file(const char *path, void **buf, size_t *length); +bool read_file(const char *path, void **buf, ssize_t *length); /** * write_file: @@ -61,7 +61,7 @@ bool read_file(const char *path, void **buf, size_t *length); * * Returns: true (1) on success, false (0) otherwise. */ -bool write_file(const char *path, const void *buf, size_t size); +bool write_file(const char *path, const void *buf, ssize_t size); #ifdef __cplusplus } diff --git a/gfx/drivers_shader/shader_glsl.c b/gfx/drivers_shader/shader_glsl.c index 4d084cba42..bf9061d568 100644 --- a/gfx/drivers_shader/shader_glsl.c +++ b/gfx/drivers_shader/shader_glsl.c @@ -433,7 +433,7 @@ static GLuint compile_program(glsl_shader_data_t *glsl, static bool load_source_path(struct video_shader_pass *pass, const char *path) { - size_t len; + ssize_t len; bool ret = read_file(path, (void**)&pass->source.string.vertex, &len); if (!ret || len <= 0) return false; diff --git a/gfx/image/image_rpng.c b/gfx/image/image_rpng.c index c05c49d21b..160574b2a9 100644 --- a/gfx/image/image_rpng.c +++ b/gfx/image/image_rpng.c @@ -214,7 +214,7 @@ bool texture_image_load(struct texture_image *out_img, const char *path) { void *raw_buf = NULL; uint8_t *buf = NULL; - size_t len; + ssize_t len; bool ret = read_file(path, &raw_buf, &len); if (!ret || len < 0) diff --git a/gfx/video_state_python.c b/gfx/video_state_python.c index 4494bc8325..9c8fb6d429 100644 --- a/gfx/video_state_python.c +++ b/gfx/video_state_python.c @@ -297,7 +297,7 @@ py_state_t *py_state_new(const char *script, * compiled with MSVC. */ char *script_ = NULL; - size_t len; + ssize_t len; bool ret = read_file(script, (void**)&script_, &len); if (!ret || len < 0) {