summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lcd.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/lcd.c b/lcd.c
index 1658efa..17d3788 100644
--- a/lcd.c
+++ b/lcd.c
@@ -17,7 +17,7 @@ char LCD_Data[LCD_rows][LCD_cols]; /* shadow copy of LCD display in local RAM, t
/*** EndHeader */
-static void break_up_string (char *in_string, int N, char *str1, char *str2, char *str3)
+static void break_up_string (char *in_string, int N, char **str1, char **str2, char **str3)
{
#define SUBSTRING_CNT 3
@@ -75,13 +75,13 @@ static void break_up_string (char *in_string, int N, char *str1, char *str2, cha
}
switch (j) {
case 0:
- strcpy(str1,interm_str);
+ *str1 = g_strdup(interm_str);
break;
case 1:
- strcpy(str2,interm_str);
+ *str2 = g_strdup(interm_str);
break;
case 2:
- strcpy(str3,interm_str);
+ *str3 = g_strdup(interm_str);
break;
}
g_free(interm_str);
@@ -129,6 +129,8 @@ static void LCD_RAM_write(int RAM_start,int row, int col, char *LCD_string)
int ram_location;
char last_op_a_write;
+ if (!LCD_string) return;
+
String_length=strlen(LCD_string);
enable_one_lcd=0x02;
@@ -279,17 +281,13 @@ void LCD_initialize(void)
void LCD_display_error_message(char *response)
{
- char row0[LCD_cols+1];
- char row1[LCD_cols+1];
- char row2[LCD_cols+1];
-
- memset(row0,0,LCD_cols+1);
- memset(row1,0,LCD_cols+1);
- memset(row2,0,LCD_cols+1);
+ char *row0 = NULL;
+ char *row1 = NULL;
+ char *row2 = NULL;
// Error_Screen=1; //FIXME
- break_up_string (response, LCD_cols, row0, row1, row2);
+ break_up_string (response, LCD_cols, &row0, &row1, &row2);
LCD_clear();
LCD_write(0,0,row0);
@@ -297,6 +295,10 @@ void LCD_display_error_message(char *response)
LCD_write(2,0,row2);
LCD_write(3,0,Press_Change_Message);
+ g_free (row0);
+ g_free (row1);
+ g_free (row2);
+
return;
}