Fix minor problems found by static checking.
* coding.c (encode_inhibit_flag, inhibit_flag): New functions. Redo the latter's body to sidestep GCC parenthesization warnings. (setup_coding_system, detect_coding, detect_coding_system): Use them. * coding.c (detect_coding, detect_coding_system): * coding.h (struct undecided_spec): Use bool for boolean. * image.c (QCmax_width, QCmax_height): Now static. * xdisp.c (Fmove_point_visually): Remove unused local.
This commit is contained in:
parent
7900732126
commit
9c90cc06dd
5 changed files with 53 additions and 36 deletions
|
@ -1,3 +1,15 @@
|
|||
2013-06-29 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Fix minor problems found by static checking.
|
||||
* coding.c (encode_inhibit_flag, inhibit_flag): New functions.
|
||||
Redo the latter's body to sidestep GCC parenthesization warnings.
|
||||
(setup_coding_system, detect_coding, detect_coding_system): Use them.
|
||||
* coding.c (detect_coding, detect_coding_system):
|
||||
* coding.h (struct undecided_spec):
|
||||
Use bool for boolean.
|
||||
* image.c (QCmax_width, QCmax_height): Now static.
|
||||
* xdisp.c (Fmove_point_visually): Remove unused local.
|
||||
|
||||
2013-06-29 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* xdisp.c (Fmove_point_visually): New function.
|
||||
|
|
62
src/coding.c
62
src/coding.c
|
@ -649,6 +649,23 @@ static struct coding_system coding_categories[coding_category_max];
|
|||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
/* Encode a flag that can be nil, something else, or t as -1, 0, 1. */
|
||||
|
||||
static int
|
||||
encode_inhibit_flag (Lisp_Object flag)
|
||||
{
|
||||
return NILP (flag) ? -1 : EQ (flag, Qt);
|
||||
}
|
||||
|
||||
/* True if the value of ENCODED_FLAG says a flag should be treated as set.
|
||||
1 means yes, -1 means no, 0 means ask the user variable VAR. */
|
||||
|
||||
static bool
|
||||
inhibit_flag (int encoded_flag, bool var)
|
||||
{
|
||||
return 0 < encoded_flag + var;
|
||||
}
|
||||
|
||||
#define CODING_GET_INFO(coding, attrs, charset_list) \
|
||||
do { \
|
||||
(attrs) = CODING_ID_ATTRS ((coding)->id); \
|
||||
|
@ -5706,17 +5723,11 @@ setup_coding_system (Lisp_Object coding_system, struct coding_system *coding)
|
|||
coding->encoder = encode_coding_raw_text;
|
||||
coding->common_flags |= CODING_REQUIRE_DETECTION_MASK;
|
||||
coding->spec.undecided.inhibit_nbd
|
||||
= (NILP (AREF (attrs, coding_attr_undecided_inhibit_null_byte_detection))
|
||||
? -1
|
||||
: EQ (AREF (attrs, coding_attr_undecided_inhibit_null_byte_detection), Qt)
|
||||
? 1
|
||||
: 0);
|
||||
= (encode_inhibit_flag
|
||||
(AREF (attrs, coding_attr_undecided_inhibit_null_byte_detection)));
|
||||
coding->spec.undecided.inhibit_ied
|
||||
= (NILP (AREF (attrs, coding_attr_undecided_inhibit_iso_escape_detection))
|
||||
? -1
|
||||
: EQ (AREF (attrs, coding_attr_undecided_inhibit_iso_escape_detection), Qt)
|
||||
? 1
|
||||
: 0);
|
||||
= (encode_inhibit_flag
|
||||
(AREF (attrs, coding_attr_undecided_inhibit_iso_escape_detection)));
|
||||
coding->spec.undecided.prefer_utf_8
|
||||
= ! NILP (AREF (attrs, coding_attr_undecided_prefer_utf_8));
|
||||
}
|
||||
|
@ -6476,16 +6487,11 @@ detect_coding (struct coding_system *coding)
|
|||
int c, i;
|
||||
struct coding_detection_info detect_info;
|
||||
bool null_byte_found = 0, eight_bit_found = 0;
|
||||
int inhibit_nbd /* null byte detection */
|
||||
= (coding->spec.undecided.inhibit_nbd > 0
|
||||
| (coding->spec.undecided.inhibit_nbd == 0
|
||||
& inhibit_null_byte_detection));
|
||||
int inhibit_ied /* iso escape detection */
|
||||
= (coding->spec.undecided.inhibit_ied > 0
|
||||
| (coding->spec.undecided.inhibit_ied == 0
|
||||
& inhibit_iso_escape_detection));
|
||||
int prefer_utf_8
|
||||
= coding->spec.undecided.prefer_utf_8;
|
||||
bool inhibit_nbd = inhibit_flag (coding->spec.undecided.inhibit_nbd,
|
||||
inhibit_null_byte_detection);
|
||||
bool inhibit_ied = inhibit_flag (coding->spec.undecided.inhibit_ied,
|
||||
inhibit_iso_escape_detection);
|
||||
bool prefer_utf_8 = coding->spec.undecided.prefer_utf_8;
|
||||
|
||||
coding->head_ascii = 0;
|
||||
detect_info.checked = detect_info.found = detect_info.rejected = 0;
|
||||
|
@ -8544,17 +8550,11 @@ detect_coding_system (const unsigned char *src,
|
|||
enum coding_category category IF_LINT (= 0);
|
||||
struct coding_system *this IF_LINT (= NULL);
|
||||
int c, i;
|
||||
int inhibit_nbd /* null byte detection */
|
||||
= (coding.spec.undecided.inhibit_nbd > 0
|
||||
| (coding.spec.undecided.inhibit_nbd == 0
|
||||
& inhibit_null_byte_detection));
|
||||
int inhibit_ied /* iso escape detection */
|
||||
= (coding.spec.undecided.inhibit_ied > 0
|
||||
| (coding.spec.undecided.inhibit_ied == 0
|
||||
& inhibit_iso_escape_detection));
|
||||
int prefer_utf_8
|
||||
= coding.spec.undecided.prefer_utf_8;
|
||||
|
||||
bool inhibit_nbd = inhibit_flag (coding.spec.undecided.inhibit_nbd,
|
||||
inhibit_null_byte_detection);
|
||||
bool inhibit_ied = inhibit_flag (coding.spec.undecided.inhibit_ied,
|
||||
inhibit_iso_escape_detection);
|
||||
bool prefer_utf_8 = coding.spec.undecided.prefer_utf_8;
|
||||
|
||||
/* Skip all ASCII bytes except for a few ISO2022 controls. */
|
||||
for (; src < src_end; src++)
|
||||
|
|
12
src/coding.h
12
src/coding.h
|
@ -382,9 +382,15 @@ struct ccl_spec;
|
|||
|
||||
struct undecided_spec
|
||||
{
|
||||
int inhibit_nbd; /* nbd: null byte detection */
|
||||
int inhibit_ied; /* ied: iso escape detection */
|
||||
int prefer_utf_8;
|
||||
/* Inhibit null byte detection. 1 means always inhibit,
|
||||
-1 means do not inhibit, 0 means rely on user variable. */
|
||||
int inhibit_nbd;
|
||||
|
||||
/* Inhibit ISO escape detection. -1, 0, 1 as above. */
|
||||
int inhibit_ied;
|
||||
|
||||
/* Prefer UTF-8 when the input could be other encodings. */
|
||||
bool prefer_utf_8;
|
||||
};
|
||||
|
||||
enum utf_bom_type
|
||||
|
|
|
@ -130,7 +130,7 @@ static void free_color_table (void);
|
|||
static unsigned long *colors_in_color_table (int *n);
|
||||
#endif
|
||||
|
||||
Lisp_Object QCmax_width, QCmax_height;
|
||||
static Lisp_Object QCmax_width, QCmax_height;
|
||||
|
||||
/* Code to deal with bitmaps. Bitmaps are referenced by their bitmap
|
||||
id, which is just an int that this section returns. Bitmaps are
|
||||
|
|
|
@ -20252,7 +20252,6 @@ Value is the new character position of point. */)
|
|||
struct it it;
|
||||
int pt_x, target_x, pixel_width, pt_vpos;
|
||||
bool at_eol_p;
|
||||
bool disp_string_at_start_p = 0;
|
||||
bool overshoot_expected = false;
|
||||
bool target_is_eol_p = false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue