]> git.eshelyaron.com Git - emacs.git/commitdiff
(code_convert_region): When we need more GAP for
authorKenichi Handa <handa@m17n.org>
Tue, 8 Oct 2002 00:57:59 +0000 (00:57 +0000)
committerKenichi Handa <handa@m17n.org>
Tue, 8 Oct 2002 00:57:59 +0000 (00:57 +0000)
conversion, pay attention to the case that coding->produced is not
greater than coding->consumed.

src/coding.c

index 4636a0712fefd812c6d3f3adf702af2fc40d2ea0..69e3b7e3e3d8fe60494e355e22dac9036d5497eb 100644 (file)
@@ -5696,9 +5696,19 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace)
                REQUIRE + LEN_BYTE = LEN_BYTE * (NEW / ORIG)
                REQUIRE = LEN_BYTE * (NEW - ORIG) / ORIG
             Here, we are sure that NEW >= ORIG.  */
-         float ratio = coding->produced - coding->consumed;
-         ratio /= coding->consumed;
-         require = len_byte * ratio;
+         float ratio;
+
+         if (coding->produced <= coding->consumed)
+           {
+             /* This happens because of CCL-based coding system with
+                eol-type CRLF.  */
+             require = 0;
+           }
+         else
+           {
+             ratio = (coding->produced - coding->consumed) / coding->consumed;
+             require = len_byte * ratio;
+           }
          first = 0;
        }
       if ((src - dst) < (require + 2000))