Skip to content

Commit

Permalink
iiod: fix shadowed local variable in iiod
Browse files Browse the repository at this point in the history
Now that we turn this on by default, make sure that this is all OK.

Fixes the warning:
./iiod/ops.c: In function ‘send_data’:
./iiod/ops.c:431:16: warning: declaration of ‘len’ shadows a parameter [-Wshadow]
   ssize_t ret, len;
                ^~~
./iiod/ops.c:415:77: note: shadowed declaration is here
 static ssize_t send_data(struct DevEntry *dev, struct ThdEntry *thd, size_t len)
                                                                      ~~~~~~~^~~

Signed-off-by: Robin Getz <[email protected]>
  • Loading branch information
rgetz authored and dNechita committed Nov 11, 2020
1 parent 75573e6 commit 64f2e41
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions iiod/ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,20 +428,20 @@ static ssize_t send_data(struct DevEntry *dev, struct ThdEntry *thd, size_t len)
unsigned int i;
char buf[129], *ptr = buf;
uint32_t *mask = demux ? thd->mask : dev->mask;
ssize_t ret, len;
ssize_t ret, length;

len = sizeof(buf);
length = sizeof(buf);
/* Send the current mask */
for (i = dev->nb_words; i > 0 && ptr < buf + sizeof(buf);
i--, ptr += 8) {
iio_snprintf(ptr, len, "%08x", mask[i - 1]);
len -= 8;
iio_snprintf(ptr, length, "%08x", mask[i - 1]);
length -= 8;
}

*ptr = '\n';
len--;
length--;

if (len < 0) {
if (length < 0) {
IIO_ERROR("send_data: string length error\n");
return -ENOSPC;
}
Expand Down

0 comments on commit 64f2e41

Please sign in to comment.