diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-09-25 17:01:50 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-09-25 17:01:50 +0000 |
commit | d3f70d6eb0b90d09ce665dbb490d70937a3ec7ea (patch) | |
tree | 42d456a16e15e7867adf643fcf9f0530151f815b | |
parent | 5512d89be3d1f8c58bf5d62c6f493d0d6a4b3dab (diff) | |
download | glibc-d3f70d6eb0b90d09ce665dbb490d70937a3ec7ea.tar glibc-d3f70d6eb0b90d09ce665dbb490d70937a3ec7ea.tar.gz glibc-d3f70d6eb0b90d09ce665dbb490d70937a3ec7ea.tar.bz2 glibc-d3f70d6eb0b90d09ce665dbb490d70937a3ec7ea.zip |
* Makefile (LOCALES): Add zh_TW.EUC-TW.
-rw-r--r-- | localedata/ChangeLog | 4 | ||||
-rw-r--r-- | localedata/Makefile | 4 | ||||
-rw-r--r-- | wcsmbs/Makefile | 2 | ||||
-rw-r--r-- | wcsmbs/tst-mbrtowc2.c | 67 |
4 files changed, 74 insertions, 3 deletions
diff --git a/localedata/ChangeLog b/localedata/ChangeLog index 2274932c2b..db40dc6afd 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,7 @@ +2005-09-25 Ulrich Drepper <drepper@redhat.com> + + * Makefile (LOCALES): Add zh_TW.EUC-TW. + 2005-09-24 Ulrich Drepper <drepper@redhat.com> [BZ #668] diff --git a/localedata/Makefile b/localedata/Makefile index 0e554806d4..db22cf16e4 100644 --- a/localedata/Makefile +++ b/localedata/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1996-2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1996-2002, 2003, 2005 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -132,7 +132,7 @@ LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 \ en_US.ISO-8859-1 ja_JP.EUC-JP da_DK.ISO-8859-1 \ hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 ja_JP.SJIS fr_FR.ISO-8859-1 \ vi_VN.TCVN5712-1 nb_NO.ISO-8859-1 nn_NO.ISO-8859-1 \ - tr_TR.UTF-8 cs_CZ.UTF-8 + tr_TR.UTF-8 cs_CZ.UTF-8 zh_TW.EUC-TW LOCALE_SRCS := $(shell echo "$(LOCALES)"|sed 's/\([^ .]*\)[^ ]*/\1/g') CHARMAPS := $(shell echo "$(LOCALES)" | \ sed -e 's/[^ .]*[.]\([^ ]*\)/\1/g' -e s/SJIS/SHIFT_JIS/g) diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile index 78b3e5b4e7..65de855837 100644 --- a/wcsmbs/Makefile +++ b/wcsmbs/Makefile @@ -40,7 +40,7 @@ routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \ wcsmbsload mbsrtowcs_l tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \ - tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h + tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h tst-mbrtowc2 include ../Rules diff --git a/wcsmbs/tst-mbrtowc2.c b/wcsmbs/tst-mbrtowc2.c new file mode 100644 index 0000000000..a3639e99cb --- /dev/null +++ b/wcsmbs/tst-mbrtowc2.c @@ -0,0 +1,67 @@ +/* Derived from the test case in http://sourceware.org/bugzilla/show_bug.cgi?id=714 */ +#include <locale.h> +#include <stdio.h> +#include <string.h> +#include <wchar.h> + + +static struct +{ + const char *chp; + size_t nchp; + const char *loc; +} tests[] = +{ + { (const char[]) { 0x8F, 0xA2, 0xAF }, 3, "ja_JP.eucJP" }, + { (const char[]) { 0xD1, 0xA5 }, 2, "ja_JP.eucJP" }, + { (const char[]) { 0x8E, 0xA5 }, 2, "ja_JP.eucJP" }, + { (const char[]) { 0x8E, 0xA2, 0xA1, 0xA1 }, 4, "zh_TW.eucTW" }, + { (const char[]) { 0xA1, 0xA1 }, 2, "zh_TW.eucTW" }, + { (const char[]) { 0xE3, 0x80, 0x80 }, 3, "en_US.UTF-8" }, + { (const char[]) { 0xC3, 0xA4 }, 2, "en_US.UTF-8" } +}; +#define ntests (sizeof (tests) / sizeof (tests[0])) + + +static int t (const char *ch, size_t nch, const char *loc); + +static int +do_test (void) +{ + int r = 0; + for (int i = 0; i < ntests; ++i) + r |= t (tests[i].chp, tests[i].nchp, tests[i].loc); + return r; +} + +static int +t (const char *ch, size_t nch, const char *loc) +{ + int i; + wchar_t wch; + wchar_t wch2; + mbstate_t mbs; + int n = 0; + + setlocale (LC_ALL, loc); + + memset (&mbs, '\0', sizeof (mbstate_t)); + for (i = 0; i < nch; i++) + { + n = mbrtowc (&wch, ch + i, 1, &mbs); + if (n >= 0) + break; + } + printf ("n = %d, count = %d, wch = %08lX\n", n, i, (unsigned long int) wch); + + memset (&mbs, '\0', sizeof (mbstate_t)); + n = mbrtowc (&wch2, ch, nch, &mbs); + printf ("n = %d, wch = %08lX\n", n, (unsigned long int) wch2); + + int ret = n != nch || i + 1 != nch || n != nch || wch != wch2; + puts (ret ? "FAIL\n" : "OK\n"); + return ret; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" |