summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2002-10-08 01:13:23 +0000
committerKenichi Handa <handa@m17n.org>2002-10-08 01:13:23 +0000
commit9b680226e4bd030041b7b0fa77b540821be982ea (patch)
treeb7601771f92eadad0a05c59c07ff586c7ace81cb
parentc263226766bc8e595756f60227c5f3a43a44659d (diff)
downloademacs-9b680226e4bd030041b7b0fa77b540821be982ea.tar.gz
(code_convert_region): When we need more GAP for
conversion, pay attention to the case that coding->produced is not greater than coding->consumed.
-rw-r--r--src/coding.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/coding.c b/src/coding.c
index 14d5542dd13..31ec3da01a3 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -5680,9 +5680,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))