From 08819acf094883c069e7c3088d5da6a9c24c45b8 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 31 Dec 1999 20:13:53 -0500 Subject: fix various warnings --- dummy_functions.c | 1 - dummy_functions.h | 1 - error_utils.c | 33 ++++++--------------------------- i2c.c | 5 +++-- i2c.h | 2 +- lcd.c | 6 +++--- parser.c | 9 ++++++--- response.c | 1 + string_utils.c | 13 ++++++++----- 9 files changed, 28 insertions(+), 43 deletions(-) diff --git a/dummy_functions.c b/dummy_functions.c index 69bfa15..71b4e83 100644 --- a/dummy_functions.c +++ b/dummy_functions.c @@ -6,7 +6,6 @@ void GPIB_Set_Command_Error() {} void GPIB_Set_Query_Error() {} void GPIB_Set_Device_Dependent_Error() {} void GPIB_Set_Execution_Error() {} -void break_up_string(char* response, int n, char* r1, char* r2, char* r3) { } void Main_update_shift_registers() { } void IO_output_to_comm_bus(char* w, int n) { } //replace with real function void Error_check(void* p) { } diff --git a/dummy_functions.h b/dummy_functions.h index 27c5872..9990ec7 100644 --- a/dummy_functions.h +++ b/dummy_functions.h @@ -7,7 +7,6 @@ void GPIB_Set_Command_Error(); void GPIB_Set_Query_Error(); void GPIB_Set_Device_Dependent_Error(); void GPIB_Set_Execution_Error(); -void break_up_string(char* response, int n, char* r1, char* r2, char* r3); void Main_update_shift_registers(); void IO_output_to_comm_bus(char* w, int n); void Error_check(void*); diff --git a/error_utils.c b/error_utils.c index 56d515a..68c8b93 100644 --- a/error_utils.c +++ b/error_utils.c @@ -15,8 +15,11 @@ END DESCRIPTION **********************************************************/ #include #include "globals.h" #include "dummy_functions.h" +#include "lcd.h" + /*** EndHeader */ +/* FIXME */ int Error_Screen=NO; void set_gpib_error_flags (int error_num); @@ -88,7 +91,7 @@ void queue_error(int error_num) /*----------------------------------------------------------------------------------------------------------*/ void queue_error_and_get_text(gchar** response, int error_num) { - response[0]=0; + *response[0]=0; if (error_num == OK) { return; } @@ -100,7 +103,7 @@ void queue_error_and_get_text(gchar** response, int error_num) /*----------------------------------------------------------------------------------------------------------*/ void queue_error_from_parser(gchar** response, int error_num) { - response[0]=0; + *response[0]=0; if (error_num == OK) { return; } @@ -128,32 +131,8 @@ void queue_error_and_display_on_LCD(int error_num); void queue_error_and_display_on_LCD(int error_num) { gchar* response = NULL; - char row0[LCD_cols+1]; - char row1[LCD_cols+1]; - char row2[LCD_cols+1]; - - char Press_Change_Message[max_output_length]; //!!! - - if (error_num == OK) { - return; - } queue_error_and_get_text(&response, error_num); - - memset(row0,0,LCD_cols+1); - memset(row1,0,LCD_cols+1); - memset(row2,0,LCD_cols+1); - - Error_Screen=YES; - - break_up_string (response, LCD_cols, row0, row1, row2); - - LCD_clear(); - LCD_write(0,0,row0); - LCD_write(1,0,row1); - LCD_write(2,0,row2); - LCD_write(3,0,Press_Change_Message); - - g_free(response); + LCD_display_error_message (response); } diff --git a/i2c.c b/i2c.c index fc9d48a..4c1499d 100644 --- a/i2c.c +++ b/i2c.c @@ -10,7 +10,7 @@ #define I2C_BUS "/dev/i2c-3" -int I2C_Write(gulong address, guchar value) { +void I2C_Write(gulong address, guchar value) { struct i2c_smbus_ioctl_data argswrite; @@ -21,7 +21,8 @@ int I2C_Write(gulong address, guchar value) { int device = open(I2C_BUS, O_RDWR); - if (device == -1) return device; + // FIXME? + if (device == -1) return; ioctl(device, I2C_SLAVE, address); ioctl(device, I2C_SMBUS, &argswrite); diff --git a/i2c.h b/i2c.h index d65a596..c11d159 100644 --- a/i2c.h +++ b/i2c.h @@ -17,5 +17,5 @@ /* 6 and 7 reserved for dual-channel current monitor */ -int I2C_Write(gulong address, guchar value); +void I2C_Write(gulong address, guchar value); guchar I2C_Read(gulong address); diff --git a/lcd.c b/lcd.c index 17d3788..2579f48 100644 --- a/lcd.c +++ b/lcd.c @@ -66,7 +66,7 @@ static void break_up_string (char *in_string, int N, char **str1, char **str2, c strcpy(copy_input, in_string+copypos); } n = strlen(interm_str); - for (k=n-1; k=0; k--) { //trim space + for ((k=n-1); (k=0); k--) { //trim space if (*(interm_str+k)==' ') { *(interm_str+k)=0; } else { @@ -96,8 +96,8 @@ static void break_up_string (char *in_string, int N, char **str1, char **str2, c void LCD_clear() { - char i; - char j; + int i; + int j; I2C_Write(PCF8574A+LCD_Port, 0x00 | LCD_ENABLE); I2C_Write(PCF8574A+LCD_Port, 0x00); diff --git a/parser.c b/parser.c index cda2bf9..eb97868 100644 --- a/parser.c +++ b/parser.c @@ -494,12 +494,15 @@ static int Parser_get_unit(char *parameter,char *units) parameter[j]=0; } - if (i < strlen(parameter)) + if (i < strlen(parameter)) { if ( (parameter[i]=='e' && parameter[i+1]=='-') - || (parameter[i]=='e' && parameter[i+1]=='+') ) + || (parameter[i]=='e' && parameter[i+1]=='+') ) { for (i+=2; (i < strlen(parameter)) && isdigit(parameter[i]); ++i) {} - else if (parameter[i]=='e' && isdigit(parameter[i+1]) ) + } + else if (parameter[i]=='e' && isdigit(parameter[i+1]) ) { for (i+=2; (i < strlen(parameter)) && isdigit(parameter[i]); ++i) {} + } + } /* suck out spaces */ while ( (i #include diff --git a/string_utils.c b/string_utils.c index b5ec2c2..31ef0ff 100644 --- a/string_utils.c +++ b/string_utils.c @@ -210,12 +210,15 @@ int String_is_it_numeric(char *parameter) parameter[j]=0; } - if (i < strlen(parameter)) - if ( (parameter[i]=='e' && parameter[i+1]=='-') - || (parameter[i]=='e' && parameter[i+1]=='+') ) + if (i < strlen(parameter)) { + if ( (parameter[i]=='e' && parameter[i+1]=='-') + || (parameter[i]=='e' && parameter[i+1]=='+') ) { for (i+=2; (i < strlen(parameter)) && isdigit(parameter[i]); ++i) {} - else if (parameter[i]=='e' && isdigit(parameter[i+1]) ) + } + else if (parameter[i]=='e' && isdigit(parameter[i+1]) ) { for (i+=2; (i < strlen(parameter)) && isdigit(parameter[i]); ++i) {} + } + } /* suck out spaces */ while ( (i