comparison src/search.c @ 88463:656d99c0c155

(boyer_moore): Fix handling of mulitbyte character translation.
author Kenichi Handa <handa@m17n.org>
date Tue, 07 May 2002 12:46:21 +0000
parents e9a23b7c1feb
children 8772b1a86905
comparison
equal deleted inserted replaced
88462:0a2b7a261e66 88463:656d99c0c155
1637 { 1637 {
1638 ch = *ptr; 1638 ch = *ptr;
1639 this_translated = 0; 1639 this_translated = 0;
1640 } 1640 }
1641 1641
1642 if (ch > 0400) 1642 if (this_translated
1643 j = ((unsigned char) ch) | 0200; 1643 && ch >= 0200)
1644 j = (ch & 0x3F) | 0200;
1644 else 1645 else
1645 j = (unsigned char) ch; 1646 j = (unsigned char) ch;
1646 1647
1647 if (i == infinity) 1648 if (i == infinity)
1648 stride_for_teases = BM_tab[j]; 1649 stride_for_teases = BM_tab[j];
1655 int starting_ch = ch; 1656 int starting_ch = ch;
1656 int starting_j = j; 1657 int starting_j = j;
1657 while (1) 1658 while (1)
1658 { 1659 {
1659 TRANSLATE (ch, inverse_trt, ch); 1660 TRANSLATE (ch, inverse_trt, ch);
1660 if (ch > 0400) 1661 if (ch > 0200)
1661 j = ((unsigned char) ch) | 0200; 1662 j = (ch & 0x3F) | 0200;
1662 else 1663 else
1663 j = (unsigned char) ch; 1664 j = (unsigned char) ch;
1664 1665
1665 /* For all the characters that map into CH, 1666 /* For all the characters that map into CH,
1666 set up simple_translate to map the last byte 1667 set up simple_translate to map the last byte