Drop has_localenames flag
This commit is contained in:
parent
ed0ff4b940
commit
94f98f18db
@ -79,8 +79,7 @@ __get_lcid_from_locale (const char *name)
|
|||||||
c = strchr (locale, '_');
|
c = strchr (locale, '_');
|
||||||
if (!c)
|
if (!c)
|
||||||
return last_lcid = (LCID) -1;
|
return last_lcid = (LCID) -1;
|
||||||
if (wincap.has_localenames ())
|
|
||||||
{
|
|
||||||
wchar_t wlocale[ENCODING_LEN + 1];
|
wchar_t wlocale[ENCODING_LEN + 1];
|
||||||
|
|
||||||
/* Convert to RFC 4646 syntax which is the standard for the locale names
|
/* Convert to RFC 4646 syntax which is the standard for the locale names
|
||||||
@ -155,91 +154,6 @@ __get_lcid_from_locale (const char *name)
|
|||||||
debug_printf ("LCID=%04y", last_lcid);
|
debug_printf ("LCID=%04y", last_lcid);
|
||||||
return last_lcid;
|
return last_lcid;
|
||||||
}
|
}
|
||||||
/* Pre-Vista we have to loop through the LCID values and see if they
|
|
||||||
match language and TERRITORY. */
|
|
||||||
*c++ = '\0';
|
|
||||||
/* locale now points to the language, c points to the TERRITORY */
|
|
||||||
const char *language = locale;
|
|
||||||
const char *territory = c;
|
|
||||||
LCID lang, sublang;
|
|
||||||
char iso[10];
|
|
||||||
|
|
||||||
/* In theory the lang part takes 10 bits (0x3ff), but up to Windows 2003 R2
|
|
||||||
the highest lang value is 0x81. */
|
|
||||||
for (lang = 1; lang <= 0x81; ++lang)
|
|
||||||
if (GetLocaleInfo (lang, LOCALE_SISO639LANGNAME, iso, 10)
|
|
||||||
&& !strcmp (language, iso))
|
|
||||||
break;
|
|
||||||
if (lang > 0x81)
|
|
||||||
lcid = 0;
|
|
||||||
else if (!territory)
|
|
||||||
lcid = lang;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* In theory the sublang part takes 7 bits (0x3f), but up to
|
|
||||||
Windows 2003 R2 the highest sublang value is 0x14. */
|
|
||||||
for (sublang = 1; sublang <= 0x14; ++sublang)
|
|
||||||
{
|
|
||||||
lcid = (sublang << 10) | lang;
|
|
||||||
if (GetLocaleInfo (lcid, LOCALE_SISO3166CTRYNAME, iso, 10)
|
|
||||||
&& !strcmp (territory, iso))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (sublang > 0x14)
|
|
||||||
lcid = 0;
|
|
||||||
}
|
|
||||||
if (lcid == 0 && territory)
|
|
||||||
{
|
|
||||||
/* Unfortunately there are four language LCID number areas representing
|
|
||||||
multiple languages. Fortunately only two of them already existed
|
|
||||||
pre-Vista. The concealed languages have to be tested explicitly,
|
|
||||||
since they are not catched by the above loops.
|
|
||||||
This also enables the serbian ISO 3166 territory codes which have
|
|
||||||
been changed post 2003, and maps them to the old wrong (SP was never
|
|
||||||
a valid ISO 3166 code) territory code sr_SP which fortunately has the
|
|
||||||
same LCID as the newer sr_CS.
|
|
||||||
Linux also supports no_NO which is equivalent to nb_NO. */
|
|
||||||
struct {
|
|
||||||
const char *loc;
|
|
||||||
LCID lcid;
|
|
||||||
} ambiguous_locale[] = {
|
|
||||||
{ "bs_BA", MAKELANGID (LANG_BOSNIAN, 0x05) },
|
|
||||||
{ "nn_NO", MAKELANGID (LANG_NORWEGIAN, SUBLANG_NORWEGIAN_NYNORSK) },
|
|
||||||
{ "no_NO", MAKELANGID (LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL) },
|
|
||||||
{ "sr_BA", MAKELANGID (LANG_BOSNIAN,
|
|
||||||
SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC) },
|
|
||||||
{ "sr_CS", MAKELANGID (LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC) },
|
|
||||||
{ "sr_ME", MAKELANGID (LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC) },
|
|
||||||
{ "sr_RS", MAKELANGID (LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC) },
|
|
||||||
{ "sr_SP", MAKELANGID (LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC) },
|
|
||||||
{ NULL, 0 },
|
|
||||||
};
|
|
||||||
*--c = '_';
|
|
||||||
for (int i = 0; ambiguous_locale[i].loc
|
|
||||||
&& ambiguous_locale[i].loc[0] <= locale[0]; ++i)
|
|
||||||
if (!strcmp (locale, ambiguous_locale[i].loc)
|
|
||||||
&& GetLocaleInfo (ambiguous_locale[i].lcid, LOCALE_SISO639LANGNAME,
|
|
||||||
iso, 10))
|
|
||||||
{
|
|
||||||
lcid = ambiguous_locale[i].lcid;
|
|
||||||
/* "@latin" modifier for the sr_XY locales changes collation
|
|
||||||
behaviour so lcid should accommodate that by being set to
|
|
||||||
the Latin sublang. */
|
|
||||||
if (!strncmp (locale, "sr_", 3) && has_modifier ("@latin"))
|
|
||||||
lcid = MAKELANGID (lcid & 0x3ff, (lcid >> 10) - 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (lcid == 0x0443) /* uz_UZ (Uzbek/Uzbekistan) */
|
|
||||||
{
|
|
||||||
/* Equivalent for "@cyrillic" modifier in uz_UZ locale */
|
|
||||||
if (lcid != 0 && has_modifier ("@cyrillic"))
|
|
||||||
lcid = MAKELANGID (lcid & 0x3ff, (lcid >> 10) + 1);
|
|
||||||
}
|
|
||||||
last_lcid = lcid ?: (LCID) -1;
|
|
||||||
debug_printf ("LCID=%04y", last_lcid);
|
|
||||||
return last_lcid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Never returns -1. Just skips invalid chars instead. Only if return_invalid
|
/* Never returns -1. Just skips invalid chars instead. Only if return_invalid
|
||||||
is set, s==NULL returns -1 since then it's used to recognize invalid strings
|
is set, s==NULL returns -1 since then it's used to recognize invalid strings
|
||||||
|
@ -25,7 +25,6 @@ wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||||||
has_gaa_largeaddress_bug:false,
|
has_gaa_largeaddress_bug:false,
|
||||||
has_transactions:false,
|
has_transactions:false,
|
||||||
has_broken_alloc_console:false,
|
has_broken_alloc_console:false,
|
||||||
has_localenames:false,
|
|
||||||
has_fast_cwd:false,
|
has_fast_cwd:false,
|
||||||
has_restricted_raw_disk_access:false,
|
has_restricted_raw_disk_access:false,
|
||||||
use_dont_resolve_hack:true,
|
use_dont_resolve_hack:true,
|
||||||
@ -52,7 +51,6 @@ wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||||||
has_gaa_largeaddress_bug:false,
|
has_gaa_largeaddress_bug:false,
|
||||||
has_transactions:false,
|
has_transactions:false,
|
||||||
has_broken_alloc_console:false,
|
has_broken_alloc_console:false,
|
||||||
has_localenames:false,
|
|
||||||
has_fast_cwd:false,
|
has_fast_cwd:false,
|
||||||
has_restricted_raw_disk_access:false,
|
has_restricted_raw_disk_access:false,
|
||||||
use_dont_resolve_hack:true,
|
use_dont_resolve_hack:true,
|
||||||
@ -79,7 +77,6 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||||||
has_gaa_largeaddress_bug:true,
|
has_gaa_largeaddress_bug:true,
|
||||||
has_transactions:true,
|
has_transactions:true,
|
||||||
has_broken_alloc_console:false,
|
has_broken_alloc_console:false,
|
||||||
has_localenames:true,
|
|
||||||
has_fast_cwd:true,
|
has_fast_cwd:true,
|
||||||
has_restricted_raw_disk_access:true,
|
has_restricted_raw_disk_access:true,
|
||||||
use_dont_resolve_hack:false,
|
use_dont_resolve_hack:false,
|
||||||
@ -106,7 +103,6 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||||||
has_gaa_largeaddress_bug:true,
|
has_gaa_largeaddress_bug:true,
|
||||||
has_transactions:true,
|
has_transactions:true,
|
||||||
has_broken_alloc_console:true,
|
has_broken_alloc_console:true,
|
||||||
has_localenames:true,
|
|
||||||
has_fast_cwd:true,
|
has_fast_cwd:true,
|
||||||
has_restricted_raw_disk_access:true,
|
has_restricted_raw_disk_access:true,
|
||||||
use_dont_resolve_hack:false,
|
use_dont_resolve_hack:false,
|
||||||
@ -133,7 +129,6 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||||||
has_gaa_largeaddress_bug:false,
|
has_gaa_largeaddress_bug:false,
|
||||||
has_transactions:true,
|
has_transactions:true,
|
||||||
has_broken_alloc_console:true,
|
has_broken_alloc_console:true,
|
||||||
has_localenames:true,
|
|
||||||
has_fast_cwd:true,
|
has_fast_cwd:true,
|
||||||
has_restricted_raw_disk_access:true,
|
has_restricted_raw_disk_access:true,
|
||||||
use_dont_resolve_hack:false,
|
use_dont_resolve_hack:false,
|
||||||
@ -160,7 +155,6 @@ wincaps wincap_10 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||||||
has_gaa_largeaddress_bug:false,
|
has_gaa_largeaddress_bug:false,
|
||||||
has_transactions:true,
|
has_transactions:true,
|
||||||
has_broken_alloc_console:true,
|
has_broken_alloc_console:true,
|
||||||
has_localenames:true,
|
|
||||||
has_fast_cwd:true,
|
has_fast_cwd:true,
|
||||||
has_restricted_raw_disk_access:true,
|
has_restricted_raw_disk_access:true,
|
||||||
use_dont_resolve_hack:false,
|
use_dont_resolve_hack:false,
|
||||||
@ -187,7 +181,6 @@ wincaps wincap_10_1511 __attribute__((section (".cygwin_dll_common"), shared)) =
|
|||||||
has_gaa_largeaddress_bug:false,
|
has_gaa_largeaddress_bug:false,
|
||||||
has_transactions:true,
|
has_transactions:true,
|
||||||
has_broken_alloc_console:true,
|
has_broken_alloc_console:true,
|
||||||
has_localenames:true,
|
|
||||||
has_fast_cwd:true,
|
has_fast_cwd:true,
|
||||||
has_restricted_raw_disk_access:true,
|
has_restricted_raw_disk_access:true,
|
||||||
use_dont_resolve_hack:false,
|
use_dont_resolve_hack:false,
|
||||||
|
@ -18,7 +18,6 @@ struct wincaps
|
|||||||
unsigned has_gaa_largeaddress_bug : 1;
|
unsigned has_gaa_largeaddress_bug : 1;
|
||||||
unsigned has_transactions : 1;
|
unsigned has_transactions : 1;
|
||||||
unsigned has_broken_alloc_console : 1;
|
unsigned has_broken_alloc_console : 1;
|
||||||
unsigned has_localenames : 1;
|
|
||||||
unsigned has_fast_cwd : 1;
|
unsigned has_fast_cwd : 1;
|
||||||
unsigned has_restricted_raw_disk_access : 1;
|
unsigned has_restricted_raw_disk_access : 1;
|
||||||
unsigned use_dont_resolve_hack : 1;
|
unsigned use_dont_resolve_hack : 1;
|
||||||
@ -70,7 +69,6 @@ public:
|
|||||||
bool IMPLEMENT (has_gaa_largeaddress_bug)
|
bool IMPLEMENT (has_gaa_largeaddress_bug)
|
||||||
bool IMPLEMENT (has_transactions)
|
bool IMPLEMENT (has_transactions)
|
||||||
bool IMPLEMENT (has_broken_alloc_console)
|
bool IMPLEMENT (has_broken_alloc_console)
|
||||||
bool IMPLEMENT (has_localenames)
|
|
||||||
bool IMPLEMENT (has_fast_cwd)
|
bool IMPLEMENT (has_fast_cwd)
|
||||||
bool IMPLEMENT (has_restricted_raw_disk_access)
|
bool IMPLEMENT (has_restricted_raw_disk_access)
|
||||||
bool IMPLEMENT (use_dont_resolve_hack)
|
bool IMPLEMENT (use_dont_resolve_hack)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user