From: Uwe Hermann Date: Wed, 16 May 2018 20:49:22 +0000 (+0200) Subject: sr_analog_to_float(): Fix multiple compiler warnings (-Wshadow). X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=0519db864bcf445ba22c9be632ac4f58bed67044;p=libsigrok.git sr_analog_to_float(): Fix multiple compiler warnings (-Wshadow). src/analog.c:205:23: warning: declaration of ā€˜iā€™ shadows a previous local [-Wshadow] for (unsigned int i = 0; i < count; i++) { ^ src/analog.c:178:18: note: shadowed declaration is here unsigned int b, i, count; ^ [...] --- diff --git a/src/analog.c b/src/analog.c index 9b2977e9..6511de51 100644 --- a/src/analog.c +++ b/src/analog.c @@ -174,7 +174,7 @@ SR_PRIV int sr_analog_init(struct sr_datafeed_analog *analog, SR_API int sr_analog_to_float(const struct sr_datafeed_analog *analog, float *outbuf) { - unsigned int b, i, count; + unsigned int b, count; gboolean bigendian; if (!analog || !(analog->data) || !(analog->meaning) @@ -274,7 +274,7 @@ SR_API int sr_analog_to_float(const struct sr_datafeed_analog *analog, /* The data is already in the right format. */ memcpy(outbuf, analog->data, count * sizeof(float)); } else { - for (i = 0; i < count; i += analog->encoding->unitsize) { + for (unsigned int i = 0; i < count; i += analog->encoding->unitsize) { for (b = 0; b < analog->encoding->unitsize; b++) { if (analog->encoding->is_bigendian == bigendian) ((uint8_t *)outbuf)[i + b] =