summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-03-25 23:15:58 +0000
committerDaniel Stone <daniel@fooishbar.org>2006-03-25 23:15:58 +0000
commite61dfbf6c72369f83a833d3a5a04c306a6b289f8 (patch)
tree3f196d389d16c446ab8ea58cd9234c1b8b6fed30
parent4b0ad25354d5807fc9e77fda3397ee78332502c1 (diff)
Bug #3819: Change open-coded _XkbStrCaseCmp to strcmp + tolower.
-rw-r--r--ChangeLog8
-rw-r--r--src/XKBfileInt.h6
-rw-r--r--src/maprules.c10
-rw-r--r--src/xkbconfig.c80
-rw-r--r--src/xkbmisc.c28
5 files changed, 54 insertions, 78 deletions
diff --git a/ChangeLog b/ChangeLog
index ced4c1f..89cd751 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-03-25 Daniel Stone <daniel@freedesktop.org>
+
+ * src/XKBfileInt.h:
+ * src/xkbmisc.c:
+ * src/xkbconfig.c:
+ * src/maprules.c:
+ Bug #3819: Change open-coded _XkbStrCaseCmp to strcmp + tolower.
+
2006-02-28 Adam Jackson <ajax@freedesktop.org>
* configure.ac:
diff --git a/src/XKBfileInt.h b/src/XKBfileInt.h
index f11c46a..a20094e 100644
--- a/src/XKBfileInt.h
+++ b/src/XKBfileInt.h
@@ -68,11 +68,7 @@ extern char * _XkbDupString(
char * /* old_str */
);
-extern int _XkbStrCaseCmp(
- char * /* str1 */,
- char * /* str2 */
-);
-#define _XkbStrCaseEqual(s1,s2) (_XkbStrCaseCmp(s1,s2)==0)
+#define _XkbStrCaseEqual(s1,s2) (strcmp(tolower(s1),tolower(s2))==0)
_XFUNCPROTOEND
diff --git a/src/maprules.c b/src/maprules.c
index 3c4905a..2638071 100644
--- a/src/maprules.c
+++ b/src/maprules.c
@@ -1106,20 +1106,20 @@ 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 (!_XkbStrCaseCmp(tok,"model"))
+ if (strcmp(tok,"model") == 0)
headingtype = HEAD_MODEL;
- else if (!_XkbStrCaseCmp(tok,"layout"))
+ else if (strcmp(tolower(tok),"layout") == 0)
headingtype = HEAD_LAYOUT;
- else if (!_XkbStrCaseCmp(tok,"variant"))
+ else if (strcmp(tolower(tok),"variant") == 0)
headingtype = HEAD_VARIANT;
- else if (!_XkbStrCaseCmp(tok,"option"))
+ else if (strcmp(tolower(tok),"option") == 0)
headingtype = HEAD_OPTION;
else {
int i;
headingtype = HEAD_EXTRA;
extra_ndx= -1;
for (i=0;(i<rules->num_extra)&&(extra_ndx<0);i++) {
- if (!_XkbStrCaseCmp(tok,rules->extra_names[i]))
+ if (_XkbStrCaseCmp(tolower(tok),rules->extra_names[i]))
extra_ndx= i;
}
if (extra_ndx<0) {
diff --git a/src/xkbconfig.c b/src/xkbconfig.c
index 7930979..bf2395d 100644
--- a/src/xkbconfig.c
+++ b/src/xkbconfig.c
@@ -256,32 +256,32 @@ int ch;
static Bool
AddCtrlByName(XkbConfigRtrnPtr rtrn,char *name,unsigned long *ctrls_rtrn)
{
- if ((_XkbStrCaseCmp(name,"repeat")==0)||
- (_XkbStrCaseCmp(name,"repeatkeys")==0))
+ if ((strcmp(tolower(name),"repeat")==0)||
+ (strcmp(tolower(name),"repeatkeys")==0))
*ctrls_rtrn= XkbRepeatKeysMask;
- else if (_XkbStrCaseCmp(name,"slowkeys")==0)
+ else if (strcmp(tolower(name),"slowkeys")==0)
*ctrls_rtrn= XkbSlowKeysMask;
- else if (_XkbStrCaseCmp(name,"bouncekeys")==0)
+ else if (strcmp(tolower(name),"bouncekeys")==0)
*ctrls_rtrn= XkbBounceKeysMask;
- else if (_XkbStrCaseCmp(name,"stickykeys")==0)
+ else if (strcmp(tolower(name),"stickykeys")==0)
*ctrls_rtrn= XkbStickyKeysMask;
- else if (_XkbStrCaseCmp(name,"mousekeys")==0)
+ else if (strcmp(tolower(name),"mousekeys")==0)
*ctrls_rtrn= XkbMouseKeysMask;
- else if (_XkbStrCaseCmp(name,"mousekeysaccel")==0)
+ else if (strcmp(tolower(name),"mousekeysaccel")==0)
*ctrls_rtrn= XkbMouseKeysAccelMask;
- else if (_XkbStrCaseCmp(name,"accessxkeys")==0)
+ else if (strcmp(tolower(name),"accessxkeys")==0)
*ctrls_rtrn= XkbAccessXKeysMask;
- else if (_XkbStrCaseCmp(name,"accessxtimeout")==0)
+ else if (strcmp(tolower(name),"accessxtimeout")==0)
*ctrls_rtrn= XkbAccessXTimeoutMask;
- else if (_XkbStrCaseCmp(name,"accessxfeedback")==0)
+ else if (strcmp(tolower(name),"accessxfeedback")==0)
*ctrls_rtrn= XkbAccessXFeedbackMask;
- else if (_XkbStrCaseCmp(name,"audiblebell")==0)
+ else if (strcmp(tolower(name),"audiblebell")==0)
*ctrls_rtrn= XkbAudibleBellMask;
- else if (_XkbStrCaseCmp(name,"overlay1")==0)
+ else if (strcmp(tolower(name),"overlay1")==0)
*ctrls_rtrn= XkbOverlay1Mask;
- else if (_XkbStrCaseCmp(name,"overlay2")==0)
+ else if (strcmp(tolower(name),"overlay2")==0)
*ctrls_rtrn= XkbOverlay2Mask;
- else if (_XkbStrCaseCmp(name,"ignoregrouplock")==0)
+ else if (strcmp(tolower(name),"ignoregrouplock")==0)
*ctrls_rtrn= XkbIgnoreGroupLockMask;
else {
rtrn->error= XkbCF_ExpectedControl;
@@ -295,29 +295,29 @@ AddAXTimeoutOptByName( XkbConfigRtrnPtr rtrn,
char * name,
unsigned short * opts_rtrn)
{
- if (_XkbStrCaseCmp(name,"slowkeyspress")==0)
+ if (strcmp(tolower(name),"slowkeyspress")==0)
*opts_rtrn= XkbAX_SKPressFBMask;
- else if (_XkbStrCaseCmp(name,"slowkeysaccept")==0)
+ else if (strcmp(tolower(name),"slowkeysaccept")==0)
*opts_rtrn= XkbAX_SKAcceptFBMask;
- else if (_XkbStrCaseCmp(name,"feature")==0)
+ else if (strcmp(tolower(name),"feature")==0)
*opts_rtrn= XkbAX_FeatureFBMask;
- else if (_XkbStrCaseCmp(name,"slowwarn")==0)
+ else if (strcmp(tolower(name),"slowwarn")==0)
*opts_rtrn= XkbAX_SlowWarnFBMask;
- else if (_XkbStrCaseCmp(name,"indicator")==0)
+ else if (strcmp(tolower(name),"indicator")==0)
*opts_rtrn= XkbAX_IndicatorFBMask;
- else if (_XkbStrCaseCmp(name,"stickykeys")==0)
+ else if (strcmp(tolower(name),"stickykeys")==0)
*opts_rtrn= XkbAX_StickyKeysFBMask;
- else if (_XkbStrCaseCmp(name,"twokeys")==0)
+ else if (strcmp(tolower(name),"twokeys")==0)
*opts_rtrn= XkbAX_TwoKeysMask;
- else if (_XkbStrCaseCmp(name,"latchtolock")==0)
+ else if (strcmp(tolower(name),"latchtolock")==0)
*opts_rtrn= XkbAX_LatchToLockMask;
- else if (_XkbStrCaseCmp(name,"slowkeysrelease")==0)
+ else if (strcmp(tolower(name),"slowkeysrelease")==0)
*opts_rtrn= XkbAX_SKReleaseFBMask;
- else if (_XkbStrCaseCmp(name,"slowkeysreject")==0)
+ else if (strcmp(tolower(name),"slowkeysreject")==0)
*opts_rtrn= XkbAX_SKRejectFBMask;
- else if (_XkbStrCaseCmp(name,"bouncekeysreject")==0)
+ else if (strcmp(tolower(name),"bouncekeysreject")==0)
*opts_rtrn= XkbAX_BKRejectFBMask;
- else if (_XkbStrCaseCmp(name,"dumbbell")==0)
+ else if (strcmp(tolower(name),"dumbbell")==0)
*opts_rtrn= XkbAX_DumbBellFBMask;
else {
rtrn->error= XkbCF_ExpectedControl;
@@ -351,22 +351,22 @@ XkbCFAddModByName( XkbConfigRtrnPtr rtrn,
last->merge= merge;
last->name= NULL;
}
- if (_XkbStrCaseCmp(name,"shift")==0)
+ if (strcmp(tolower(name),"shift")==0)
last->mods|= ShiftMask;
- else if (_XkbStrCaseCmp(name,"lock")==0)
+ else if (strcmp(tolower(name),"lock")==0)
last->mods|= LockMask;
- else if ((_XkbStrCaseCmp(name,"control")==0)||
- (_XkbStrCaseCmp(name,"ctrl")==0))
+ else if ((strcmp(tolower(name),"control")==0)||
+ (strcmp(tolower(name),"ctrl")==0))
last->mods|= ControlMask;
- else if (_XkbStrCaseCmp(name,"mod1")==0)
+ else if (strcmp(tolower(name),"mod1")==0)
last->mods|= Mod1Mask;
- else if (_XkbStrCaseCmp(name,"mod2")==0)
+ else if (strcmp(tolower(name),"mod2")==0)
last->mods|= Mod2Mask;
- else if (_XkbStrCaseCmp(name,"mod3")==0)
+ else if (strcmp(tolower(name),"mod3")==0)
last->mods|= Mod3Mask;
- else if (_XkbStrCaseCmp(name,"mod4")==0)
+ else if (strcmp(tolower(name),"mod4")==0)
last->mods|= Mod4Mask;
- else if (_XkbStrCaseCmp(name,"mod5")==0)
+ else if (strcmp(tolower(name),"mod5")==0)
last->mods|= Mod5Mask;
else {
if (last->name!=NULL) {
@@ -796,11 +796,11 @@ unsigned what;
if (tok!=XkbCF_Integer) {
Bool ok= False;
if ((onoff)&&(tok==XkbCF_Ident)&&(val.str!=NULL)) {
- if (_XkbStrCaseCmp(val.str,"on")) {
+ if (strcmp(tolower(val.str),"on")) {
val.ival= onoff;
ok= True;
}
- else if (_XkbStrCaseCmp(val.str,"off")) {
+ else if (strcmp(tolower(val.str),"off")) {
val.ival= 0;
ok= True;
}
@@ -826,10 +826,10 @@ unsigned what;
}
tok= XkbCFScan(file,&val,rtrn);
if (tok==XkbCF_Ident) {
- if (_XkbStrCaseCmp(val.str,"wrap")==0) {
+ if (strcmp(tolower(val.str),"wrap")==0) {
rtrn->groups_wrap= XkbSetGroupInfo(0,XkbWrapIntoRange,0);
}
- else if (_XkbStrCaseCmp(val.str,"clamp")==0) {
+ else if (strcmp(tolower(val.str),"clamp")==0) {
rtrn->groups_wrap= XkbSetGroupInfo(0,XkbClampIntoRange,0);
}
else {
@@ -1280,7 +1280,7 @@ XkbConfigFieldsPtr tmp;
XkbConfigFieldPtr f;
for (i=0,f=tmp->fields;(i<tmp->num_fields)&&(!done);i++,f++) {
- if (_XkbStrCaseCmp(val.str,f->field)!=0)
+ if (strcmp(tolower(val.str),f->field)!=0)
continue;
if ((*tmp->parser)(file,tmp,f,xkb,rtrn))
done= True;
diff --git a/src/xkbmisc.c b/src/xkbmisc.c
index cca31f7..01f6174 100644
--- a/src/xkbmisc.c
+++ b/src/xkbmisc.c
@@ -150,34 +150,6 @@ unsigned set,rtrn;
/***===================================================================***/
-int
-_XkbStrCaseCmp(char *str1,char *str2)
-{
- char buf1[512],buf2[512];
- char c, *s;
- register int n;
-
- for (n=0, s = buf1; (c = *str1++); n++) {
- if (isupper(c))
- c = tolower(c);
- if (n>510)
- break;
- *s++ = c;
- }
- *s = '\0';
- for (n=0, s = buf2; (c = *str2++); n++) {
- if (isupper(c))
- c = tolower(c);
- if (n>510)
- break;
- *s++ = c;
- }
- *s = '\0';
- return (strcmp(buf1, buf2));
-}
-
-/***===================================================================***/
-
Bool
XkbLookupGroupAndLevel( XkbDescPtr xkb,
int key,