Mercurial > emacs
comparison src/coding.c @ 59095:8a2a99b47220
(code_convert_region): Fix calculation of `ratio'.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Mon, 27 Dec 2004 05:51:40 +0000 |
| parents | ff8a37b5299b |
| children | 0345f2b10f1d 223c12363c0c |
comparison
equal
deleted
inserted
replaced
| 59094:9ba68ebb293d | 59095:8a2a99b47220 |
|---|---|
| 5879 NEW bytes (coding->produced). To convert the remaining | 5879 NEW bytes (coding->produced). To convert the remaining |
| 5880 LEN bytes, we may need REQUIRE bytes of gap, where: | 5880 LEN bytes, we may need REQUIRE bytes of gap, where: |
| 5881 REQUIRE + LEN_BYTE = LEN_BYTE * (NEW / ORIG) | 5881 REQUIRE + LEN_BYTE = LEN_BYTE * (NEW / ORIG) |
| 5882 REQUIRE = LEN_BYTE * (NEW - ORIG) / ORIG | 5882 REQUIRE = LEN_BYTE * (NEW - ORIG) / ORIG |
| 5883 Here, we are sure that NEW >= ORIG. */ | 5883 Here, we are sure that NEW >= ORIG. */ |
| 5884 float ratio; | |
| 5885 | 5884 |
| 5886 if (coding->produced <= coding->consumed) | 5885 if (coding->produced <= coding->consumed) |
| 5887 { | 5886 { |
| 5888 /* This happens because of CCL-based coding system with | 5887 /* This happens because of CCL-based coding system with |
| 5889 eol-type CRLF. */ | 5888 eol-type CRLF. */ |
| 5890 require = 0; | 5889 require = 0; |
| 5891 } | 5890 } |
| 5892 else | 5891 else |
| 5893 { | 5892 { |
| 5894 ratio = (coding->produced - coding->consumed) / coding->consumed; | 5893 float ratio = coding->produced - coding->consumed; |
| 5894 ratio /= coding->consumed; | |
| 5895 require = len_byte * ratio; | 5895 require = len_byte * ratio; |
| 5896 } | 5896 } |
| 5897 first = 0; | 5897 first = 0; |
| 5898 } | 5898 } |
| 5899 if ((src - dst) < (require + 2000)) | 5899 if ((src - dst) < (require + 2000)) |
