diff --git a/gfx/gfx_animation.c b/gfx/gfx_animation.c index 8cf91d3f94..277302fdae 100644 --- a/gfx/gfx_animation.c +++ b/gfx/gfx_animation.c @@ -2000,7 +2000,7 @@ bool gfx_animation_line_ticker_smooth(gfx_animation_ctx_line_ticker_smooth_t *li gfx_animation_t *p_anim = &anim_st; const char *wideglyph_str = NULL; int wideglyph_width = 100; - void (*word_wrap_func)(char *dst, size_t dst_size, + size_t (*word_wrap_func)(char *dst, size_t dst_size, const char *src, size_t src_len, int line_width, int wideglyph_width, unsigned max_lines); @@ -2008,10 +2008,10 @@ bool gfx_animation_line_ticker_smooth(gfx_animation_ctx_line_ticker_smooth_t *li if (!line_ticker) return false; - if (!line_ticker->font || - string_is_empty(line_ticker->src_str) || - (line_ticker->field_width < 1) || - (line_ticker->field_height < 1)) + if ( !line_ticker->font + || string_is_empty(line_ticker->src_str) + || (line_ticker->field_width < 1) + || (line_ticker->field_height < 1)) goto end; /* Get font dimensions */ diff --git a/libretro-common/include/string/stdstring.h b/libretro-common/include/string/stdstring.h index 79fa40955f..4e38e8d4cd 100644 --- a/libretro-common/include/string/stdstring.h +++ b/libretro-common/include/string/stdstring.h @@ -48,7 +48,7 @@ RETRO_BEGIN_DECLS #define TOUPPER(c) ((c) & ~(lr_char_props[(unsigned char)(c)] & 0x20)) /* C standard says \f \v are space, but this one disagrees */ -#define ISSPACE(c) (lr_char_props[(unsigned char)(c)] & 0x80) +#define ISSPACE(c) (lr_char_props[(unsigned char)(c)] & 0x80) #define ISDIGIT(c) (lr_char_props[(unsigned char)(c)] & 0x40) #define ISALPHA(c) (lr_char_props[(unsigned char)(c)] & 0x20) @@ -204,7 +204,7 @@ char *string_trim_whitespace(char *const s); * correctly any text containing so-called 'wide' Unicode * characters (e.g. CJK languages, emojis, etc.). **/ -void word_wrap(char *dst, size_t dst_size, const char *src, size_t src_len, +size_t word_wrap(char *dst, size_t dst_size, const char *src, size_t src_len, int line_width, int wideglyph_width, unsigned max_lines); /** @@ -241,7 +241,7 @@ void word_wrap(char *dst, size_t dst_size, const char *src, size_t src_len, * on-screen pixel width deviates greatly from the set * @wideglyph_width value. **/ -void word_wrap_wideglyph( +size_t word_wrap_wideglyph( char *dst, size_t dst_size, const char *src, size_t src_len, int line_width, int wideglyph_width, @@ -331,7 +331,7 @@ int string_count_occurrences_single_character(const char *str, char c); /** * string_replace_whitespace_with_single_character: - * + * * Leaf function. * * Replaces all spaces with given character @c. diff --git a/libretro-common/media/media_detect_cd.c b/libretro-common/media/media_detect_cd.c index f19bae70f4..ef872aa634 100644 --- a/libretro-common/media/media_detect_cd.c +++ b/libretro-common/media/media_detect_cd.c @@ -43,47 +43,39 @@ static void media_zero_trailing_spaces(char *buf, size_t len) static bool media_skip_spaces(const char **buf, size_t len) { - bool found = false; - unsigned i; - - if (!buf || !*buf || !**buf) - return false; - - for (i = 0; i < len; i++) + if (buf && *buf && **buf) { - if ((*buf)[i] == ' ' || (*buf)[i] == '\t') - continue; + size_t i; + for (i = 0; i < len; i++) + { + if ((*buf)[i] == ' ' || (*buf)[i] == '\t') + continue; - *buf += i; - found = true; - break; + *buf += i; + return true; + } } - if (found) - return true; - return false; } /* Fill in "info" with detected CD info. Use this when you have a cue file and want it parsed to find the first data track and any pregap info. */ bool media_detect_cd_info_cue(const char *path, media_detect_cd_info_t *info) { - RFILE *file = NULL; - char *line = NULL; - char track_path[PATH_MAX_LENGTH] = {0}; + RFILE *file = NULL; + char *line = NULL; + char track_path[PATH_MAX_LENGTH] = {0}; char track_abs_path[PATH_MAX_LENGTH] = {0}; - char track_mode[11] = {0}; - bool found_file = false; - bool found_track = false; - unsigned first_data_track = 0; - uint64_t data_track_pregap_bytes = 0; + char track_mode[11] = {0}; + bool found_file = false; + bool found_track = false; + unsigned first_data_track = 0; + uint64_t data_track_pregap_bytes = 0; if (string_is_empty(path) || !info) return false; - file = filestream_open(path, RETRO_VFS_FILE_ACCESS_READ, 0); - - if (!file) + if (!(file = filestream_open(path, RETRO_VFS_FILE_ACCESS_READ, 0))) { #ifdef MEDIA_CUE_PARSE_DEBUG printf("[MEDIA] Could not open cue path for reading: %s\n", path); @@ -116,8 +108,8 @@ bool media_detect_cd_info_cue(const char *path, media_detect_cd_info_t *info) if (!string_is_empty(file)) { const char *file_end = NULL; - size_t file_len = 0; - bool quoted = false; + size_t file_len = 0; + bool quoted = false; if (file[0] == '"') { @@ -198,7 +190,7 @@ bool media_detect_cd_info_cue(const char *path, media_detect_cd_info_t *info) if (!string_is_empty(pregap)) { media_skip_spaces(&pregap, strlen(pregap)); - found_file = false; + found_file = false; found_track = false; if (first_data_track && !string_is_empty(track_mode)) @@ -273,9 +265,7 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_ if (string_is_empty(path) || !info) return false; - file = filestream_open(path, RETRO_VFS_FILE_ACCESS_READ, 0); - - if (!file) + if (!(file = filestream_open(path, RETRO_VFS_FILE_ACCESS_READ, 0))) { #ifdef MEDIA_CUE_PARSE_DEBUG printf("[MEDIA] Could not open path for reading: %s\n", path); @@ -285,11 +275,11 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_ } { - unsigned offset = 0; + unsigned offset = 0; unsigned sector_size = 0; - unsigned buf_size = 17 * 2352; - char *buf = (char*)calloc(1, buf_size); - int64_t read_bytes = 0; + unsigned buf_size = 17 * 2352; + char *buf = (char*)calloc(1, buf_size); + int64_t read_bytes = 0; if (!buf) return false; @@ -321,23 +311,14 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_ /* Assume track data contains all fields. */ sector_size = 2352; + /* Assume Mode 2 formed (formless is rarely used) */ if (buf[15] == 2) - { - /* assume Mode 2 formed (formless is rarely used) */ - offset = 24; - } - else - { - /* assume Mode 1 */ - offset = 16; - } + offset = 24; + else /* Assume Mode 1 */ + offset = 16; } - else - { - /* Assume sectors only contain user data instead. */ - offset = 0; + else /* Assume sectors only contain user data instead. */ sector_size = 2048; - } if (!memcmp(buf + offset, "SEGADISCSYSTEM", STRLEN_CONST("SEGADISCSYSTEM"))) @@ -551,13 +532,11 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_ else if (!memcmp(buf + offset, "\x01\x5a\x5a\x5a\x5a\x5a\x01\x00\x00\x00\x00\x00", 12)) { info->system_id = MEDIA_CD_SYSTEM_3DO; - strcpy_literal(info->system, "3DO"); } else if (!memcmp(buf + offset + 0x950, "PC Engine CD-ROM SYSTEM", 23)) { info->system_id = MEDIA_CD_SYSTEM_PC_ENGINE_CD; - strcpy_literal(info->system, "TurboGrafx-CD / PC-Engine CD"); } diff --git a/libretro-common/queues/fifo_queue.c b/libretro-common/queues/fifo_queue.c index 7e3849f4ce..05deb18785 100644 --- a/libretro-common/queues/fifo_queue.c +++ b/libretro-common/queues/fifo_queue.c @@ -46,9 +46,7 @@ static bool fifo_initialize_internal(fifo_buffer_t *buf, size_t size) bool fifo_initialize(fifo_buffer_t *buf, size_t size) { - if (!buf) - return false; - return fifo_initialize_internal(buf, size); + return (buf && fifo_initialize_internal(buf, size)); } void fifo_free(fifo_buffer_t *buffer) diff --git a/libretro-common/queues/message_queue.c b/libretro-common/queues/message_queue.c index 13bf45be9b..4e7dea061c 100644 --- a/libretro-common/queues/message_queue.c +++ b/libretro-common/queues/message_queue.c @@ -28,12 +28,15 @@ #include #include -static bool msg_queue_initialize_internal(msg_queue_t *queue, size_t size) +bool msg_queue_initialize(msg_queue_t *queue, size_t size) { - struct queue_elem **elems = (struct queue_elem**)calloc(size + 1, - sizeof(struct queue_elem*)); + struct queue_elem **elems = NULL; - if (!elems) + if (!queue) + return false; + + if (!(elems = (struct queue_elem**) + calloc(size + 1, sizeof(struct queue_elem*)))) return false; queue->tmp_msg = NULL; @@ -55,27 +58,18 @@ static bool msg_queue_initialize_internal(msg_queue_t *queue, size_t size) **/ msg_queue_t *msg_queue_new(size_t size) { - msg_queue_t *queue = (msg_queue_t*)malloc(sizeof(*queue)); + msg_queue_t *queue = (msg_queue_t*)malloc(sizeof(*queue)); - if (!queue) - return NULL; - - if (!msg_queue_initialize_internal(queue, size)) + if (!msg_queue_initialize(queue, size)) { - free(queue); + if (queue) + free(queue); return NULL; } return queue; } -bool msg_queue_initialize(msg_queue_t *queue, size_t size) -{ - if (!queue) - return false; - return msg_queue_initialize_internal(queue, size); -} - /** * msg_queue_free: * @queue : pointer to queue object @@ -126,9 +120,7 @@ void msg_queue_push(msg_queue_t *queue, const char *msg, if (!queue || queue->ptr >= queue->size) return; - new_elem = (struct queue_elem*)malloc( - sizeof(struct queue_elem)); - if (!new_elem) + if (!(new_elem = (struct queue_elem*)malloc(sizeof(struct queue_elem)))) return; new_elem->duration = duration; @@ -180,7 +172,7 @@ void msg_queue_clear(msg_queue_t *queue) queue->elems[i] = NULL; } } - queue->ptr = 1; + queue->ptr = 1; free(queue->tmp_msg); queue->tmp_msg = NULL; } @@ -199,8 +191,6 @@ const char *msg_queue_pull(msg_queue_t *queue) struct queue_elem *front = NULL, *last = NULL; size_t tmp_ptr = 1; - (void)tmp_ptr; - /* Nothing in queue. */ if (!queue || queue->ptr == 1) return NULL; diff --git a/libretro-common/queues/task_queue.c b/libretro-common/queues/task_queue.c index 137e4adc4b..76670bb71a 100644 --- a/libretro-common/queues/task_queue.c +++ b/libretro-common/queues/task_queue.c @@ -68,7 +68,7 @@ static slock_t *property_lock = NULL; static slock_t *queue_lock = NULL; static scond_t *worker_cond = NULL; static sthread_t *worker_thread = NULL; -static bool worker_continue = true; +static bool worker_continue = true; /* use running_lock when touching it */ #endif @@ -132,11 +132,11 @@ static void task_queue_put(task_queue_t *queue, retro_task_t *task) if (queue->front) { - /* Make sure to insert in order - the queue is + /* Make sure to insert in order - the queue is * sorted by 'when' so items that aren't scheduled - * to run immediately are at the back of the queue. + * to run immediately are at the back of the queue. * Items with the same 'when' are inserted after - * all the other items with the same 'when'. + * all the other items with the same 'when'. * This primarily affects items with a 'when' of 0. */ if (queue->back) @@ -234,7 +234,7 @@ static void retro_task_regular_gather(void) if (task->finished) task_queue_put(&tasks_finished, task); else - retro_task_regular_push_running(task); + task_queue_put(&tasks_running, task); } retro_task_internal_gather(); @@ -468,18 +468,14 @@ static void retro_task_threaded_retrieve(task_retriever_data_t *data) { /* Protect access to running tasks */ slock_lock(running_lock); - /* Call regular retrieve function */ retro_task_regular_retrieve(data); - /* Release access to running tasks */ slock_unlock(running_lock); } static void threaded_worker(void *userdata) { - (void)userdata; - for (;;) { retro_task_t *task = NULL; @@ -522,13 +518,13 @@ static void threaded_worker(void *userdata) if (!finished) { /* Move the task to the back of the queue */ - /* mimics retro_task_threaded_push_running, + /* mimics retro_task_threaded_push_running, * but also includes a task_queue_remove */ slock_lock(running_lock); slock_lock(queue_lock); /* do nothing if only item in queue */ - if (task->next) + if (task->next) { task_queue_remove(&tasks_running, task); task_queue_put(&tasks_running, task); @@ -734,16 +730,13 @@ void task_queue_cancel_task(void *task) void *task_queue_retriever_info_next(task_retriever_info_t **link) { - void *data = NULL; - /* Grab data and move to next link */ if (*link) { - data = (*link)->data; *link = (*link)->next; + return (*link)->data; } - - return data; + return NULL; } void task_queue_retriever_info_free(task_retriever_info_t *list) diff --git a/libretro-common/string/stdstring.c b/libretro-common/string/stdstring.c index 4b36deb77f..7f05883d0a 100644 --- a/libretro-common/string/stdstring.c +++ b/libretro-common/string/stdstring.c @@ -217,27 +217,24 @@ char *string_trim_whitespace(char *const s) * correctly any text containing so-called 'wide' Unicode * characters (e.g. CJK languages, emojis, etc.). **/ -void word_wrap( +size_t word_wrap( char *dst, size_t dst_size, const char *src, size_t src_len, int line_width, int wideglyph_width, unsigned max_lines) { - char *lastspace = NULL; + char *last_space = NULL; unsigned counter = 0; unsigned lines = 1; const char *src_end = src + src_len; /* Prevent buffer overflow */ if (dst_size < src_len + 1) - return; + return 0; /* Early return if src string length is less * than line width */ if (src_len < (size_t)line_width) - { - strlcpy(dst, src, dst_size); - return; - } + return strlcpy(dst, src, dst_size); while (*src != '\0') { @@ -245,21 +242,18 @@ void word_wrap( counter++; if (*src == ' ') - lastspace = dst; /* Remember the location of the whitespace */ + last_space = dst; /* Remember the location of the whitespace */ else if (*src == '\n') { /* If newlines embedded in the input, * reset the index */ lines++; - counter = 0; + counter = 0; /* Early return if remaining src string * length is less than line width */ if (src_end - src <= line_width) - { - strlcpy(dst, src, dst_size); - return; - } + return strlcpy(dst, src, dst_size); } while (char_len--) @@ -269,29 +263,27 @@ void word_wrap( { counter = 0; - if (lastspace && (max_lines == 0 || lines < max_lines)) + if (last_space && (max_lines == 0 || lines < max_lines)) { /* Replace nearest (previous) whitespace * with newline character */ - *lastspace = '\n'; + *last_space = '\n'; lines++; - src -= dst - lastspace - 1; - dst = lastspace + 1; - lastspace = NULL; + src -= dst - last_space - 1; + dst = last_space + 1; + last_space = NULL; /* Early return if remaining src string * length is less than line width */ if (src_end - src < line_width) - { - strlcpy(dst, src, dst_size); - return; - } + return strlcpy(dst, src, dst_size); } } } *dst = '\0'; + return 0; } /** @@ -327,7 +319,7 @@ void word_wrap( * on-screen pixel width deviates greatly from the set * @wideglyph_width value. **/ -void word_wrap_wideglyph(char *dst, size_t dst_size, +size_t word_wrap_wideglyph(char *dst, size_t dst_size, const char *src, size_t src_len, int line_width, int wideglyph_width, unsigned max_lines) { @@ -359,14 +351,11 @@ void word_wrap_wideglyph(char *dst, size_t dst_size, unsigned counter_normalized = 0; int line_width_normalized = line_width * 100; int additional_counter_normalized = wideglyph_width - 100; - + /* Early return if src string length is less * than line width */ if (src_end - src < line_width) - { - strlcpy(dst, src, dst_size); - return; - } + return strlcpy(dst, src, dst_size); while (*src != '\0') { @@ -389,10 +378,7 @@ void word_wrap_wideglyph(char *dst, size_t dst_size, /* Early return if remaining src string * length is less than line width */ if (src_end - src <= line_width) - { - strlcpy(dst, src, dst_size); - return; - } + return strlcpy(dst, src, dst_size); } else if (char_len >= 3) { @@ -424,10 +410,7 @@ void word_wrap_wideglyph(char *dst, size_t dst_size, /* Early return if remaining src string * length is less than line width */ if (src_end - src <= line_width) - { - strlcpy(dst, src, dst_size); - return; - } + return strlcpy(dst, src, dst_size); } else if (lastspace) { @@ -442,15 +425,13 @@ void word_wrap_wideglyph(char *dst, size_t dst_size, /* Early return if remaining src string * length is less than line width */ if (src_end - src < line_width) - { - strlcpy(dst, src, dst_size); - return; - } + return strlcpy(dst, src, dst_size); } } } *dst = '\0'; + return 0; } /** @@ -592,7 +573,7 @@ unsigned string_hex_to_unsigned(const char *str) if (str[0] != '\0' && str[1] != '\0') { if ( (str[0] == '0') && - ((str[1] == 'x') || + ((str[1] == 'x') || (str[1] == 'X'))) { hex_str = str + 2; @@ -635,7 +616,7 @@ int string_count_occurrences_single_character(const char *str, char c) /** * string_replace_whitespace_with_single_character: - * + * * Leaf function. * * Replaces all spaces with given character @c. diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index d3ae5ec997..00b54e73de 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -589,7 +589,7 @@ typedef struct materialui_handle font_data_impl_t hint; /* ptr alignment */ } font_data; - void (*word_wrap)( + size_t (*word_wrap)( char *dst, size_t dst_size, const char *src, size_t src_len, int line_width, int wideglyph_width, unsigned max_lines); diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index b0a18205a0..abb6e1f807 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -468,7 +468,7 @@ struct ozone_handle font_data_impl_t sidebar; } fonts; - void (*word_wrap)( + size_t (*word_wrap)( char *dst, size_t dst_size, const char *src, size_t src_len, int line_width, int wideglyph_width, unsigned max_lines); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index a39f2900f1..e5ed0d0fe0 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -319,7 +319,7 @@ typedef struct xmb_handle video_font_raster_block_t raster_block; video_font_raster_block_t raster_block2; - void (*word_wrap)( + size_t (*word_wrap)( char *dst, size_t dst_size, const char *src, size_t src_len, int line_width, int wideglyph_width, unsigned max_lines); @@ -1021,7 +1021,7 @@ static void xmb_render_messagebox_internal( wrapped_message[0] = '\0'; - if ((usable_width = + if ((usable_width = (int)video_width - (xmb->margins_dialog * 8)) < 1) return; @@ -1146,7 +1146,7 @@ static char* xmb_path_dynamic_wallpaper(xmb_handle_t *xmb) if ( (xmb->categories_selection_ptr == 0 && depth > 4) || (xmb->categories_selection_ptr > xmb->system_tab_end && depth > 1)) return strdup(xmb->bg_file_path); - + if (!path_is_valid(path)) fill_pathname_application_special(path, sizeof(path), APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_BG); @@ -2159,7 +2159,7 @@ static void xmb_list_switch(xmb_handle_t *xmb) unsigned remember_selection_type = settings->uints.menu_remember_selection; unsigned xmb_system_tab = xmb_get_system_tab(xmb, (unsigned)xmb->categories_selection_ptr); - if ( xmb->categories_selection_ptr + if ( xmb->categories_selection_ptr > xmb->categories_selection_ptr_old) dir = 1; @@ -2192,7 +2192,7 @@ static void xmb_list_switch(xmb_handle_t *xmb) gfx_animation_push(&anim_entry); dir = -1; - if ( xmb->categories_selection_ptr + if ( xmb->categories_selection_ptr > xmb->categories_selection_ptr_old) dir = 1; @@ -2449,9 +2449,9 @@ static void xmb_context_reset_horizontal_list( len = fill_pathname_base( sysname, path, sizeof(sysname)); /* Manually strip the extension (and dot) from sysname */ - sysname[len-4] = - sysname[len-3] = - sysname[len-2] = + sysname[len-4] = + sysname[len-3] = + sysname[len-2] = sysname[len-1] = '\0'; len = fill_pathname_join_special( texturepath, iconpath, sysname, @@ -2649,7 +2649,7 @@ static void xmb_list_open(xmb_handle_t *xmb) break; } - if ( xmb->depth == 1 + if ( xmb->depth == 1 || xmb->depth == 2) { gfx_animation_push(&entry); @@ -2714,7 +2714,7 @@ static void xmb_populate_entries(void *data, && ( (xmb_system_tab > XMB_SYSTEM_TAB_SETTINGS && depth == 1) || (xmb_system_tab < XMB_SYSTEM_TAB_SETTINGS && depth == 4)); - xmb->is_playlist = + xmb->is_playlist = xmb->is_playlist && !string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_INFORMATION)) && !string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RDB_ENTRY_DETAIL)); @@ -3478,7 +3478,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, /* No state means its a header - show the info icon */ if (!rcheevos_menu_get_state(index, buffer, sizeof(buffer))) return xmb->textures.list[XMB_TEXTURE_INFO]; - /* Placeholder badge image was not found, + /* Placeholder badge image was not found, show generic menu icon */ return xmb->textures.list[XMB_TEXTURE_ACHIEVEMENTS]; } @@ -3497,7 +3497,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, if (type == input_id) return xmb->textures.list[XMB_TEXTURE_INPUT_ADC]; #ifdef HAVE_LIBNX - /* Account for the additional split JoyCon + /* Account for the additional split JoyCon option in Input # Binds */ input_id++; #endif @@ -3520,7 +3520,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, } else { - /* Quickmenu controls repeats the same icons + /* Quickmenu controls repeats the same icons for all users */ if (type < MENU_SETTINGS_INPUT_DESC_KBD_BEGIN) input_id = MENU_SETTINGS_INPUT_DESC_BEGIN; @@ -3534,7 +3534,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, { unsigned index = 0; int input_num = type - input_id; - for ( index = 0; + for ( index = 0; index < ARRAY_SIZE(input_config_bind_order); index++) { @@ -3547,7 +3547,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, } } - /* This is utilized for both Input # Binds + /* This is utilized for both Input # Binds and Quickmenu controls */ if (type == input_id) return xmb->textures.list[XMB_TEXTURE_INPUT_DPAD_U]; @@ -3865,8 +3865,8 @@ static int xmb_draw_item( if (menu_xmb_vertical_fade_factor) { float min_alpha = 0.1f; - float max_alpha = (i == current) - ? xmb->items_active_alpha + float max_alpha = (i == current) + ? xmb->items_active_alpha : xmb->items_passive_alpha; float new_alpha = node->alpha; float icon_space = xmb->icon_spacing_vertical; @@ -4077,7 +4077,7 @@ static int xmb_draw_item( && (color[3] != 0) && ( (entry.flags & MENU_ENTRY_FLAG_CHECKED) - || !((entry_type >= MENU_SETTING_DROPDOWN_ITEM) + || !((entry_type >= MENU_SETTING_DROPDOWN_ITEM) && (entry_type <= MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM_SPECIAL)) ) ) @@ -4192,7 +4192,7 @@ static int xmb_draw_item( { 0.0f, 0.0f, 0.0f, 0.0f , 0.0f, 0.0f, 0.0f, 0.0f , 0.0f, 0.0f, 0.0f, 0.0f , - 0.0f, 0.0f, 0.0f, 1.0f } + 0.0f, 0.0f, 0.0f, 1.0f } }; MAT_ELEM_4X4(matrix_scaled, 0, 0) = scale_factor; MAT_ELEM_4X4(matrix_scaled, 1, 1) = scale_factor; @@ -4375,7 +4375,7 @@ static void xmb_context_reset_internal(xmb_handle_t *xmb, static void xmb_hide_fullscreen_thumbnails( xmb_handle_t *xmb, bool animate) { - uintptr_t alpha_tag = + uintptr_t alpha_tag = (uintptr_t)&xmb->fullscreen_thumbnail_alpha; /* Kill any existing fade in/out animations */ @@ -4389,10 +4389,10 @@ static void xmb_hide_fullscreen_thumbnails( /* Configure fade out animation */ animation_entry.easing_enum = EASING_OUT_QUAD; animation_entry.tag = alpha_tag; - animation_entry.duration = + animation_entry.duration = gfx_thumb_get_ptr()->fade_duration; animation_entry.target_value = 0.0f; - animation_entry.subject = + animation_entry.subject = &xmb->fullscreen_thumbnail_alpha; animation_entry.cb = NULL; animation_entry.userdata = NULL; @@ -4434,7 +4434,7 @@ static void xmb_show_fullscreen_thumbnails( if (gfx_thumbnail_is_enabled( menu_st->thumbnail_path_data, GFX_THUMBNAIL_RIGHT)) { - if ( xmb->thumbnails.right.status + if ( xmb->thumbnails.right.status != GFX_THUMBNAIL_STATUS_AVAILABLE && xmb->thumbnails.savestate.status != GFX_THUMBNAIL_STATUS_AVAILABLE) @@ -4445,7 +4445,7 @@ static void xmb_show_fullscreen_thumbnails( menu_st->thumbnail_path_data, GFX_THUMBNAIL_LEFT)) { if ( - xmb->thumbnails.left.status + xmb->thumbnails.left.status != GFX_THUMBNAIL_STATUS_AVAILABLE) return; } @@ -4457,19 +4457,19 @@ static void xmb_show_fullscreen_thumbnails( bool left_thumbnail_enabled = gfx_thumbnail_is_enabled( menu_st->thumbnail_path_data, GFX_THUMBNAIL_LEFT); - if (( xmb->thumbnails.right.status + if (( xmb->thumbnails.right.status == GFX_THUMBNAIL_STATUS_AVAILABLE) && (left_thumbnail_enabled - && ((xmb->thumbnails.left.status + && ((xmb->thumbnails.left.status != GFX_THUMBNAIL_STATUS_MISSING) - && (xmb->thumbnails.left.status + && (xmb->thumbnails.left.status != GFX_THUMBNAIL_STATUS_AVAILABLE)))) return; - if (( xmb->thumbnails.right.status + if (( xmb->thumbnails.right.status == GFX_THUMBNAIL_STATUS_MISSING) && (!left_thumbnail_enabled - || ( xmb->thumbnails.left.status + || ( xmb->thumbnails.left.status != GFX_THUMBNAIL_STATUS_AVAILABLE))) return; } @@ -4578,14 +4578,14 @@ static enum menu_action xmb_parse_menu_entry_action( size_t category = xmb->categories_selection_ptr; size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) + xmb->system_tab_end; /* We only want the scrolling sound to play if any of the following are true: - * 1. Wraparound is enabled (since the category is guaranteed to change) + * 1. Wraparound is enabled (since the category is guaranteed to change) * 2. We're scrolling right, but we aren't on the last category * 3. We're scrolling left, but we aren't on the first category */ - bool fail_condition = ((action == MENU_ACTION_RIGHT) - ? (category == list_size) + bool fail_condition = ((action == MENU_ACTION_RIGHT) + ? (category == list_size) : (category == 0)) && !(settings->bools.menu_navigation_wraparound_enable); - if (((current_time - xmb->last_tab_switch_time) >= XMB_TAB_SWITCH_REPEAT_DELAY || + if (((current_time - xmb->last_tab_switch_time) >= XMB_TAB_SWITCH_REPEAT_DELAY || scroll_accel <= 0) && !fail_condition) audio_driver_mixer_play_scroll_sound(action == MENU_ACTION_RIGHT); #endif @@ -4836,7 +4836,7 @@ static void xmb_render(void *data, /* When determining current pointer selection, we * only track pointer movements between the left * and right screen margins */ - if ( (pointer_x > margin_left) + if ( (pointer_x > margin_left) && (pointer_x < margin_right)) { unsigned first = 0; @@ -4855,7 +4855,7 @@ static void xmb_render(void *data, int y1 = (int)((y_curr - half_entry_size) + 0.5f); int y2 = (int)((y_curr + half_entry_size) + 0.5f); - if ( (pointer_y > y1) + if ( (pointer_y > y1) && (pointer_y < y2)) { menu_input->ptr = (unsigned)i; @@ -4868,7 +4868,7 @@ static void xmb_render(void *data, * as a sort of virtual dpad: * - Above top margin: navigate left/right * - Beyond right margin: navigate up/down */ - if ( (pointer_y < margin_top) + if ( (pointer_y < margin_top) || (pointer_x > margin_right)) { menu_entry_t entry; @@ -4936,8 +4936,8 @@ static void xmb_render(void *data, if (pointer_y < margin_top) xmb_menu_entry_action(xmb, &entry, selection, - (xmb->depth == 1) - ? MENU_ACTION_RIGHT + (xmb->depth == 1) + ? MENU_ACTION_RIGHT : MENU_ACTION_LEFT); break; case MENU_INPUT_PRESS_DIRECTION_RIGHT: @@ -4948,8 +4948,8 @@ static void xmb_render(void *data, if (pointer_y < margin_top) xmb_menu_entry_action(xmb, &entry, selection, - (xmb->depth == 1) - ? MENU_ACTION_LEFT + (xmb->depth == 1) + ? MENU_ACTION_LEFT : MENU_ACTION_RIGHT); break; default: @@ -4969,7 +4969,7 @@ static void xmb_render(void *data, /* Explore list needs cached selection index */ if (xmb->is_explore_list) - selection = menu_st->thumbnail_path_data + selection = menu_st->thumbnail_path_data ? menu_st->thumbnail_path_data->playlist_index : 0; @@ -4984,9 +4984,9 @@ static void xmb_render(void *data, &xmb->thumbnails.left, gfx_thumbnail_upscale_threshold, network_on_demand_thumbnails); - if (( xmb->thumbnails.right.status + if (( xmb->thumbnails.right.status != GFX_THUMBNAIL_STATUS_UNKNOWN) - && ( xmb->thumbnails.left.status + && ( xmb->thumbnails.left.status != GFX_THUMBNAIL_STATUS_UNKNOWN)) xmb->thumbnails.pending = XMB_PENDING_THUMBNAIL_NONE; break; @@ -4999,7 +4999,7 @@ static void xmb_render(void *data, &xmb->thumbnails.right, gfx_thumbnail_upscale_threshold, network_on_demand_thumbnails); - if ( xmb->thumbnails.right.status + if ( xmb->thumbnails.right.status != GFX_THUMBNAIL_STATUS_UNKNOWN) xmb->thumbnails.pending = XMB_PENDING_THUMBNAIL_NONE; break; @@ -5012,7 +5012,7 @@ static void xmb_render(void *data, &xmb->thumbnails.left, gfx_thumbnail_upscale_threshold, network_on_demand_thumbnails); - if ( xmb->thumbnails.left.status + if ( xmb->thumbnails.left.status != GFX_THUMBNAIL_STATUS_UNKNOWN) xmb->thumbnails.pending = XMB_PENDING_THUMBNAIL_NONE; break; @@ -5813,7 +5813,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) && (menu_st->selection_ptr != xmb->fullscreen_thumbnail_selection)) xmb_show_fullscreen_thumbnails(xmb, menu_st, menu_st->selection_ptr); else if (!xmb->show_fullscreen_thumbnails - && xmb->fullscreen_thumbnails_available + && xmb->fullscreen_thumbnails_available && xmb->want_fullscreen_thumbnails) xmb_show_fullscreen_thumbnails(xmb, menu_st, menu_st->selection_ptr); @@ -6242,7 +6242,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) { 0.0f, 0.0f, 0.0f, 0.0f , 0.0f, 0.0f, 0.0f, 0.0f , 0.0f, 0.0f, 0.0f, 0.0f , - 0.0f, 0.0f, 0.0f, 1.0f } + 0.0f, 0.0f, 0.0f, 1.0f } }; MAT_ELEM_4X4(matrix_scaled, 0, 0) = scale_factor; MAT_ELEM_4X4(matrix_scaled, 1, 1) = scale_factor; @@ -6710,7 +6710,7 @@ static void *xmb_init(void **userdata, bool video_is_threaded) for (i = 0; i < XMB_TAB_MAX_LENGTH; i++) xmb->tab_selection[i] = 0; - if ( settings->bools.menu_content_show_settings + if ( settings->bools.menu_content_show_settings && !settings->bools.kiosk_mode_enable) xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_SETTINGS; if (settings->bools.menu_content_show_favorites) @@ -6784,7 +6784,7 @@ static void *xmb_init(void **userdata, bool video_is_threaded) gfx_thumbnail_set_fade_duration(-1.0f); gfx_thumbnail_set_fade_missing(false); - xmb->use_ps3_layout = + xmb->use_ps3_layout = xmb_use_ps3_layout(settings->uints.menu_xmb_layout, width, height); xmb->last_use_ps3_layout = xmb->use_ps3_layout; xmb->last_scale_factor = xmb_get_scale_factor( @@ -6794,7 +6794,7 @@ static void *xmb_init(void **userdata, bool video_is_threaded) p_anim->updatetime_cb = xmb_menu_animation_update_time; /* set word_wrap function pointer */ - xmb->word_wrap = + xmb->word_wrap = msg_hash_get_wideglyph_str() ? word_wrap_wideglyph : word_wrap; return menu; @@ -7271,7 +7271,7 @@ static void xmb_context_reset_background(xmb_handle_t *xmb, const char *iconpath { char path[PATH_MAX_LENGTH]; settings_t *settings = config_get_ptr(); - const char *path_menu_wp = + const char *path_menu_wp = settings->paths.path_menu_wallpaper; bool menu_dynamic_wallpaper_enable = settings->bools.menu_dynamic_wallpaper_enable;