comparison src/coding.c @ 89917:1763eef5ad02

(encode_coding_utf_8): Fix handling of raw-byte char. (consume_chars): Fix handling of 8-bit bytes in unibyte source.
author Kenichi Handa <handa@m17n.org>
date Tue, 20 Apr 2004 02:46:38 +0000
parents 37e044cc35f6
children 7d0f6da3ea6e
comparison
equal deleted inserted replaced
89916:e0e4e6a0599f 89917:1763eef5ad02
1347 1347
1348 while (charbuf < charbuf_end) 1348 while (charbuf < charbuf_end)
1349 { 1349 {
1350 ASSURE_DESTINATION (safe_room); 1350 ASSURE_DESTINATION (safe_room);
1351 c = *charbuf++; 1351 c = *charbuf++;
1352 dst += CHAR_STRING (c, dst); 1352 if (CHAR_BYTE8_P (c))
1353 *dst++ = CHAR_TO_BYTE8 (c);
1354 else
1355 dst += CHAR_STRING (c, dst);
1353 produced_chars++; 1356 produced_chars++;
1354 } 1357 }
1355 } 1358 }
1356 record_conversion_result (coding, CODING_RESULT_SUCCESS); 1359 record_conversion_result (coding, CODING_RESULT_SUCCESS);
1357 coding->produced_char += produced_chars; 1360 coding->produced_char += produced_chars;
6377 6380
6378 if (! multibytep) 6381 if (! multibytep)
6379 { 6382 {
6380 EMACS_INT bytes; 6383 EMACS_INT bytes;
6381 6384
6382 if (! CODING_FOR_UNIBYTE (coding) 6385 if ((bytes = MULTIBYTE_LENGTH (src, src_end)) > 0)
6383 && (bytes = MULTIBYTE_LENGTH (src, src_end)) > 0)
6384 c = STRING_CHAR_ADVANCE (src), pos += bytes; 6386 c = STRING_CHAR_ADVANCE (src), pos += bytes;
6385 else 6387 else
6386 c = *src++, pos++; 6388 c = BYTE8_TO_CHAR (*src), src++, pos++;
6387 } 6389 }
6388 else 6390 else
6389 c = STRING_CHAR_ADVANCE (src), pos++; 6391 c = STRING_CHAR_ADVANCE (src), pos++;
6390 if ((c == '\r') && (coding->mode & CODING_MODE_SELECTIVE_DISPLAY)) 6392 if ((c == '\r') && (coding->mode & CODING_MODE_SELECTIVE_DISPLAY))
6391 c = '\n'; 6393 c = '\n';