Hi,

On 05/30/2013 12:17 AM, Sean McBride wrote:
> On Thu, 30 May 2013 00:17:11 +0200, Hans de Goede said:
>
>>> IMHO you should use LC_MESSAGES in the usual way instead
>>> of inventing your own API.  I.e. libusb_strerror() internally
>>> calls setlocale(LC_MESSAGES, NULL) to query the locale.
>>
>> Which is exactly what it does when the apps does not make any
>> call to libusb_set_strerror_locale() itself...
>
> Wait, setlocale() queries the locale?

Yes.

> Wouldn't that be getlocale()?  With a name like setlocale(), and from my 
> reading of the man page, that API changes the locale, does it not?

If you pass in a second argument it changes things, if you pass
in NULL it queries the current settings, quoting from the manpage:

"If locale is NULL, the current locale is only queried, not modified."

"RETURN VALUE
        A  successful  call to setlocale() returns an opaque string that corre‐
        sponds to the locale set."

 > As a library, it doesn't seem right for libusb to be changing the process' 
 > locale settings.

And my proposal does not do that, it queries the current setting and uses that
unless the user explicitly sets a language for libusb_strerror itself with
libusb_set_strerror_locale().

Regards,

Hans

------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to