On Sat, Aug 31, 2013 at 12:21 AM, Gisle Vanem <gisle.va...@gmail.com> wrote:
> Good job, but there are some warnings from MSVC v16

Is that Visual C++ 2010?

> when I'm
> using '-Wp64' in my CFLAGS.  "enable 64 bit porting warnings".
> I'm on a 32-bit WIndows:
>
> libusb/core.c(692) : warning C4267: '=' : conversion from 'size_t' to 
> 'ssize_t', possible loss of data
> libusb/os/windows_usb.c(173) : warning C4267: '=' : conversion from 'size_t' 
> to 'ssize_t', possible loss of data
>
> I'm not sure these matters.

Did you see this with the default Visual C++2010 solution file settings
for the 64bit build? I remember Pete's stand is to fix the warnings
for the default settings but selective in fixing the warnings for
non-default settings.

> Also (maybe more serious). If I build a debug-version with '-RTCc'
> ("Convert to smaller type checks"), line 1117 in libusb/os/windows_usb.c
> triggers a runtime-check since the line:
>    priv->depth = parent_priv->depth + 1
>
> could possibly overflow (acording to the compiler at least).
> This patch fixed it. But again, I'm not sure it matters:
>
> --- Git-latest/libusb/os/windows_usb.c  2013-08-28 19:13:58 +0000
> +++ libusb/os/windows_usb.c     2013-08-30 16:14:29 +0000
> @@ -1114,7 +1114,7 @@
>         dev->bus_number = parent_dev->bus_number;
>         priv->port = port_number;
>         dev->port_number = port_number;
> -       priv->depth = parent_priv->depth + 1;
> +       priv->depth = 0xff & (parent_priv->depth + 1);
>         priv->parent_dev = parent_dev;
>         dev->parent_dev = libusb_ref_device(parent_dev);
>

Hmm, I think this is not needed since depth can not be
more than 8 as per USB standard.


-- 
Xiaofan

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to