Commit 25a48bd0 authored by Paul Eggert's avatar Paul Eggert

xstrcasecmp: conform to C89 pointer rules

parent d154c079
2011-02-05 Paul Eggert <eggert@cs.ucla.edu>
xstrcasecmp: conform to C89 pointer rules
* xfaces.c (xstrcasecmp): Change args from const unsigned char *
to const char *, since they're usually low-level C strings, and
this stays compatible with C89 pointer rules. All callers changed.
* charset.c: conform to C89 pointer rules
(define_charset_internal): Switch between char * and unsigned char *.
......@@ -3151,7 +3151,7 @@ char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object,
int *);
int ascii_face_of_lisp_face (struct frame *, int);
void prepare_face_for_display (struct frame *, struct face *);
int xstrcasecmp (const unsigned char *, const unsigned char *);
int xstrcasecmp (const char *, const char *);
int lookup_named_face (struct frame *, Lisp_Object, int);
int lookup_basic_face (struct frame *, int);
int smaller_face (struct frame *, int, int);
......@@ -3361,4 +3361,3 @@ extern Lisp_Object x_default_parameter (struct frame *, Lisp_Object,
#endif /* HAVE_WINDOW_SYSTEM */
#endif /* not DISPEXTERN_H_INCLUDED */
......@@ -315,7 +315,7 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror
if (SYMBOLP (val))
{
unsigned char *s;
char *s;
Lisp_Object args[2], elt;
/* At first try exact match. */
......@@ -325,12 +325,12 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror
return ((XINT (AREF (AREF (table, i), 0)) << 8)
| (i << 4) | (j - 1));
/* Try also with case-folding match. */
s = SDATA (SYMBOL_NAME (val));
s = SSDATA (SYMBOL_NAME (val));
for (i = 0; i < len; i++)
for (j = 1; j < ASIZE (AREF (table, i)); j++)
{
elt = AREF (AREF (table, i), j);
if (xstrcasecmp (s, SDATA (SYMBOL_NAME (elt))) == 0)
if (xstrcasecmp (s, SSDATA (SYMBOL_NAME (elt))) == 0)
return ((XINT (AREF (AREF (table, i), 0)) << 8)
| (i << 4) | (j - 1));
}
......
......@@ -1166,7 +1166,7 @@ fs_query_fontset (Lisp_Object name, int name_pattern)
this_name = FONTSET_NAME (fontset);
if (name_pattern == 1
? fast_string_match_ignore_case (name, this_name) >= 0
: !xstrcasecmp (SDATA (name), SDATA (this_name)))
: !xstrcasecmp (SSDATA (name), SSDATA (this_name)))
return i;
}
return -1;
......
......@@ -1022,12 +1022,12 @@ ftfont_list (Lisp_Object frame, Lisp_Object spec)
if (! NILP (adstyle)
&& (NILP (this_adstyle)
|| xstrcasecmp (SDATA (SYMBOL_NAME (adstyle)),
SDATA (SYMBOL_NAME (this_adstyle))) != 0))
|| xstrcasecmp (SSDATA (SYMBOL_NAME (adstyle)),
SSDATA (SYMBOL_NAME (this_adstyle))) != 0))
continue;
if (langname
&& ! NILP (this_adstyle)
&& xstrcasecmp (langname, SDATA (SYMBOL_NAME (this_adstyle))))
&& xstrcasecmp (langname, SSDATA (SYMBOL_NAME (this_adstyle))))
continue;
}
entity = ftfont_pattern_entity (fontset->fonts[i],
......
......@@ -3906,7 +3906,7 @@ xpm_load_image (struct frame *f,
while (num_colors-- > 0)
{
unsigned char *color, *max_color;
char *color, *max_color;
int key, next_key, max_key = 0;
Lisp_Object symbol_color = Qnil, color_val;
XColor cdef;
......@@ -3958,7 +3958,7 @@ xpm_load_image (struct frame *f,
if (CONSP (specified_color) && STRINGP (XCDR (specified_color)))
{
if (xstrcasecmp (SDATA (XCDR (specified_color)), "None") == 0)
if (xstrcasecmp (SSDATA (XCDR (specified_color)), "None") == 0)
color_val = Qt;
else if (x_defined_color (f, SDATA (XCDR (specified_color)),
&cdef, 0))
......
......@@ -6168,10 +6168,10 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */)
;
else
{
unsigned char *name;
char *name;
CHECK_SYMBOL (sigcode);
name = SDATA (SYMBOL_NAME (sigcode));
name = SSDATA (SYMBOL_NAME (sigcode));
if (!strncmp (name, "SIG", 3) || !strncmp (name, "sig", 3))
name += 3;
......
......@@ -716,12 +716,14 @@ x_free_gc (struct frame *f, GC gc)
are in ISO8859-1. */
int
xstrcasecmp (const unsigned char *s1, const unsigned char *s2)
xstrcasecmp (const char *s1, const char *s2)
{
while (*s1 && *s2)
{
unsigned char c1 = tolower (*s1);
unsigned char c2 = tolower (*s2);
unsigned char b1 = *s1;
unsigned char b2 = *s2;
unsigned char c1 = tolower (b1);
unsigned char c2 = tolower (b2);
if (c1 != c2)
return c1 < c2 ? -1 : 1;
++s1, ++s2;
......@@ -3466,13 +3468,13 @@ face_boolean_x_resource_value (Lisp_Object value, int signal_p)
xassert (STRINGP (value));
if (xstrcasecmp (SDATA (value), "on") == 0
|| xstrcasecmp (SDATA (value), "true") == 0)
if (xstrcasecmp (SSDATA (value), "on") == 0
|| xstrcasecmp (SSDATA (value), "true") == 0)
result = Qt;
else if (xstrcasecmp (SDATA (value), "off") == 0
|| xstrcasecmp (SDATA (value), "false") == 0)
else if (xstrcasecmp (SSDATA (value), "off") == 0
|| xstrcasecmp (SSDATA (value), "false") == 0)
result = Qnil;
else if (xstrcasecmp (SDATA (value), "unspecified") == 0)
else if (xstrcasecmp (SSDATA (value), "unspecified") == 0)
result = Qunspecified;
else if (signal_p)
signal_error ("Invalid face attribute value from X resource", value);
......@@ -3491,7 +3493,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource",
CHECK_SYMBOL (attr);
CHECK_STRING (value);
if (xstrcasecmp (SDATA (value), "unspecified") == 0)
if (xstrcasecmp (SSDATA (value), "unspecified") == 0)
value = Qunspecified;
else if (EQ (attr, QCheight))
{
......@@ -4051,10 +4053,10 @@ lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2)
{
xassert (lface_fully_specified_p (lface1)
&& lface_fully_specified_p (lface2));
return (xstrcasecmp (SDATA (lface1[LFACE_FAMILY_INDEX]),
SDATA (lface2[LFACE_FAMILY_INDEX])) == 0
&& xstrcasecmp (SDATA (lface1[LFACE_FOUNDRY_INDEX]),
SDATA (lface2[LFACE_FOUNDRY_INDEX])) == 0
return (xstrcasecmp (SSDATA (lface1[LFACE_FAMILY_INDEX]),
SSDATA (lface2[LFACE_FAMILY_INDEX])) == 0
&& xstrcasecmp (SSDATA (lface1[LFACE_FOUNDRY_INDEX]),
SSDATA (lface2[LFACE_FOUNDRY_INDEX])) == 0
&& EQ (lface1[LFACE_HEIGHT_INDEX], lface2[LFACE_HEIGHT_INDEX])
&& EQ (lface1[LFACE_SWIDTH_INDEX], lface2[LFACE_SWIDTH_INDEX])
&& EQ (lface1[LFACE_WEIGHT_INDEX], lface2[LFACE_WEIGHT_INDEX])
......@@ -4063,8 +4065,8 @@ lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2)
&& (EQ (lface1[LFACE_FONTSET_INDEX], lface2[LFACE_FONTSET_INDEX])
|| (STRINGP (lface1[LFACE_FONTSET_INDEX])
&& STRINGP (lface2[LFACE_FONTSET_INDEX])
&& ! xstrcasecmp (SDATA (lface1[LFACE_FONTSET_INDEX]),
SDATA (lface2[LFACE_FONTSET_INDEX]))))
&& ! xstrcasecmp (SSDATA (lface1[LFACE_FONTSET_INDEX]),
SSDATA (lface2[LFACE_FONTSET_INDEX]))))
);
}
......
......@@ -164,8 +164,8 @@ xfont_get_cache (FRAME_PTR f)
static int
compare_font_names (const void *name1, const void *name2)
{
return xstrcasecmp (*(const unsigned char **) name1,
*(const unsigned char **) name2);
return xstrcasecmp (*(const char **) name1,
*(const char **) name2);
}
/* Decode XLFD as iso-8859-1 into OUTPUT, and return the byte length
......
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