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

View File

@ -224,27 +224,27 @@ sthread_t *sthread_create_with_priority(void (*thread_func)(void*), void *userda
thread_attr_needed = true; thread_attr_needed = true;
} }
#endif
#if defined(VITA) #if defined(VITA)
pthread_attr_setstacksize(&thread_attr , 0x10000 ); pthread_attr_setstacksize(&thread_attr , 0x10000 );
thread_attr_needed = true; thread_attr_needed = true;
#elif defined(__APPLE__) #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 ); pthread_attr_setstacksize(&thread_attr , 0x200000 );
thread_attr_needed = true; thread_attr_needed = true;
#endif #endif
#ifdef HAVE_THREAD_ATTR
if (thread_attr_needed) if (thread_attr_needed)
thread_created = pthread_create(&thread->id, &thread_attr, thread_wrap, data) == 0; thread_created = pthread_create(&thread->id, &thread_attr, thread_wrap, data) == 0;
else else
#endif
thread_created = pthread_create(&thread->id, NULL, thread_wrap, data) == 0; thread_created = pthread_create(&thread->id, NULL, thread_wrap, data) == 0;
#ifdef HAVE_THREAD_ATTR
pthread_attr_destroy(&thread_attr); pthread_attr_destroy(&thread_attr);
#else
thread_created = pthread_create(&thread->id, NULL, thread_wrap, data) == 0;
#endif #endif
#endif #endif
if (thread_created) if (thread_created)

View File

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