comparison src/coding.c @ 30847:91e24edb537a

(encode_coding): Fix the bug of not flushing ISO escape sequence at the end of the source block.
author Kenichi Handa <handa@m17n.org>
date Wed, 16 Aug 2000 11:19:34 +0000
parents 2db6e42a6ba3
children 5682de5cfdac
comparison
equal deleted inserted replaced
30846:d83ff3be716a 30847:91e24edb537a
4184 { 4184 {
4185 unsigned char *src = source + coding->consumed; 4185 unsigned char *src = source + coding->consumed;
4186 unsigned char *dst = destination + coding->produced; 4186 unsigned char *dst = destination + coding->produced;
4187 4187
4188 src_bytes -= coding->consumed; 4188 src_bytes -= coding->consumed;
4189 coding->errors++; 4189 coding->errors++;
4190 if (COMPOSING_P (coding)) 4190 if (COMPOSING_P (coding))
4191 DECODE_COMPOSITION_END ('1'); 4191 DECODE_COMPOSITION_END ('1');
4192 while (src_bytes--) 4192 while (src_bytes--)
4193 { 4193 {
4194 int c = *src++; 4194 int c = *src++;
4253 4253
4254 default: 4254 default:
4255 encode_eol (coding, source, destination, src_bytes, dst_bytes); 4255 encode_eol (coding, source, destination, src_bytes, dst_bytes);
4256 } 4256 }
4257 4257
4258 if (coding->result == CODING_FINISH_INSUFFICIENT_SRC
4259 && coding->consumed == src_bytes)
4260 coding->result = CODING_FINISH_NORMAL;
4261
4262 if (coding->mode & CODING_MODE_LAST_BLOCK 4258 if (coding->mode & CODING_MODE_LAST_BLOCK
4263 && coding->result == CODING_FINISH_INSUFFICIENT_SRC) 4259 && coding->result == CODING_FINISH_INSUFFICIENT_SRC)
4264 { 4260 {
4265 unsigned char *src = source + coding->consumed; 4261 unsigned char *src = source + coding->consumed;
4266 unsigned char *src_end = src + src_bytes; 4262 unsigned char *src_end = src + src_bytes;
4281 coding->consumed = src_bytes; 4277 coding->consumed = src_bytes;
4282 } 4278 }
4283 coding->produced = coding->produced_char = dst - destination; 4279 coding->produced = coding->produced_char = dst - destination;
4284 coding->result = CODING_FINISH_NORMAL; 4280 coding->result = CODING_FINISH_NORMAL;
4285 } 4281 }
4282
4283 if (coding->result == CODING_FINISH_INSUFFICIENT_SRC
4284 && coding->consumed == src_bytes)
4285 coding->result = CODING_FINISH_NORMAL;
4286 4286
4287 return coding->result; 4287 return coding->result;
4288 } 4288 }
4289 4289
4290 /* Scan text in the region between *BEG and *END (byte positions), 4290 /* Scan text in the region between *BEG and *END (byte positions),