case CODING_RESULT_INSUFFICIENT_MEM:
Vlast_code_conversion_error = Qinsufficient_memory;
break;
+ case CODING_RESULT_SUCCESS:
+ break;
default:
Vlast_code_conversion_error = intern ("Unknown error");
}
}
else
coding_alloc_by_realloc (coding, nbytes);
- record_conversion_result (coding, CODING_RESULT_SUCCESS);
coding_set_destination (coding);
dst = coding->destination + offset;
return dst;
const unsigned char *src_end = coding->source + coding->src_bytes;
const unsigned char *src_base;
int *charbuf = coding->charbuf + coding->charbuf_used;
- int *charbuf_end = coding->charbuf + coding->charbuf_size;
+ /* We may produces at most 3 chars in one loop. */
+ int *charbuf_end = coding->charbuf + coding->charbuf_size - 2;
int consumed_chars = 0, consumed_chars_base = 0;
int multibytep = coding->src_multibyte;
enum utf_bom_type bom = CODING_UTF_16_BOM (coding);
src_base = src;
consumed_chars_base = consumed_chars;
- if (charbuf + 2 >= charbuf_end)
+ if (charbuf >= charbuf_end)
{
if (byte_after_cr1 >= 0)
src_base -= 2;
const unsigned char *src_end = coding->source + coding->src_bytes;
const unsigned char *src_base;
int *charbuf = coding->charbuf + coding->charbuf_used;
+ /* We may produce two annocations (charset and composition) in one
+ loop and one more charset annocation at the end. */
int *charbuf_end
- = coding->charbuf + coding->charbuf_size - MAX_ANNOTATION_LENGTH;
+ = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3);
int consumed_chars = 0, consumed_chars_base;
int multibytep = coding->src_multibyte;
Lisp_Object attrs, charset_list;
const unsigned char *src_end = coding->source + coding->src_bytes;
const unsigned char *src_base;
int *charbuf = coding->charbuf + coding->charbuf_used;
+ /* We may produce two annocations (charset and composition) in one
+ loop and one more charset annocation at the end. */
int *charbuf_end
- = coding->charbuf + coding->charbuf_size - MAX_ANNOTATION_LENGTH;
+ = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3);
int consumed_chars = 0, consumed_chars_base;
int multibytep = coding->src_multibyte;
/* Charsets invoked to graphic plane 0 and 1 respectively. */
const unsigned char *src_end = coding->source + coding->src_bytes;
const unsigned char *src_base;
int *charbuf = coding->charbuf + coding->charbuf_used;
+ /* We may produce one charset annocation in one loop and one more at
+ the end. */
int *charbuf_end
- = coding->charbuf + coding->charbuf_size - MAX_ANNOTATION_LENGTH;
+ = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
int consumed_chars = 0, consumed_chars_base;
int multibytep = coding->src_multibyte;
struct charset *charset_roman, *charset_kanji, *charset_kana;
const unsigned char *src_end = coding->source + coding->src_bytes;
const unsigned char *src_base;
int *charbuf = coding->charbuf + coding->charbuf_used;
+ /* We may produce one charset annocation in one loop and one more at
+ the end. */
int *charbuf_end
- = coding->charbuf + coding->charbuf_size - MAX_ANNOTATION_LENGTH;
+ = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
int consumed_chars = 0, consumed_chars_base;
int multibytep = coding->src_multibyte;
struct charset *charset_roman, *charset_big5;
const unsigned char *src_end = coding->source + coding->src_bytes;
const unsigned char *src_base;
int *charbuf = coding->charbuf + coding->charbuf_used;
+ /* We may produce one charset annocation in one loop and one more at
+ the end. */
int *charbuf_end
- = coding->charbuf + coding->charbuf_size - MAX_ANNOTATION_LENGTH;
+ = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
int consumed_chars = 0, consumed_chars_base;
int multibytep = coding->src_multibyte;
Lisp_Object attrs, charset_list, valids;
Lisp_Object standard, translation_table;
Lisp_Object val;
+ if (NILP (Venable_character_translation))
+ {
+ if (max_lookup)
+ *max_lookup = 0;
+ return Qnil;
+ }
if (encodep)
translation_table = CODING_ATTR_ENCODE_TBL (attrs),
standard = Vstandard_translation_table_for_encode;
DEFUN ("terminal-coding-system", Fterminal_coding_system,
Sterminal_coding_system, 0, 1, 0,
doc: /* Return coding system specified for terminal output on the given terminal.
-TERMINAL may be a terminal id, a frame, or nil for the selected
+TERMINAL may be a terminal object, a frame, or nil for the selected
frame's terminal device. */)
(terminal)
Lisp_Object terminal;