aboutsummaryrefslogtreecommitdiffstats
path: root/src/ccl.c
diff options
context:
space:
mode:
authorGerd Moellmann2001-05-15 10:39:45 +0000
committerGerd Moellmann2001-05-15 10:39:45 +0000
commit8a1ae4dd2a31d415d3c446f2f3701dd06d7a3bd4 (patch)
tree2c1f5c6650be3dd8842bf5204075cc2726005553 /src/ccl.c
parent33568849577b4c07e8f8b29e187eb6ea69f0cc86 (diff)
downloademacs-8a1ae4dd2a31d415d3c446f2f3701dd06d7a3bd4.tar.gz
emacs-8a1ae4dd2a31d415d3c446f2f3701dd06d7a3bd4.zip
(ccl_driver): Don't copy remaining bytes in case
of CCL_STAT_INVALID_CMD.
Diffstat (limited to 'src/ccl.c')
-rw-r--r--src/ccl.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/ccl.c b/src/ccl.c
index ce0a1bd4402..a69585cf0d5 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -860,15 +860,15 @@ ccl_driver (ccl, source, destination, src_bytes, dst_bytes, consumed)
860{ 860{
861 register int *reg = ccl->reg; 861 register int *reg = ccl->reg;
862 register int ic = ccl->ic; 862 register int ic = ccl->ic;
863 register int code, field1, field2; 863 register int code = 0, field1, field2;
864 register Lisp_Object *ccl_prog = ccl->prog; 864 register Lisp_Object *ccl_prog = ccl->prog;
865 unsigned char *src = source, *src_end = src + src_bytes; 865 unsigned char *src = source, *src_end = src + src_bytes;
866 unsigned char *dst = destination, *dst_end = dst + dst_bytes; 866 unsigned char *dst = destination, *dst_end = dst + dst_bytes;
867 int jump_address; 867 int jump_address;
868 int i, j, op; 868 int i = 0, j, op;
869 int stack_idx = ccl->stack_idx; 869 int stack_idx = ccl->stack_idx;
870 /* Instruction counter of the current CCL code. */ 870 /* Instruction counter of the current CCL code. */
871 int this_ic; 871 int this_ic = 0;
872 /* CCL_WRITE_CHAR will produce 8-bit code of range 0x80..0x9F. But, 872 /* CCL_WRITE_CHAR will produce 8-bit code of range 0x80..0x9F. But,
873 each of them will be converted to multibyte form of 2-byte 873 each of them will be converted to multibyte form of 2-byte
874 sequence. For that conversion, we remember how many more bytes 874 sequence. For that conversion, we remember how many more bytes
@@ -878,7 +878,7 @@ ccl_driver (ccl, source, destination, src_bytes, dst_bytes, consumed)
878 if (ic >= ccl->eof_ic) 878 if (ic >= ccl->eof_ic)
879 ic = CCL_HEADER_MAIN; 879 ic = CCL_HEADER_MAIN;
880 880
881 if (ccl->buf_magnification ==0) /* We can't produce any bytes. */ 881 if (ccl->buf_magnification == 0) /* We can't produce any bytes. */
882 dst = NULL; 882 dst = NULL;
883 883
884 /* Set mapping stack pointer. */ 884 /* Set mapping stack pointer. */
@@ -1824,8 +1824,12 @@ ccl_driver (ccl, source, destination, src_bytes, dst_bytes, consumed)
1824 bcopy (msg, dst, msglen); 1824 bcopy (msg, dst, msglen);
1825 dst += msglen; 1825 dst += msglen;
1826 } 1826 }
1827
1827 if (ccl->status == CCL_STAT_INVALID_CMD) 1828 if (ccl->status == CCL_STAT_INVALID_CMD)
1828 { 1829 {
1830#if 0 /* If the remaining bytes contain 0x80..0x9F, copying them
1831 results in an invalid multibyte sequence. */
1832
1829 /* Copy the remaining source data. */ 1833 /* Copy the remaining source data. */
1830 int i = src_end - src; 1834 int i = src_end - src;
1831 if (dst_bytes && (dst_end - dst) < i) 1835 if (dst_bytes && (dst_end - dst) < i)
@@ -1833,6 +1837,10 @@ ccl_driver (ccl, source, destination, src_bytes, dst_bytes, consumed)
1833 bcopy (src, dst, i); 1837 bcopy (src, dst, i);
1834 src += i; 1838 src += i;
1835 dst += i; 1839 dst += i;
1840#else
1841 /* Signal that we've consumed everything. */
1842 src = src_end;
1843#endif
1836 } 1844 }
1837 } 1845 }
1838 1846
@@ -1841,7 +1849,8 @@ ccl_driver (ccl, source, destination, src_bytes, dst_bytes, consumed)
1841 ccl->stack_idx = stack_idx; 1849 ccl->stack_idx = stack_idx;
1842 ccl->prog = ccl_prog; 1850 ccl->prog = ccl_prog;
1843 ccl->eight_bit_control = (extra_bytes > 0); 1851 ccl->eight_bit_control = (extra_bytes > 0);
1844 if (consumed) *consumed = src - source; 1852 if (consumed)
1853 *consumed = src - source;
1845 return (dst ? dst - destination : 0); 1854 return (dst ? dst - destination : 0);
1846} 1855}
1847 1856