mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 04:50:07 +00:00
Update.
2001-05-21 Bruno Haible <haible@clisp.cons.org> * wcsmbs/mbrtowc.c (mbrtowc): Remove local variable 'flush', always use 0 instead, and rely on the converter to do the flush. * wcsmbs/tst-mbrtowc.c (utf8_test_1): New function, taken from utf8_test. (utf8_test_2, utf8_test_3): New function. (utf8_test): Call utf8_test_1, utf8_test_2, utf8_test_3.
This commit is contained in:
parent
1826d7933b
commit
e017830580
@ -1,3 +1,12 @@
|
|||||||
|
2001-05-21 Bruno Haible <haible@clisp.cons.org>
|
||||||
|
|
||||||
|
* wcsmbs/mbrtowc.c (mbrtowc): Remove local variable 'flush', always
|
||||||
|
use 0 instead, and rely on the converter to do the flush.
|
||||||
|
* wcsmbs/tst-mbrtowc.c (utf8_test_1): New function, taken from
|
||||||
|
utf8_test.
|
||||||
|
(utf8_test_2, utf8_test_3): New function.
|
||||||
|
(utf8_test): Call utf8_test_1, utf8_test_2, utf8_test_3.
|
||||||
|
|
||||||
2001-05-22 Jakub Jelinek <jakub@redhat.com>
|
2001-05-22 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* elf/dl-close.c (_dl_close): Save imap->l_reldeps, not map->l_reldeps.
|
* elf/dl-close.c (_dl_close): Save imap->l_reldeps, not map->l_reldeps.
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2001-05-21 Bruno Haible <haible@clisp.cons.org>
|
||||||
|
|
||||||
|
* tests-mbwc/dat_mbrlen.c (tst_mbrlen_loc): Use a private mbstate_t
|
||||||
|
for some tests, because mbrlen (NULL, 0, &s) does not always put back
|
||||||
|
s into the initial state.
|
||||||
|
|
||||||
2001-05-14 Andreas Jaeger <aj@suse.de>
|
2001-05-14 Andreas Jaeger <aj@suse.de>
|
||||||
|
|
||||||
* locales/ms_MY: Fix entries for Tue and Wednesday.
|
* locales/ms_MY: Fix entries for Tue and Wednesday.
|
||||||
|
@ -99,21 +99,15 @@ TST_MBRLEN tst_mbrlen_loc [] = {
|
|||||||
{ /*----------------- #01 -----------------*/
|
{ /*----------------- #01 -----------------*/
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ 1, "\317\302", 1, 0, 0 },
|
{ 1, "\317\302", 1, 1, 1 },
|
||||||
#ifdef SHOJI_IS_RIGHT
|
{ 0, "", 0, 1, 0 },
|
||||||
{ 0, "", 0, 0, 0 },
|
{ 1, "\317\302", USE_MBCURMAX, 1, 1 },
|
||||||
#else
|
|
||||||
/* XXX This test depends on the internal state being empty.
|
|
||||||
XXX Therefore we must explicitly clean it. */
|
|
||||||
{ 0, "", 0, 0, 1 },
|
|
||||||
#endif
|
|
||||||
{ 1, "\317\302", USE_MBCURMAX, 0, 0 },
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ 0, 1, -2, },
|
{ 0, 1, -2, },
|
||||||
{ 0, 1, 0, },
|
{ 0, 1, -1, },
|
||||||
{ 0, 1, 2, },
|
{ 0, 1, 2, },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
|||||||
size_t dummy;
|
size_t dummy;
|
||||||
const unsigned char *inbuf;
|
const unsigned char *inbuf;
|
||||||
char *outbuf = (char *) (pwc ?: buf);
|
char *outbuf = (char *) (pwc ?: buf);
|
||||||
int flush = 0;
|
|
||||||
|
|
||||||
/* Set information for this step. */
|
/* Set information for this step. */
|
||||||
data.__invocation_counter = 0;
|
data.__invocation_counter = 0;
|
||||||
@ -58,7 +57,6 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
|||||||
outbuf = (char *) buf;
|
outbuf = (char *) buf;
|
||||||
s = "";
|
s = "";
|
||||||
n = 1;
|
n = 1;
|
||||||
flush = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell where we want the result. */
|
/* Tell where we want the result. */
|
||||||
@ -72,7 +70,7 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
|||||||
inbuf = (const unsigned char *) s;
|
inbuf = (const unsigned char *) s;
|
||||||
status = DL_CALL_FCT (__wcsmbs_gconv_fcts.towc->__fct,
|
status = DL_CALL_FCT (__wcsmbs_gconv_fcts.towc->__fct,
|
||||||
(__wcsmbs_gconv_fcts.towc, &data, &inbuf, inbuf + n,
|
(__wcsmbs_gconv_fcts.towc, &data, &inbuf, inbuf + n,
|
||||||
NULL, &dummy, flush, 1));
|
NULL, &dummy, 0, 1));
|
||||||
|
|
||||||
/* There must not be any problems with the conversion but illegal input
|
/* There must not be any problems with the conversion but illegal input
|
||||||
characters. The output buffer must be large enough, otherwise the
|
characters. The output buffer must be large enough, otherwise the
|
||||||
|
@ -27,24 +27,18 @@
|
|||||||
|
|
||||||
static int check_ascii (const char *locname);
|
static int check_ascii (const char *locname);
|
||||||
|
|
||||||
/* Test for mbrtowc, contributed by Markus Kuhn <mkuhn@acm.org>. */
|
/* UTF-8 single byte feeding test for mbrtowc(),
|
||||||
|
contributed by Markus Kuhn <mkuhn@acm.org>. */
|
||||||
static int
|
static int
|
||||||
utf8_test (void)
|
utf8_test_1 (void)
|
||||||
{
|
{
|
||||||
/* UTF-8 single byte feeding test for mbrtowc(). */
|
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
mbstate_t s;
|
mbstate_t s;
|
||||||
const char *locale = "de_DE.UTF-8";
|
|
||||||
|
|
||||||
if (!setlocale (LC_CTYPE, locale))
|
|
||||||
{
|
|
||||||
fprintf (stderr, "locale '%s' not available!\n", locale);
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
wc = 42; /* arbitrary number */
|
wc = 42; /* arbitrary number */
|
||||||
memset (&s, 0, sizeof (s)); /* get s into initial state */
|
memset (&s, 0, sizeof (s)); /* get s into initial state */
|
||||||
assert (mbrtowc (&wc, "\xE2", 1, &s) == (size_t) - 2); /* 1st byte processed */
|
assert (mbrtowc (&wc, "\xE2", 1, &s) == (size_t) -2); /* 1st byte processed */
|
||||||
assert (mbrtowc (&wc, "\x89", 1, &s) == (size_t) - 2); /* 2nd byte processed */
|
assert (mbrtowc (&wc, "\x89", 1, &s) == (size_t) -2); /* 2nd byte processed */
|
||||||
assert (wc == 42); /* no value has not been stored into &wc yet */
|
assert (wc == 42); /* no value has not been stored into &wc yet */
|
||||||
assert (mbrtowc (&wc, "\xA0", 1, &s) == 1); /* 3nd byte processed */
|
assert (mbrtowc (&wc, "\xA0", 1, &s) == 1); /* 3nd byte processed */
|
||||||
assert (wc == 0x2260); /* E2 89 A0 = U+2260 (not equal) decoded correctly */
|
assert (wc == 0x2260); /* E2 89 A0 = U+2260 (not equal) decoded correctly */
|
||||||
@ -54,6 +48,93 @@ utf8_test (void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Test for NUL byte processing via empty string. */
|
||||||
|
static int
|
||||||
|
utf8_test_2 (void)
|
||||||
|
{
|
||||||
|
wchar_t wc;
|
||||||
|
mbstate_t s;
|
||||||
|
|
||||||
|
wc = 42; /* arbitrary number */
|
||||||
|
memset (&s, 0, sizeof (s)); /* get s into initial state */
|
||||||
|
assert (mbrtowc (NULL, "", 1, &s) == 0); /* valid terminator */
|
||||||
|
assert (mbsinit (&s));
|
||||||
|
|
||||||
|
wc = 42; /* arbitrary number */
|
||||||
|
memset (&s, 0, sizeof (s)); /* get s into initial state */
|
||||||
|
assert (mbrtowc (&wc, "\xE2", 1, &s) == (size_t) -2); /* 1st byte processed */
|
||||||
|
assert (mbrtowc (NULL, "", 1, &s) == (size_t) -1); /* invalid terminator */
|
||||||
|
|
||||||
|
wc = 42; /* arbitrary number */
|
||||||
|
memset (&s, 0, sizeof (s)); /* get s into initial state */
|
||||||
|
assert (mbrtowc (&wc, "\xE2", 1, &s) == (size_t) -2); /* 1st byte processed */
|
||||||
|
assert (mbrtowc (&wc, "\x89", 1, &s) == (size_t) -2); /* 2nd byte processed */
|
||||||
|
assert (mbrtowc (NULL, "", 1, &s) == (size_t) -1); /* invalid terminator */
|
||||||
|
|
||||||
|
wc = 42; /* arbitrary number */
|
||||||
|
memset (&s, 0, sizeof (s)); /* get s into initial state */
|
||||||
|
assert (mbrtowc (&wc, "\xE2", 1, &s) == (size_t) -2); /* 1st byte processed */
|
||||||
|
assert (mbrtowc (&wc, "\x89", 1, &s) == (size_t) -2); /* 2nd byte processed */
|
||||||
|
assert (mbrtowc (&wc, "\xA0", 1, &s) == 1); /* 3nd byte processed */
|
||||||
|
assert (mbrtowc (NULL, "", 1, &s) == 0); /* valid terminator */
|
||||||
|
assert (mbsinit (&s));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Test for NUL byte processing via NULL string. */
|
||||||
|
static int
|
||||||
|
utf8_test_3 (void)
|
||||||
|
{
|
||||||
|
wchar_t wc;
|
||||||
|
mbstate_t s;
|
||||||
|
|
||||||
|
wc = 42; /* arbitrary number */
|
||||||
|
memset (&s, 0, sizeof (s)); /* get s into initial state */
|
||||||
|
assert (mbrtowc (NULL, NULL, 0, &s) == 0); /* valid terminator */
|
||||||
|
assert (mbsinit (&s));
|
||||||
|
|
||||||
|
wc = 42; /* arbitrary number */
|
||||||
|
memset (&s, 0, sizeof (s)); /* get s into initial state */
|
||||||
|
assert (mbrtowc (&wc, "\xE2", 1, &s) == (size_t) -2); /* 1st byte processed */
|
||||||
|
assert (mbrtowc (NULL, NULL, 0, &s) == (size_t) -1); /* invalid terminator */
|
||||||
|
|
||||||
|
wc = 42; /* arbitrary number */
|
||||||
|
memset (&s, 0, sizeof (s)); /* get s into initial state */
|
||||||
|
assert (mbrtowc (&wc, "\xE2", 1, &s) == (size_t) -2); /* 1st byte processed */
|
||||||
|
assert (mbrtowc (&wc, "\x89", 1, &s) == (size_t) -2); /* 2nd byte processed */
|
||||||
|
assert (mbrtowc (NULL, NULL, 0, &s) == (size_t) -1); /* invalid terminator */
|
||||||
|
|
||||||
|
wc = 42; /* arbitrary number */
|
||||||
|
memset (&s, 0, sizeof (s)); /* get s into initial state */
|
||||||
|
assert (mbrtowc (&wc, "\xE2", 1, &s) == (size_t) -2); /* 1st byte processed */
|
||||||
|
assert (mbrtowc (&wc, "\x89", 1, &s) == (size_t) -2); /* 2nd byte processed */
|
||||||
|
assert (mbrtowc (&wc, "\xA0", 1, &s) == 1); /* 3nd byte processed */
|
||||||
|
assert (mbrtowc (NULL, NULL, 0, &s) == 0); /* valid terminator */
|
||||||
|
assert (mbsinit (&s));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
utf8_test (void)
|
||||||
|
{
|
||||||
|
const char *locale = "de_DE.UTF-8";
|
||||||
|
int error = 0;
|
||||||
|
|
||||||
|
if (!setlocale (LC_CTYPE, locale))
|
||||||
|
{
|
||||||
|
fprintf (stderr, "locale '%s' not available!\n", locale);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
error |= utf8_test_1 ();
|
||||||
|
error |= utf8_test_2 ();
|
||||||
|
error |= utf8_test_3 ();
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (void)
|
main (void)
|
||||||
|
Loading…
Reference in New Issue
Block a user