On 2012.06.30 11:15, Xiaofan Chen wrote: > The patch reduced some warnings but there are still 3 warnings > remained. Actually the three warnings are basically the same though.
> ../../libusbx/libusb/sync.c:84:28: warning: Result of 'malloc' is > converted to a pointer of type 'unsigned char', which is incompatible > with sizeof operand type 'struct libusb_control_setup' > buffer = (unsigned char*) malloc(LIBUSB_CONTROL_SETUP_SIZE + > wLength); > ~~~~~~~~~~~~~~ ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~ > ../../libusbx/examples/dpfp.c:167:40: warning: Result of 'malloc' is > converted to a pointer of type 'unsigned char', which is incompatible > with sizeof operand type 'struct libusb_control_setup' > unsigned char *buf = (unsigned char*) > malloc(LIBUSB_CONTROL_SETUP_SIZE + 1); > ~~~~~~~~~~~~~~~ ^~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~ > ../../libusbx/examples/dpfp_threaded.c:196:40: warning: Result of > 'malloc' is converted to a pointer of type 'unsigned char', which is > incompatible with sizeof operand type 'struct libusb_control_setup' > unsigned char *buf = (unsigned char*) > malloc(LIBUSB_CONTROL_SETUP_SIZE + 1); > ~~~~~~~~~~~~~~~ ^~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~ Then it seems Clang is trying to be too much of a smart ass here, which, fortunately, the Clang developers also appear to have recently noticed [1]. I propose to wait for versions of Clang post r158219 to see if the false positive still occur, as I would expect the issue to have been fixed then. Also note that I am currently not planning to revert the (unsigned char*) cast, that have been added with the patch, since the Visual Studio IDE tends to complain about these if not present. But if someone has strong objections, I don't mind removing them. I will alter the patch comments when committing however, to point to the Clang discussion. Regards, /Pete [1] http://permalink.gmane.org/gmane.comp.compilers.clang.scm/52142 ------------------------------------------------------------------------------ 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