From 4b2a3918fdb2669b13e2d813dfa6952d5f120219 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 20 Jun 2008 13:43:19 +0000 Subject: [PATCH] Fixed some compiler warnings. --- examples/reefnet_sensuspro_test.c | 2 +- examples/reefnet_sensusultra_test.c | 6 +++--- src/irda.c | 6 +++--- src/serial_posix.c | 4 ++-- src/utils.c | 2 +- src/uwatec_smart.c | 3 +-- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/examples/reefnet_sensuspro_test.c b/examples/reefnet_sensuspro_test.c index 4343ce7..457cbda 100644 --- a/examples/reefnet_sensuspro_test.c +++ b/examples/reefnet_sensuspro_test.c @@ -31,7 +31,7 @@ int test_dump_memory (const char* name, const char* filename) } time_t now = time (NULL); - unsigned char datetime[21] = {0}; + char datetime[21] = {0}; strftime (datetime, sizeof (datetime), "%Y-%m-%dT%H:%M:%SZ", gmtime (&now)); message ("time=%lu (%s)\n", (unsigned long)now, datetime); diff --git a/examples/reefnet_sensusultra_test.c b/examples/reefnet_sensusultra_test.c index 5591836..2b6b159 100644 --- a/examples/reefnet_sensusultra_test.c +++ b/examples/reefnet_sensusultra_test.c @@ -31,7 +31,7 @@ int test_dump_memory_dives (const char* name, const char* filename) } time_t now = time (NULL); - unsigned char datetime[21] = {0}; + char datetime[21] = {0}; strftime (datetime, sizeof (datetime), "%Y-%m-%dT%H:%M:%SZ", gmtime (&now)); message ("time=%lu (%s)\n", (unsigned long)now, datetime); @@ -76,7 +76,7 @@ int test_dump_memory_data (const char* name, const char* filename) } time_t now = time (NULL); - unsigned char datetime[21] = {0}; + char datetime[21] = {0}; strftime (datetime, sizeof (datetime), "%Y-%m-%dT%H:%M:%SZ", gmtime (&now)); message ("time=%lu (%s)\n", (unsigned long)now, datetime); @@ -128,7 +128,7 @@ int test_dump_memory_user (const char* name, const char* filename) } time_t now = time (NULL); - unsigned char datetime[21] = {0}; + char datetime[21] = {0}; strftime (datetime, sizeof (datetime), "%Y-%m-%dT%H:%M:%SZ", gmtime (&now)); message ("time=%lu (%s)\n", (unsigned long)now, datetime); diff --git a/src/irda.c b/src/irda.c index 5154c0d..f7f3ec1 100644 --- a/src/irda.c +++ b/src/irda.c @@ -228,7 +228,7 @@ irda_socket_discover (irda *device, irda_callback_t callback, void *userdata) int rc = 0; unsigned int n = 0; - while ((rc = getsockopt (device->fd, SOL_IRLMP, IRLMP_ENUMDEVICES, data, &size)) != 0) { + while ((rc = getsockopt (device->fd, SOL_IRLMP, IRLMP_ENUMDEVICES, (char*) data, &size)) != 0) { #ifdef _WIN32 if (WSAGetLastError() != WSAEWOULDBLOCK) { #else @@ -396,7 +396,7 @@ irda_socket_read (irda* device, void* data, unsigned int size) break; // Timeout. } - int n = recv (device->fd, data + nbytes, size - nbytes, 0); + int n = recv (device->fd, (char*) data + nbytes, size - nbytes, 0); if (n < 0) { TRACE ("recv"); return -1; // Error during recv call. @@ -419,7 +419,7 @@ irda_socket_write (irda* device, const void *data, unsigned int size) unsigned int nbytes = 0; while (nbytes < size) { - int n = send (device->fd, data + nbytes, size - nbytes, 0); + int n = send (device->fd, (char*) data + nbytes, size - nbytes, 0); if (n < 0) { TRACE ("send"); return -1; // Error during send call. diff --git a/src/serial_posix.c b/src/serial_posix.c index b53177d..918e4b5 100644 --- a/src/serial_posix.c +++ b/src/serial_posix.c @@ -426,7 +426,7 @@ serial_read (serial* device, void* data, unsigned int size) unsigned int nbytes = 0; for (;;) { // Attempt to read data from the file descriptor. - int n = read (device->fd, data + nbytes, size - nbytes); + int n = read (device->fd, (char*) data + nbytes, size - nbytes); if (n < 0) { if (errno == EINTR) continue; // Retry. @@ -477,7 +477,7 @@ serial_write (serial* device, const void* data, unsigned int size) unsigned int nbytes = 0; for (;;) { // Attempt to write data to the file descriptor. - int n = write (device->fd, data + nbytes, size - nbytes); + int n = write (device->fd, (char*) data + nbytes, size - nbytes); if (n < 0) { if (errno == EINTR) continue; // Retry. diff --git a/src/utils.c b/src/utils.c index 8f3a59c..0c24228 100644 --- a/src/utils.c +++ b/src/utils.c @@ -5,7 +5,7 @@ static FILE* g_logfile = NULL; int message (const char* fmt, ...) { - va_list ap = {0}; + va_list ap; if (g_logfile) { va_start (ap, fmt); diff --git a/src/uwatec_smart.c b/src/uwatec_smart.c index d4e60d0..f8b2b7e 100644 --- a/src/uwatec_smart.c +++ b/src/uwatec_smart.c @@ -171,7 +171,6 @@ uwatec_smart_read (smart *device, unsigned char data[], unsigned int size) if (device == NULL) return UWATEC_ERROR; - unsigned int timestamp = 0; unsigned char command[9] = {0}; unsigned char answer[4] = {0}; @@ -224,7 +223,7 @@ uwatec_smart_read (smart *device, unsigned char data[], unsigned int size) // PC Time and Time Correction. time_t now = time (NULL); - unsigned char datetime[21] = {0}; + char datetime[21] = {0}; strftime (datetime, sizeof (datetime), "%Y-%m-%dT%H:%M:%SZ", gmtime (&now)); message ("handshake: now=%lu (%s)\n", (unsigned long)now, datetime);