This commit is contained in:
twinaphex 2020-06-28 06:52:33 +02:00
parent 2e9a0fd739
commit 435538fc28
2 changed files with 51 additions and 4 deletions

View File

@ -875,9 +875,30 @@ char* task_get_title(retro_task_t *task)
retro_task_t *task_init(void)
{
retro_task_t *task = (retro_task_t*)calloc(1, sizeof(*task));
retro_task_t *task = (retro_task_t*)malloc(sizeof(*task));
if (!task)
return NULL;
task->handler = NULL;
task->callback = NULL;
task->cleanup = NULL;
task->finished = false;
task->cancelled = false;
task->mute = false;
task->task_data = NULL;
task->user_data = NULL;
task->state = NULL;
task->error = NULL;
task->progress = 0;
task->progress_cb = NULL;
task->title = NULL;
task->type = TASK_TYPE_NONE;
task->ident = task_count++;
task->frontend_userdata = NULL;
task->alternative_look = false;
task->next = NULL;
task->when = 0;
return task;
}

View File

@ -287,11 +287,25 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(
const char *mode_str = NULL;
libretro_vfs_implementation_file *stream =
(libretro_vfs_implementation_file*)
calloc(1, sizeof(*stream));
malloc(sizeof(*stream));
if (!stream)
return NULL;
stream->fd = 0;
stream->hints = hints;
stream->size = 0;
stream->buf = NULL;
stream->fp = NULL;
#ifdef _WIN32
stream->fh = 0;
#endif
stream->orig_path = NULL;
stream->mappos = 0;
stream->mapsize = 0;
stream->mapped = NULL;
stream->scheme = VFS_SCHEME_NONE;
#ifdef VFS_FRONTEND
if (path_len >= dumb_prefix_len)
if (!memcmp(path, dumb_prefix, dumb_prefix_len))
@ -299,6 +313,19 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(
#endif
#ifdef HAVE_CDROM
stream->cdrom.cue_buf = NULL;
stream->cdrom.cue_len = 0;
stream->cdrom.byte_pos = 0;
stream->cdrom.drive = 0;
stream->cdrom.cur_min = 0;
stream->cdrom.cur_sec = 0;
stream->cdrom.cur_frame = 0;
stream->cdrom.cur_track = 0;
stream->cdrom.cur_lba = 0;
stream->cdrom.last_frame_lba = 0;
stream->cdrom.last_frame[0] = '\0';
stream->cdrom.last_frame_valid = false;
if (path_len > cdrom_prefix_len)
{
if (!memcmp(path, cdrom_prefix, cdrom_prefix_len))
@ -309,7 +336,6 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(
}
#endif
stream->hints = hints;
stream->orig_path = strdup(path);
#ifdef HAVE_MMAP
@ -382,7 +408,7 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(
stream->fd = -1;
goto error;
}
stream->fd = fd;
stream->fd = fd;
#else
FILE *fp;
#ifdef HAVE_CDROM