comparison src/coding.c @ 46702:2673ae55a6f9

(detect_coding_iso2022): While checking a byte sequence for CODING_CATEGORY_MASK_ISO_8_2, if we read one extra byte, check it in the normal loop.
author Kenichi Handa <handa@m17n.org>
date Fri, 26 Jul 2002 11:53:25 +0000
parents cb1914307488
children 395572099269
comparison
equal deleted inserted replaced
46701:d5bf1117c68b 46702:2673ae55a6f9
1347 1347
1348 reg[0] = CHARSET_ASCII, reg[1] = reg[2] = reg[3] = -1; 1348 reg[0] = CHARSET_ASCII, reg[1] = reg[2] = reg[3] = -1;
1349 while (mask && src < src_end) 1349 while (mask && src < src_end)
1350 { 1350 {
1351 ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep); 1351 ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
1352 retry:
1352 switch (c) 1353 switch (c)
1353 { 1354 {
1354 case ISO_CODE_ESC: 1355 case ISO_CODE_ESC:
1355 if (inhibit_iso_escape_detection) 1356 if (inhibit_iso_escape_detection)
1356 break; 1357 break;
1521 when we are not single shifting. */ 1522 when we are not single shifting. */
1522 if (!single_shifting 1523 if (!single_shifting
1523 && mask & CODING_CATEGORY_MASK_ISO_8_2) 1524 && mask & CODING_CATEGORY_MASK_ISO_8_2)
1524 { 1525 {
1525 int i = 1; 1526 int i = 1;
1527
1528 c = -1;
1526 while (src < src_end) 1529 while (src < src_end)
1527 { 1530 {
1528 ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep); 1531 ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
1529 if (c < 0xA0) 1532 if (c < 0xA0)
1530 break; 1533 break;
1533 1536
1534 if (i & 1 && src < src_end) 1537 if (i & 1 && src < src_end)
1535 mask &= ~CODING_CATEGORY_MASK_ISO_8_2; 1538 mask &= ~CODING_CATEGORY_MASK_ISO_8_2;
1536 else 1539 else
1537 mask_found |= CODING_CATEGORY_MASK_ISO_8_2; 1540 mask_found |= CODING_CATEGORY_MASK_ISO_8_2;
1541 if (c >= 0)
1542 /* This means that we have read one extra byte. */
1543 goto retry;
1538 } 1544 }
1539 } 1545 }
1540 break; 1546 break;
1541 } 1547 }
1542 } 1548 }