On 2013.09.02 05:52, Xiaofan Chen wrote:
> On Sat, Aug 31, 2013 at 12:21 AM, Gisle Vanem wrote:
>> when I'm using '-Wp64' in my CFLAGS.
This flag does not exist in VS2012.
>> "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.
Unless you go pedantic, I wouldn't want compilers to warn on size_t to
ssize_t conversions, because that's something people are going to do all
the time, and the expectation is that developers doing such conversion
are fully aware that they're going to lose a bit for the sign when using
super large values.
As such, I'm not planning to take any action to silence these in the
code, especially as we're talking about the number of discovered devices
for the core.c one (=> someone would need more than 2 billion of those
connected on one machine for this to become an actual issue) and
likewise, you'll need the OS to supply us with a > 2 GB device string
for the windows_usb.c one. Not gonna happen.
Also, as Xiaofan highlighted, and since we don't really have the scope
to to fix warnings for every compiler, below is the list of those I
would consider canon, or officially supported, for libusb(x)/Windows:
- Visual Studio 2012
- WDK 7600
- relatively recent version of MinGW32
- relatively recent version of MinGW-w64
- relatively recent on cygwin
If you get a warning that isn't for a real issue and that isn't going to
appear in any of the compilers above, I will expect you to fix it in
your solution files.
Now, of course, you will notice that we have VS2010 and VS2005 and even
MSVC6 solution files, but we make no promise that these are up to date
or even in working state. Of course, if you want to send a patch that we
can apply to these solution files, we'll have no problem applying them.
>> - priv->depth = parent_priv->depth + 1;
>> + priv->depth = 0xff & (parent_priv->depth + 1);
>
> Hmm, I think this is not needed since depth can not be
> more than 8 as per USB standard.
Yeah. I distinctively remember looking for the maximum numbers of hubs
that an USB device could go through, with regards to this line of code,
and concluding that we could safely ignore the overflow. If we are going
to change that line, it'd be to add a message that says
"Congratulations, you ignored the USB specs and must have horrendous
latency."
Thus, unless we get that warning in one of the canon compilers, I'm not
planning to do anything here.
I other news, I have now pushed a fix for the VS2012/x64 conversion warning.
Regards,
/Pete
--
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