]> 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 08:14:36 +0000 (08:14 +0000)
committerKenichi Handa <handa@m17n.org>
Fri, 30 May 2003 08:14:36 +0000 (08:14 +0000)
nonzero.
(ccl_driver): Initialize extra_bytes to ccl->eight_bit_control.
(setup_ccl_program): Initialize ccl->eight_bit_control to zero.

src/ChangeLog
src/ccl.c

index ca57df34edbe16084552c38f39aaf32f99633d61..698d7e2bc48f31733b6fe5ecd01e27a5af505a81 100644 (file)
@@ -1,3 +1,15 @@
+2003-05-30  Kenichi Handa  <handa@m17n.org>
+
+       * coding.c (ccl_coding_driver): Set ccl->eight_bit_control
+       properly before calling ccl_driver.
+
+       * ccl.h (struct ccl_program) <eight_bit_control: Comment fixed.
+
+       * ccl.c (CCL_WRITE_CHAR): Increment extra_bytes only when it is
+       nonzero.
+       (ccl_driver): Initialize extra_bytes to ccl->eight_bit_control.
+       (setup_ccl_program): Initialize ccl->eight_bit_control to zero.
+
 2003-05-14  Stefan Monnier  <monnier@cs.yale.edu>
 
        * keyboard.c (make_lispy_event): Apply modifiers to multibyte chars.
index d3879abae6ba57830cc62d836581acb8ef547e67..de848995779f8eab5686f0293d75b46e59477963 100644 (file)
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -717,7 +717,7 @@ else
        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++;                                            \
@@ -731,6 +731,7 @@ else
       CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST);                           \
   } while (0)
 
+
 /* Encode one character CH to multibyte form and write to the current
    output buffer.  The output bytes always forms a valid multibyte
    sequence.  */
@@ -874,7 +875,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;
@@ -1849,7 +1850,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);
@@ -2004,6 +2005,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;
 }