summaryrefslogtreecommitdiff
path: root/menus.c
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-31 08:56:41 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-31 08:56:41 -0400
commit060b13f50acd4b5eda8179e66a8e09a1b4c69d05 (patch)
tree46f333625d2f6f48a5178d2c0d1dd3d5483d9dd6 /menus.c
parent205695233031100e2e5168e170b6d90e35f9bfd0 (diff)
removed another fixed-length string
Diffstat (limited to 'menus.c')
-rw-r--r--menus.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/menus.c b/menus.c
index 049f4c0..e303327 100644
--- a/menus.c
+++ b/menus.c
@@ -1077,7 +1077,7 @@ static void Menu_Move_Pointer(int move_amount)
static void Display_Number_on_LCD(int Is_Item_Visible,int LCD_row,int LCD_col,char *start_string,int Show_What, int significant_digits, int width_of_column)
{
- char units[10];
+ gchar *units = NULL;
int show_plus_sign;
int i;
int channel;
@@ -1091,19 +1091,19 @@ static void Display_Number_on_LCD(int Is_Item_Visible,int LCD_row,int LCD_col,ch
switch (Show_What-channel) {
case Show_frequency:
Submenu_Value=globals.ChannelState[channel].frequency;
- strcpy(units,"Hz");
+ units = g_strdup("Hz");
show_plus_sign=NO;
break;
case Show_delay:
Submenu_Value=globals.ChannelState[channel].delay;
- strcpy(units,"s");
+ units = g_strdup("s");
show_plus_sign=YES;
break;
case Show_pw:
Submenu_Value=globals.ChannelState[channel].pw;
- strcpy(units,"s");
+ units = g_strdup("s");
show_plus_sign=NO;
break;
@@ -1111,9 +1111,9 @@ static void Display_Number_on_LCD(int Is_Item_Visible,int LCD_row,int LCD_col,ch
Submenu_Value=globals.ChannelState[channel].amplitude;
show_plus_sign=YES;
if (globals.Flash.voltage_enabled[channel]) {
- strcpy(units,"V");
+ units = g_strdup("V");
} else {
- strcpy(units,"A");
+ units = g_strdup("A");
}
break;
@@ -1130,16 +1130,16 @@ static void Display_Number_on_LCD(int Is_Item_Visible,int LCD_row,int LCD_col,ch
break;
}
show_plus_sign=YES;
- strcpy(units,"V");
+ units = g_strdup("V");
break;
case Show_offset:
Submenu_Value=globals.ChannelState[channel].offset;
show_plus_sign=YES;
if (globals.Flash.voltage_offset_enabled[channel]) {
- strcpy(units,"V");
+ units = g_strdup("V");
} else {
- strcpy(units,"A");
+ units = g_strdup("A");
}
break;
@@ -1147,76 +1147,79 @@ static void Display_Number_on_LCD(int Is_Item_Visible,int LCD_row,int LCD_col,ch
Submenu_Value=globals.ChannelState[channel].Curr_Mon_value;
show_plus_sign=YES;
if (globals.ChannelState[channel].pw<globals.Flash.mon_pw_threshold[channel]) {
- strcpy(units,"A*");
+ units = g_strdup("A*");
--significant_digits;
} else {
- strcpy(units,"A");
+ units = g_strdup("A");
}
break;
case Show_duty_cycle:
Submenu_Value=100*globals.ChannelState[channel].pw*globals.ChannelState[channel].frequency;
show_plus_sign=NO;
- strcpy(units,"%");
+ units = g_strdup("%");
break;
case Show_route_primary:
Submenu_Value=(float) globals.ChannelState[channel].route_primary;
significant_digits=0;
show_plus_sign=NO;
- strcpy(units,"");
+ units = g_strdup("");
break;
case Show_route_secondary:
Submenu_Value=(float) globals.ChannelState[channel].route_secondary;
significant_digits=0;
show_plus_sign=NO;
- strcpy(units,"");
+ units = g_strdup("");
break;
case Show_Burst_Count:
Submenu_Value=(float) globals.ChannelState[channel].burst_count;
significant_digits=0;
show_plus_sign=NO;
- strcpy(units,"");
+ units = g_strdup("");
break;
case Show_Burst_Time:
Submenu_Value=globals.ChannelState[channel].burst_time;
- strcpy(units,"s");
+ units = g_strdup("s");
show_plus_sign=NO;
break;
case Show_rise_time:
Submenu_Value=globals.ChannelState[channel].rise_time;
- strcpy(units,"s");
+ units = g_strdup("s");
show_plus_sign=NO;
break;
case Show_slew:
Submenu_Value=globals.ChannelState[channel].slew;
- strcpy(units,"A/s");
+ units = g_strdup("A/s");
show_plus_sign=NO;
break;
case Show_load_type:
Submenu_Value=globals.ChannelState[channel].load_type;
- strcpy(units,"\xf4");
+ units = g_strdup("\xf4");
show_plus_sign=NO;
break;
case Show_soft_current_limit:
Submenu_Value=globals.ChannelState[channel].soft_current_limit;
- strcpy(units,"A");
+ units = g_strdup("A");
show_plus_sign=YES;
break;
case Show_gpib_address:
Submenu_Value=(float) globals.GPIB.PRIMARY_ADDRESS;
significant_digits=0;
- strcpy(units,"");
+ units = g_strdup("");
show_plus_sign=NO;
break;
+
+ default:
+ units = g_strdup("");
}
String_Parameter_To_Text(Submenu_Value,significant_digits,start_string,units,LCD_string,show_plus_sign);
@@ -1227,6 +1230,8 @@ static void Display_Number_on_LCD(int Is_Item_Visible,int LCD_row,int LCD_col,ch
if (Is_Item_Visible) {
LCD_write_padded_spaces(LCD_row, LCD_col, LCD_string, width_of_column);
}
+
+ g_free (units);
}