diff options
| author | Joakim Verona | 2012-10-16 17:14:35 +0200 |
|---|---|---|
| committer | Joakim Verona | 2012-10-16 17:14:35 +0200 |
| commit | 017a270078be5ae39301e3205afad80d23facbbc (patch) | |
| tree | 5c85d8c3890f3a0cead231e87823b621a8f28e16 /src/coding.c | |
| parent | 5fcc7035c884b4419a1619551222b5f28ad9906f (diff) | |
| parent | 2b794d6940aa7dc58e297b3649b7799190d71f64 (diff) | |
| download | emacs-017a270078be5ae39301e3205afad80d23facbbc.tar.gz emacs-017a270078be5ae39301e3205afad80d23facbbc.zip | |
upstream
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/coding.c b/src/coding.c index 13f53ad5abc..d9606cf5710 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -5059,6 +5059,7 @@ decode_coding_ccl (struct coding_system *coding) | |||
| 5059 | while (1) | 5059 | while (1) |
| 5060 | { | 5060 | { |
| 5061 | const unsigned char *p = src; | 5061 | const unsigned char *p = src; |
| 5062 | ptrdiff_t offset; | ||
| 5062 | int i = 0; | 5063 | int i = 0; |
| 5063 | 5064 | ||
| 5064 | if (multibytep) | 5065 | if (multibytep) |
| @@ -5076,8 +5077,17 @@ decode_coding_ccl (struct coding_system *coding) | |||
| 5076 | 5077 | ||
| 5077 | if (p == src_end && coding->mode & CODING_MODE_LAST_BLOCK) | 5078 | if (p == src_end && coding->mode & CODING_MODE_LAST_BLOCK) |
| 5078 | ccl->last_block = 1; | 5079 | ccl->last_block = 1; |
| 5080 | /* As ccl_driver calls DECODE_CHAR, buffer may be relocated. */ | ||
| 5081 | charset_map_loaded = 0; | ||
| 5079 | ccl_driver (ccl, source_charbuf, charbuf, i, charbuf_end - charbuf, | 5082 | ccl_driver (ccl, source_charbuf, charbuf, i, charbuf_end - charbuf, |
| 5080 | charset_list); | 5083 | charset_list); |
| 5084 | if (charset_map_loaded | ||
| 5085 | && (offset = coding_change_source (coding))) | ||
| 5086 | { | ||
| 5087 | p += offset; | ||
| 5088 | src += offset; | ||
| 5089 | src_end += offset; | ||
| 5090 | } | ||
| 5081 | charbuf += ccl->produced; | 5091 | charbuf += ccl->produced; |
| 5082 | if (multibytep) | 5092 | if (multibytep) |
| 5083 | src += source_byteidx[ccl->consumed]; | 5093 | src += source_byteidx[ccl->consumed]; |
| @@ -5130,8 +5140,15 @@ encode_coding_ccl (struct coding_system *coding) | |||
| 5130 | 5140 | ||
| 5131 | do | 5141 | do |
| 5132 | { | 5142 | { |
| 5143 | ptrdiff_t offset; | ||
| 5144 | |||
| 5145 | /* As ccl_driver calls DECODE_CHAR, buffer may be relocated. */ | ||
| 5146 | charset_map_loaded = 0; | ||
| 5133 | ccl_driver (ccl, charbuf, destination_charbuf, | 5147 | ccl_driver (ccl, charbuf, destination_charbuf, |
| 5134 | charbuf_end - charbuf, 1024, charset_list); | 5148 | charbuf_end - charbuf, 1024, charset_list); |
| 5149 | if (charset_map_loaded | ||
| 5150 | && (offset = coding_change_destination (coding))) | ||
| 5151 | dst += offset; | ||
| 5135 | if (multibytep) | 5152 | if (multibytep) |
| 5136 | { | 5153 | { |
| 5137 | ASSURE_DESTINATION (ccl->produced * 2); | 5154 | ASSURE_DESTINATION (ccl->produced * 2); |
| @@ -6805,7 +6822,7 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table, | |||
| 6805 | [ -LENGTH ANNOTATION_MASK NCHARS NBYTES METHOD [ COMPONENTS... ] ] | 6822 | [ -LENGTH ANNOTATION_MASK NCHARS NBYTES METHOD [ COMPONENTS... ] ] |
| 6806 | */ | 6823 | */ |
| 6807 | 6824 | ||
| 6808 | static inline void | 6825 | static void |
| 6809 | produce_composition (struct coding_system *coding, int *charbuf, ptrdiff_t pos) | 6826 | produce_composition (struct coding_system *coding, int *charbuf, ptrdiff_t pos) |
| 6810 | { | 6827 | { |
| 6811 | int len; | 6828 | int len; |
| @@ -6849,7 +6866,7 @@ produce_composition (struct coding_system *coding, int *charbuf, ptrdiff_t pos) | |||
| 6849 | [ -LENGTH ANNOTATION_MASK NCHARS CHARSET-ID ] | 6866 | [ -LENGTH ANNOTATION_MASK NCHARS CHARSET-ID ] |
| 6850 | */ | 6867 | */ |
| 6851 | 6868 | ||
| 6852 | static inline void | 6869 | static void |
| 6853 | produce_charset (struct coding_system *coding, int *charbuf, ptrdiff_t pos) | 6870 | produce_charset (struct coding_system *coding, int *charbuf, ptrdiff_t pos) |
| 6854 | { | 6871 | { |
| 6855 | ptrdiff_t from = pos - charbuf[2]; | 6872 | ptrdiff_t from = pos - charbuf[2]; |
| @@ -7084,7 +7101,7 @@ decode_coding (struct coding_system *coding) | |||
| 7084 | position of a composition after POS (if any) or to LIMIT, and | 7101 | position of a composition after POS (if any) or to LIMIT, and |
| 7085 | return BUF. */ | 7102 | return BUF. */ |
| 7086 | 7103 | ||
| 7087 | static inline int * | 7104 | static int * |
| 7088 | handle_composition_annotation (ptrdiff_t pos, ptrdiff_t limit, | 7105 | handle_composition_annotation (ptrdiff_t pos, ptrdiff_t limit, |
| 7089 | struct coding_system *coding, int *buf, | 7106 | struct coding_system *coding, int *buf, |
| 7090 | ptrdiff_t *stop) | 7107 | ptrdiff_t *stop) |
| @@ -7167,7 +7184,7 @@ handle_composition_annotation (ptrdiff_t pos, ptrdiff_t limit, | |||
| 7167 | If the property value is nil, set *STOP to the position where the | 7184 | If the property value is nil, set *STOP to the position where the |
| 7168 | property value is non-nil (limiting by LIMIT), and return BUF. */ | 7185 | property value is non-nil (limiting by LIMIT), and return BUF. */ |
| 7169 | 7186 | ||
| 7170 | static inline int * | 7187 | static int * |
| 7171 | handle_charset_annotation (ptrdiff_t pos, ptrdiff_t limit, | 7188 | handle_charset_annotation (ptrdiff_t pos, ptrdiff_t limit, |
| 7172 | struct coding_system *coding, int *buf, | 7189 | struct coding_system *coding, int *buf, |
| 7173 | ptrdiff_t *stop) | 7190 | ptrdiff_t *stop) |
| @@ -8412,7 +8429,7 @@ highest priority. */) | |||
| 8412 | } | 8429 | } |
| 8413 | 8430 | ||
| 8414 | 8431 | ||
| 8415 | static inline bool | 8432 | static bool |
| 8416 | char_encodable_p (int c, Lisp_Object attrs) | 8433 | char_encodable_p (int c, Lisp_Object attrs) |
| 8417 | { | 8434 | { |
| 8418 | Lisp_Object tail; | 8435 | Lisp_Object tail; |