From 217e4a430c08b9ad468c55715dd91787301a2d16 Mon Sep 17 00:00:00 2001 From: Martin Peach Date: Wed, 3 Feb 2010 17:39:14 +0000 Subject: Got rid of some more warnings in the MinGW version. svn path=/trunk/externals/iem/comport/; revision=13142 --- comport/comport.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'comport') diff --git a/comport/comport.c b/comport/comport.c index 60ecb43..3a90f2a 100644 --- a/comport/comport.c +++ b/comport/comport.c @@ -171,8 +171,6 @@ long baudspeedbittable[] = struct timeval null_tv; -#endif /* else _WIN32 */ - #define BAUDRATETABLE_LEN 19 static long baudratetable[] = @@ -199,6 +197,8 @@ static long baudratetable[] = }; /* holds the baud rate selections */ +#endif /* else _WIN32 */ + /* From man cfsetospeed: cfsetospeed() sets the output baud rate stored in the termios structure pointed to by termios_p to speed, which @@ -506,7 +506,7 @@ static HANDLE open_serial(unsigned int com_num, t_comport *x) errStr = " "; break; } - pd_error(x, "[comport]: could not open device %s:\n failure(%d) %s\n", + pd_error(x, "[comport]: could not open device %s:\n failure(%ld) %s\n", &x->serial_device->s_name[4], dw, errStr); return INVALID_HANDLE_VALUE; } @@ -1025,12 +1025,19 @@ static void comport_tick(t_comport *x) { /* while there are bytes, read them and send them out, ignore errors (!??) */ #ifdef _WIN32 DWORD dwRead; - OVERLAPPED osReader = {0}; + OVERLAPPED osReader; DWORD dwX; DWORD whicherr = 0; err = 0; - +/* initialize all fields off osReader to zero to avoid gcc warnings about */ +/* missing initializer if we just do osReader ={0} */ + osReader.hEvent = 0; + osReader.Internal = 0; + osReader.InternalHigh = 0; + osReader.Offset = 0; + osReader.OffsetHigh = 0; + osReader.Pointer = 0; osReader.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); if(ReadFile(x->comhandle, x->x_inbuf, x->x_inbuf_len, &dwRead, &osReader)) { @@ -1082,12 +1089,20 @@ static void comport_tick(t_comport *x) if (0 != x->x_outbuf_wr_index) { #ifdef _WIN32 - OVERLAPPED osWrite = {0}; + OVERLAPPED osWrite; DWORD dwWritten; DWORD dwToWrite = (DWORD)x->x_outbuf_wr_index; DWORD dwErr; DWORD numTransferred = 0L; +/* initialize all fields off osWrite to zero to avoid gcc warnings about */ +/* missing initializer if we just do osWrite ={0} */ + osWrite.hEvent = 0; + osWrite.Internal = 0; + osWrite.InternalHigh = 0; + osWrite.Offset = 0; + osWrite.OffsetHigh = 0; + osWrite.Pointer = 0; osWrite.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); if (osWrite.hEvent == NULL) { -- cgit v1.2.1