summaryrefslogtreecommitdiff
path: root/xkb/ddxLoad.c
diff options
context:
space:
mode:
Diffstat (limited to 'xkb/ddxLoad.c')
-rw-r--r--xkb/ddxLoad.c56
1 files changed, 33 insertions, 23 deletions
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index ee64c3be7..ade13c3af 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -274,7 +274,7 @@ char tmpname[PATH_MAX];
return True;
}
else
- DebugF("[xkb] Error compiling keymap (%s)\n",keymap);
+ LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap);
#ifdef WIN32
/* remove the temporary file */
unlink(tmpname);
@@ -282,9 +282,9 @@ char tmpname[PATH_MAX];
}
else {
#ifndef WIN32
- DebugF("[xkb] Could not invoke keymap compiler\n");
+ LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp\n");
#else
- DebugF("[xkb] Could not open file %s\n", tmpname);
+ LogMessage(X_ERROR, "Could not open file %s\n", tmpname);
#endif
}
if (nameRtrn)
@@ -350,11 +350,13 @@ unsigned missing;
if ((names->keycodes==NULL)&&(names->types==NULL)&&
(names->compat==NULL)&&(names->symbols==NULL)&&
(names->geometry==NULL)) {
+ LogMessage(X_ERROR, "XKB: No components provided for device %s\n",
+ keybd->name);
return 0;
}
else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need,
nameRtrn,nameRtrnLen)){
- DebugF("[xkb] Couldn't compile keymap file\n");
+ LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n");
return 0;
}
file= XkbDDXOpenConfigFile(nameRtrn,fileName,PATH_MAX);
@@ -369,8 +371,8 @@ unsigned missing;
(void) unlink (fileName);
return 0;
}
- else if (xkbDebugFlags) {
- DebugF("[xkb] Loaded XKB keymap %s, defined=0x%x\n",fileName,(*xkbRtrn)->defined);
+ else {
+ DebugF("Loaded XKB keymap %s, defined=0x%x\n",fileName,(*xkbRtrn)->defined);
}
fclose(file);
(void) unlink (fileName);
@@ -390,32 +392,40 @@ XkbRF_RulesPtr rules;
if (!rules_name)
return False;
- if (XkbBaseDirectory==NULL) {
- if (strlen(rules_name)+7 > PATH_MAX)
- return False;
- sprintf(buf,"rules/%s",rules_name);
- }
- else {
- if (strlen(XkbBaseDirectory)+strlen(rules_name)+8 > PATH_MAX)
- return False;
- sprintf(buf,"%s/rules/%s",XkbBaseDirectory,rules_name);
+
+ if (strlen(XkbBaseDirectory) + strlen(rules_name) + 8 > PATH_MAX) {
+ LogMessage(X_ERROR, "XKB: Rules name is too long\n");
+ return False;
}
- if ((file= fopen(buf,"r"))==NULL)
+ sprintf(buf,"%s/rules/%s", XkbBaseDirectory, rules_name);
+
+ file = fopen(buf, "r");
+ if (!file) {
+ LogMessage(X_ERROR, "XKB: Couldn't open rules file %s\n", buf);
return False;
- if ((rules= XkbRF_Create(0,0))==NULL) {
+ }
+
+ rules = XkbRF_Create(0, 0);
+ if (!rules) {
+ LogMessage(X_ERROR, "XKB: Couldn't create rules struct\n");
fclose(file);
return False;
}
- if (!XkbRF_LoadRules(file,rules)) {
+
+ if (!XkbRF_LoadRules(file, rules)) {
+ LogMessage(X_ERROR, "XKB: Couldn't parse rules file %s\n", rules_name);
fclose(file);
XkbRF_Free(rules,True);
return False;
}
- bzero((char *)names,sizeof(XkbComponentNamesRec));
- complete= XkbRF_GetComponents(rules,defs,names);
+
+ memset(names, 0, sizeof(*names));
+ complete = XkbRF_GetComponents(rules,defs,names);
fclose(file);
- XkbRF_Free(rules,True);
- return complete;
-}
+ XkbRF_Free(rules, True);
+ if (!complete)
+ LogMessage(X_ERROR, "XKB: Rules returned no components\n");
+ return complete;
+}