/* * Callback function for EnumSystemLocalesEx. * Stop enumerating if a match is found for a locale with the format * <Language>_<Country>. * The order for search locale is essential: * Find LCType first as LOCALE_SNAME, if not found try LOCALE_SENGLISHLANGUAGENAME and * finally LOCALE_SENGLISHCOUNTRYNAME, before return. */
Typo "enumarating".
I would not call the order essential, is just meant to try the easier ways first: is already "ISO" formatted !-> is just a "language" !-> is a full "language_country" tag.
I take note about "enumarating".
2. Maybe the fail has here:
if (hyphen == NULL || underscore == NULL)
Change || to &&, the logical is wrong?
If the Windows locale does not have a hyphen ("aa") *or* the lc_message does not have an underscore ("Afar"), only a comparison on language is needed.
3. Why iso_lc_messages[0] = '\0'?
If we go call strchr, soon after, it's a waste.
Less code churn, and strchr() againts an empty string did not look too awful.
I would like to find were the errors come from before sending a new version, can you reproduce them?