mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-10 06:00:51 +00:00
(code_convert_region): When we need more GAP for
conversion, pay attention to the case that coding->produced is not greater than coding->consumed.
This commit is contained in:
parent
4d46d6da26
commit
b3385c2865
1 changed files with 13 additions and 3 deletions
16
src/coding.c
16
src/coding.c
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue