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 *.
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);
#endif /* HAVE_WINDOW_SYSTEM */
#endif /* not DISPEXTERN_H_INCLUDED */
-
if (SYMBOLP (val))
{
- unsigned char *s;
+ char *s;
Lisp_Object args[2], elt;
/* At first try exact match. */
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));
}
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;
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],
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;
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))
;
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;
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;
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);
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))
{
{
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])
&& (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]))))
);
}
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