2012/6/26 Pete Batard <p...@akeo.ie>: > On 2012.06.25 23:45, Pete Batard wrote: >> >> - The only real controversial addon is that "if (!dbg) UNUSED(dbg);" in >> libusb_init(), which is only there be OACR insists on wanting that >> variable tested no matter what, before exiting the call. I thought about >> somehow concealing this farce with a debug statement indicating whether >> the LIBUSB_DEBUG environmental variable existed... but that would be >> rather useless as such a debug statement would never appear unless you >> compile with forced debug (no context yet), and if you do, and knowing >> the status of LIBUSB_DEBUG becomes pointless anyway. > > > Not thinking straight here, which I guess is what happens when you've been > spending too much time addressing warnings. Of course the proper way to > address this is to assign the dbg variable just before the test, and not > sooner. > > v2 of the patch attached.
I think it is a bad news to replace strncpy() by a for() loop just because "WDK's OACR doesn't like strncpy..." If you need a secure strncpy then strlcpy is there. But it is a BSD variant. The code should be: strncpy(binary_name, argv[j+1], sizeof binary_name); binary_name[sizeof(binary_name) - 1] = '\0'; - use of sizeof instead of the "magic" number 64 - aways add a NUL byte at the end of the string I would prefer if each warning fix is in a different commit and if the warning message from the compiler is added to the commit message. It is hard to review a patch with many fixes mixed. For example I could not find in the commit message why the dbg variable assignation has moved. Bye -- Dr. Ludovic Rousseau ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel