diff options
| author | Kenichi Handa | 2002-10-08 00:57:59 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2002-10-08 00:57:59 +0000 |
| commit | b3385c2865e95130930be5d6959c339f83bcce5f (patch) | |
| tree | 539b099148f4e0fcc4926cd0e41ad2acb411a770 /src | |
| parent | 4d46d6da26dec27e033459c55902c8ee8d5e1d43 (diff) | |
| download | emacs-b3385c2865e95130930be5d6959c339f83bcce5f.tar.gz emacs-b3385c2865e95130930be5d6959c339f83bcce5f.zip | |
(code_convert_region): When we need more GAP for
conversion, pay attention to the case that coding->produced is not
greater than coding->consumed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/coding.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/coding.c b/src/coding.c index 4636a0712fe..69e3b7e3e3d 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -5696,9 +5696,19 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) | |||
| 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)) |