[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gawk3.1.4: parse_escape problem
From: |
KIMURA Koichi |
Subject: |
gawk3.1.4: parse_escape problem |
Date: |
Mon, 13 Jun 2005 08:42:21 +0900 |
Hi,
I found multibyte bug.
That is, string which has escape seqence and some multibyte character
(has '\' as tis second byte) is parse_escape() accidentrally.
ex. "\nXXYY" (here, XX and YY are multibyte character)
Here is a patch.
--- node.c.7~ 2005-02-15 23:25:19.000000000 +0900
+++ node.c 2005-06-13 01:08:40.000000000 +0900
@@ -378,9 +378,21 @@
register char *ptm;
register int c;
register const char *end;
-
+#if defined MBS_SUPPORT
+ mbstate_t cur_state;
+ memset(&cur_state, 0, sizeof (cur_state));
+#endif
end = &(r->stptr[len]);
for (pf = ptm = r->stptr; pf < end;) {
+#if defined MBS_SUPPORT
+ int mblen = mbrlen(pf, end-pf, &cur_state);
+ if (mblen > 1) {
+ int i;
+ for (i=0; i<mblen; i++)
+ *ptm++ = *pf++;
+ continue;
+ }
+#endif
c = *pf++;
if (c == '\\') {
c = parse_escape(&pf);
Thank you,
--
KIMURA Koichi
- gawk3.1.4: parse_escape problem,
KIMURA Koichi <=