mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
Make it possible to read bigger files by replacing ssize_t with int64_t
and size_t with uint64_t
This commit is contained in:
parent
70abbbf4fb
commit
1751f4a0af
@ -44,7 +44,7 @@ bool glslang_read_shader_file(const char *path, vector<string> *output, bool roo
|
||||
char tmp[PATH_MAX_LENGTH];
|
||||
char *ptr = NULL;
|
||||
char *buf = nullptr;
|
||||
ssize_t len = 0;
|
||||
int64_t len = 0;
|
||||
const char *basename = path_basename(path);
|
||||
|
||||
include_path[0] = tmp[0] = '\0';
|
||||
|
@ -493,7 +493,7 @@ static void gl_glsl_strip_parameter_pragmas(char *source)
|
||||
static bool gl_glsl_load_source_path(struct video_shader_pass *pass,
|
||||
const char *path)
|
||||
{
|
||||
ssize_t len;
|
||||
int64_t len;
|
||||
int nitems = pass ? filestream_read_file(path,
|
||||
(void**)&pass->source.string.vertex, &len) : 0;
|
||||
|
||||
|
@ -111,7 +111,7 @@ void audio_mix_free_chunk(audio_chunk_t *chunk)
|
||||
audio_chunk_t* audio_mix_load_wav_file(const char *path, int sample_rate)
|
||||
{
|
||||
int sample_size;
|
||||
ssize_t len = 0;
|
||||
int64_t len = 0;
|
||||
void *buf = NULL;
|
||||
audio_chunk_t *chunk = (audio_chunk_t*)calloc(1, sizeof(*chunk));
|
||||
|
||||
|
@ -129,7 +129,7 @@ static void file_archive_free(file_archive_file_data_t *data)
|
||||
|
||||
static file_archive_file_data_t* file_archive_open(const char *path)
|
||||
{
|
||||
ssize_t ret = -1;
|
||||
int64_t ret = -1;
|
||||
bool read_from_file = false;
|
||||
file_archive_file_data_t *data = (file_archive_file_data_t*)
|
||||
calloc(1, sizeof(*data));
|
||||
@ -722,7 +722,7 @@ error:
|
||||
*/
|
||||
int file_archive_compressed_read(
|
||||
const char * path, void **buf,
|
||||
const char* optional_filename, ssize_t *length)
|
||||
const char* optional_filename, int64_t *length)
|
||||
{
|
||||
const struct file_archive_file_backend *backend = NULL;
|
||||
int ret = 0;
|
||||
|
@ -187,7 +187,7 @@ bool file_archive_perform_mode(const char *name, const char *valid_exts,
|
||||
|
||||
int file_archive_compressed_read(
|
||||
const char* path, void **buf,
|
||||
const char* optional_filename, ssize_t *length);
|
||||
const char* optional_filename, int64_t *length);
|
||||
|
||||
const struct file_archive_file_backend* file_archive_get_zlib_file_backend(void);
|
||||
const struct file_archive_file_backend* file_archive_get_7z_file_backend(void);
|
||||
|
@ -49,11 +49,11 @@ int chdstream_getc(chdstream_t *stream);
|
||||
|
||||
char *chdstream_gets(chdstream_t *stream, char *buffer, size_t len);
|
||||
|
||||
size_t chdstream_tell(chdstream_t *stream);
|
||||
uint64_t chdstream_tell(chdstream_t *stream);
|
||||
|
||||
void chdstream_rewind(chdstream_t *stream);
|
||||
|
||||
int chdstream_seek(chdstream_t *stream, ssize_t offset, int whence);
|
||||
int64_t chdstream_seek(chdstream_t *stream, int64_t offset, int whence);
|
||||
|
||||
ssize_t chdstream_get_size(chdstream_t *stream);
|
||||
|
||||
|
@ -47,7 +47,7 @@ typedef struct RFILE RFILE;
|
||||
|
||||
void filestream_vfs_init(const struct retro_vfs_interface_info* vfs_info);
|
||||
|
||||
ssize_t filestream_get_size(RFILE *stream);
|
||||
int64_t filestream_get_size(RFILE *stream);
|
||||
|
||||
/**
|
||||
* filestream_open:
|
||||
@ -60,19 +60,19 @@ ssize_t filestream_get_size(RFILE *stream);
|
||||
**/
|
||||
RFILE *filestream_open(const char *path, unsigned mode, unsigned hints);
|
||||
|
||||
ssize_t filestream_seek(RFILE *stream, ssize_t offset, int seek_position);
|
||||
int64_t filestream_seek(RFILE *stream, int64_t offset, int seek_position);
|
||||
|
||||
ssize_t filestream_read(RFILE *stream, void *data, int64_t len);
|
||||
int64_t filestream_read(RFILE *stream, void *data, int64_t len);
|
||||
|
||||
ssize_t filestream_write(RFILE *stream, const void *data, int64_t len);
|
||||
int64_t filestream_write(RFILE *stream, const void *data, int64_t len);
|
||||
|
||||
ssize_t filestream_tell(RFILE *stream);
|
||||
int64_t filestream_tell(RFILE *stream);
|
||||
|
||||
void filestream_rewind(RFILE *stream);
|
||||
|
||||
int filestream_close(RFILE *stream);
|
||||
|
||||
int filestream_read_file(const char *path, void **buf, ssize_t *len);
|
||||
int64_t filestream_read_file(const char *path, void **buf, int64_t *len);
|
||||
|
||||
char *filestream_gets(RFILE *stream, char *s, size_t len);
|
||||
|
||||
@ -80,7 +80,7 @@ int filestream_getc(RFILE *stream);
|
||||
|
||||
int filestream_eof(RFILE *stream);
|
||||
|
||||
bool filestream_write_file(const char *path, const void *data, ssize_t size);
|
||||
bool filestream_write_file(const char *path, const void *data, int64_t size);
|
||||
|
||||
int filestream_putc(RFILE *stream, int c);
|
||||
|
||||
|
@ -68,29 +68,29 @@ bool intfstream_resize(intfstream_internal_t *intf,
|
||||
bool intfstream_open(intfstream_internal_t *intf,
|
||||
const char *path, unsigned mode, unsigned hints);
|
||||
|
||||
ssize_t intfstream_read(intfstream_internal_t *intf,
|
||||
void *s, size_t len);
|
||||
int64_t intfstream_read(intfstream_internal_t *intf,
|
||||
void *s, uint64_t len);
|
||||
|
||||
ssize_t intfstream_write(intfstream_internal_t *intf,
|
||||
const void *s, size_t len);
|
||||
int64_t intfstream_write(intfstream_internal_t *intf,
|
||||
const void *s, uint64_t len);
|
||||
|
||||
char *intfstream_gets(intfstream_internal_t *intf,
|
||||
char *buffer, size_t len);
|
||||
|
||||
int intfstream_getc(intfstream_internal_t *intf);
|
||||
|
||||
int intfstream_seek(intfstream_internal_t *intf,
|
||||
int offset, int whence);
|
||||
int64_t intfstream_seek(intfstream_internal_t *intf,
|
||||
int64_t offset, int whence);
|
||||
|
||||
void intfstream_rewind(intfstream_internal_t *intf);
|
||||
|
||||
int intfstream_tell(intfstream_internal_t *intf);
|
||||
int64_t intfstream_tell(intfstream_internal_t *intf);
|
||||
|
||||
void intfstream_putc(intfstream_internal_t *intf, int c);
|
||||
|
||||
int intfstream_close(intfstream_internal_t *intf);
|
||||
|
||||
ssize_t intfstream_get_size(intfstream_internal_t *intf);
|
||||
int64_t intfstream_get_size(intfstream_internal_t *intf);
|
||||
|
||||
int intfstream_flush(intfstream_internal_t *intf);
|
||||
|
||||
|
@ -36,9 +36,9 @@ memstream_t *memstream_open(unsigned writing);
|
||||
|
||||
void memstream_close(memstream_t *stream);
|
||||
|
||||
size_t memstream_read(memstream_t *stream, void *data, size_t bytes);
|
||||
uint64_t memstream_read(memstream_t *stream, void *data, uint64_t bytes);
|
||||
|
||||
size_t memstream_write(memstream_t *stream, const void *data, size_t bytes);
|
||||
uint64_t memstream_write(memstream_t *stream, const void *data, uint64_t bytes);
|
||||
|
||||
int memstream_getc(memstream_t *stream);
|
||||
|
||||
@ -46,15 +46,15 @@ void memstream_putc(memstream_t *stream, int c);
|
||||
|
||||
char *memstream_gets(memstream_t *stream, char *buffer, size_t len);
|
||||
|
||||
size_t memstream_pos(memstream_t *stream);
|
||||
uint64_t memstream_pos(memstream_t *stream);
|
||||
|
||||
void memstream_rewind(memstream_t *stream);
|
||||
|
||||
int memstream_seek(memstream_t *stream, int offset, int whence);
|
||||
int64_t memstream_seek(memstream_t *stream, int64_t offset, int whence);
|
||||
|
||||
void memstream_set_buffer(uint8_t *buffer, size_t size);
|
||||
void memstream_set_buffer(uint8_t *buffer, uint64_t size);
|
||||
|
||||
size_t memstream_get_last_size(void);
|
||||
uint64_t memstream_get_last_size(void);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
|
@ -386,7 +386,7 @@ char *chdstream_gets(chdstream_t *stream, char *buffer, size_t len)
|
||||
return buffer;
|
||||
}
|
||||
|
||||
size_t chdstream_tell(chdstream_t *stream)
|
||||
uint64_t chdstream_tell(chdstream_t *stream)
|
||||
{
|
||||
return stream->offset;
|
||||
}
|
||||
@ -396,9 +396,9 @@ void chdstream_rewind(chdstream_t *stream)
|
||||
stream->offset = 0;
|
||||
}
|
||||
|
||||
int chdstream_seek(chdstream_t *stream, ssize_t offset, int whence)
|
||||
int64_t chdstream_seek(chdstream_t *stream, int64_t offset, int whence)
|
||||
{
|
||||
ssize_t new_offset;
|
||||
int64_t new_offset;
|
||||
|
||||
switch (whence)
|
||||
{
|
||||
|
@ -111,9 +111,9 @@ bool filestream_exists(const char *path)
|
||||
return true;
|
||||
}
|
||||
|
||||
ssize_t filestream_get_size(RFILE *stream)
|
||||
int64_t filestream_get_size(RFILE *stream)
|
||||
{
|
||||
ssize_t output;
|
||||
int64_t output;
|
||||
|
||||
if (filestream_size_cb != NULL)
|
||||
output = filestream_size_cb(stream->hfile);
|
||||
@ -191,7 +191,7 @@ int filestream_getc(RFILE *stream)
|
||||
return EOF;
|
||||
}
|
||||
|
||||
ssize_t filestream_seek(RFILE *stream, ssize_t offset, int seek_position)
|
||||
int64_t filestream_seek(RFILE *stream, int64_t offset, int seek_position)
|
||||
{
|
||||
int64_t output;
|
||||
|
||||
@ -213,9 +213,9 @@ int filestream_eof(RFILE *stream)
|
||||
}
|
||||
|
||||
|
||||
ssize_t filestream_tell(RFILE *stream)
|
||||
int64_t filestream_tell(RFILE *stream)
|
||||
{
|
||||
ssize_t output;
|
||||
int64_t output;
|
||||
|
||||
if (filestream_size_cb != NULL)
|
||||
output = filestream_tell_cb(stream->hfile);
|
||||
@ -237,7 +237,7 @@ void filestream_rewind(RFILE *stream)
|
||||
stream->eof_flag = false;
|
||||
}
|
||||
|
||||
ssize_t filestream_read(RFILE *stream, void *s, int64_t len)
|
||||
int64_t filestream_read(RFILE *stream, void *s, int64_t len)
|
||||
{
|
||||
int64_t output;
|
||||
|
||||
@ -294,7 +294,7 @@ const char *filestream_get_path(RFILE *stream)
|
||||
return retro_vfs_file_get_path_impl((libretro_vfs_implementation_file*)stream->hfile);
|
||||
}
|
||||
|
||||
ssize_t filestream_write(RFILE *stream, const void *s, int64_t len)
|
||||
int64_t filestream_write(RFILE *stream, const void *s, int64_t len)
|
||||
{
|
||||
int64_t output;
|
||||
|
||||
@ -373,9 +373,9 @@ int filestream_close(RFILE *stream)
|
||||
*
|
||||
* Returns: number of items read, -1 on error.
|
||||
*/
|
||||
int filestream_read_file(const char *path, void **buf, ssize_t *len)
|
||||
int64_t filestream_read_file(const char *path, void **buf, int64_t *len)
|
||||
{
|
||||
ssize_t ret = 0;
|
||||
int64_t ret = 0;
|
||||
int64_t content_buf_size = 0;
|
||||
void *content_buf = NULL;
|
||||
RFILE *file = filestream_open(path,
|
||||
@ -393,11 +393,11 @@ int filestream_read_file(const char *path, void **buf, ssize_t *len)
|
||||
if (content_buf_size < 0)
|
||||
goto error;
|
||||
|
||||
content_buf = malloc((size_t)(content_buf_size + 1));
|
||||
content_buf = malloc((uint64_t)(content_buf_size + 1));
|
||||
|
||||
if (!content_buf)
|
||||
goto error;
|
||||
if ((int64_t)(size_t)(content_buf_size + 1) != (content_buf_size + 1))
|
||||
if ((int64_t)(uint64_t)(content_buf_size + 1) != (content_buf_size + 1))
|
||||
goto error;
|
||||
|
||||
ret = filestream_read(file, content_buf, (int64_t)content_buf_size);
|
||||
@ -441,9 +441,9 @@ error:
|
||||
*
|
||||
* Returns: true (1) on success, false (0) otherwise.
|
||||
*/
|
||||
bool filestream_write_file(const char *path, const void *data, ssize_t size)
|
||||
bool filestream_write_file(const char *path, const void *data, int64_t size)
|
||||
{
|
||||
ssize_t ret = 0;
|
||||
int64_t ret = 0;
|
||||
RFILE *file = filestream_open(path,
|
||||
RETRO_VFS_FILE_ACCESS_WRITE,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
|
@ -57,7 +57,7 @@ struct intfstream_internal
|
||||
#endif
|
||||
};
|
||||
|
||||
ssize_t intfstream_get_size(intfstream_internal_t *intf)
|
||||
int64_t intfstream_get_size(intfstream_internal_t *intf)
|
||||
{
|
||||
if (!intf)
|
||||
return 0;
|
||||
@ -219,7 +219,7 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int intfstream_seek(intfstream_internal_t *intf, int offset, int whence)
|
||||
int64_t intfstream_seek(intfstream_internal_t *intf, int64_t offset, int whence)
|
||||
{
|
||||
if (!intf)
|
||||
return -1;
|
||||
@ -241,14 +241,14 @@ int intfstream_seek(intfstream_internal_t *intf, int offset, int whence)
|
||||
seek_position = RETRO_VFS_SEEK_POSITION_END;
|
||||
break;
|
||||
}
|
||||
return (int)filestream_seek(intf->file.fp, (int)offset,
|
||||
return (int64_t)filestream_seek(intf->file.fp, (int64_t)offset,
|
||||
seek_position);
|
||||
}
|
||||
case INTFSTREAM_MEMORY:
|
||||
return (int)memstream_seek(intf->memory.fp, offset, whence);
|
||||
return (int64_t)memstream_seek(intf->memory.fp, offset, whence);
|
||||
case INTFSTREAM_CHD:
|
||||
#ifdef HAVE_CHD
|
||||
return (int)chdstream_seek(intf->chd.fp, offset, whence);
|
||||
return (int64_t)chdstream_seek(intf->chd.fp, offset, whence);
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
@ -257,7 +257,7 @@ int intfstream_seek(intfstream_internal_t *intf, int offset, int whence)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ssize_t intfstream_read(intfstream_internal_t *intf, void *s, size_t len)
|
||||
int64_t intfstream_read(intfstream_internal_t *intf, void *s, uint64_t len)
|
||||
{
|
||||
if (!intf)
|
||||
return 0;
|
||||
@ -279,8 +279,8 @@ ssize_t intfstream_read(intfstream_internal_t *intf, void *s, size_t len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ssize_t intfstream_write(intfstream_internal_t *intf,
|
||||
const void *s, size_t len)
|
||||
int64_t intfstream_write(intfstream_internal_t *intf,
|
||||
const void *s, uint64_t len)
|
||||
{
|
||||
if (!intf)
|
||||
return 0;
|
||||
@ -343,7 +343,7 @@ int intfstream_getc(intfstream_internal_t *intf)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int intfstream_tell(intfstream_internal_t *intf)
|
||||
int64_t intfstream_tell(intfstream_internal_t *intf)
|
||||
{
|
||||
if (!intf)
|
||||
return -1;
|
||||
@ -351,12 +351,12 @@ int intfstream_tell(intfstream_internal_t *intf)
|
||||
switch (intf->type)
|
||||
{
|
||||
case INTFSTREAM_FILE:
|
||||
return (int)filestream_tell(intf->file.fp);
|
||||
return (int64_t)filestream_tell(intf->file.fp);
|
||||
case INTFSTREAM_MEMORY:
|
||||
return (int)memstream_pos(intf->memory.fp);
|
||||
return (int64_t)memstream_pos(intf->memory.fp);
|
||||
case INTFSTREAM_CHD:
|
||||
#ifdef HAVE_CHD
|
||||
return (int)chdstream_tell(intf->chd.fp);
|
||||
return (int64_t)chdstream_tell(intf->chd.fp);
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
|
@ -26,16 +26,16 @@
|
||||
|
||||
#include <streams/memory_stream.h>
|
||||
|
||||
static uint8_t* g_buffer = NULL;
|
||||
static size_t g_size = 0;
|
||||
static size_t last_file_size = 0;
|
||||
static uint8_t* g_buffer = NULL;
|
||||
static uint64_t g_size = 0;
|
||||
static uint64_t last_file_size = 0;
|
||||
|
||||
struct memstream
|
||||
{
|
||||
uint8_t *buf;
|
||||
size_t size;
|
||||
size_t ptr;
|
||||
size_t max_ptr;
|
||||
uint64_t size;
|
||||
uint64_t ptr;
|
||||
uint64_t max_ptr;
|
||||
unsigned writing;
|
||||
};
|
||||
|
||||
@ -45,19 +45,19 @@ static void memstream_update_pos(memstream_t *stream)
|
||||
stream->max_ptr = stream->ptr;
|
||||
}
|
||||
|
||||
void memstream_set_buffer(uint8_t *buffer, size_t size)
|
||||
void memstream_set_buffer(uint8_t *buffer, uint64_t size)
|
||||
{
|
||||
g_buffer = buffer;
|
||||
g_size = size;
|
||||
}
|
||||
|
||||
size_t memstream_get_last_size(void)
|
||||
uint64_t memstream_get_last_size(void)
|
||||
{
|
||||
return last_file_size;
|
||||
}
|
||||
|
||||
static void memstream_init(memstream_t *stream,
|
||||
uint8_t *buffer, size_t max_size, unsigned writing)
|
||||
uint8_t *buffer, uint64_t max_size, unsigned writing)
|
||||
{
|
||||
if (!stream)
|
||||
return;
|
||||
@ -92,9 +92,9 @@ void memstream_close(memstream_t *stream)
|
||||
free(stream);
|
||||
}
|
||||
|
||||
size_t memstream_read(memstream_t *stream, void *data, size_t bytes)
|
||||
uint64_t memstream_read(memstream_t *stream, void *data, uint64_t bytes)
|
||||
{
|
||||
size_t avail = 0;
|
||||
uint64_t avail = 0;
|
||||
|
||||
if (!stream)
|
||||
return 0;
|
||||
@ -109,9 +109,9 @@ size_t memstream_read(memstream_t *stream, void *data, size_t bytes)
|
||||
return bytes;
|
||||
}
|
||||
|
||||
size_t memstream_write(memstream_t *stream, const void *data, size_t bytes)
|
||||
uint64_t memstream_write(memstream_t *stream, const void *data, uint64_t bytes)
|
||||
{
|
||||
size_t avail = 0;
|
||||
uint64_t avail = 0;
|
||||
|
||||
if (!stream)
|
||||
return 0;
|
||||
@ -126,9 +126,9 @@ size_t memstream_write(memstream_t *stream, const void *data, size_t bytes)
|
||||
return bytes;
|
||||
}
|
||||
|
||||
int memstream_seek(memstream_t *stream, int offset, int whence)
|
||||
int64_t memstream_seek(memstream_t *stream, int64_t offset, int whence)
|
||||
{
|
||||
size_t ptr;
|
||||
uint64_t ptr;
|
||||
|
||||
switch (whence)
|
||||
{
|
||||
@ -159,7 +159,7 @@ void memstream_rewind(memstream_t *stream)
|
||||
memstream_seek(stream, 0L, SEEK_SET);
|
||||
}
|
||||
|
||||
size_t memstream_pos(memstream_t *stream)
|
||||
uint64_t memstream_pos(memstream_t *stream)
|
||||
{
|
||||
return stream->ptr;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ char* copy_core_to_temp_file(void)
|
||||
char *retroarchTempPath = NULL;
|
||||
char *tempDllPath = NULL;
|
||||
void *dllFileData = NULL;
|
||||
ssize_t dllFileSize = 0;
|
||||
int64_t dllFileSize = 0;
|
||||
const char *corePath = path_get(RARCH_PATH_CORE);
|
||||
const char *coreBaseName = path_basename(corePath);
|
||||
|
||||
|
@ -151,7 +151,7 @@ static char pending_subsystem_extensions[PATH_MAX_LENGTH];
|
||||
static char *pending_subsystem_roms[RARCH_MAX_SUBSYSTEM_ROMS];
|
||||
|
||||
|
||||
static int content_file_read(const char *path, void **buf, ssize_t *length)
|
||||
static int64_t content_file_read(const char *path, void **buf, int64_t *length)
|
||||
{
|
||||
#ifdef HAVE_COMPRESSION
|
||||
if (path_contains_compressed_file(path))
|
||||
@ -324,7 +324,7 @@ end:
|
||||
static bool load_content_into_memory(
|
||||
content_information_ctx_t *content_ctx,
|
||||
unsigned i, const char *path, void **buf,
|
||||
ssize_t *length)
|
||||
int64_t *length)
|
||||
{
|
||||
uint8_t *ret_buf = NULL;
|
||||
|
||||
@ -383,7 +383,7 @@ static bool load_content_from_compressed_archive(
|
||||
char **error_string)
|
||||
{
|
||||
union string_list_elem_attr attributes;
|
||||
ssize_t new_path_len = 0;
|
||||
int64_t new_path_len = 0;
|
||||
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
|
||||
char *new_basedir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
char *new_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
@ -582,7 +582,7 @@ static bool content_file_load(
|
||||
{
|
||||
/* Load the content into memory. */
|
||||
|
||||
ssize_t len = 0;
|
||||
int64_t len = 0;
|
||||
|
||||
if (!load_content_into_memory(
|
||||
content_ctx,
|
||||
|
@ -70,17 +70,17 @@ typedef struct db_handle
|
||||
} db_handle_t;
|
||||
|
||||
int cue_find_track(const char *cue_path, bool first,
|
||||
size_t *offset, size_t *size,
|
||||
char *track_path, size_t max_len);
|
||||
uint64_t *offset, uint64_t *size,
|
||||
char *track_path, uint64_t max_len);
|
||||
|
||||
bool cue_next_file(intfstream_t *fd, const char *cue_path,
|
||||
char *path, size_t max_len);
|
||||
char *path, uint64_t max_len);
|
||||
|
||||
int gdi_find_track(const char *gdi_path, bool first,
|
||||
char *track_path, size_t max_len);
|
||||
char *track_path, uint64_t max_len);
|
||||
|
||||
bool gdi_next_file(intfstream_t *fd, const char *gdi_path,
|
||||
char *path, size_t max_len);
|
||||
char *path, uint64_t max_len);
|
||||
|
||||
int detect_system(intfstream_t *fd, const char** system_name);
|
||||
|
||||
@ -204,11 +204,11 @@ static int intfstream_get_serial(intfstream_t *fd, char *serial)
|
||||
}
|
||||
|
||||
static bool intfstream_file_get_serial(const char *name,
|
||||
size_t offset, size_t size, char *serial)
|
||||
uint64_t offset, uint64_t size, char *serial)
|
||||
{
|
||||
int rv;
|
||||
uint8_t *data = NULL;
|
||||
ssize_t file_size = -1;
|
||||
int64_t file_size = -1;
|
||||
intfstream_t *fd = intfstream_open_file(name,
|
||||
RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
|
||||
@ -226,14 +226,14 @@ static bool intfstream_file_get_serial(const char *name,
|
||||
if (file_size < 0)
|
||||
goto error;
|
||||
|
||||
if (offset != 0 || size < (size_t) file_size)
|
||||
if (offset != 0 || size < (uint64_t) file_size)
|
||||
{
|
||||
if (intfstream_seek(fd, (int)offset, SEEK_SET) == -1)
|
||||
if (intfstream_seek(fd, (int64_t)offset, SEEK_SET) == -1)
|
||||
goto error;
|
||||
|
||||
data = (uint8_t*)malloc(size);
|
||||
|
||||
if (intfstream_read(fd, data, size) != (ssize_t) size)
|
||||
if (intfstream_read(fd, data, size) != (int64_t) size)
|
||||
{
|
||||
free(data);
|
||||
goto error;
|
||||
@ -268,8 +268,8 @@ static int task_database_cue_get_serial(const char *name, char* serial)
|
||||
char *track_path = (char*)malloc(PATH_MAX_LENGTH
|
||||
* sizeof(char));
|
||||
int ret = 0;
|
||||
size_t offset = 0;
|
||||
size_t size = 0;
|
||||
uint64_t offset = 0;
|
||||
uint64_t size = 0;
|
||||
int rv = 0;
|
||||
|
||||
track_path[0] = '\0';
|
||||
@ -340,7 +340,7 @@ static int task_database_chd_get_serial(const char *name, char* serial)
|
||||
|
||||
static int intfstream_get_crc(intfstream_t *fd, uint32_t *crc)
|
||||
{
|
||||
ssize_t read = 0;
|
||||
int64_t read = 0;
|
||||
uint32_t acc = 0;
|
||||
uint8_t buffer[4096];
|
||||
|
||||
@ -356,13 +356,13 @@ static int intfstream_get_crc(intfstream_t *fd, uint32_t *crc)
|
||||
}
|
||||
|
||||
static bool intfstream_file_get_crc(const char *name,
|
||||
size_t offset, size_t size, uint32_t *crc)
|
||||
uint64_t offset, size_t size, uint32_t *crc)
|
||||
{
|
||||
int rv;
|
||||
intfstream_t *fd = intfstream_open_file(name,
|
||||
RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
uint8_t *data = NULL;
|
||||
ssize_t file_size = -1;
|
||||
int64_t file_size = -1;
|
||||
|
||||
if (!fd)
|
||||
return 0;
|
||||
@ -378,14 +378,14 @@ static bool intfstream_file_get_crc(const char *name,
|
||||
if (file_size < 0)
|
||||
goto error;
|
||||
|
||||
if (offset != 0 || size < (size_t) file_size)
|
||||
if (offset != 0 || size < (uint64_t) file_size)
|
||||
{
|
||||
if (intfstream_seek(fd, (int)offset, SEEK_SET) == -1)
|
||||
if (intfstream_seek(fd, (int64_t)offset, SEEK_SET) == -1)
|
||||
goto error;
|
||||
|
||||
data = (uint8_t*)malloc(size);
|
||||
|
||||
if (intfstream_read(fd, data, size) != (ssize_t) size)
|
||||
if (intfstream_read(fd, data, size) != (int64_t) size)
|
||||
goto error;
|
||||
|
||||
intfstream_close(fd);
|
||||
@ -417,8 +417,8 @@ error:
|
||||
static int task_database_cue_get_crc(const char *name, uint32_t *crc)
|
||||
{
|
||||
char *track_path = (char *)malloc(PATH_MAX_LENGTH);
|
||||
size_t offset = 0;
|
||||
size_t size = 0;
|
||||
uint64_t offset = 0;
|
||||
uint64_t size = 0;
|
||||
int rv = 0;
|
||||
|
||||
track_path[0] = '\0';
|
||||
|
@ -64,15 +64,15 @@ static struct magic_entry MAGIC_NUMBERS[] = {
|
||||
{ 0, NULL, NULL}
|
||||
};
|
||||
|
||||
static ssize_t get_token(intfstream_t *fd, char *token, size_t max_len)
|
||||
static int64_t get_token(intfstream_t *fd, char *token, uint64_t max_len)
|
||||
{
|
||||
char *c = token;
|
||||
ssize_t len = 0;
|
||||
int64_t len = 0;
|
||||
int in_string = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int rv = (int)intfstream_read(fd, c, 1);
|
||||
int64_t rv = (int64_t)intfstream_read(fd, c, 1);
|
||||
if (rv == 0)
|
||||
return 0;
|
||||
|
||||
@ -116,7 +116,7 @@ static ssize_t get_token(intfstream_t *fd, char *token, size_t max_len)
|
||||
|
||||
len++;
|
||||
c++;
|
||||
if (len == (ssize_t)max_len)
|
||||
if (len == (int64_t)max_len)
|
||||
{
|
||||
*c = '\0';
|
||||
return len;
|
||||
@ -362,7 +362,7 @@ int detect_system(intfstream_t *fd, const char **system_name)
|
||||
int rv;
|
||||
char magic[MAGIC_LEN];
|
||||
int i;
|
||||
ssize_t read;
|
||||
int64_t read;
|
||||
|
||||
RARCH_LOG("%s\n", msg_hash_to_str(MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS));
|
||||
for (i = 0; MAGIC_NUMBERS[i].system_name != NULL; i++)
|
||||
@ -409,9 +409,9 @@ clean:
|
||||
return rv;
|
||||
}
|
||||
|
||||
static ssize_t intfstream_get_file_size(const char *path)
|
||||
static int64_t intfstream_get_file_size(const char *path)
|
||||
{
|
||||
ssize_t rv;
|
||||
int64_t rv;
|
||||
intfstream_t *fd = intfstream_open_file(path,
|
||||
RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
if (!fd)
|
||||
@ -422,13 +422,13 @@ static ssize_t intfstream_get_file_size(const char *path)
|
||||
return rv;
|
||||
}
|
||||
|
||||
static bool update_cand(ssize_t *cand_index, ssize_t *last_index,
|
||||
size_t *largest, char *last_file, size_t *offset,
|
||||
size_t *size, char *track_path, size_t max_len)
|
||||
static bool update_cand(int64_t *cand_index, int64_t *last_index,
|
||||
uint64_t *largest, char *last_file, uint64_t *offset,
|
||||
uint64_t *size, char *track_path, uint64_t max_len)
|
||||
{
|
||||
if (*cand_index != -1)
|
||||
{
|
||||
if ((unsigned)(*last_index - *cand_index) > *largest)
|
||||
if ((uint64_t)(*last_index - *cand_index) > *largest)
|
||||
{
|
||||
*largest = *last_index - *cand_index;
|
||||
strlcpy(track_path, last_file, max_len);
|
||||
@ -443,19 +443,19 @@ static bool update_cand(ssize_t *cand_index, ssize_t *last_index,
|
||||
}
|
||||
|
||||
int cue_find_track(const char *cue_path, bool first,
|
||||
size_t *offset, size_t *size, char *track_path, size_t max_len)
|
||||
uint64_t *offset, uint64_t *size, char *track_path, uint64_t max_len)
|
||||
{
|
||||
int rv;
|
||||
intfstream_info_t info;
|
||||
char *tmp_token = (char*)malloc(MAX_TOKEN_LEN);
|
||||
char *last_file = (char*)malloc(PATH_MAX_LENGTH + 1);
|
||||
intfstream_t *fd = NULL;
|
||||
ssize_t last_index = -1;
|
||||
ssize_t cand_index = -1;
|
||||
int64_t last_index = -1;
|
||||
int64_t cand_index = -1;
|
||||
int32_t cand_track = -1;
|
||||
int32_t track = 0;
|
||||
size_t largest = 0;
|
||||
ssize_t volatile file_size = -1;
|
||||
uint64_t largest = 0;
|
||||
int64_t volatile file_size = -1;
|
||||
bool is_data = false;
|
||||
char *cue_dir = (char*)malloc(PATH_MAX_LENGTH);
|
||||
cue_dir[0] = '\0';
|
||||
@ -604,16 +604,16 @@ bool cue_next_file(intfstream_t *fd, const char *cue_path, char *path, size_t ma
|
||||
}
|
||||
|
||||
int gdi_find_track(const char *gdi_path, bool first,
|
||||
char *track_path, size_t max_len)
|
||||
char *track_path, uint64_t max_len)
|
||||
{
|
||||
int rv;
|
||||
intfstream_info_t info;
|
||||
char *tmp_token = (char*)malloc(MAX_TOKEN_LEN);
|
||||
intfstream_t *fd = NULL;
|
||||
size_t largest = 0;
|
||||
uint64_t largest = 0;
|
||||
int size = -1;
|
||||
int mode = -1;
|
||||
ssize_t file_size = -1;
|
||||
int64_t file_size = -1;
|
||||
|
||||
info.type = INTFSTREAM_FILE;
|
||||
|
||||
@ -692,7 +692,7 @@ int gdi_find_track(const char *gdi_path, bool first,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((unsigned)file_size > largest)
|
||||
if ((uint64_t)file_size > largest)
|
||||
{
|
||||
strlcpy(track_path, last_file, max_len);
|
||||
rv = 0;
|
||||
@ -733,11 +733,11 @@ error:
|
||||
}
|
||||
|
||||
bool gdi_next_file(intfstream_t *fd, const char *gdi_path,
|
||||
char *path, size_t max_len)
|
||||
char *path, uint64_t max_len)
|
||||
{
|
||||
bool rv = false;
|
||||
char *tmp_token = (char*)malloc(MAX_TOKEN_LEN);
|
||||
ssize_t offset = -1;
|
||||
int64_t offset = -1;
|
||||
|
||||
tmp_token[0] = '\0';
|
||||
|
||||
|
@ -551,7 +551,7 @@ static bool try_bps_patch(bool allow_bps, const char *name_bps,
|
||||
if (allow_bps && !string_is_empty(name_bps))
|
||||
if (path_is_valid(name_bps) && filestream_exists(name_bps))
|
||||
{
|
||||
ssize_t patch_size;
|
||||
int64_t patch_size;
|
||||
bool ret = false;
|
||||
void *patch_data = NULL;
|
||||
|
||||
@ -578,7 +578,7 @@ static bool try_ups_patch(bool allow_ups, const char *name_ups,
|
||||
if (allow_ups && !string_is_empty(name_ups))
|
||||
if (path_is_valid(name_ups) && filestream_exists(name_ups))
|
||||
{
|
||||
ssize_t patch_size;
|
||||
int64_t patch_size;
|
||||
bool ret = false;
|
||||
void *patch_data = NULL;
|
||||
|
||||
@ -605,7 +605,7 @@ static bool try_ips_patch(bool allow_ips,
|
||||
if (allow_ips && !string_is_empty(name_ips))
|
||||
if (path_is_valid(name_ips) && filestream_exists(name_ips))
|
||||
{
|
||||
ssize_t patch_size;
|
||||
int64_t patch_size;
|
||||
bool ret = false;
|
||||
void *patch_data = NULL;
|
||||
|
||||
|
@ -1347,7 +1347,7 @@ static bool content_get_memory(retro_ctx_memory_info_t *mem_info,
|
||||
*/
|
||||
bool content_load_ram_file(unsigned slot)
|
||||
{
|
||||
ssize_t rc;
|
||||
int64_t rc;
|
||||
struct ram_type ram;
|
||||
retro_ctx_memory_info_t mem_info;
|
||||
void *buf = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user