aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-11-19 09:09:27 +0000
committerUlrich Drepper <drepper@redhat.com>2003-11-19 09:09:27 +0000
commit02b50340af3fe92aebd6960faa5eb45c34ae7fe6 (patch)
tree1e8b6040fdb2217b0bf8ba7ea814b1b299ea1269 /posix/regex_internal.c
parentUpdate. (diff)
downloadglibc-02b50340af3fe92aebd6960faa5eb45c34ae7fe6.tar.gz
glibc-02b50340af3fe92aebd6960faa5eb45c34ae7fe6.tar.bz2
glibc-02b50340af3fe92aebd6960faa5eb45c34ae7fe6.zip
Update.
* posix/regex_internal.c (build_wcs_upper_buffer): If mbrtowc fails, just use the byte, do no fancy conversions.
Diffstat (limited to 'posix/regex_internal.c')
-rw-r--r--posix/regex_internal.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/posix/regex_internal.c b/posix/regex_internal.c
index 1da5f7040a..859fe16c61 100644
--- a/posix/regex_internal.c
+++ b/posix/regex_internal.c
@@ -294,16 +294,11 @@ build_wcs_upper_buffer (pstr)
}
else if (mbclen == (size_t) -1 || mbclen == 0)
{
- /* In case of a singlebyte character. */
+ /* It is an invalid character. Just use the byte. */
int ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx];
- /* Apply the translation if we need. */
- if (BE (pstr->trans != NULL, 0) && mbclen == 1)
- {
- ch = pstr->trans[ch];
- pstr->mbs_case[byte_idx] = ch;
- }
- pstr->wcs[byte_idx] = towupper (wc);
- pstr->mbs[byte_idx++] = toupper (ch);
+ pstr->mbs[byte_idx] = ch;
+ /* And also cast it to wide char. */
+ pstr->wcs[byte_idx++] = (wchar_t) ch;
if (BE (mbclen == (size_t) -1, 0))
pstr->cur_state = prev_st;
}
@@ -324,7 +319,7 @@ build_wcs_upper_buffer (pstr)
mbclen = mbrtowc (&wc,
((const char *) pstr->raw_mbs + pstr->raw_mbs_idx
+ byte_idx), remain_len, &pstr->cur_state);
- if (mbclen == 1 || mbclen == (size_t) -1 || mbclen == 0)
+ if (mbclen == 1)
{
/* In case of a singlebyte character. */
int ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx];
@@ -351,6 +346,16 @@ build_wcs_upper_buffer (pstr)
for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;)
pstr->wcs[byte_idx++] = WEOF;
}
+ else if (mbclen == (size_t) -1 || mbclen == 0)
+ {
+ /* It is an invalid character. Just use the byte. */
+ int ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx];
+ pstr->mbs[byte_idx] = ch;
+ /* And also cast it to wide char. */
+ pstr->wcs[byte_idx++] = (wchar_t) ch;
+ if (BE (mbclen == (size_t) -1, 0))
+ pstr->cur_state = prev_st;
+ }
else
{
/* The buffer doesn't have enough space, finish to build. */