From 2519e80b677156ccc4327de1396f88e0097ac3cf Mon Sep 17 00:00:00 2001 From: "Michael J. Chudobiak" Date: Fri, 31 Aug 2012 07:50:20 -0400 Subject: removed more fixed-width strings --- menus.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'menus.c') diff --git a/menus.c b/menus.c index 5eed020..607da32 100644 --- a/menus.c +++ b/menus.c @@ -947,34 +947,38 @@ void Menu_Update_Display(void) LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; + gchar *ctrl_str = NULL; + switch (globals.control_mode) { - case LOCS_ctrl: - strcpy(LCD_string,"LOCAL CTRL "); - break; - case LWLS_ctrl: - strcpy(LCD_string,"LOCAL LOCK "); - break; case REMS_ctrl: - strcpy(LCD_string,"GPIB CTRL "); + ctrl_str = g_strdup ("GPIB CTRL "); break; case RWLS_ctrl: - strcpy(LCD_string,"GPIB LOCK "); + ctrl_str = g_strdup ("GPIB LOCK "); break; case RS232_ctrl: - strcpy(LCD_string,"RS232 CTRL "); + ctrl_str = g_strdup ("RS232 CTRL "); break; case WEB_ctrl: - strcpy(LCD_string,"WEB CTRL "); + ctrl_str = g_strdup ("WEB CTRL "); break; case TELNET_ctrl: - strcpy(LCD_string,"TELNET CTRL "); + ctrl_str = g_strdup ("TELNET CTRL "); + break; + case LWLS_ctrl: + ctrl_str = g_strdup ("LOCAL LOCK "); + break; + case LOCS_ctrl: + default: + ctrl_str = g_strdup ("LOCAL CTRL "); break; } if (globals.Changes.update_whole_main_menu && Menu_Is_Item_Visible(LCD_entry)) { - LCD_write(LCD_row,LCD_col,LCD_string); + LCD_write(LCD_row,LCD_col,ctrl_str); } + g_free (ctrl_str); /*----- display memory, always -----*/ @@ -986,9 +990,8 @@ void Menu_Update_Display(void) LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; - strcpy(LCD_string,"Memory menu "); if (globals.Changes.update_whole_main_menu && Menu_Is_Item_Visible(LCD_entry)) { - LCD_write(LCD_row,LCD_col,LCD_string); + LCD_write(LCD_row,LCD_col,"Memory menu "); } @@ -1002,9 +1005,8 @@ void Menu_Update_Display(void) LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; - strcpy(LCD_string,"Setup menu "); if (globals.Changes.update_whole_main_menu && Menu_Is_Item_Visible(LCD_entry)) { - LCD_write(LCD_row,LCD_col,LCD_string); + LCD_write(LCD_row,LCD_col,"Setup menu "); } @@ -2486,7 +2488,7 @@ static void Submenu_Service_Encoder(int encoder_change) Float_To_Text(3,abs_Submenu_Value,&num_string); /* isolate the exponent and non-exponent parts */ - expon = g_strdup (num_string+5); + gchar *expon = g_strdup (num_string+5); num_string[5]=0; -- cgit