diff --git a/src/context.c b/src/context.c index c7642e6..88fd9b5 100644 --- a/src/context.c +++ b/src/context.c @@ -130,7 +130,7 @@ l_hexdump (char *str, size_t size, const unsigned char data[], size_t n) } static void -logfunc (dc_context_t *context, dc_loglevel_t loglevel, const char *file, unsigned int line, const char *function, const char *msg, void *userdata) +loghandler (dc_context_t *context, dc_loglevel_t loglevel, const char *file, unsigned int line, const char *function, const char *msg, void *userdata) { const char *loglevels[] = {"NONE", "ERROR", "WARNING", "INFO", "DEBUG", "ALL"}; @@ -166,7 +166,7 @@ dc_context_new (dc_context_t **out) #ifdef ENABLE_LOGGING context->loglevel = DC_LOGLEVEL_WARNING; - context->logfunc = logfunc; + context->logfunc = loghandler; #else context->loglevel = DC_LOGLEVEL_NONE; context->logfunc = NULL; diff --git a/src/oceanic_vtpro.c b/src/oceanic_vtpro.c index 22d61fd..74b94ec 100644 --- a/src/oceanic_vtpro.c +++ b/src/oceanic_vtpro.c @@ -592,8 +592,8 @@ oceanic_vtpro_device_version (dc_device_t *abstract, unsigned char data[], unsig return rc; // Verify the checksum of the answer. - unsigned char crc = answer[PAGESIZE / 2]; - unsigned char ccrc = checksum_add_uint4 (answer, PAGESIZE / 2, 0x00); + crc = answer[PAGESIZE / 2]; + ccrc = checksum_add_uint4 (answer, PAGESIZE / 2, 0x00); if (crc != ccrc) { ERROR (abstract->context, "Unexpected answer checksum."); return DC_STATUS_PROTOCOL; diff --git a/src/reefnet_sensuspro_parser.c b/src/reefnet_sensuspro_parser.c index fe62668..7e68a72 100644 --- a/src/reefnet_sensuspro_parser.c +++ b/src/reefnet_sensuspro_parser.c @@ -163,8 +163,8 @@ reefnet_sensuspro_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, while (offset + sizeof (footer) <= size && memcmp (data + offset, footer, sizeof (footer)) != 0) { - unsigned int value = array_uint16_le (data + offset); - unsigned int depth = (value & 0x01FF); + unsigned int raw = array_uint16_le (data + offset); + unsigned int depth = (raw & 0x01FF); if (depth > maxdepth) maxdepth = depth; diff --git a/src/suunto_eonsteel_parser.c b/src/suunto_eonsteel_parser.c index 0d519cd..d8dcdcc 100644 --- a/src/suunto_eonsteel_parser.c +++ b/src/suunto_eonsteel_parser.c @@ -366,10 +366,10 @@ static int record_type(suunto_eonsteel_parser_t *eon, unsigned short type, const return 0; } -static int traverse_entry(suunto_eonsteel_parser_t *eon, const unsigned char *p, int len, eon_data_cb_t callback, void *user) +static int traverse_entry(suunto_eonsteel_parser_t *eon, const unsigned char *p, int size, eon_data_cb_t callback, void *user) { - const unsigned char *name, *data, *end, *last, *one_past_end = p + len; - int textlen, type; + const unsigned char *name, *data, *end, *last, *one_past_end = p + size; + int textlen, id; int rc; // First two bytes: zero and text length @@ -388,7 +388,7 @@ static int traverse_entry(suunto_eonsteel_parser_t *eon, const unsigned char *p, // Two bytes of 'type' followed by the name/descriptor, followed by the data data = name + textlen; - type = array_uint16_le(name); + id = array_uint16_le(name); name += 2; if (*name != '<') { @@ -396,7 +396,7 @@ static int traverse_entry(suunto_eonsteel_parser_t *eon, const unsigned char *p, return -1; } - record_type(eon, type, (const char *) name, textlen-3); + record_type(eon, id, (const char *) name, textlen-3); end = data; last = data; @@ -982,8 +982,7 @@ static int traverse_samples(unsigned short type, const struct type_desc *desc, c info->ceiling = 0.0; for (i = 0; i < EON_MAX_GROUP; i++) { - enum eon_sample type = desc->type[i]; - int bytes = handle_sample_type(desc, info, type, data); + int bytes = handle_sample_type(desc, info, desc->type[i], data); if (!bytes) break; diff --git a/src/suunto_solution_parser.c b/src/suunto_solution_parser.c index 9b2ac9d..34aab7d 100644 --- a/src/suunto_solution_parser.c +++ b/src/suunto_solution_parser.c @@ -110,10 +110,10 @@ suunto_solution_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, u unsigned int depth = 0, maxdepth = 0; unsigned int offset = 3; while (offset < size && data[offset] != 0x80) { - unsigned char value = data[offset++]; - if (value < 0x7e || value > 0x82) { - depth += (signed char) value; - if (value == 0x7D || value == 0x83) { + unsigned char raw = data[offset++]; + if (raw < 0x7e || raw > 0x82) { + depth += (signed char) raw; + if (raw == 0x7D || raw == 0x83) { if (offset + 1 > size) return DC_STATUS_DATAFORMAT; depth += (signed char) data[offset++];