Change to ssize_t

This commit is contained in:
twinaphex 2015-02-16 03:46:27 +01:00
parent 47889ff755
commit ceb09648eb
8 changed files with 23 additions and 23 deletions

View File

@ -42,7 +42,7 @@
#endif #endif
static bool apply_patch_content(uint8_t **buf, 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) patch_func_t func)
{ {
void *patch_data = NULL; void *patch_data = NULL;
@ -52,7 +52,7 @@ static bool apply_patch_content(uint8_t **buf,
uint8_t *patched_content = NULL; uint8_t *patched_content = NULL;
ssize_t ret_size = *size; ssize_t ret_size = *size;
uint8_t *ret_buf = *buf; uint8_t *ret_buf = *buf;
size_t patch_size; ssize_t patch_size;
if (!read_file(patch_desc, &patch_data, &patch_size)) if (!read_file(patch_desc, &patch_data, &patch_size))
return false; return false;
@ -105,7 +105,7 @@ error:
return false; 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; 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); 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; 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); 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; 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. * 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) 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. * Returns: true if successful, false on error.
**/ **/
static bool read_content_file(const char *path, void **buf, static bool read_content_file(const char *path, void **buf,
size_t *length) ssize_t *length)
{ {
uint8_t *ret_buf = NULL; uint8_t *ret_buf = NULL;
@ -307,7 +307,7 @@ bool load_state(const char *path)
bool ret = true; bool ret = true;
void *buf = NULL; void *buf = NULL;
struct sram_block *blocks = NULL; struct sram_block *blocks = NULL;
size_t size; ssize_t size;
ret = read_file(path, &buf, &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) void load_ram_file(const char *path, int type)
{ {
size_t rc; ssize_t rc;
bool ret = false; bool ret = false;
void *buf = NULL; void *buf = NULL;
size_t size = pretro_get_memory_size(type); 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) if (!need_fullpath && *path)
{ {
size_t len; ssize_t len;
/* Load the content into memory. */ /* Load the content into memory. */
/* First content file is significant, attempt to do patching, /* 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)) if (need_fullpath && path_contains_compressed_file(path))
{ {
bool ret = false; bool ret = false;
size_t len; ssize_t len;
char new_path[PATH_MAX_LENGTH], new_basedir[PATH_MAX_LENGTH]; char new_path[PATH_MAX_LENGTH], new_basedir[PATH_MAX_LENGTH];
union string_list_elem_attr attributes; union string_list_elem_attr attributes;

View File

@ -92,7 +92,7 @@ int database_info_write_rdl(const char *dir)
else else
#endif #endif
{ {
size_t ret; ssize_t ret;
uint32_t crc, target_crc = 0; uint32_t crc, target_crc = 0;
uint8_t *ret_buf = NULL; uint8_t *ret_buf = NULL;
bool read_from = false; bool read_from = false;

View File

@ -158,7 +158,7 @@ static size_t zlib_file_size(void *handle)
static void *zlib_file_open(const char *path) static void *zlib_file_open(const char *path)
{ {
size_t ret = -1; ssize_t ret = -1;
bool read_from_file = false; bool read_from_file = false;
zlib_file_data_t *data = (zlib_file_data_t*)calloc(1, sizeof(*data)); zlib_file_data_t *data = (zlib_file_data_t*)calloc(1, sizeof(*data));

View File

@ -75,7 +75,7 @@
* *
* Returns: true (1) on success, false (0) otherwise. * 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; bool ret = false;
FILE *file = fopen(path, "wb"); 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. * 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; long ret = 0, _len = 0;
void *rom_buf = NULL; void *rom_buf = NULL;
@ -148,7 +148,7 @@ error:
* Then extracts to optional_filename and leaves buf alone. * Then extracts to optional_filename and leaves buf alone.
*/ */
bool read_compressed_file(const char * path, void **buf, 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; const char* file_ext;
char archive_path[PATH_MAX_LENGTH], *archive_found = NULL; 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. * 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 #ifdef HAVE_COMPRESSION
/* Here we check, whether the file, we are about to read is /* Here we check, whether the file, we are about to read is

View File

@ -34,7 +34,7 @@ extern "C" {
* Then extracts to optional_filename and leaves buf alone. * Then extracts to optional_filename and leaves buf alone.
*/ */
bool read_compressed_file(const char * path, void **buf, bool read_compressed_file(const char * path, void **buf,
const char* optional_filename, size_t *length); const char* optional_filename, ssize_t *length);
#endif #endif
/** /**
@ -49,7 +49,7 @@ bool read_compressed_file(const char * path, void **buf,
* *
* Returns: true if file read, false on error. * 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: * 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. * 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 #ifdef __cplusplus
} }

View File

@ -433,7 +433,7 @@ static GLuint compile_program(glsl_shader_data_t *glsl,
static bool load_source_path(struct video_shader_pass *pass, static bool load_source_path(struct video_shader_pass *pass,
const char *path) const char *path)
{ {
size_t len; ssize_t len;
bool ret = read_file(path, (void**)&pass->source.string.vertex, &len); bool ret = read_file(path, (void**)&pass->source.string.vertex, &len);
if (!ret || len <= 0) if (!ret || len <= 0)
return false; return false;

View File

@ -214,7 +214,7 @@ bool texture_image_load(struct texture_image *out_img, const char *path)
{ {
void *raw_buf = NULL; void *raw_buf = NULL;
uint8_t *buf = NULL; uint8_t *buf = NULL;
size_t len; ssize_t len;
bool ret = read_file(path, &raw_buf, &len); bool ret = read_file(path, &raw_buf, &len);
if (!ret || len < 0) if (!ret || len < 0)

View File

@ -297,7 +297,7 @@ py_state_t *py_state_new(const char *script,
* compiled with MSVC. */ * compiled with MSVC. */
char *script_ = NULL; char *script_ = NULL;
size_t len; ssize_t len;
bool ret = read_file(script, (void**)&script_, &len); bool ret = read_file(script, (void**)&script_, &len);
if (!ret || len < 0) if (!ret || len < 0)
{ {