comparison src/coding.c @ 47791:1a71f916ad2f

(code_convert_region): When we need more GAP for conversion, pay attention to the case that coding->produced is not greater than coding->consumed.
author Kenichi Handa <handa@m17n.org>
date Tue, 08 Oct 2002 00:57:59 +0000
parents 77511decc5ff
children 080b4586492b
comparison
equal deleted inserted replaced
47790:2eb1a25294ab 47791:1a71f916ad2f
5694 NEW bytes (coding->produced). To convert the remaining 5694 NEW bytes (coding->produced). To convert the remaining
5695 LEN bytes, we may need REQUIRE bytes of gap, where: 5695 LEN bytes, we may need REQUIRE bytes of gap, where:
5696 REQUIRE + LEN_BYTE = LEN_BYTE * (NEW / ORIG) 5696 REQUIRE + LEN_BYTE = LEN_BYTE * (NEW / ORIG)
5697 REQUIRE = LEN_BYTE * (NEW - ORIG) / ORIG 5697 REQUIRE = LEN_BYTE * (NEW - ORIG) / ORIG
5698 Here, we are sure that NEW >= ORIG. */ 5698 Here, we are sure that NEW >= ORIG. */
5699 float ratio = coding->produced - coding->consumed; 5699 float ratio;
5700 ratio /= coding->consumed; 5700
5701 require = len_byte * ratio; 5701 if (coding->produced <= coding->consumed)
5702 {
5703 /* This happens because of CCL-based coding system with
5704 eol-type CRLF. */
5705 require = 0;
5706 }
5707 else
5708 {
5709 ratio = (coding->produced - coding->consumed) / coding->consumed;
5710 require = len_byte * ratio;
5711 }
5702 first = 0; 5712 first = 0;
5703 } 5713 }
5704 if ((src - dst) < (require + 2000)) 5714 if ((src - dst) < (require + 2000))
5705 { 5715 {
5706 /* See the comment above the previous call of make_gap. */ 5716 /* See the comment above the previous call of make_gap. */