Update.
* posix/regex_internal.c (build_wcs_upper_buffer): If mbrtowc fails, just use the byte, do no fancy conversions.
This commit is contained in:
parent
ebcf449fd4
commit
02b50340af
@ -1,5 +1,8 @@
|
||||
2003-11-19 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* posix/regex_internal.c (build_wcs_upper_buffer): If mbrtowc
|
||||
fails, just use the byte, do no fancy conversions.
|
||||
|
||||
* posix/regex_internal.h (re_string_first_byte): Use ->valid_len
|
||||
not ->len.
|
||||
(re_string_is_single_byte_char): Likewise.
|
||||
|
@ -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. */
|
||||
|
Loading…
Reference in New Issue
Block a user