]> git.eshelyaron.com Git - emacs.git/commitdiff
(CCL_WRITE_CHAR): Increment extra_bytes only when it is
authorKenichi Handa <handa@m17n.org>
Fri, 30 May 2003 07:56:08 +0000 (07:56 +0000)
committerKenichi Handa <handa@m17n.org>
Fri, 30 May 2003 07:56:08 +0000 (07:56 +0000)
nonzero.
(ccl_driver): Initialize extra_bytes to ccl->eight_bit_control.
(setup_ccl_program): Initialize ccl->eight_bit_control to zero.

src/ccl.c

index e82eea542c2821141c87a879c2ed4a426e3f7f3a..4a47ca063f37a07e9f58d82a28701106708f37b1 100644 (file)
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -730,7 +730,7 @@ while(0)
        if (bytes == 1)                                                 \
          {                                                             \
            *dst++ = (ch);                                              \
-           if ((ch) >= 0x80 && (ch) < 0xA0)                            \
+           if (extra_bytes && (ch) >= 0x80 && (ch) < 0xA0)             \
              /* We may have to convert this eight-bit char to          \
                 multibyte form later.  */                              \
              extra_bytes++;                                            \
@@ -887,7 +887,7 @@ ccl_driver (ccl, source, destination, src_bytes, dst_bytes, consumed)
      each of them will be converted to multibyte form of 2-byte
      sequence.  For that conversion, we remember how many more bytes
      we must keep in DESTINATION in this variable.  */
-  int extra_bytes = 0;
+  int extra_bytes = ccl->eight_bit_control;
 
   if (ic >= ccl->eof_ic)
     ic = CCL_HEADER_MAIN;
@@ -1905,7 +1905,7 @@ ccl_driver (ccl, source, destination, src_bytes, dst_bytes, consumed)
   ccl->ic = ic;
   ccl->stack_idx = stack_idx;
   ccl->prog = ccl_prog;
-  ccl->eight_bit_control = (extra_bytes > 0);
+  ccl->eight_bit_control = (extra_bytes > 1);
   if (consumed)
     *consumed = src - source;
   return (dst ? dst - destination : 0);
@@ -2060,6 +2060,7 @@ setup_ccl_program (ccl, ccl_prog)
   ccl->stack_idx = 0;
   ccl->eol_type = CODING_EOL_LF;
   ccl->suppress_error = 0;
+  ccl->eight_bit_control = 0;
   return 0;
 }