mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
(libretro-common) Cleanups
This commit is contained in:
parent
f57ca1abba
commit
eb4e365820
@ -348,12 +348,12 @@ static unsigned char check_arm_cpu_feature(const char* feature)
|
||||
if (!fp)
|
||||
return 0;
|
||||
|
||||
while (filestream_gets(fp, line, sizeof(line)) != NULL)
|
||||
while (filestream_gets(fp, line, sizeof(line)))
|
||||
{
|
||||
if (strncmp(line, "Features\t: ", 11))
|
||||
continue;
|
||||
|
||||
if (strstr(line + 11, feature) != NULL)
|
||||
if (strstr(line + 11, feature))
|
||||
status = 1;
|
||||
|
||||
break;
|
||||
|
@ -256,7 +256,7 @@ static int sevenzip_file_read(
|
||||
|
||||
outsize = outSizeProcessed;
|
||||
|
||||
if (optional_outfile != NULL)
|
||||
if (optional_outfile)
|
||||
{
|
||||
const void *ptr = (const void*)(output + offset);
|
||||
|
||||
|
@ -450,7 +450,7 @@ static config_file_t *config_file_new_internal(
|
||||
|
||||
conf->tail = list;
|
||||
|
||||
if (cb != NULL && list->key != NULL && list->value != NULL)
|
||||
if (cb && list->key && list->value)
|
||||
cb->config_file_new_entry_cb(list->key, list->value) ;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ void dirent_vfs_init(const struct retro_vfs_interface_info* vfs_info)
|
||||
|
||||
struct RDIR *retro_opendir_include_hidden(const char *name, bool include_hidden)
|
||||
{
|
||||
if (dirent_opendir_cb != NULL)
|
||||
if (dirent_opendir_cb)
|
||||
return (struct RDIR *)dirent_opendir_cb(name, include_hidden);
|
||||
return (struct RDIR *)retro_vfs_opendir_impl(name, include_hidden);
|
||||
}
|
||||
@ -79,14 +79,14 @@ bool retro_dirent_error(struct RDIR *rdir)
|
||||
|
||||
int retro_readdir(struct RDIR *rdir)
|
||||
{
|
||||
if (dirent_readdir_cb != NULL)
|
||||
if (dirent_readdir_cb)
|
||||
return dirent_readdir_cb((struct retro_vfs_dir_handle *)rdir);
|
||||
return retro_vfs_readdir_impl((struct retro_vfs_dir_handle *)rdir);
|
||||
}
|
||||
|
||||
const char *retro_dirent_get_name(struct RDIR *rdir)
|
||||
{
|
||||
if (dirent_dirent_get_name_cb != NULL)
|
||||
if (dirent_dirent_get_name_cb)
|
||||
return dirent_dirent_get_name_cb((struct retro_vfs_dir_handle *)rdir);
|
||||
return retro_vfs_dirent_get_name_impl((struct retro_vfs_dir_handle *)rdir);
|
||||
}
|
||||
@ -104,14 +104,14 @@ const char *retro_dirent_get_name(struct RDIR *rdir)
|
||||
*/
|
||||
bool retro_dirent_is_dir(struct RDIR *rdir, const char *unused)
|
||||
{
|
||||
if (dirent_dirent_is_dir_cb != NULL)
|
||||
if (dirent_dirent_is_dir_cb)
|
||||
return dirent_dirent_is_dir_cb((struct retro_vfs_dir_handle *)rdir);
|
||||
return retro_vfs_dirent_is_dir_impl((struct retro_vfs_dir_handle *)rdir);
|
||||
}
|
||||
|
||||
void retro_closedir(struct RDIR *rdir)
|
||||
{
|
||||
if (dirent_closedir_cb != NULL)
|
||||
if (dirent_closedir_cb)
|
||||
dirent_closedir_cb((struct retro_vfs_dir_handle *)rdir);
|
||||
else
|
||||
retro_vfs_closedir_impl((struct retro_vfs_dir_handle *)rdir);
|
||||
|
@ -156,19 +156,15 @@ int cdfs_open_file(cdfs_file_t* file, cdfs_track_t* track, const char* path)
|
||||
file->track = track;
|
||||
|
||||
file->current_sector = -1;
|
||||
if (path != NULL)
|
||||
{
|
||||
if (path)
|
||||
file->first_sector = cdfs_find_file(file, path);
|
||||
}
|
||||
else if (file->track->stream_sector_size)
|
||||
{
|
||||
file->first_sector = 0;
|
||||
file->size = (intfstream_get_size(file->track->stream) / file->track->stream_sector_size) * 2048;
|
||||
}
|
||||
else
|
||||
{
|
||||
file->first_sector = -1;
|
||||
}
|
||||
|
||||
return (file->first_sector >= 0);
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ static retro_task_t *task_queue_get(task_queue_t *queue)
|
||||
static void retro_task_internal_gather(void)
|
||||
{
|
||||
retro_task_t *task = NULL;
|
||||
while ((task = task_queue_get(&tasks_finished)) != NULL)
|
||||
while ((task = task_queue_get(&tasks_finished)))
|
||||
{
|
||||
task_queue_push_progress(task);
|
||||
|
||||
@ -172,7 +172,7 @@ static void retro_task_regular_gather(void)
|
||||
retro_task_t *queue = NULL;
|
||||
retro_task_t *next = NULL;
|
||||
|
||||
while ((task = task_queue_get(&tasks_running)) != NULL)
|
||||
while ((task = task_queue_get(&tasks_running)))
|
||||
{
|
||||
task->next = queue;
|
||||
queue = task;
|
||||
@ -387,7 +387,7 @@ static void retro_task_threaded_wait(retro_task_condition_fn_t cond, void* data)
|
||||
retro_task_threaded_gather();
|
||||
|
||||
slock_lock(running_lock);
|
||||
wait = (tasks_running.front != NULL) &&
|
||||
wait = (tasks_running.front) &&
|
||||
(!cond || cond(data));
|
||||
slock_unlock(running_lock);
|
||||
} while (wait);
|
||||
|
@ -119,7 +119,7 @@ int64_t filestream_get_size(RFILE *stream)
|
||||
{
|
||||
int64_t output;
|
||||
|
||||
if (filestream_size_cb != NULL)
|
||||
if (filestream_size_cb)
|
||||
output = filestream_size_cb(stream->hfile);
|
||||
else
|
||||
output = retro_vfs_file_size_impl((libretro_vfs_implementation_file*)stream->hfile);
|
||||
@ -134,7 +134,7 @@ int64_t filestream_truncate(RFILE *stream, int64_t length)
|
||||
{
|
||||
int64_t output;
|
||||
|
||||
if (filestream_truncate_cb != NULL)
|
||||
if (filestream_truncate_cb)
|
||||
output = filestream_truncate_cb(stream->hfile, length);
|
||||
else
|
||||
output = retro_vfs_file_truncate_impl((libretro_vfs_implementation_file*)stream->hfile, length);
|
||||
@ -159,7 +159,7 @@ RFILE* filestream_open(const char *path, unsigned mode, unsigned hints)
|
||||
struct retro_vfs_file_handle *fp = NULL;
|
||||
RFILE* output = NULL;
|
||||
|
||||
if (filestream_open_cb != NULL)
|
||||
if (filestream_open_cb)
|
||||
fp = (struct retro_vfs_file_handle*)
|
||||
filestream_open_cb(path, mode, hints);
|
||||
else
|
||||
@ -309,7 +309,7 @@ int64_t filestream_seek(RFILE *stream, int64_t offset, int seek_position)
|
||||
{
|
||||
int64_t output;
|
||||
|
||||
if (filestream_seek_cb != NULL)
|
||||
if (filestream_seek_cb)
|
||||
output = filestream_seek_cb(stream->hfile, offset, seek_position);
|
||||
else
|
||||
output = retro_vfs_file_seek_impl((libretro_vfs_implementation_file*)stream->hfile, offset, seek_position);
|
||||
@ -330,7 +330,7 @@ int64_t filestream_tell(RFILE *stream)
|
||||
{
|
||||
int64_t output;
|
||||
|
||||
if (filestream_size_cb != NULL)
|
||||
if (filestream_size_cb)
|
||||
output = filestream_tell_cb(stream->hfile);
|
||||
else
|
||||
output = retro_vfs_file_tell_impl((libretro_vfs_implementation_file*)stream->hfile);
|
||||
@ -354,7 +354,7 @@ int64_t filestream_read(RFILE *stream, void *s, int64_t len)
|
||||
{
|
||||
int64_t output;
|
||||
|
||||
if (filestream_read_cb != NULL)
|
||||
if (filestream_read_cb)
|
||||
output = filestream_read_cb(stream->hfile, s, len);
|
||||
else
|
||||
output = retro_vfs_file_read_impl(
|
||||
@ -372,7 +372,7 @@ int filestream_flush(RFILE *stream)
|
||||
{
|
||||
int output;
|
||||
|
||||
if (filestream_flush_cb != NULL)
|
||||
if (filestream_flush_cb)
|
||||
output = filestream_flush_cb(stream->hfile);
|
||||
else
|
||||
output = retro_vfs_file_flush_impl((libretro_vfs_implementation_file*)stream->hfile);
|
||||
@ -385,7 +385,7 @@ int filestream_flush(RFILE *stream)
|
||||
|
||||
int filestream_delete(const char *path)
|
||||
{
|
||||
if (filestream_remove_cb != NULL)
|
||||
if (filestream_remove_cb)
|
||||
return filestream_remove_cb(path);
|
||||
|
||||
return retro_vfs_file_remove_impl(path);
|
||||
@ -393,7 +393,7 @@ int filestream_delete(const char *path)
|
||||
|
||||
int filestream_rename(const char *old_path, const char *new_path)
|
||||
{
|
||||
if (filestream_rename_cb != NULL)
|
||||
if (filestream_rename_cb)
|
||||
return filestream_rename_cb(old_path, new_path);
|
||||
|
||||
return retro_vfs_file_rename_impl(old_path, new_path);
|
||||
@ -401,7 +401,7 @@ int filestream_rename(const char *old_path, const char *new_path)
|
||||
|
||||
const char* filestream_get_path(RFILE *stream)
|
||||
{
|
||||
if (filestream_get_path_cb != NULL)
|
||||
if (filestream_get_path_cb)
|
||||
return filestream_get_path_cb(stream->hfile);
|
||||
|
||||
return retro_vfs_file_get_path_impl((libretro_vfs_implementation_file*)stream->hfile);
|
||||
@ -411,7 +411,7 @@ int64_t filestream_write(RFILE *stream, const void *s, int64_t len)
|
||||
{
|
||||
int64_t output;
|
||||
|
||||
if (filestream_write_cb != NULL)
|
||||
if (filestream_write_cb)
|
||||
output = filestream_write_cb(stream->hfile, s, len);
|
||||
else
|
||||
output = retro_vfs_file_write_impl((libretro_vfs_implementation_file*)stream->hfile, s, len);
|
||||
@ -465,7 +465,7 @@ int filestream_close(RFILE *stream)
|
||||
int output;
|
||||
struct retro_vfs_file_handle* fp = stream->hfile;
|
||||
|
||||
if (filestream_close_cb != NULL)
|
||||
if (filestream_close_cb)
|
||||
output = filestream_close_cb(fp);
|
||||
else
|
||||
output = retro_vfs_file_close_impl((libretro_vfs_implementation_file*)fp);
|
||||
|
@ -328,7 +328,7 @@ void string_replace_all_chars(char *str, char find, char replace)
|
||||
if (string_is_empty(str))
|
||||
return;
|
||||
|
||||
while((str_ptr = strchr(str_ptr, find)) != NULL)
|
||||
while ((str_ptr = strchr(str_ptr, find)))
|
||||
*str_ptr++ = replace;
|
||||
}
|
||||
|
||||
|
@ -643,8 +643,6 @@ static int16_t netplay_input_state(netplay_t *netplay,
|
||||
static void netplay_announce_cb(retro_task_t *task,
|
||||
void *task_data, void *user_data, const char *error)
|
||||
{
|
||||
RARCH_LOG("[netplay] announcing netplay game... \n");
|
||||
|
||||
if (task_data)
|
||||
{
|
||||
unsigned i, ip_len, port_len;
|
||||
@ -762,8 +760,6 @@ static void netplay_announce_cb(retro_task_t *task,
|
||||
|
||||
if (mitm_ip && mitm_port)
|
||||
{
|
||||
RARCH_LOG("[netplay] joining relay server: %s:%s\n", mitm_ip, mitm_port);
|
||||
|
||||
ip_len = (unsigned)strlen(mitm_ip);
|
||||
port_len = (unsigned)strlen(mitm_port);
|
||||
|
||||
@ -877,9 +873,6 @@ static void netplay_announce(void)
|
||||
*settings->paths.netplay_spectate_password ? 1 : 0,
|
||||
settings->bools.netplay_use_mitm_server,
|
||||
PACKAGE_VERSION, frontend_architecture, subsystemname);
|
||||
#if 0
|
||||
RARCH_LOG("[netplay] announcement URL: %s\n", buf);
|
||||
#endif
|
||||
task_push_http_post_transfer(url, buf, true, NULL, netplay_announce_cb, NULL);
|
||||
|
||||
if (username)
|
||||
|
Loading…
x
Reference in New Issue
Block a user