fix \l and \u in a multi-byte configuration
2004-11-15 Paolo Bonzini <bonzini@gnu.org> * sed/execute.c (str_append_modified): Copy the first character when using \l or \u in a multi-byte configuration. Use WCRTOMB instead of wcrtomb. * sed/sed.h (WCRTOMB): New. git-archimport-id: bonzini@gnu.org--2004b/sed--stable--4.1--patch-19
This commit is contained in:
1 parent
fd8f5daad7
commit
7f53c1c16e
3 files changed
+20
-3
No files matched your search
@@ -1,4 +1,11 @@
|
||||
2004-11-11 Paolo Bonzini <bonzini@gnu
|
||||
2004-11-15 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* sed/execute.c (str_append_modified): Copy the first character
|
||||
when using \l or \u in a multi-byte configuration. Use
|
||||
WCRTOMB instead of wcrtomb.
|
||||
* sed/sed.h (WCRTOMB): New.
|
||||
|
||||
2004-11-11 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* tst-rxspecer.c: Do not mix instructions and
|
||||
declarations.
|
||||
@@ -6,7 +13,7 @@
|
||||
gettext, to avoid breakage under Solaris.
|
||||
* sed/sed.c: do not include locale.h.
|
||||
|
||||
2004-11-03 Paolo Bonzini <bonzini@gnu
|
||||
2004-11-03 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* bug-regex11.c: Improve portability.
|
||||
* bug-regex12.c: Improve portability.
|
||||
|
||||
+3
-1
@@ -313,6 +313,8 @@ str_append_modified(to, string, length, type)
|
||||
type &= ~(REPL_LOWERCASE_FIRST | REPL_UPPERCASE_FIRST);
|
||||
if (type == REPL_ASIS)
|
||||
{
|
||||
n = WCRTOMB (to->active + to->length, wc, &to->mbstate);
|
||||
to->length += n;
|
||||
str_append(to, string, length);
|
||||
return;
|
||||
}
|
||||
@@ -324,7 +326,7 @@ str_append_modified(to, string, length, type)
|
||||
wc = towlower(wc);
|
||||
|
||||
/* Copy the new wide character to the end of the string. */
|
||||
n = wcrtomb (to->active + to->length, wc, &to->mbstate);
|
||||
n = WCRTOMB (to->active + to->length, wc, &to->mbstate);
|
||||
to->length += n;
|
||||
if (n == -1)
|
||||
{
|
||||
|
||||
@@ -233,9 +233,17 @@ extern int mb_cur_max;
|
||||
(mb_cur_max == 1 ? \
|
||||
(*(pwc) = btowc (*(unsigned char *) (s)), 1) : \
|
||||
mbrtowc ((pwc), (s), (n), (ps)))
|
||||
|
||||
#define WCRTOMB(s, wc, ps) \
|
||||
(mb_cur_max == 1 ? \
|
||||
(*(s) = wctob ((wint_t) (wc)), 1) : \
|
||||
wcrtomb ((s), (wc), (ps)))
|
||||
#else
|
||||
#define MBRTOWC(pwc, s, n, ps) \
|
||||
mbrtowc ((pwc), (s), (n), (ps))
|
||||
|
||||
#define WCRTOMB(s, wc, ps) \
|
||||
wcrtomb ((s), (wc), (ps))
|
||||
#endif
|
||||
|
||||
#define MBRLEN(s, n, ps) \
|
||||
|
||||
Reference in new issue
Block a user