libftdi Archives

Subject: variable shadowing

From: xantares 09 <xantares09@xxxxxxxxxxx>
To: "libftdi@xxxxxxxxxxxxxxxxxxxxxxx" <libftdi@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 14 Sep 2014 10:38:36 +0000

hi,

in ftdi_stream.c:155, the return code declaration at beginnign of ftdi_readstream
int err = 0;
is overriden by at line 243 by:

do
    {
        FTDIProgressInfo  *progress = &state.progress;
        const double progressInterval = 1.0;
        struct timeval timeout = { 0, ftdi->usb_read_timeout };
        struct timeval now;

        int err = libusb_handle_events_timeout(ftdi->usb_ctx, &timeout);
        if (err ==  LIBUSB_ERROR_INTERRUPTED)
            /* restart interrupted events */
            err = libusb_handle_events_timeout(ftdi->usb_ctx, &timeout);


if the final return code should depend on the return code of libusb_handle_events_timeout,
it's a bug, if not a different name should be chosen.

here's a patch for a similar fix for a more trivial case in ftdi.c.

xan.


libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx


Attachment: 0001-Fix-declaration-shadow-in-ftdi.c.patch
Description: Binary data

Current Thread