summaryrefslogtreecommitdiff
path: root/src/coding.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2004-09-29 23:40:30 +0000
committerKenichi Handa <handa@m17n.org>2004-09-29 23:40:30 +0000
commitce559e6f5bd5ebdd8f2ebeeb609fae06f6bac1f6 (patch)
tree0614303192d983b7d3850dcdcb5d4f06f8278543 /src/coding.c
parent14e20e1309c68b214db1b6d3c369a2c2bdaeb4e2 (diff)
downloademacs-ce559e6f5bd5ebdd8f2ebeeb609fae06f6bac1f6.tar.gz
(code_convert_region): Don't skip ASCIIs if there are compositions to encode.
Free composition data. (encode_coding_string): Likewise.
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/coding.c b/src/coding.c
index 7f87abce34d..0c99054d47b 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -5650,8 +5650,11 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace)
coding_allocate_composition_data (coding, from);
}
- /* Try to skip the heading and tailing ASCIIs. */
- if (coding->type != coding_type_ccl)
+ /* Try to skip the heading and tailing ASCIIs. We can't skip them
+ if we must run CCL program or there are compositions to
+ encode. */
+ if (coding->type != coding_type_ccl
+ && (! coding->cmp_data || coding->cmp_data->used == 0))
{
int from_byte_orig = from_byte, to_byte_orig = to_byte;
@@ -5667,6 +5670,7 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace)
if (!replace)
/* We must record and adjust for this new text now. */
adjust_after_insert (from, from_byte_orig, to, to_byte_orig, len);
+ coding_free_composition_data (coding);
return 0;
}
@@ -6297,13 +6301,19 @@ encode_coding_string (str, coding, nocopy)
if (coding->composing != COMPOSITION_DISABLED)
coding_save_composition (coding, from, to, str);
- /* Try to skip the heading and tailing ASCIIs. */
- if (coding->type != coding_type_ccl)
+ /* Try to skip the heading and tailing ASCIIs. We can't skip them
+ if we must run CCL program or there are compositions to
+ encode. */
+ if (coding->type != coding_type_ccl
+ && (! coding->cmp_data || coding->cmp_data->used == 0))
{
SHRINK_CONVERSION_REGION (&from, &to_byte, coding, SDATA (str),
1);
if (from == to_byte)
- return (nocopy ? str : Fcopy_sequence (str));
+ {
+ coding_free_composition_data (coding);
+ return (nocopy ? str : Fcopy_sequence (str));
+ }
shrinked_bytes = from + (SBYTES (str) - to_byte);
}