diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2013-06-24 20:53:50 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2013-06-24 20:53:50 +0300 |
commit | e50f9b883b4aa5d6ce7f9218f7dfba8b5686ee2a (patch) | |
tree | af79bfb696961e24ee87adec38b526c0e8cb6ef3 | |
parent | b3d8abcd4404089f1e242dbd7d3785c638d160f6 (diff) | |
download | egawk-e50f9b883b4aa5d6ce7f9218f7dfba8b5686ee2a.tar.gz egawk-e50f9b883b4aa5d6ce7f9218f7dfba8b5686ee2a.tar.bz2 egawk-e50f9b883b4aa5d6ce7f9218f7dfba8b5686ee2a.zip |
Fix multibyte character problem with brackets in dfa.c.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | dfa.c | 13 |
2 files changed, 14 insertions, 7 deletions
@@ -1,3 +1,11 @@ +2013-06-24 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c (copytoks): Rewrite to call addtok_mb() directly. Avoids + problems with multibyte characters inside character sets. + Thanks to Steven Daniels <stevendaniels88@gmail.com> for reporting + the problem. Much thanks to Mike Haertel <mike@ducky.net> for the + analysis and fix. + 2013-06-24 Eli Zaretskii <eliz@gnu.org> * io.c: Move #include "popen.h" out of the HAVE_SOCKETS condition, @@ -1847,13 +1847,12 @@ copytoks (size_t tindex, size_t ntokens) { size_t i; - for (i = 0; i < ntokens; ++i) - { - addtok (dfa->tokens[tindex + i]); - /* Update index into multibyte csets. */ - if (MB_CUR_MAX > 1 && dfa->tokens[tindex + i] == MBCSET) - dfa->multibyte_prop[dfa->tindex - 1] = dfa->multibyte_prop[tindex + i]; - } + if (MB_CUR_MAX > 1) + for (i = 0; i < ntokens; ++i) + addtok_mb(dfa->tokens[tindex + i], dfa->multibyte_prop[tindex + i]); + else + for (i = 0; i < ntokens; ++i) + addtok_mb(dfa->tokens[tindex + i], 3); } static void |