Commit 1c88af36 authored by Stefan Monnier's avatar Stefan Monnier

* src/coding.c (decode_coding_gap): Remove `chars` argument.

* src/json.c (Fjson_insert):
* src/fileio.c (Finsert_file_contents):
* src/coding.h (decode_coding_gap): Adjust accordingly.
parent a2c56a90
......@@ -7892,23 +7892,26 @@ coding_restore_undo_list (Lisp_Object arg)
bset_undo_list (buf, undo_list);
}
/* Decode the *last* BYTES of the gap and insert them at point. */
void
decode_coding_gap (struct coding_system *coding,
ptrdiff_t chars, ptrdiff_t bytes)
decode_coding_gap (struct coding_system *coding, ptrdiff_t bytes)
{
ptrdiff_t count = SPECPDL_INDEX ();
Lisp_Object attrs;
eassert (GPT_BYTE == PT_BYTE);
coding->src_object = Fcurrent_buffer ();
coding->src_chars = chars;
coding->src_chars = bytes;
coding->src_bytes = bytes;
coding->src_pos = -chars;
coding->src_pos = -bytes;
coding->src_pos_byte = -bytes;
coding->src_multibyte = chars < bytes;
coding->src_multibyte = false;
coding->dst_object = coding->src_object;
coding->dst_pos = PT;
coding->dst_pos_byte = PT_BYTE;
coding->dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
eassert (coding->dst_multibyte
== !NILP (BVAR (current_buffer, enable_multibyte_characters)));
coding->head_ascii = -1;
coding->detected_utf8_bytes = coding->detected_utf8_chars = -1;
......@@ -7922,7 +7925,7 @@ decode_coding_gap (struct coding_system *coding,
&& NILP (CODING_ATTR_POST_READ (attrs))
&& NILP (get_translation_table (attrs, 0, NULL)))
{
chars = coding->head_ascii;
ptrdiff_t chars = coding->head_ascii;
if (chars < 0)
chars = check_ascii (coding);
if (chars != bytes)
......
......@@ -697,8 +697,7 @@ extern Lisp_Object coding_inherit_eol_type (Lisp_Object, Lisp_Object);
extern Lisp_Object complement_process_encoding_system (Lisp_Object);
extern Lisp_Object make_string_from_utf8 (const char *, ptrdiff_t);
extern void decode_coding_gap (struct coding_system *,
ptrdiff_t, ptrdiff_t);
extern void decode_coding_gap (struct coding_system *, ptrdiff_t);
extern void decode_coding_object (struct coding_system *,
Lisp_Object, ptrdiff_t, ptrdiff_t,
ptrdiff_t, ptrdiff_t, Lisp_Object);
......
......@@ -4538,7 +4538,7 @@ by calling `format-decode', which see. */)
Z_BYTE -= inserted;
ZV -= inserted;
Z -= inserted;
decode_coding_gap (&coding, inserted, inserted);
decode_coding_gap (&coding, inserted);
inserted = coding.produced_char;
coding_system = CODING_ID_NAME (coding.id);
}
......
......@@ -769,7 +769,7 @@ usage: (json-insert OBJECT &rest ARGS) */)
Z_BYTE -= inserted_bytes;
ZV -= inserted_bytes;
Z -= inserted_bytes;
decode_coding_gap (&coding, inserted_bytes, inserted_bytes);
decode_coding_gap (&coding, inserted_bytes);
inserted = coding.produced_char;
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment