mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-05 19:35:52 +03:00
[BZ #2420]
* stdlib/strfmon_l.c (__vstrfmon_l): Fix handling of ! modifier. * localedata/Makefile: Add rules to build and run tst-strfmon1. * localedata/tst-strfmon1.c: New file.
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
2006-04-25 Ulrich Drepper <drepper@redhat.com>
|
2006-04-25 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
[BZ #2420]
|
||||||
|
* stdlib/strfmon_l.c (__vstrfmon_l): Fix handling of ! modifier.
|
||||||
|
* localedata/Makefile: Add rules to build and run tst-strfmon1.
|
||||||
|
* localedata/tst-strfmon1.c: New file.
|
||||||
|
|
||||||
[BZ #2571]
|
[BZ #2571]
|
||||||
* nscd/nscd_helper.c (__nscd_get_map_ref): Make mapptr argument a
|
* nscd/nscd_helper.c (__nscd_get_map_ref): Make mapptr argument a
|
||||||
volatile pointer so that the mapptr->mapped value is re-read after
|
volatile pointer so that the mapptr->mapped value is re-read after
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
2006-04-25 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
[BZ #2376]
|
||||||
|
* locales/es_UY: Change curreny_symbol.
|
||||||
|
|
||||||
2006-04-24 Ulrich Drepper <drepper@redhat.com>
|
2006-04-24 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
[BZ #2349]
|
[BZ #2349]
|
||||||
|
@@ -92,7 +92,8 @@ locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \
|
|||||||
tst_wctype tst_wcwidth
|
tst_wctype tst_wcwidth
|
||||||
|
|
||||||
tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
|
tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
|
||||||
tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale
|
tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
|
||||||
|
tst-strfmon1
|
||||||
ifeq (yes,$(build-shared))
|
ifeq (yes,$(build-shared))
|
||||||
ifneq (no,$(PERL))
|
ifneq (no,$(PERL))
|
||||||
tests: $(objpfx)mtrace-tst-leaks
|
tests: $(objpfx)mtrace-tst-leaks
|
||||||
@@ -282,6 +283,7 @@ tst-digits-ENV = $(TEST_MBWC_ENV)
|
|||||||
tst-mbswcs6-ENV = $(TEST_MBWC_ENV)
|
tst-mbswcs6-ENV = $(TEST_MBWC_ENV)
|
||||||
tst-xlocale1-ENV = $(TEST_MBWC_ENV)
|
tst-xlocale1-ENV = $(TEST_MBWC_ENV)
|
||||||
tst-xlocale2-ENV = $(TEST_MBWC_ENV)
|
tst-xlocale2-ENV = $(TEST_MBWC_ENV)
|
||||||
|
tst-strfmon1-ENV = $(TEST_MBWC_ENV)
|
||||||
|
|
||||||
tst-setlocale-ENV = LOCPATH=$(common-objpfx)localedata LC_ALL=ja_JP.EUC-JP
|
tst-setlocale-ENV = LOCPATH=$(common-objpfx)localedata LC_ALL=ja_JP.EUC-JP
|
||||||
|
|
||||||
|
@@ -62,7 +62,7 @@ END LC_MESSAGES
|
|||||||
|
|
||||||
LC_MONETARY
|
LC_MONETARY
|
||||||
int_curr_symbol "<U0055><U0059><U0055><U0020>"
|
int_curr_symbol "<U0055><U0059><U0055><U0020>"
|
||||||
currency_symbol "<U004E><U0024>"
|
currency_symbol "<U0024>"
|
||||||
mon_decimal_point "<U002C>"
|
mon_decimal_point "<U002C>"
|
||||||
mon_thousands_sep "<U002E>"
|
mon_thousands_sep "<U002E>"
|
||||||
mon_grouping 3;3
|
mon_grouping 3;3
|
||||||
|
42
localedata/tst-strfmon1.c
Normal file
42
localedata/tst-strfmon1.c
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#include <monetary.h>
|
||||||
|
#include <locale.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
const char *locale;
|
||||||
|
const char *expected;
|
||||||
|
} tests[] =
|
||||||
|
{
|
||||||
|
{ "de_DE.ISO-8859-1", "|-12,34 EUR|-12,34|" },
|
||||||
|
{ "da_DK.ISO-8859-1", "|kr -12,34|-12,34|" },
|
||||||
|
{ "zh_TW.EUC-TW", "|-NT$12.34|-12.34|" },
|
||||||
|
{ "sv_SE.ISO-8859-1", "|-12,34 kr|-12,34|" }
|
||||||
|
};
|
||||||
|
#define ntests (sizeof (tests) / sizeof (tests[0]))
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
do_test (void)
|
||||||
|
{
|
||||||
|
int res = 0;
|
||||||
|
for (int i = 0; i < ntests; ++i)
|
||||||
|
{
|
||||||
|
char buf[500];
|
||||||
|
if (setlocale (LC_ALL, tests[i].locale) == NULL)
|
||||||
|
{
|
||||||
|
printf ("failed to set locale %s\n", tests[i].locale);
|
||||||
|
res = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
strfmon (buf, sizeof (buf), "|%n|%!n|", -12.34, -12.34);
|
||||||
|
int fail = strcmp (buf, tests[i].expected) != 0;
|
||||||
|
printf ("%s%s\n", buf, fail ? " *** FAIL ***" : "");
|
||||||
|
res |= fail;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define TEST_FUNCTION do_test ()
|
||||||
|
#include "../test-skeleton.c"
|
@@ -486,23 +486,21 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (print_curr_symbol)
|
if (print_curr_symbol)
|
||||||
{
|
out_string (currency_symbol);
|
||||||
out_string (currency_symbol);
|
|
||||||
|
|
||||||
if (sign_posn == 4)
|
if (sign_posn == 4)
|
||||||
{
|
{
|
||||||
if (sep_by_space == 2)
|
if (print_curr_symbol && sep_by_space == 2)
|
||||||
out_char (space_char);
|
out_char (space_char);
|
||||||
out_string (sign_string);
|
out_string (sign_string);
|
||||||
if (sep_by_space == 1)
|
if (sep_by_space == 1)
|
||||||
/* POSIX.2 and SUS are not clear on this case, but C99
|
/* POSIX.2 and SUS are not clear on this case, but C99
|
||||||
says a space follows the adjacent-symbol-and-sign */
|
says a space follows the adjacent-symbol-and-sign */
|
||||||
out_char (' ');
|
out_char (' ');
|
||||||
}
|
|
||||||
else
|
|
||||||
if (sep_by_space == 1)
|
|
||||||
out_char (space_char);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if (print_curr_symbol && sep_by_space == 1)
|
||||||
|
out_char (space_char);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (sign_posn != 0 && sign_posn != 2 && sign_posn != 3
|
if (sign_posn != 0 && sign_posn != 2 && sign_posn != 3
|
||||||
@@ -561,12 +559,13 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
|
|||||||
|| (sign_posn == 0 && sep_by_space == 1))
|
|| (sign_posn == 0 && sep_by_space == 1))
|
||||||
out_char (space_char);
|
out_char (space_char);
|
||||||
out_nstring (currency_symbol, currency_symbol_len);
|
out_nstring (currency_symbol, currency_symbol_len);
|
||||||
if (sign_posn == 4)
|
}
|
||||||
{
|
|
||||||
if (sep_by_space == 2)
|
if (sign_posn == 4)
|
||||||
out_char (' ');
|
{
|
||||||
out_string (sign_string);
|
if (sep_by_space == 2)
|
||||||
}
|
out_char (' ');
|
||||||
|
out_string (sign_string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user