Fix remnants of previous busted _XkbStrCaseCmp commit.

This commit is contained in:
Daniel Stone 2006-03-27 22:28:32 +00:00
parent 9e202dfe40
commit 5be8a66d32
6 changed files with 38 additions and 8 deletions

View File

@ -18,8 +18,11 @@
prototype to xkb.h.
Explicitly initialise nTypes in xkb.c.
* configure.ac:
* include/xkb-config.h.in:
* xkb/xkbfmisc.c:
* xkb/maprules.c:
* hw/xfree86/dixmods/xkbPrivate.c:
Bug #3819: Remove open-coding of strcasecmp.
* xkb/ddxVT.c:

View File

@ -727,6 +727,8 @@ REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
XKB_LIB='$(top_builddir)/xkb/libxkb.la'
XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
[Do not have `strcasecmp'.]))
PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
if test "x$have_libxdmcp" = xyes; then

View File

@ -26,13 +26,13 @@ XkbDDXPrivate(DeviceIntPtr dev,KeyCode key,XkbAction *act)
if (xf86act->type == XkbSA_XFree86Private) {
memcpy(msgbuf, xf86act->data, XkbAnyActionDataSize);
msgbuf[XkbAnyActionDataSize]= '\0';
if (_XkbStrCaseCmp(msgbuf, "-vmode")==0)
if (strcmp(msgbuf, "-vmode")==0)
xf86ProcessActionEvent(ACTION_PREV_MODE, NULL);
else if (_XkbStrCaseCmp(msgbuf, "+vmode")==0)
else if (strcmp(msgbuf, "+vmode")==0)
xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL);
else if (_XkbStrCaseCmp(msgbuf, "ungrab")==0)
else if (strcmp(msgbuf, "ungrab")==0)
xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL);
else if (_XkbStrCaseCmp(msgbuf, "clsgrb")==0)
else if (strcmp(msgbuf, "clsgrb")==0)
xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL);
else
xf86ProcessActionEvent(ACTION_MESSAGE, (void *) msgbuf);

View File

@ -17,4 +17,7 @@
/* XKB output dir for compiled keymaps. */
#undef XKM_OUTPUT_DIR
/* Do not have `strcasecmp'. */
#undef NEED_STRCASECMP
#endif /* _XKB_CONFIG_H_ */

View File

@ -82,6 +82,12 @@
#define PR_DEBUG2(s,a,b)
#endif
#ifdef NEED_STRCASECMP
extern int _XkbStrCaseCmp(char *s1, char *s2);
#else
#define _XkbStrCaseCmp strcasecmp
#endif
/***====================================================================***/
#define DFLT_LINE_SIZE 128
@ -1106,13 +1112,13 @@ int len,headingtype,extra_ndx = 0;
for ( ; GetInputLine(file,&line,False); line.num_line= 0) {
if (line.line[0]=='!') {
tok = strtok(&(line.line[1]), " \t");
if (strcmp(tolower(tok),"model") == 0)
if (_XkbStrCaseCmp(tolower(tok),"model") == 0)
headingtype = HEAD_MODEL;
else if (strcmp(tolower(tok),"layout") == 0)
else if (_XkbStrCaseCmp(tok,"layout") == 0)
headingtype = HEAD_LAYOUT;
else if (strcmp(tolower(tok),"variant") == 0)
else if (_XkbStrCaseCmp(tok,"variant") == 0)
headingtype = HEAD_VARIANT;
else if (strcmp(tolower(tok),"option") == 0)
else if (_XkbStrCaseCmp(tok,"option") == 0)
headingtype = HEAD_OPTION;
else {
int i;

View File

@ -659,3 +659,19 @@ XkbNameMatchesPattern(char *name,char *ptrn)
/* if we get here, the pattern is exhausted (-:just like me:-) */
return (name[0]=='\0');
}
#ifdef NEED_STRCASECMP
_X_HIDDEN int
_XkbStrCaseCmp(char *str1,char *str2)
{
const u_char *us1 = (const u_char *)str1, *us2 = (const u_char *)str2;
while (tolower(*us1) == tolower(*us2)) {
if (*us1++ == '\0')
return (0);
us2++;
}
return (tolower(*us1) - tolower(*us2));
}
#endif