aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert <[email protected]>2012-08-27 09:19:34 -0700
committerPaul Eggert <[email protected]>2012-08-27 09:19:34 -0700
commitf10fe38f772c29031a23ef7aa92d2de1b3675461 (patch)
tree5e45fef267903dafb4d2a92bd464ff851b3e3835
parent5474c384641da64d402e4d135dbf4697a60a70d3 (diff)
* cmds.c, coding.c: Use bool for booleans.
* cmds.c (move_point, Fself_insert_command): * coding.h (struct composition status, struct coding_system): * coding.c (detect_coding_utf_8, encode_coding_utf_8) (detect_coding_utf_16, encode_coding_utf_16, detect_coding_emacs_mule) (emacs_mule_char, decode_coding_emacs_mule) (encode_coding_emacs_mule, detect_coding_iso_2022) (decode_coding_iso_2022, encode_invocation_designation) (encode_designation_at_bol, encode_coding_iso_2022) (detect_coding_sjis, detect_coding_big5, decode_coding_sjis) (decode_coding_big5, encode_coding_sjis, encode_coding_big5) (detect_coding_ccl, encode_coding_ccl, decode_coding_raw_text) (encode_coding_raw_text, detect_coding_charset) (decode_coding_charset, encode_coding_charset, detect_eol) (detect_coding, get_translation_table, produce_chars) (consume_chars, reused_workbuf_in_use) (make_conversion_work_buffer, code_conversion_save) (decode_coding_object, encode_coding_object) (detect_coding_system, char_encodable_p) (Funencodable_char_position, code_convert_region) (code_convert_string, code_convert_string_norecord) (Fset_coding_system_priority): * fileio.c (Finsert_file_contents): Use bool for booleans. * coding.h, lisp.h: Reflect above API changes. * coding.c: Remove unnecessary static function decls. (detect_coding): Use unsigned, not signed, to copy an unsigned field. (decode_coding, encode_coding, decode_coding_gap): Return 'void', not a boolean 'int', since callers never look at the return value. (ALLOC_CONVERSION_WORK_AREA): Assume caller returns 'void', not 'int'. * coding.h (decoding_buffer_size, encoding_buffer_size) (emacs_mule_string_char): Remove unused extern decls. (struct iso_2022_spec, struct coding_system): Use 'unsigned int : 1' for boolean fields, since there's more than one. (struct emacs_mule_spec): Remove unused field 'full_support'. All initializations removed. * cmds.c (internal_self_insert): Don't assume EMACS_INT fits in 'int'.
-rw-r--r--src/ChangeLog42
-rw-r--r--src/charset.h2
-rw-r--r--src/cmds.c8
-rw-r--r--src/coding.c368
-rw-r--r--src/coding.h49
-rw-r--r--src/fileio.c3
-rw-r--r--src/lisp.h2
7 files changed, 208 insertions, 266 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2a5afcaa31..7be88c568e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,6 +1,46 @@
+2012-08-27 Paul Eggert <[email protected]>
+
+ * cmds.c, coding.c: Use bool for booleans.
+ * cmds.c (move_point, Fself_insert_command):
+ * coding.h (struct composition status, struct coding_system):
+ * coding.c (detect_coding_utf_8, encode_coding_utf_8)
+ (detect_coding_utf_16, encode_coding_utf_16, detect_coding_emacs_mule)
+ (emacs_mule_char, decode_coding_emacs_mule)
+ (encode_coding_emacs_mule, detect_coding_iso_2022)
+ (decode_coding_iso_2022, encode_invocation_designation)
+ (encode_designation_at_bol, encode_coding_iso_2022)
+ (detect_coding_sjis, detect_coding_big5, decode_coding_sjis)
+ (decode_coding_big5, encode_coding_sjis, encode_coding_big5)
+ (detect_coding_ccl, encode_coding_ccl, decode_coding_raw_text)
+ (encode_coding_raw_text, detect_coding_charset)
+ (decode_coding_charset, encode_coding_charset, detect_eol)
+ (detect_coding, get_translation_table, produce_chars)
+ (consume_chars, reused_workbuf_in_use)
+ (make_conversion_work_buffer, code_conversion_save)
+ (decode_coding_object, encode_coding_object)
+ (detect_coding_system, char_encodable_p)
+ (Funencodable_char_position, code_convert_region)
+ (code_convert_string, code_convert_string_norecord)
+ (Fset_coding_system_priority):
+ * fileio.c (Finsert_file_contents):
+ Use bool for booleans.
+ * coding.h, lisp.h: Reflect above API changes.
+ * coding.c: Remove unnecessary static function decls.
+ (detect_coding): Use unsigned, not signed, to copy an unsigned field.
+ (decode_coding, encode_coding, decode_coding_gap): Return 'void',
+ not a boolean 'int', since callers never look at the return value.
+ (ALLOC_CONVERSION_WORK_AREA): Assume caller returns 'void', not 'int'.
+ * coding.h (decoding_buffer_size, encoding_buffer_size)
+ (emacs_mule_string_char): Remove unused extern decls.
+ (struct iso_2022_spec, struct coding_system):
+ Use 'unsigned int : 1' for boolean fields, since there's more than one.
+ (struct emacs_mule_spec): Remove unused field 'full_support'.
+ All initializations removed.
+ * cmds.c (internal_self_insert): Don't assume EMACS_INT fits in 'int'.
+
2012-08-27 Dmitry Antipov <[email protected]>
- Fix spare memory change.
+ Fix spare memory change (Bug#12286).
* alloc.c (mark_maybe_pointer): Handle MEM_TYPE_SPARE.
(valid_lisp_object_p): Likewise.
diff --git a/src/charset.h b/src/charset.h
index 6e6d0ec270..50d230489f 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -496,7 +496,7 @@ extern int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL];
-/* 1 if CHARSET may contain the character C. */
+/* True if CHARSET may contain the character C. */
#define CHAR_CHARSET_P(c, charset) \
((ASCII_CHAR_P (c) && (charset)->ascii_compatible_p) \
|| ((CHARSET_UNIFIED_P (charset) \
diff --git a/src/cmds.c b/src/cmds.c
index b416135ee9..90d3cd6dce 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -47,10 +47,10 @@ DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0,
return make_number (PT + XINT (n));
}
-/* Add N to point; or subtract N if FORWARD is zero. N defaults to 1.
+/* Add N to point; or subtract N if FORWARD is false. N defaults to 1.
Validate the new location. Return nil. */
static Lisp_Object
-move_point (Lisp_Object n, int forward)
+move_point (Lisp_Object n, bool forward)
{
/* This used to just set point to point + XINT (n), and then check
to see if it was within boundaries. But now that SET_PT can
@@ -277,7 +277,7 @@ After insertion, the value of `auto-fill-function' is called if the
At the end, it runs `post-self-insert-hook'. */)
(Lisp_Object n)
{
- int remove_boundary = 1;
+ bool remove_boundary = 1;
CHECK_NATNUM (n);
if (!EQ (Vthis_command, KVAR (current_kboard, Vlast_command)))
@@ -438,7 +438,7 @@ internal_self_insert (int c, EMACS_INT n)
: UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ())))
== Sword))
{
- int modiff = MODIFF;
+ EMACS_INT modiff = MODIFF;
Lisp_Object sym;
sym = call0 (Qexpand_abbrev);
diff --git a/src/coding.c b/src/coding.c
index 971686dc18..5bfd42c727 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -147,18 +147,18 @@ STRUCT CODING_SYSTEM
CODING conforms to the format of XXX, and update the members of
DETECT_INFO.
- Return 1 if the byte sequence conforms to XXX, otherwise return 0.
+ Return true if the byte sequence conforms to XXX.
Below is the template of these functions. */
#if 0
-static int
+static bool
detect_coding_XXX (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t consumed_chars = 0;
int found = 0;
...;
@@ -212,7 +212,7 @@ decode_coding_XXXX (struct coding_system *coding)
/* A buffer to produce decoded characters. */
int *charbuf = coding->charbuf + coding->charbuf_used;
int *charbuf_end = coding->charbuf + coding->charbuf_size;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
while (1)
{
@@ -260,7 +260,7 @@ decode_coding_XXXX (struct coding_system *coding)
static void
encode_coding_XXX (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf->charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -651,8 +651,8 @@ static struct coding_system coding_categories[coding_category_max];
/* Safely get one byte from the source text pointed by SRC which ends
at SRC_END, and set C to that byte. If there are not enough bytes
- in the source, it jumps to `no_more_source'. If multibytep is
- nonzero, and a multibyte character is found at SRC, set C to the
+ in the source, it jumps to 'no_more_source'. If MULTIBYTEP,
+ and a multibyte character is found at SRC, set C to the
negative value of the character code. The caller should declare
and set these variables appropriately in advance:
src, src_end, multibytep */
@@ -685,7 +685,7 @@ static struct coding_system coding_categories[coding_category_max];
/* Safely get two bytes from the source text pointed by SRC which ends
at SRC_END, and set C1 and C2 to those bytes while skipping the
heading multibyte characters. If there are not enough bytes in the
- source, it jumps to `no_more_source'. If multibytep is nonzero and
+ source, it jumps to 'no_more_source'. If MULTIBYTEP and
a multibyte character is found for C2, set C2 to the negative value
of the character code. The caller should declare and set these
variables appropriately in advance:
@@ -746,8 +746,8 @@ static struct coding_system coding_categories[coding_category_max];
/* Store a byte C in the place pointed by DST and increment DST to the
- next free point, and increment PRODUCED_CHARS. If MULTIBYTEP is
- nonzero, store in an appropriate multibyte from. The caller should
+ next free point, and increment PRODUCED_CHARS. If MULTIBYTEP,
+ store in an appropriate multibyte form. The caller should
declare and set the variables `dst' and `multibytep' appropriately
in advance. */
@@ -806,83 +806,6 @@ static struct coding_system coding_categories[coding_category_max];
} while (0)
-/* Prototypes for static functions. */
-static void record_conversion_result (struct coding_system *coding,
- enum coding_result_code result);
-static int detect_coding_utf_8 (struct coding_system *,
- struct coding_detection_info *info);
-static void decode_coding_utf_8 (struct coding_system *);
-static int encode_coding_utf_8 (struct coding_system *);
-
-static int detect_coding_utf_16 (struct coding_system *,
- struct coding_detection_info *info);
-static void decode_coding_utf_16 (struct coding_system *);
-static int encode_coding_utf_16 (struct coding_system *);
-
-static int detect_coding_iso_2022 (struct coding_system *,
- struct coding_detection_info *info);
-static void decode_coding_iso_2022 (struct coding_system *);
-static int encode_coding_iso_2022 (struct coding_system *);
-
-static int detect_coding_emacs_mule (struct coding_system *,
- struct coding_detection_info *info);
-static void decode_coding_emacs_mule (struct coding_system *);
-static int encode_coding_emacs_mule (struct coding_system *);
-
-static int detect_coding_sjis (struct coding_system *,
- struct coding_detection_info *info);
-static void decode_coding_sjis (struct coding_system *);
-static int encode_coding_sjis (struct coding_system *);
-
-static int detect_coding_big5 (struct coding_system *,
- struct coding_detection_info *info);
-static void decode_coding_big5 (struct coding_system *);
-static int encode_coding_big5 (struct coding_system *);
-
-static int detect_coding_ccl (struct coding_system *,
- struct coding_detection_info *info);
-static void decode_coding_ccl (struct coding_system *);
-static int encode_coding_ccl (struct coding_system *);
-
-static void decode_coding_raw_text (struct coding_system *);
-static int encode_coding_raw_text (struct coding_system *);
-
-static void coding_set_source (struct coding_system *);
-static ptrdiff_t coding_change_source (struct coding_system *);
-static void coding_set_destination (struct coding_system *);
-static ptrdiff_t coding_change_destination (struct coding_system *);
-static void coding_alloc_by_realloc (struct coding_system *, ptrdiff_t);
-static void coding_alloc_by_making_gap (struct coding_system *,
- ptrdiff_t, ptrdiff_t);
-static unsigned char *alloc_destination (struct coding_system *,
- ptrdiff_t, unsigned char *);
-static void setup_iso_safe_charsets (Lisp_Object);
-static ptrdiff_t encode_designation_at_bol (struct coding_system *,
- int *, int *, unsigned char *);
-static int detect_eol (const unsigned char *,
- ptrdiff_t, enum coding_category);
-static Lisp_Object adjust_coding_eol_type (struct coding_system *, int);
-static void decode_eol (struct coding_system *);
-static Lisp_Object get_translation_table (Lisp_Object, int, int *);
-static Lisp_Object get_translation (Lisp_Object, int *, int *);
-static int produce_chars (struct coding_system *, Lisp_Object, int);
-static inline void produce_charset (struct coding_system *, int *,
- ptrdiff_t);
-static void produce_annotation (struct coding_system *, ptrdiff_t);
-static int decode_coding (struct coding_system *);
-static inline int *handle_composition_annotation (ptrdiff_t, ptrdiff_t,
- struct coding_system *,
- int *, ptrdiff_t *);
-static inline int *handle_charset_annotation (ptrdiff_t, ptrdiff_t,
- struct coding_system *,
- int *, ptrdiff_t *);
-static void consume_chars (struct coding_system *, Lisp_Object, int);
-static int encode_coding (struct coding_system *);
-static Lisp_Object make_conversion_work_buffer (int);
-static Lisp_Object code_conversion_restore (Lisp_Object);
-static inline int char_encodable_p (int, Lisp_Object);
-static Lisp_Object make_subsidiaries (Lisp_Object);
-
static void
record_conversion_result (struct coding_system *coding,
enum coding_result_code result)
@@ -1264,8 +1187,7 @@ alloc_destination (struct coding_system *coding, ptrdiff_t nbytes,
/*** 3. UTF-8 ***/
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in UTF-8. If it is, return 1, else
- return 0. */
+ Return true if a text is encoded in UTF-8. */
#define UTF_8_1_OCTET_P(c) ((c) < 0x80)
#define UTF_8_EXTRA_OCTET_P(c) (((c) & 0xC0) == 0x80)
@@ -1278,16 +1200,16 @@ alloc_destination (struct coding_system *coding, ptrdiff_t nbytes,
#define UTF_8_BOM_2 0xBB
#define UTF_8_BOM_3 0xBF
-static int
+static bool
detect_coding_utf_8 (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t consumed_chars = 0;
- int bom_found = 0;
- int found = 0;
+ bool bom_found = 0;
+ bool found = 0;
detect_info->checked |= CATEGORY_MASK_UTF_8;
/* A coding system of this category is always ASCII compatible. */
@@ -1371,10 +1293,10 @@ decode_coding_utf_8 (struct coding_system *coding)
int *charbuf = coding->charbuf + coding->charbuf_used;
int *charbuf_end = coding->charbuf + coding->charbuf_size;
ptrdiff_t consumed_chars = 0, consumed_chars_base = 0;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
enum utf_bom_type bom = CODING_UTF_8_BOM (coding);
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
int byte_after_cr = -1;
if (bom != utf_without_bom)
@@ -1513,10 +1435,10 @@ decode_coding_utf_8 (struct coding_system *coding)
}
-static int
+static bool
encode_coding_utf_8 (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -1577,8 +1499,7 @@ encode_coding_utf_8 (struct coding_system *coding)
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in one of UTF-16 based coding systems.
- If it is, return 1, else return 0. */
+ Return true if a text is encoded in one of UTF-16 based coding systems. */
#define UTF_16_HIGH_SURROGATE_P(val) \
(((val) & 0xFC00) == 0xD800)
@@ -1587,13 +1508,13 @@ encode_coding_utf_8 (struct coding_system *coding)
(((val) & 0xFC00) == 0xDC00)
-static int
+static bool
detect_coding_utf_16 (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
int c1, c2;
detect_info->checked |= CATEGORY_MASK_UTF_16;
@@ -1680,12 +1601,12 @@ decode_coding_utf_16 (struct coding_system *coding)
/* We may produces at most 3 chars in one loop. */
int *charbuf_end = coding->charbuf + coding->charbuf_size - 2;
ptrdiff_t consumed_chars = 0, consumed_chars_base = 0;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
enum utf_bom_type bom = CODING_UTF_16_BOM (coding);
enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding);
int surrogate = CODING_UTF_16_SURROGATE (coding);
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
int byte_after_cr1 = -1, byte_after_cr2 = -1;
if (bom == utf_with_bom)
@@ -1795,17 +1716,17 @@ decode_coding_utf_16 (struct coding_system *coding)
coding->charbuf_used = charbuf - coding->charbuf;
}
-static int
+static bool
encode_coding_utf_16 (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
unsigned char *dst_end = coding->destination + coding->dst_bytes;
int safe_room = 8;
enum utf_bom_type bom = CODING_UTF_16_BOM (coding);
- int big_endian = CODING_UTF_16_ENDIAN (coding) == utf_16_big_endian;
+ bool big_endian = CODING_UTF_16_ENDIAN (coding) == utf_16_big_endian;
ptrdiff_t produced_chars = 0;
int c;
@@ -1930,16 +1851,15 @@ char emacs_mule_bytes[256];
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in `emacs-mule'. If it is, return 1,
- else return 0. */
+ Return true if a text is encoded in 'emacs-mule'. */
-static int
+static bool
detect_coding_emacs_mule (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t consumed_chars = 0;
int c;
int found = 0;
@@ -2029,12 +1949,12 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
{
const unsigned char *src_end = coding->source + coding->src_bytes;
const unsigned char *src_base = src;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
int charset_ID;
unsigned code;
int c;
int consumed_chars = 0;
- int mseq_found = 0;
+ bool mseq_found = 0;
ONE_MORE_BYTE (c);
if (c < 0)
@@ -2411,12 +2331,12 @@ decode_coding_emacs_mule (struct coding_system *coding)
/* We can produce up to 2 characters in a loop. */
- 1;
ptrdiff_t consumed_chars = 0, consumed_chars_base;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t char_offset = coding->produced_char;
ptrdiff_t last_offset = char_offset;
int last_id = charset_ascii;
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
int byte_after_cr = -1;
struct composition_status *cmp_status = &coding->spec.emacs_mule.cmp_status;
@@ -2657,10 +2577,10 @@ decode_coding_emacs_mule (struct coding_system *coding)
} while (0);
-static int
+static bool
encode_coding_emacs_mule (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -2722,7 +2642,7 @@ encode_coding_emacs_mule (struct coding_system *coding)
if (preferred_charset_id >= 0)
{
- int result;
+ bool result;
charset = CHARSET_FROM_ID (preferred_charset_id);
CODING_CHAR_CHARSET_P (coding, dst, dst_end, c, charset, result);
@@ -3017,17 +2937,17 @@ setup_iso_safe_charsets (Lisp_Object attrs)
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in one of ISO-2022 based coding systems.
- If it is, return 1, else return 0. */
+ Return true if a text is encoded in one of ISO-2022 based coding
+ systems. */
-static int
+static bool
detect_coding_iso_2022 (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source, *src_base = src;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
- int single_shifting = 0;
+ bool multibytep = coding->src_multibyte;
+ bool single_shifting = 0;
int id;
int c, c1;
ptrdiff_t consumed_chars = 0;
@@ -3390,8 +3310,6 @@ detect_coding_iso_2022 (struct coding_system *coding,
/* Finish the current composition as invalid. */
-static int finish_composition (int *, struct composition_status *);
-
static int
finish_composition (int *charbuf, struct composition_status *cmp_status)
{
@@ -3541,7 +3459,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
int *charbuf_end
= coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3);
ptrdiff_t consumed_chars = 0, consumed_chars_base;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
/* Charsets invoked to graphic plane 0 and 1 respectively. */
int charset_id_0 = CODING_ISO_INVOKED_CHARSET (coding, 0);
int charset_id_1 = CODING_ISO_INVOKED_CHARSET (coding, 1);
@@ -3553,8 +3471,8 @@ decode_coding_iso_2022 (struct coding_system *coding)
ptrdiff_t char_offset = coding->produced_char;
ptrdiff_t last_offset = char_offset;
int last_id = charset_ascii;
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
int byte_after_cr = -1;
int i;
@@ -4282,7 +4200,7 @@ encode_invocation_designation (struct charset *charset,
struct coding_system *coding,
unsigned char *dst, ptrdiff_t *p_nchars)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
ptrdiff_t produced_chars = *p_nchars;
int reg; /* graphic register number */
int id = CHARSET_ID (charset);
@@ -4380,7 +4298,7 @@ encode_designation_at_bol (struct coding_system *coding,
int r[4];
int c, found = 0, reg;
ptrdiff_t produced_chars = 0;
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
Lisp_Object attrs;
Lisp_Object charset_list;
@@ -4422,21 +4340,21 @@ encode_designation_at_bol (struct coding_system *coding,
/* See the above "GENERAL NOTES on `encode_coding_XXX ()' functions". */
-static int
+static bool
encode_coding_iso_2022 (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
unsigned char *dst_end = coding->destination + coding->dst_bytes;
int safe_room = 16;
- int bol_designation
+ bool bol_designation
= (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_DESIGNATE_AT_BOL
&& CODING_ISO_BOL (coding));
ptrdiff_t produced_chars = 0;
Lisp_Object attrs, eol_type, charset_list;
- int ascii_compatible;
+ bool ascii_compatible;
int c;
int preferred_charset_id = -1;
@@ -4523,8 +4441,9 @@ encode_coding_iso_2022 (struct coding_system *coding)
CODING_ISO_DESIGNATION (coding, i)
= CODING_ISO_INITIAL (coding, i);
}
- bol_designation
- = CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_DESIGNATE_AT_BOL;
+ bol_designation = ((CODING_ISO_FLAGS (coding)
+ & CODING_ISO_FLAG_DESIGNATE_AT_BOL)
+ != 0);
}
else if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_RESET_AT_CNTL)
ENCODE_RESET_PLANE_AND_REGISTER ();
@@ -4551,7 +4470,7 @@ encode_coding_iso_2022 (struct coding_system *coding)
if (preferred_charset_id >= 0)
{
- int result;
+ bool result;
charset = CHARSET_FROM_ID (preferred_charset_id);
CODING_CHAR_CHARSET_P (coding, dst, dst_end, c, charset, result);
@@ -4631,16 +4550,15 @@ encode_coding_iso_2022 (struct coding_system *coding)
*/
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in SJIS. If it is, return
- CATEGORY_MASK_SJIS, else return 0. */
+ Return true if a text is encoded in SJIS. */
-static int
+static bool
detect_coding_sjis (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t consumed_chars = 0;
int found = 0;
int c;
@@ -4688,16 +4606,15 @@ detect_coding_sjis (struct coding_system *coding,
}
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in BIG5. If it is, return
- CATEGORY_MASK_BIG5, else return 0. */
+ Return true if a text is encoded in BIG5. */
-static int
+static bool
detect_coding_big5 (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t consumed_chars = 0;
int found = 0;
int c;
@@ -4735,8 +4652,7 @@ detect_coding_big5 (struct coding_system *coding,
return 1;
}
-/* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions".
- If SJIS_P is 1, decode SJIS text, else decode BIG5 test. */
+/* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */
static void
decode_coding_sjis (struct coding_system *coding)
@@ -4750,15 +4666,15 @@ decode_coding_sjis (struct coding_system *coding)
int *charbuf_end
= coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
ptrdiff_t consumed_chars = 0, consumed_chars_base;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
struct charset *charset_roman, *charset_kanji, *charset_kana;
struct charset *charset_kanji2;
Lisp_Object attrs, charset_list, val;
ptrdiff_t char_offset = coding->produced_char;
ptrdiff_t last_offset = char_offset;
int last_id = charset_ascii;
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
int byte_after_cr = -1;
CODING_GET_INFO (coding, attrs, charset_list);
@@ -4868,14 +4784,14 @@ decode_coding_big5 (struct coding_system *coding)
int *charbuf_end
= coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
ptrdiff_t consumed_chars = 0, consumed_chars_base;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
struct charset *charset_roman, *charset_big5;
Lisp_Object attrs, charset_list, val;
ptrdiff_t char_offset = coding->produced_char;
ptrdiff_t last_offset = char_offset;
int last_id = charset_ascii;
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
int byte_after_cr = -1;
CODING_GET_INFO (coding, attrs, charset_list);
@@ -4957,13 +4873,12 @@ decode_coding_big5 (struct coding_system *coding)
`japanese-jisx0208', `chinese-big5-1', and `chinese-big5-2'. We
are sure that all these charsets are registered as official charset
(i.e. do not have extended leading-codes). Characters of other
- charsets are produced without any encoding. If SJIS_P is 1, encode
- SJIS text, else encode BIG5 text. */
+ charsets are produced without any encoding. */
-static int
+static bool
encode_coding_sjis (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -4971,7 +4886,7 @@ encode_coding_sjis (struct coding_system *coding)
int safe_room = 4;
ptrdiff_t produced_chars = 0;
Lisp_Object attrs, charset_list, val;
- int ascii_compatible;
+ bool ascii_compatible;
struct charset *charset_kanji, *charset_kana;
struct charset *charset_kanji2;
int c;
@@ -5054,10 +4969,10 @@ encode_coding_sjis (struct coding_system *coding)
return 0;
}
-static int
+static bool
encode_coding_big5 (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -5065,7 +4980,7 @@ encode_coding_big5 (struct coding_system *coding)
int safe_room = 4;
ptrdiff_t produced_chars = 0;
Lisp_Object attrs, charset_list, val;
- int ascii_compatible;
+ bool ascii_compatible;
struct charset *charset_big5;
int c;
@@ -5130,17 +5045,16 @@ encode_coding_big5 (struct coding_system *coding)
/*** 10. CCL handlers ***/
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in a coding system of which
- encoder/decoder are written in CCL program. If it is, return
- CATEGORY_MASK_CCL, else return 0. */
+ Return true if a text is encoded in a coding system of which
+ encoder/decoder are written in CCL program. */
-static int
+static bool
detect_coding_ccl (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t consumed_chars = 0;
int found = 0;
unsigned char *valids;
@@ -5182,7 +5096,7 @@ decode_coding_ccl (struct coding_system *coding)
int *charbuf = coding->charbuf + coding->charbuf_used;
int *charbuf_end = coding->charbuf + coding->charbuf_size;
ptrdiff_t consumed_chars = 0;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
struct ccl_program *ccl = &coding->spec.ccl->ccl;
int source_charbuf[1024];
int source_byteidx[1025];
@@ -5243,11 +5157,11 @@ decode_coding_ccl (struct coding_system *coding)
coding->charbuf_used = charbuf - coding->charbuf;
}
-static int
+static bool
encode_coding_ccl (struct coding_system *coding)
{
struct ccl_program *ccl = &coding->spec.ccl->ccl;
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -5308,7 +5222,6 @@ encode_coding_ccl (struct coding_system *coding)
return 0;
}
-
/*** 10, 11. no-conversion handlers ***/
@@ -5317,8 +5230,8 @@ encode_coding_ccl (struct coding_system *coding)
static void
decode_coding_raw_text (struct coding_system *coding)
{
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
coding->chars_at_source = 1;
coding->consumed_char = coding->src_chars;
@@ -5333,10 +5246,10 @@ decode_coding_raw_text (struct coding_system *coding)
record_conversion_result (coding, CODING_RESULT_SUCCESS);
}
-static int
+static bool
encode_coding_raw_text (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = coding->charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -5414,21 +5327,20 @@ encode_coding_raw_text (struct coding_system *coding)
}
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in a charset-based coding system. If it
- is, return 1, else return 0. */
+ Return true if a text is encoded in a charset-based coding system. */
-static int
+static bool
detect_coding_charset (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t consumed_chars = 0;
Lisp_Object attrs, valids, name;
int found = 0;
ptrdiff_t head_ascii = coding->head_ascii;
- int check_latin_extra = 0;
+ bool check_latin_extra = 0;
detect_info->checked |= CATEGORY_MASK_CHARSET;
@@ -5532,14 +5444,14 @@ decode_coding_charset (struct coding_system *coding)
int *charbuf_end
= coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
ptrdiff_t consumed_chars = 0, consumed_chars_base;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
Lisp_Object attrs = CODING_ID_ATTRS (coding->id);
Lisp_Object valids;
ptrdiff_t char_offset = coding->produced_char;
ptrdiff_t last_offset = char_offset;
int last_id = charset_ascii;
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
int byte_after_cr = -1;
valids = AREF (attrs, coding_attr_charset_valids);
@@ -5648,10 +5560,10 @@ decode_coding_charset (struct coding_system *coding)
coding->charbuf_used = charbuf - coding->charbuf;
}
-static int
+static bool
encode_coding_charset (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -5659,7 +5571,7 @@ encode_coding_charset (struct coding_system *coding)
int safe_room = MAX_MULTIBYTE_LENGTH;
ptrdiff_t produced_chars = 0;
Lisp_Object attrs, charset_list;
- int ascii_compatible;
+ bool ascii_compatible;
int c;
CODING_GET_INFO (coding, attrs, charset_list);
@@ -5865,7 +5777,6 @@ setup_coding_system (Lisp_Object coding_system, struct coding_system *coding)
coding->encoder = encode_coding_emacs_mule;
coding->common_flags
|= (CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK);
- coding->spec.emacs_mule.full_support = 1;
if (! NILP (AREF (attrs, coding_attr_emacs_mule_full))
&& ! EQ (CODING_ATTR_CHARSET_LIST (attrs), Vemacs_mule_charset_list))
{
@@ -5883,7 +5794,6 @@ setup_coding_system (Lisp_Object coding_system, struct coding_system *coding)
SSET (safe_charsets, XFASTINT (XCAR (tail)), 0);
coding->max_charset_id = max_charset_id;
coding->safe_charsets = SDATA (safe_charsets);
- coding->spec.emacs_mule.full_support = 1;
}
coding->spec.emacs_mule.cmp_status.state = COMPOSING_NO;
coding->spec.emacs_mule.cmp_status.method = COMPOSITION_NO;
@@ -6216,11 +6126,9 @@ detect_eol (const unsigned char *source, ptrdiff_t src_bytes,
if ((1 << category) & CATEGORY_MASK_UTF_16)
{
- int msb, lsb;
-
- msb = category == (coding_category_utf_16_le
- | coding_category_utf_16_le_nosig);
- lsb = 1 - msb;
+ bool msb = category == (coding_category_utf_16_le
+ | coding_category_utf_16_le_nosig);
+ bool lsb = !msb;
while (src + 1 < src_end)
{
@@ -6335,7 +6243,7 @@ static void
detect_coding (struct coding_system *coding)
{
const unsigned char *src, *src_end;
- int saved_mode = coding->mode;
+ unsigned int saved_mode = coding->mode;
coding->consumed = coding->consumed_char = 0;
coding->produced = coding->produced_char = 0;
@@ -6350,7 +6258,7 @@ detect_coding (struct coding_system *coding)
{
int c, i;
struct coding_detection_info detect_info;
- int null_byte_found = 0, eight_bit_found = 0;
+ bool null_byte_found = 0, eight_bit_found = 0;
detect_info.checked = detect_info.found = detect_info.rejected = 0;
for (src = coding->source; src < src_end; src++)
@@ -6609,11 +6517,11 @@ decode_eol (struct coding_system *coding)
/* Return a translation table (or list of them) from coding system
- attribute vector ATTRS for encoding (ENCODEP is nonzero) or
- decoding (ENCODEP is zero). */
+ attribute vector ATTRS for encoding (if ENCODEP) or decoding (if
+ not ENCODEP). */
static Lisp_Object
-get_translation_table (Lisp_Object attrs, int encodep, int *max_lookup)
+get_translation_table (Lisp_Object attrs, bool encodep, int *max_lookup)
{
Lisp_Object standard, translation_table;
Lisp_Object val;
@@ -6743,7 +6651,7 @@ get_translation (Lisp_Object trans, int *buf, int *buf_end)
static int
produce_chars (struct coding_system *coding, Lisp_Object translation_table,
- int last_block)
+ bool last_block)
{
unsigned char *dst = coding->destination + coding->produced;
unsigned char *dst_end = coding->destination + coding->dst_bytes;
@@ -6846,7 +6754,7 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
{
if (coding->src_multibyte)
{
- int multibytep = 1;
+ bool multibytep = 1;
ptrdiff_t consumed_chars = 0;
while (1)
@@ -6882,7 +6790,7 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
else
while (src < src_end)
{
- int multibytep = 1;
+ bool multibytep = 1;
int c = *src++;
if (dst >= dst_end - 1)
@@ -7018,7 +6926,7 @@ produce_charset (struct coding_system *coding, int *charbuf, ptrdiff_t pos)
if (! coding->charbuf) \
{ \
record_conversion_result (coding, CODING_RESULT_INSUFFICIENT_MEM); \
- return coding->result; \
+ return; \
} \
coding->charbuf_size = size; \
} while (0)
@@ -7079,7 +6987,7 @@ produce_annotation (struct coding_system *coding, ptrdiff_t pos)
CODING->dst_object.
*/
-static int
+static void
decode_coding (struct coding_system *coding)
{
Lisp_Object attrs;
@@ -7212,7 +7120,6 @@ decode_coding (struct coding_system *coding)
bset_undo_list (current_buffer, undo_list);
record_insert (coding->dst_pos, coding->produced_char);
}
- return coding->result;
}
@@ -7341,7 +7248,7 @@ consume_chars (struct coding_system *coding, Lisp_Object translation_table,
const unsigned char *src_end = coding->source + coding->src_bytes;
ptrdiff_t pos = coding->src_pos + coding->consumed_char;
ptrdiff_t end_pos = coding->src_pos + coding->src_chars;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
Lisp_Object eol_type;
int c;
ptrdiff_t stop, stop_composition, stop_charset;
@@ -7488,7 +7395,7 @@ consume_chars (struct coding_system *coding, Lisp_Object translation_table,
If CODING->dst_object is nil, the encoded data is placed at the
memory area specified by CODING->destination. */
-static int
+static void
encode_coding (struct coding_system *coding)
{
Lisp_Object attrs;
@@ -7530,8 +7437,6 @@ encode_coding (struct coding_system *coding)
if (BUFFERP (coding->dst_object) && coding->produced_char > 0)
insert_from_gap (coding->produced_char, coding->produced);
-
- return (coding->result);
}
@@ -7545,26 +7450,27 @@ static Lisp_Object Vcode_conversion_workbuf_name;
versions of Vcode_conversion_workbuf_name. */
static Lisp_Object Vcode_conversion_reused_workbuf;
-/* 1 iff Vcode_conversion_reused_workbuf is already in use. */
-static int reused_workbuf_in_use;
+/* True iff Vcode_conversion_reused_workbuf is already in use. */
+static bool reused_workbuf_in_use;
/* Return a working buffer of code conversion. MULTIBYTE specifies the
multibyteness of returning buffer. */
static Lisp_Object
-make_conversion_work_buffer (int multibyte)
+make_conversion_work_buffer (bool multibyte)
{
Lisp_Object name, workbuf;
struct buffer *current;
- if (reused_workbuf_in_use++)
+ if (reused_workbuf_in_use)
{
name = Fgenerate_new_buffer_name (Vcode_conversion_workbuf_name, Qnil);
workbuf = Fget_buffer_create (name);
}
else
{
+ reused_workbuf_in_use = 1;
if (NILP (Fbuffer_live_p (Vcode_conversion_reused_workbuf)))
Vcode_conversion_reused_workbuf
= Fget_buffer_create (Vcode_conversion_workbuf_name);
@@ -7606,7 +7512,7 @@ code_conversion_restore (Lisp_Object arg)
}
Lisp_Object
-code_conversion_save (int with_work_buf, int multibyte)
+code_conversion_save (bool with_work_buf, bool multibyte)
{
Lisp_Object workbuf = Qnil;
@@ -7617,7 +7523,7 @@ code_conversion_save (int with_work_buf, int multibyte)
return workbuf;
}
-int
+void
decode_coding_gap (struct coding_system *coding,
ptrdiff_t chars, ptrdiff_t bytes)
{
@@ -7660,7 +7566,6 @@ decode_coding_gap (struct coding_system *coding,
}
unbind_to (count, Qnil);
- return coding->result;
}
@@ -7706,8 +7611,8 @@ decode_coding_object (struct coding_system *coding,
ptrdiff_t chars = to - from;
ptrdiff_t bytes = to_byte - from_byte;
Lisp_Object attrs;
- int saved_pt = -1, saved_pt_byte IF_LINT (= 0);
- int need_marker_adjustment = 0;
+ ptrdiff_t saved_pt = -1, saved_pt_byte IF_LINT (= 0);
+ bool need_marker_adjustment = 0;
Lisp_Object old_deactivate_mark;
old_deactivate_mark = Vdeactivate_mark;
@@ -7894,9 +7799,9 @@ encode_coding_object (struct coding_system *coding,
ptrdiff_t chars = to - from;
ptrdiff_t bytes = to_byte - from_byte;
Lisp_Object attrs;
- int saved_pt = -1, saved_pt_byte IF_LINT (= 0);
- int need_marker_adjustment = 0;
- int kill_src_buffer = 0;
+ ptrdiff_t saved_pt = -1, saved_pt_byte IF_LINT (= 0);
+ bool need_marker_adjustment = 0;
+ bool kill_src_buffer = 0;
Lisp_Object old_deactivate_mark;
old_deactivate_mark = Vdeactivate_mark;
@@ -8172,10 +8077,10 @@ function `define-coding-system'. */)
/* Detect how the bytes at SRC of length SRC_BYTES are encoded. If
- HIGHEST is nonzero, return the coding system of the highest
+ HIGHEST, return the coding system of the highest
priority among the detected coding systems. Otherwise return a
list of detected coding systems sorted by their priorities. If
- MULTIBYTEP is nonzero, it is assumed that the bytes are in correct
+ MULTIBYTEP, it is assumed that the bytes are in correct
multibyte form but contains only ASCII and eight-bit chars.
Otherwise, the bytes are raw bytes.
@@ -8190,7 +8095,7 @@ function `define-coding-system'. */)
Lisp_Object
detect_coding_system (const unsigned char *src,
ptrdiff_t src_chars, ptrdiff_t src_bytes,
- int highest, int multibytep,
+ bool highest, bool multibytep,
Lisp_Object coding_system)
{
const unsigned char *src_end = src + src_bytes;
@@ -8200,7 +8105,7 @@ detect_coding_system (const unsigned char *src,
ptrdiff_t id;
struct coding_detection_info detect_info;
enum coding_category base_category;
- int null_byte_found = 0, eight_bit_found = 0;
+ bool null_byte_found = 0, eight_bit_found = 0;
if (NILP (coding_system))
coding_system = Qundecided;
@@ -8556,7 +8461,7 @@ highest priority. */)
}
-static inline int
+static inline bool
char_encodable_p (int c, Lisp_Object attrs)
{
Lisp_Object tail;
@@ -8728,7 +8633,7 @@ to the string. */)
Lisp_Object positions;
ptrdiff_t from, to;
const unsigned char *p, *stop, *pend;
- int ascii_compatible;
+ bool ascii_compatible;
setup_coding_system (Fcheck_coding_system (coding_system), &coding);
attrs = CODING_ID_ATTRS (coding.id);
@@ -8952,7 +8857,7 @@ is nil. */)
static Lisp_Object
code_convert_region (Lisp_Object start, Lisp_Object end,
Lisp_Object coding_system, Lisp_Object dst_object,
- int encodep, int norecord)
+ bool encodep, bool norecord)
{
struct coding_system coding;
ptrdiff_t from, from_byte, to, to_byte;
@@ -9040,7 +8945,8 @@ not fully specified.) */)
Lisp_Object
code_convert_string (Lisp_Object string, Lisp_Object coding_system,
- Lisp_Object dst_object, int encodep, int nocopy, int norecord)
+ Lisp_Object dst_object, bool encodep, bool nocopy,
+ bool norecord)
{
struct coding_system coding;
ptrdiff_t chars, bytes;
@@ -9088,7 +8994,7 @@ code_convert_string (Lisp_Object string, Lisp_Object coding_system,
Lisp_Object
code_convert_string_norecord (Lisp_Object string, Lisp_Object coding_system,
- int encodep)
+ bool encodep)
{
return code_convert_string (string, coding_system, Qt, encodep, 0, 1);
}
@@ -9489,7 +9395,7 @@ usage: (set-coding-system-priority &rest coding-systems) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
ptrdiff_t i, j;
- int changed[coding_category_max];
+ bool changed[coding_category_max];
enum coding_category priorities[coding_category_max];
memset (changed, 0, sizeof changed);
diff --git a/src/coding.h b/src/coding.h
index 2987f19607..c45d2ef86e 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -321,7 +321,7 @@ struct composition_status
{
enum composition_state state;
enum composition_method method;
- int old_form; /* 0:pre-21 form, 1:post-21 form */
+ bool old_form; /* true if pre-21 form */
int length; /* number of elements produced in charbuf */
int nchars; /* number of characters composed */
int ncomps; /* number of composition components */
@@ -350,18 +350,18 @@ struct iso_2022_spec
there was an invalid designation previously. */
int current_designation[4];
- /* Set to 1 temporarily only when graphic register 2 or 3 is invoked
- by single-shift while encoding. */
- int single_shifting;
-
- /* Set to 1 temporarily only when processing at beginning of line. */
- int bol;
-
/* If positive, we are now scanning CTEXT extended segment. */
int ctext_extended_segment_len;
- /* If nonzero, we are now scanning embedded UTF-8 sequence. */
- int embedded_utf_8;
+ /* True temporarily only when graphic register 2 or 3 is invoked by
+ single-shift while encoding. */
+ unsigned single_shifting : 1;
+
+ /* True temporarily only when processing at beginning of line. */
+ unsigned bol : 1;
+
+ /* If true, we are now scanning embedded UTF-8 sequence. */
+ unsigned embedded_utf_8 : 1;
/* The current composition. */
struct composition_status cmp_status;
@@ -369,7 +369,6 @@ struct iso_2022_spec
struct emacs_mule_spec
{
- int full_support;
struct composition_status cmp_status;
};
@@ -470,10 +469,6 @@ struct coding_system
Lisp_Object dst_object;
unsigned char *destination;
- /* Set to 1 if the source of conversion is not in the member
- `charbuf', but at `src_object'. */
- int chars_at_source;
-
/* If an element is non-negative, it is a character code.
If it is in the range -128..-1, it is a 8-bit character code
@@ -489,18 +484,21 @@ struct coding_system
int *charbuf;
int charbuf_size, charbuf_used;
+ /* True if the source of conversion is not in the member
+ `charbuf', but at `src_object'. */
+ unsigned chars_at_source : 1;
+
/* Set to 1 if charbuf contains an annotation. */
- int annotated;
+ unsigned annotated : 1;
unsigned char carryover[64];
int carryover_bytes;
int default_char;
- int (*detector) (struct coding_system *,
- struct coding_detection_info *);
+ bool (*detector) (struct coding_system *, struct coding_detection_info *);
void (*decoder) (struct coding_system *);
- int (*encoder) (struct coding_system *);
+ bool (*encoder) (struct coding_system *);
};
/* Meanings of bits in the member `common_flags' of the structure
@@ -688,22 +686,20 @@ struct coding_system
#define ENCODE_UTF_8(str) code_convert_string_norecord (str, Qutf_8, 1)
/* Extern declarations. */
-extern Lisp_Object code_conversion_save (int, int);
-extern int decoding_buffer_size (struct coding_system *, int);
-extern int encoding_buffer_size (struct coding_system *, int);
+extern Lisp_Object code_conversion_save (bool, bool);
extern void setup_coding_system (Lisp_Object, struct coding_system *);
extern Lisp_Object coding_charset_list (struct coding_system *);
extern Lisp_Object coding_system_charset_list (Lisp_Object);
extern Lisp_Object code_convert_string (Lisp_Object, Lisp_Object,
- Lisp_Object, int, int, int);
+ Lisp_Object, bool, bool, bool);
extern Lisp_Object code_convert_string_norecord (Lisp_Object, Lisp_Object,
- int);
+ bool);
extern Lisp_Object raw_text_coding_system (Lisp_Object);
extern Lisp_Object coding_inherit_eol_type (Lisp_Object, Lisp_Object);
extern Lisp_Object complement_process_encoding_system (Lisp_Object);
-extern int decode_coding_gap (struct coding_system *,
- ptrdiff_t, ptrdiff_t);
+extern void decode_coding_gap (struct coding_system *,
+ ptrdiff_t, ptrdiff_t);
extern void decode_coding_object (struct coding_system *,
Lisp_Object, ptrdiff_t, ptrdiff_t,
ptrdiff_t, ptrdiff_t, Lisp_Object);
@@ -778,6 +774,5 @@ extern struct coding_system safe_terminal_coding;
extern Lisp_Object Qcoding_system_error;
extern char emacs_mule_bytes[256];
-extern int emacs_mule_string_char (unsigned char *);
#endif /* EMACS_CODING_H */
diff --git a/src/fileio.c b/src/fileio.c
index 6deca0bf1e..6906af7e74 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3760,7 +3760,8 @@ variable `last-coding-system-used' to the coding system actually used. */)
ptrdiff_t temp;
ptrdiff_t this = 0;
ptrdiff_t this_count = SPECPDL_INDEX ();
- int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
+ bool multibyte
+ = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
Lisp_Object conversion_buffer;
struct gcpro gcpro1;
diff --git a/src/lisp.h b/src/lisp.h
index 5b842d371a..9ae24998aa 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2632,7 +2632,7 @@ extern void keys_of_cmds (void);
/* Defined in coding.c */
extern Lisp_Object Qcharset;
extern Lisp_Object detect_coding_system (const unsigned char *, ptrdiff_t,
- ptrdiff_t, int, int, Lisp_Object);
+ ptrdiff_t, bool, bool, Lisp_Object);
extern void init_coding (void);
extern void init_coding_once (void);
extern void syms_of_coding (void);