Silence warnings; code cleanups

This commit is contained in:
libretroadmin 2023-05-28 22:43:33 +02:00
parent 5e94d81f33
commit 90115e2dc9
3 changed files with 22 additions and 32 deletions

View file

@ -57,9 +57,9 @@ static bool core_backup_get_backup_dir(
/* Extract core file 'ID' (name without extension + suffix)
* from core path */
if (string_is_empty(dir_libretro) ||
string_is_empty(core_filename) ||
(len < 1))
if ( string_is_empty(dir_libretro)
|| string_is_empty(core_filename)
|| (len < 1))
return false;
strlcpy(core_file_id, core_filename, sizeof(core_file_id));
@ -424,10 +424,10 @@ static bool core_backup_add_entry(core_backup_list_t *backup_list,
unsigned long crc = 0;
unsigned backup_mode = 0;
if (!backup_list ||
string_is_empty(core_filename) ||
string_is_empty(backup_path) ||
(backup_list->size >= backup_list->capacity))
if ( !backup_list
|| string_is_empty(core_filename)
|| string_is_empty(backup_path)
|| (backup_list->size >= backup_list->capacity))
goto error;
backup_filename = strdup(path_basename(backup_path));
@ -636,9 +636,8 @@ size_t core_backup_list_get_num_backups(
for (i = 0; i < backup_list->size; i++)
{
core_backup_list_entry_t *current_entry = &backup_list->entries[i];
if (current_entry &&
(current_entry->backup_mode == backup_mode))
if ( current_entry
&& (current_entry->backup_mode == backup_mode))
num_backups++;
}
@ -687,9 +686,9 @@ bool core_backup_list_get_crc(
{
core_backup_list_entry_t *current_entry = &backup_list->entries[i];
if (current_entry &&
(current_entry->crc == crc) &&
(current_entry->backup_mode == backup_mode))
if ( (current_entry)
&& (current_entry->crc == crc)
&& (current_entry->backup_mode == backup_mode))
{
*entry = current_entry;
return true;
@ -707,24 +706,16 @@ bool core_backup_list_get_entry_timestamp_str(
enum core_backup_date_separator_type date_separator,
char *timestamp, size_t len)
{
const char *format_str = "";
const char *format_str = "%04u-%02u-%02u %02u:%02u:%02u";
if (!entry || (len < 20))
return false;
/* Get time format string */
switch (date_separator)
{
case CORE_BACKUP_DATE_SEPARATOR_SLASH:
format_str = "%04u/%02u/%02u %02u:%02u:%02u";
break;
case CORE_BACKUP_DATE_SEPARATOR_PERIOD:
format_str = "%04u.%02u.%02u %02u:%02u:%02u";
break;
default:
format_str = "%04u-%02u-%02u %02u:%02u:%02u";
break;
}
if (date_separator == CORE_BACKUP_DATE_SEPARATOR_SLASH)
format_str = "%04u/%02u/%02u %02u:%02u:%02u";
else if (date_separator == CORE_BACKUP_DATE_SEPARATOR_PERIOD)
format_str = "%04u.%02u.%02u %02u:%02u:%02u";
snprintf(timestamp, len,
format_str,

View file

@ -224,27 +224,27 @@ sthread_t *sthread_create_with_priority(void (*thread_func)(void*), void *userda
thread_attr_needed = true;
}
#endif
#if defined(VITA)
pthread_attr_setstacksize(&thread_attr , 0x10000 );
thread_attr_needed = true;
#elif defined(__APPLE__)
// default stack size on apple is 512kb; for ps2 disc scanning and other reasons, we'd like 2MB.
/* Default stack size on Apple is 512Kb;
* for PS2 disc scanning and other reasons, we'd like 2MB. */
pthread_attr_setstacksize(&thread_attr , 0x200000 );
thread_attr_needed = true;
#endif
#ifdef HAVE_THREAD_ATTR
if (thread_attr_needed)
thread_created = pthread_create(&thread->id, &thread_attr, thread_wrap, data) == 0;
else
#endif
thread_created = pthread_create(&thread->id, NULL, thread_wrap, data) == 0;
#ifdef HAVE_THREAD_ATTR
pthread_attr_destroy(&thread_attr);
#else
thread_created = pthread_create(&thread->id, NULL, thread_wrap, data) == 0;
#endif
#endif
if (thread_created)

View file

@ -5386,7 +5386,6 @@ static void ozone_compute_entries_position(
if (ozone->show_thumbnail_bar)
ozone_update_content_metadata(ozone);
i = menu_st->entries.begin;
selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
video_driver_get_size(&video_info_width, &video_info_height);