From b434fa344bdf59341d59d1c5cf15c965efab1e90 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Tue, 6 Jan 2009 21:44:25 +0000 Subject: [PATCH] Fixed some warnings related to shadow variables. --- src/reefnet_sensuspro.c | 2 +- src/reefnet_sensusultra.c | 8 ++++---- src/suunto_common.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/reefnet_sensuspro.c b/src/reefnet_sensuspro.c index aaa847f..0dcaea2 100644 --- a/src/reefnet_sensuspro.c +++ b/src/reefnet_sensuspro.c @@ -247,7 +247,7 @@ reefnet_sensuspro_device_dump (device_t *abstract, unsigned char *data, unsigned if (len > 256) len = 256; - int rc = serial_read (device->port, answer + nbytes, len); + rc = serial_read (device->port, answer + nbytes, len); if (rc != len) { WARNING ("Failed to receive the answer."); return EXITCODE (rc); diff --git a/src/reefnet_sensusultra.c b/src/reefnet_sensusultra.c index 13ded59..b167b46 100644 --- a/src/reefnet_sensusultra.c +++ b/src/reefnet_sensusultra.c @@ -686,9 +686,9 @@ reefnet_sensusultra_device_foreach (device_t *abstract, dive_callback_t callback unsigned int npages = 0; while (nbytes < REEFNET_SENSUSULTRA_MEMORY_DATA_SIZE) { // Receive the packet. - unsigned int index = REEFNET_SENSUSULTRA_MEMORY_DATA_SIZE - + unsigned int offset = REEFNET_SENSUSULTRA_MEMORY_DATA_SIZE - nbytes - REEFNET_SENSUSULTRA_PACKET_SIZE; - rc = reefnet_sensusultra_page (device, data + index, REEFNET_SENSUSULTRA_PACKET_SIZE, npages); + rc = reefnet_sensusultra_page (device, data + offset, REEFNET_SENSUSULTRA_PACKET_SIZE, npages); if (rc != DEVICE_STATUS_SUCCESS) { free (data); return rc; @@ -697,12 +697,12 @@ reefnet_sensusultra_device_foreach (device_t *abstract, dive_callback_t callback progress_event (&progress, DEVICE_EVENT_PROGRESS, REEFNET_SENSUSULTRA_PACKET_SIZE); // Abort the transfer if the page contains no useful data. - if (reefnet_sensusultra_isempty (data + index, REEFNET_SENSUSULTRA_PACKET_SIZE)) + if (reefnet_sensusultra_isempty (data + offset, REEFNET_SENSUSULTRA_PACKET_SIZE)) break; // Parse the page data. int aborted = 0; - rc = reefnet_sensusultra_parse (data, index, index + REEFNET_SENSUSULTRA_PACKET_SIZE, &previous, &aborted, callback, userdata, device->timestamp); + rc = reefnet_sensusultra_parse (data, offset, offset + REEFNET_SENSUSULTRA_PACKET_SIZE, &previous, &aborted, callback, userdata, device->timestamp); if (rc != DEVICE_STATUS_SUCCESS) { free (data); return rc; diff --git a/src/suunto_common.c b/src/suunto_common.c index 4a82bb5..512e11f 100644 --- a/src/suunto_common.c +++ b/src/suunto_common.c @@ -49,8 +49,8 @@ suunto_common_extract_dives (const unsigned char data[], unsigned int begin, uns // Check for an end of dive marker (of the next dive), // to find the start of the current dive. - unsigned int index = ringbuffer_decrement (current, peek, begin, end); - if (data[index] == 0x80) { + unsigned int idx = ringbuffer_decrement (current, peek, begin, end); + if (data[idx] == 0x80) { unsigned int len = ringbuffer_distance (current, previous, begin, end); if (current + len > end) { unsigned int a = end - current;