Mercurial > emacs
comparison src/coding.c @ 32806:9502d0a5b2ad
(decode_coding_emacs_mule): If coding->eol_type is CR
or CRLF, decode EOLs.
| author | Eli Zaretskii <eliz@gnu.org> |
|---|---|
| date | Tue, 24 Oct 2000 09:04:35 +0000 |
| parents | 70dcd0333504 |
| children | 3d8fb019040f |
comparison
equal
deleted
inserted
replaced
| 32805:112b31ea0526 | 32806:9502d0a5b2ad |
|---|---|
| 612 while ((src_base = src) < src_end) | 612 while ((src_base = src) < src_end) |
| 613 { | 613 { |
| 614 unsigned char tmp[MAX_MULTIBYTE_LENGTH], *p; | 614 unsigned char tmp[MAX_MULTIBYTE_LENGTH], *p; |
| 615 int bytes; | 615 int bytes; |
| 616 | 616 |
| 617 if (UNIBYTE_STR_AS_MULTIBYTE_P (src, src_end - src, bytes)) | 617 if (*src == '\r') |
| 618 { | |
| 619 int c; | |
| 620 | |
| 621 src++; | |
| 622 if (coding->eol_type == CODING_EOL_CR) | |
| 623 c = '\n'; | |
| 624 else if (coding->eol_type == CODING_EOL_CRLF) | |
| 625 { | |
| 626 ONE_MORE_BYTE (c); | |
| 627 if (c != '\n') | |
| 628 { | |
| 629 if (coding->mode & CODING_MODE_INHIBIT_INCONSISTENT_EOL) | |
| 630 { | |
| 631 coding->result = CODING_FINISH_INCONSISTENT_EOL; | |
| 632 goto label_end_of_loop; | |
| 633 } | |
| 634 src--; | |
| 635 c = '\r'; | |
| 636 } | |
| 637 } | |
| 638 *dst++ = c; | |
| 639 coding->produced_char++; | |
| 640 continue; | |
| 641 } | |
| 642 else if (*src == '\n') | |
| 643 { | |
| 644 if ((coding->eol_type == CODING_EOL_CR | |
| 645 || coding->eol_type == CODING_EOL_CRLF) | |
| 646 && coding->mode & CODING_MODE_INHIBIT_INCONSISTENT_EOL) | |
| 647 { | |
| 648 coding->result = CODING_FINISH_INCONSISTENT_EOL; | |
| 649 goto label_end_of_loop; | |
| 650 } | |
| 651 *dst++ = *src++; | |
| 652 coding->produced_char++; | |
| 653 continue; | |
| 654 } | |
| 655 else if (UNIBYTE_STR_AS_MULTIBYTE_P (src, src_end - src, bytes)) | |
| 618 { | 656 { |
| 619 p = src; | 657 p = src; |
| 620 src += bytes; | 658 src += bytes; |
| 621 } | 659 } |
| 622 else | 660 else |
| 631 break; | 669 break; |
| 632 } | 670 } |
| 633 while (bytes--) *dst++ = *p++; | 671 while (bytes--) *dst++ = *p++; |
| 634 coding->produced_char++; | 672 coding->produced_char++; |
| 635 } | 673 } |
| 674 label_end_of_loop: | |
| 636 coding->consumed = coding->consumed_char = src_base - source; | 675 coding->consumed = coding->consumed_char = src_base - source; |
| 637 coding->produced = dst - destination; | 676 coding->produced = dst - destination; |
| 638 } | 677 } |
| 639 | 678 |
| 640 #define encode_coding_emacs_mule(coding, source, destination, src_bytes, dst_bytes) \ | 679 #define encode_coding_emacs_mule(coding, source, destination, src_bytes, dst_bytes) \ |
