mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-28 03:27:46 +08:00
Fix numeric and monetary decimal point and thousands separator in fa_IR and ps_AF locales
* nlsfuncs.cc (setlocaleinfo): New macro calling __setlocaleinfo. (__setlocaleinfo): New function to set a locale-specific character to an explicit wchar_t value. (__set_lc_numeric_from_win): Handle fa_IR and ps_AF locales to return same decimal point and thousands separator characters as on Linux. (__set_lc_monetary_from_win): Ditto for monetary characters. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
666a3482a5
commit
26a8b62e9a
@ -1,3 +1,12 @@
|
|||||||
|
2015-11-21 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* nlsfuncs.cc (setlocaleinfo): New macro calling __setlocaleinfo.
|
||||||
|
(__setlocaleinfo): New function to set a locale-specific character
|
||||||
|
to an explicit wchar_t value.
|
||||||
|
(__set_lc_numeric_from_win): Handle fa_IR and ps_AF locales to return
|
||||||
|
same decimal point and thousands separator characters as on Linux.
|
||||||
|
(__set_lc_monetary_from_win): Ditto for monetary characters.
|
||||||
|
|
||||||
2015-11-20 Corinna Vinschen <corinna@vinschen.de>
|
2015-11-20 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* common.din (strtold): Drop redirection to _strtold.
|
* common.din (strtold): Drop redirection to _strtold.
|
||||||
|
@ -31,6 +31,8 @@ details. */
|
|||||||
|
|
||||||
#define getlocaleinfo(category,type) \
|
#define getlocaleinfo(category,type) \
|
||||||
__getlocaleinfo(lcid,(type),_LC(category))
|
__getlocaleinfo(lcid,(type),_LC(category))
|
||||||
|
#define setlocaleinfo(category,val) \
|
||||||
|
__setlocaleinfo(_LC(category),(val))
|
||||||
#define eval_datetimefmt(type,flags) \
|
#define eval_datetimefmt(type,flags) \
|
||||||
__eval_datetimefmt(lcid,(type),(flags),&lc_time_ptr,\
|
__eval_datetimefmt(lcid,(type),(flags),&lc_time_ptr,\
|
||||||
lc_time_end-lc_time_ptr)
|
lc_time_end-lc_time_ptr)
|
||||||
@ -365,6 +367,20 @@ __getlocaleinfo (LCID lcid, LCTYPE type, char **ptr, size_t size)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static wchar_t *
|
||||||
|
__setlocaleinfo (char **ptr, size_t size, wchar_t val)
|
||||||
|
{
|
||||||
|
wchar_t *ret;
|
||||||
|
|
||||||
|
if ((uintptr_t) *ptr % 1)
|
||||||
|
++*ptr;
|
||||||
|
ret = (wchar_t *) *ptr;
|
||||||
|
ret[0] = val;
|
||||||
|
ret[1] = L'\0';
|
||||||
|
*ptr = (char *) (ret + 2);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
__charfromwchar (const wchar_t *in, char **ptr, size_t size,
|
__charfromwchar (const wchar_t *in, char **ptr, size_t size,
|
||||||
wctomb_p f_wctomb, const char *charset)
|
wctomb_p f_wctomb, const char *charset)
|
||||||
@ -868,11 +884,28 @@ __set_lc_numeric_from_win (const char *name,
|
|||||||
memcpy (_numeric_locale, _C_numeric_locale, sizeof (struct lc_numeric_T));
|
memcpy (_numeric_locale, _C_numeric_locale, sizeof (struct lc_numeric_T));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* decimal_point */
|
/* decimal_point and thousands_sep */
|
||||||
_numeric_locale->wdecimal_point = getlocaleinfo (numeric, LOCALE_SDECIMAL);
|
if (lcid == 0x0429) /* fa_IR. Windows decimal_point is slash,
|
||||||
|
correct is dot */
|
||||||
|
{
|
||||||
|
_numeric_locale->wdecimal_point = setlocaleinfo (numeric, L'.');
|
||||||
|
_numeric_locale->wthousands_sep = setlocaleinfo (numeric, L',');
|
||||||
|
}
|
||||||
|
else if (lcid == 0x0463) /* ps_AF. Windows decimal_point is dot,
|
||||||
|
thousands_sep is comma, correct are
|
||||||
|
arabic separators. */
|
||||||
|
{
|
||||||
|
_numeric_locale->wdecimal_point = setlocaleinfo (numeric, 0x066b);
|
||||||
|
_numeric_locale->wthousands_sep = setlocaleinfo (numeric, 0x066c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_numeric_locale->wdecimal_point = getlocaleinfo (numeric,
|
||||||
|
LOCALE_SDECIMAL);
|
||||||
|
_numeric_locale->wthousands_sep = getlocaleinfo (numeric,
|
||||||
|
LOCALE_STHOUSAND);
|
||||||
|
}
|
||||||
_numeric_locale->decimal_point = charfromwchar (numeric, wdecimal_point);
|
_numeric_locale->decimal_point = charfromwchar (numeric, wdecimal_point);
|
||||||
/* thousands_sep */
|
|
||||||
_numeric_locale->wthousands_sep = getlocaleinfo (numeric, LOCALE_STHOUSAND);
|
|
||||||
_numeric_locale->thousands_sep = charfromwchar (numeric, wthousands_sep);
|
_numeric_locale->thousands_sep = charfromwchar (numeric, wthousands_sep);
|
||||||
/* grouping */
|
/* grouping */
|
||||||
_numeric_locale->grouping = conv_grouping (lcid, LOCALE_SGROUPING,
|
_numeric_locale->grouping = conv_grouping (lcid, LOCALE_SGROUPING,
|
||||||
@ -953,14 +986,27 @@ __set_lc_monetary_from_win (const char *name,
|
|||||||
else
|
else
|
||||||
_monetary_locale->currency_symbol = charfromwchar (monetary,
|
_monetary_locale->currency_symbol = charfromwchar (monetary,
|
||||||
wcurrency_symbol);
|
wcurrency_symbol);
|
||||||
/* mon_decimal_point */
|
/* mon_decimal_point and mon_thousands_sep */
|
||||||
_monetary_locale->wmon_decimal_point = getlocaleinfo (monetary,
|
if (lcid == 0x0429 || lcid == 0x0463) /* fa_IR or ps_AF. Windows
|
||||||
LOCALE_SMONDECIMALSEP);
|
mon_decimal_point is slash
|
||||||
|
and comma, mon_thousands_sep
|
||||||
|
is comma and dot, correct
|
||||||
|
are arabic separators. */
|
||||||
|
{
|
||||||
|
_monetary_locale->wmon_decimal_point = setlocaleinfo (monetary,
|
||||||
|
0x066b);
|
||||||
|
_monetary_locale->wmon_thousands_sep = setlocaleinfo (monetary,
|
||||||
|
0x066c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_monetary_locale->wmon_decimal_point = getlocaleinfo (monetary,
|
||||||
|
LOCALE_SMONDECIMALSEP);
|
||||||
|
_monetary_locale->wmon_thousands_sep = getlocaleinfo (monetary,
|
||||||
|
LOCALE_SMONTHOUSANDSEP);
|
||||||
|
}
|
||||||
_monetary_locale->mon_decimal_point = charfromwchar (monetary,
|
_monetary_locale->mon_decimal_point = charfromwchar (monetary,
|
||||||
wmon_decimal_point);
|
wmon_decimal_point);
|
||||||
/* mon_thousands_sep */
|
|
||||||
_monetary_locale->wmon_thousands_sep = getlocaleinfo (monetary,
|
|
||||||
LOCALE_SMONTHOUSANDSEP);
|
|
||||||
_monetary_locale->mon_thousands_sep = charfromwchar (monetary,
|
_monetary_locale->mon_thousands_sep = charfromwchar (monetary,
|
||||||
wmon_thousands_sep);
|
wmon_thousands_sep);
|
||||||
/* mon_grouping */
|
/* mon_grouping */
|
||||||
|
@ -31,6 +31,9 @@ What changed:
|
|||||||
- setfacl(1) now allows to use the -b and -k option combined to allow reducing
|
- setfacl(1) now allows to use the -b and -k option combined to allow reducing
|
||||||
an ACL to only reflect standard POSIX permissions.
|
an ACL to only reflect standard POSIX permissions.
|
||||||
|
|
||||||
|
- Fix (numeric and monetary) decimal point and thousands separator in
|
||||||
|
fa_IR and ps_AF locales to be aligned with Linux.
|
||||||
|
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
---------
|
---------
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2015-11-21 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* new-features.xml (ov-new2.4): Document fa_IR and ps_AF locale fixes.
|
||||||
|
|
||||||
2015-11-18 Corinna Vinschen <corinna@vinschen.de>
|
2015-11-18 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* new-features.xml (ov-new2.4): Add new ACL changes.
|
* new-features.xml (ov-new2.4): Add new ACL changes.
|
||||||
|
@ -40,6 +40,11 @@ setfacl(1) now allows to use the -b and -k option combined to allow reducing
|
|||||||
an ACL to only reflect standard POSIX permissions.
|
an ACL to only reflect standard POSIX permissions.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
|
|
||||||
|
<listitem><para>
|
||||||
|
Fix (numeric and monetary) decimal point and thousands separator in
|
||||||
|
fa_IR and ps_AF locales to be aligned with Linux.
|
||||||
|
</para></listitem>
|
||||||
|
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
|
||||||
</sect2>
|
</sect2>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user