(Menu) Cleanups

This commit is contained in:
twinaphex 2015-06-13 00:09:09 +02:00
parent daf4f5719b
commit b31723236d
6 changed files with 44 additions and 34 deletions

View File

@ -423,8 +423,9 @@ static void glui_frame(void)
if (menu->keyboard.display) if (menu->keyboard.display)
{ {
char msg[PATH_MAX_LENGTH]; char msg[PATH_MAX_LENGTH] = {0};
const char *str = *menu->keyboard.buffer; const char *str = *menu->keyboard.buffer;
if (!str) if (!str)
str = ""; str = "";
glui_render_quad(gl, 0, 0, width, height, 0, 0, 0, 0.75); glui_render_quad(gl, 0, 0, width, height, 0, 0, 0, 0.75);

View File

@ -327,12 +327,14 @@ static void rgui_blit_cursor(menu_handle_t *menu)
static void rgui_render(void) static void rgui_render(void)
{ {
size_t i, end;
int bottom;
char title[256], title_buf[256], title_msg[64];
char timedate[PATH_MAX_LENGTH];
unsigned x, y; unsigned x, y;
uint16_t hover_color, normal_color; uint16_t hover_color, normal_color;
size_t i, end;
int bottom;
char title[256] = {0};
char title_buf[256] = {0};
char title_msg[64] = {0};
char timedate[PATH_MAX_LENGTH] = {0};
menu_handle_t *menu = menu_driver_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr();
runloop_t *runloop = rarch_main_get_ptr(); runloop_t *runloop = rarch_main_get_ptr();
driver_t *driver = driver_get_ptr(); driver_t *driver = driver_get_ptr();
@ -489,8 +491,9 @@ static void rgui_render(void)
if (menu->keyboard.display) if (menu->keyboard.display)
{ {
char msg[PATH_MAX_LENGTH]; char msg[PATH_MAX_LENGTH] = {0};
const char *str = *menu->keyboard.buffer; const char *str = *menu->keyboard.buffer;
if (!str) if (!str)
str = ""; str = "";
snprintf(msg, sizeof(msg), "%s\n%s", menu->keyboard.label, str); snprintf(msg, sizeof(msg), "%s\n%s", menu->keyboard.label, str);

View File

@ -158,7 +158,8 @@ HRESULT CRetroArchMain::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
if (XuiHandleIsValid(m_menutitlebottom)) if (XuiHandleIsValid(m_menutitlebottom))
{ {
char str[PATH_MAX_LENGTH]; char str[PATH_MAX_LENGTH] = {0};
snprintf(str, sizeof(str), "%s - %s", PACKAGE_VERSION, global->title_buf); snprintf(str, sizeof(str), "%s - %s", PACKAGE_VERSION, global->title_buf);
mbstowcs(strw_buffer, str, sizeof(strw_buffer) / sizeof(wchar_t)); mbstowcs(strw_buffer, str, sizeof(strw_buffer) / sizeof(wchar_t));
XuiTextElementSetText(m_menutitlebottom, strw_buffer); XuiTextElementSetText(m_menutitlebottom, strw_buffer);
@ -531,7 +532,7 @@ static void rmenu_xui_set_list_text(int index, const wchar_t* leftText,
static void rmenu_xui_render(void) static void rmenu_xui_render(void)
{ {
size_t end, i; size_t end, i;
char title[PATH_MAX_LENGTH]; char title[PATH_MAX_LENGTH] = {0};
const char *dir = NULL, *label = NULL; const char *dir = NULL, *label = NULL;
unsigned menu_type = 0; unsigned menu_type = 0;
menu_handle_t *menu = menu_driver_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr();
@ -568,8 +569,10 @@ static void rmenu_xui_render(void)
end = menu_entries_get_end(); end = menu_entries_get_end();
for (i = 0; i < end; i++) for (i = 0; i < end; i++)
{ {
char entry_path[PATH_MAX_LENGTH], entry_value[PATH_MAX_LENGTH]; char entry_path[PATH_MAX_LENGTH] = {0};
wchar_t msg_left[PATH_MAX_LENGTH], msg_right[PATH_MAX_LENGTH]; char entry_value[PATH_MAX_LENGTH] = {0};
char msg_right[PATH_MAX_LENGTH] = {0};
wchar_t msg_left[PATH_MAX_LENGTH] = {0};
menu_entry_get_value(i, entry_value, sizeof(entry_value)); menu_entry_get_value(i, entry_value, sizeof(entry_value));
menu_entry_get_path(i, entry_path, sizeof(entry_path)); menu_entry_get_path(i, entry_path, sizeof(entry_path));
@ -582,8 +585,9 @@ static void rmenu_xui_render(void)
if (menu->keyboard.display) if (menu->keyboard.display)
{ {
char msg[1024]; char msg[1024] = {0};
const char *str = *menu->keyboard.buffer; const char *str = *menu->keyboard.buffer;
if (!str) if (!str)
str = ""; str = "";
snprintf(msg, sizeof(msg), "%s\n%s", menu->keyboard.label, str); snprintf(msg, sizeof(msg), "%s\n%s", menu->keyboard.label, str);
@ -629,7 +633,7 @@ static void rmenu_xui_navigation_alphabet(size_t *ptr_out)
static void rmenu_xui_list_insert(file_list_t *list, static void rmenu_xui_list_insert(file_list_t *list,
const char *path, const char *, size_t list_size) const char *path, const char *, size_t list_size)
{ {
wchar_t buf[PATH_MAX_LENGTH]; wchar_t buf[PATH_MAX_LENGTH] = {0};
XuiListInsertItems(m_menulist, list_size, 1); XuiListInsertItems(m_menulist, list_size, 1);
mbstowcs(buf, path, sizeof(buf) / sizeof(wchar_t)); mbstowcs(buf, path, sizeof(buf) / sizeof(wchar_t));

View File

@ -60,8 +60,8 @@ static void menu_push_to_history_playlist(void)
if (*global->fullpath) if (*global->fullpath)
{ {
char tmp[PATH_MAX_LENGTH]; char tmp[PATH_MAX_LENGTH] = {0};
char str[PATH_MAX_LENGTH]; char str[PATH_MAX_LENGTH] = {0};
fill_pathname_base(tmp, global->fullpath, sizeof(tmp)); fill_pathname_base(tmp, global->fullpath, sizeof(tmp));
snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp); snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp);
@ -102,7 +102,8 @@ bool menu_load_content(void)
if (!(main_load_content(0, NULL, NULL, menu_environment_get, if (!(main_load_content(0, NULL, NULL, menu_environment_get,
driver->frontend_ctx->process_args))) driver->frontend_ctx->process_args)))
{ {
char name[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH]; char name[PATH_MAX_LENGTH] = {0};
char msg[PATH_MAX_LENGTH] = {0};
fill_pathname_base(name, global->fullpath, sizeof(name)); fill_pathname_base(name, global->fullpath, sizeof(name));
snprintf(msg, sizeof(msg), "Failed to load %s.\n", name); snprintf(msg, sizeof(msg), "Failed to load %s.\n", name);

View File

@ -54,8 +54,9 @@ int menu_entry_go_back(void)
static rarch_setting_t *menu_entry_get_setting(uint32_t i) static rarch_setting_t *menu_entry_get_setting(uint32_t i)
{ {
const char *path = NULL, *entry_label = NULL;
unsigned type = 0; unsigned type = 0;
const char *path = NULL;
const char *entry_label = NULL;
const char *dir = NULL; const char *dir = NULL;
const char *label = NULL; const char *label = NULL;
menu_list_t *menu_list = menu_list_get_ptr(); menu_list_t *menu_list = menu_list_get_ptr();
@ -73,7 +74,7 @@ static rarch_setting_t *menu_entry_get_setting(uint32_t i)
enum menu_entry_type menu_entry_get_type(uint32_t i) enum menu_entry_type menu_entry_get_type(uint32_t i)
{ {
rarch_setting_t *setting; rarch_setting_t *setting = NULL;
const char *path = NULL, *entry_label = NULL; const char *path = NULL, *entry_label = NULL;
unsigned type = 0; unsigned type = 0;
const char *dir = NULL; const char *dir = NULL;

View File

@ -509,8 +509,8 @@ static int menu_input_bind_iterate_keyboard(int64_t current, int timeout)
int menu_input_bind_iterate(void) int menu_input_bind_iterate(void)
{ {
int64_t current; int64_t current;
char msg[PATH_MAX_LENGTH];
struct menu_bind_state binds; struct menu_bind_state binds;
char msg[PATH_MAX_LENGTH] = {0};
int timeout = 0; int timeout = 0;
menu_handle_t *menu = menu_driver_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr();
driver_t *driver = driver_get_ptr(); driver_t *driver = driver_get_ptr();