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

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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