On 2012.09.15 12:13, Chuck Cook wrote:
> On 09/15/2012 06:31 AM, Hans de Goede wrote:
>> Note that for the code 0 which means success resp. completed we have an
>> overlap in the codes. This is not a problem since normally one would not
>> call libusb_error_name on success / normal completion.

 > How about returning NO_ERROR for code >= 0
 > and UNKNOWN_ERROR when code < 0 and doesn't match a defined error

I'd vote for Hans' approach of returning both codes. The point of the 
function is to convert an error code int to error code string. While 
LIBUSB_SUCCESS and LIBUSB_TRANSFER_COMPLETED are such an error code 
(albeit error codes that indicates that there wasn't any error), 
"NO_ERROR" isn't.

I think we may want to do something with regards to >0 codes however, as 
some people may use libusb_error_name on transfer type calls, that 
return a positive number on success and a negative error code on error.

Not sure what message we want to return then, as LIBUSB_SUCCESS would 
not really apply.

Or we can just keep the proposal, and stick with the idea that the call 
is meant to handle error codes and nothing else.

Otherwise, ack for the patch.

Regards,

/Pete



------------------------------------------------------------------------------
How fast is your code?
3 out of 4 devs don\\\'t know how their code performs in production.
Find out how slow your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219672;13503038;z?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to