Re: [Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-09 Thread Pete Batard
I have now pushed the strerror commit to mainline (with the added benefit of fixing the nano). On 2013.06.09 07:34, Hans de Goede wrote:> +if (i >= ARRAYSIZE(usbi_locale_supported)) { > +usbi_warn(NULL, "Unrecognized locale format: %s", locale); > +return LIBUSB_ERROR_NOT_F

Re: [Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-09 Thread Ludovic Rousseau
2013/6/9 Pete Batard : > diff --git a/examples/xusb.c b/examples/xusb.c > index 4e2f6a5..cae3d82 100644 > --- a/examples/xusb.c > +++ b/examples/xusb.c > uint16_t endian_test = 0xBE00; > + char* error_lang = NULL; @@ -1009,6 +1010,13 @@ int main(int argc, char** argv)

Re: [Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-08 Thread Hans de Goede
Hi, On 06/09/2013 02:28 AM, Pete Batard wrote: > On 2013.06.08 19:22, Hans de Goede wrote: >> a dash or a dot, ie accept "nl.UTF-8". > > Good point. > >> Ok, so lets modify your proposal with an INVALAD_PARAM check then, and >> move forward with your proposal. > > OK. If I understand the rest of y

Re: [Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-08 Thread Pete Batard
On 2013.06.08 19:22, Hans de Goede wrote: a dash or a dot, ie accept "nl.UTF-8". Good point. Ok, so lets modify your proposal with an INVALAD_PARAM check then, and move forward with your proposal. OK. If I understand the rest of your message properly, you don't want the function with the s

Re: [Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-08 Thread Hans de Goede
Hi, On 06/08/2013 04:56 PM, Pete Batard wrote: > On 2013.06.08 13:05, Hans de Goede wrote: >> 1) You simplify the setlocale function > > Well, duh. > > I think I've been pretty clear that I've been trying to spend the least > amount of time I can looking at this localization charade. > But if y

Re: [Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-08 Thread Ludovic Rousseau
2013/6/8 Pete Batard : > On 2013.06.08 16:39, Ludovic Rousseau wrote: >> If you don't want to invest more time than needed then just provide >> the missing MSVC and mingw changes. >> But you _also_ had time to rewrite a working code. > > Indeed. The choice was: Do I want to leave libusbx with a sol

Re: [Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-08 Thread Pete Batard
On 2013.06.08 16:39, Ludovic Rousseau wrote: > If you don't want to invest more time than needed then just provide > the missing MSVC and mingw changes. > But you _also_ had time to rewrite a working code. Indeed. The choice was: Do I want to leave libusbx with a solution that will make it more d

Re: [Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-08 Thread Ludovic Rousseau
2013/6/8 Pete Batard : > As pointed out above, I'm not using "tricks" because I have to, but > because I didn't want to waste more time than needed on this, and I fail > to see the part where there's something fundamentally tricky about > converting something into a bounded array index to reference

Re: [Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-08 Thread Pete Batard
On 2013.06.08 13:05, Hans de Goede wrote: > Not working because of the project file issues, or did you find other > issues too ? MSVC was not working because strerror.c was not referenced. MinGW was not working because it is referencing the dll by default, and the .def file used to generate the i

Re: [Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-08 Thread Hans de Goede
Hi, On 06/08/2013 12:31 AM, Pete Batard wrote: > On 2013.06.07 08:05, Ludovic Rousseau wrote: >> It is too late to rewrite exiting and working code. > > How is it too late? > This code has not been integrated and furthermore was proposed for review. > Also, it does not work, since it breaks Window

Re: [Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-07 Thread Pete Batard
On 2013.06.07 08:05, Ludovic Rousseau wrote: It is too late to rewrite exiting and working code. How is it too late? This code has not been integrated and furthermore was proposed for review. Also, it does not work, since it breaks Windows (see below). Unless you have a lot of free time :-)

Re: [Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-07 Thread Ludovic Rousseau
2013/6/7 Pete Batard : > How does that sound? I can produce a formal patch if you like this > solution enough. It is too late to rewrite exiting and working code. Unless you have a lot of free time :-) And I prefer Hans version. Bye -- Dr. Ludovic Rousseau

Re: [Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-06 Thread Pete Batard
Sorry for the late reply, > 2013/6/5 Hans de Goede : >> +int API_EXPORTED libusb_setlocale(const char *locale) >> +{ >> + const char * const iso639[] = { >> + /* Note the order here MUST match the libusb_locale_enum */ >> + "en", /* LANG_EN */ >> + "

Re: [Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-06 Thread Ludovic Rousseau
2013/6/5 Hans de Goede : > +++ b/libusb/strerror.c > @@ -0,0 +1,205 @@ > +/** \ingroup misc > + * Set the language, and only the language, not the encoding! used for > + * translatable libusb messages. > + * > + * This takes a locale string in the default setlocale format: > + * lang[_country_regi

Re: [Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-05 Thread Hans de Goede
Hi, On 06/05/2013 12:39 PM, Hans de Goede wrote: > diff --git a/libusb/strerror.c b/libusb/strerror.c > new file mode 100644 > index 000..bea75a3 > --- /dev/null > +++ b/libusb/strerror.c > @@ -0,0 +1,205 @@ > +/* > + * libusb strerror code > + * Copyright © 2013 Hans de Goede > + * > + *

[Libusbx-devel] [PATCH] Add a libusb_strerror() function

2013-06-05 Thread Hans de Goede
This patch adds the much requested libusb_strerror() function, taking into account all issues people raised wrt previous attempts. Criteria / Decisions underlying this implementation: -Must support translated messages -Must not use gettext as that does not work well in combination with Windows (w

[Libusbx-devel] [PATCH] Add a libusb_strerror() function v2

2013-06-05 Thread Hans de Goede
Hi All, Here is a new version of my libusb_strerror() function, following my new proposal discussed earlier. Regards, Hans -- How ServiceNow helps IT people transform IT departments: 1. A cloud service to automate IT de