diff options
author | Keith Packard <keithp@keithp.com> | 2013-11-15 05:28:47 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-01-12 10:14:49 -0800 |
commit | 6e51645b4796fc3a02206fefd416b84beb2fcdf7 (patch) | |
tree | 3185d4a25eb59b1af45649cc8353391d2afb2009 | |
parent | abce3206cbc82f632abae5344e0ce46622e00f24 (diff) |
xkb: Clean up warnings
Add const to lots of strings.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | include/xkbrules.h | 2 | ||||
-rw-r--r-- | include/xkbsrv.h | 2 | ||||
-rw-r--r-- | xkb/ddxLoad.c | 2 | ||||
-rw-r--r-- | xkb/maprules.c | 73 | ||||
-rw-r--r-- | xkb/xkbInit.c | 10 |
5 files changed, 47 insertions, 42 deletions
diff --git a/include/xkbrules.h b/include/xkbrules.h index 5b69d0db2..956eade0b 100644 --- a/include/xkbrules.h +++ b/include/xkbrules.h @@ -64,7 +64,7 @@ typedef struct _XkbRF_Rule { typedef struct _XkbRF_Group { int number; const char *name; - const char *words; + char *words; } XkbRF_GroupRec, *XkbRF_GroupPtr; #define XkbRF_PendingMatch (1L<<1) diff --git a/include/xkbsrv.h b/include/xkbsrv.h index 346ebccf0..fbfe4035f 100644 --- a/include/xkbsrv.h +++ b/include/xkbsrv.h @@ -852,7 +852,7 @@ extern _X_EXPORT unsigned int XkbDDXLoadKeymapByNames(DeviceIntPtr /* keybd */ , ); extern _X_EXPORT Bool XkbDDXNamesFromRules(DeviceIntPtr /* keybd */ , - char * /* rules */ , + const char * /* rules */ , XkbRF_VarDefsPtr /* defs */ , XkbComponentNamesPtr /* names */ ); diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index d462957f4..f458e3bde 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -299,7 +299,7 @@ XkbDDXLoadKeymapByNames(DeviceIntPtr keybd, Bool XkbDDXNamesFromRules(DeviceIntPtr keybd, - char *rules_name, + const char *rules_name, XkbRF_VarDefsPtr defs, XkbComponentNamesPtr names) { char buf[PATH_MAX]; diff --git a/xkb/maprules.c b/xkb/maprules.c index 5462763d1..6f5f8ccf3 100644 --- a/xkb/maprules.c +++ b/xkb/maprules.c @@ -218,10 +218,10 @@ typedef struct _FileSpec { } FileSpec; typedef struct { - char *model; - char *layout[XkbNumKbdGroups + 1]; - char *variant[XkbNumKbdGroups + 1]; - char *options; + const char *model; + const char *layout[XkbNumKbdGroups + 1]; + const char *variant[XkbNumKbdGroups + 1]; + const char *options; } XkbRF_MultiDefsRec, *XkbRF_MultiDefsPtr; #define NDX_BUFF_SIZE 4 @@ -343,9 +343,9 @@ SetUpRemap(InputLine * line, RemapSpec * remap) } static Bool -MatchOneOf(char *wanted, char *vals_defined) +MatchOneOf(const char *wanted, const char *vals_defined) { - char *str, *next; + const char *str, *next; int want_len = strlen(wanted); for (str = vals_defined, next = NULL; str != NULL; str = next) { @@ -469,7 +469,7 @@ CheckLine(InputLine * line, } static char * -_Concat(char *str1, char *str2) +_Concat(char *str1, const char *str2) { int len; @@ -498,12 +498,13 @@ squeeze_spaces(char *p1) static Bool MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs) { - + char *options; memset((char *) mdefs, 0, sizeof(XkbRF_MultiDefsRec)); mdefs->model = defs->model; - mdefs->options = Xstrdup(defs->options); - if (mdefs->options) - squeeze_spaces(mdefs->options); + options = Xstrdup(defs->options); + if (options) + squeeze_spaces(options); + mdefs->options = options; if (defs->layout) { if (!strchr(defs->layout, ',')) { @@ -511,13 +512,15 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs) } else { char *p; + char *layout; int i; - mdefs->layout[1] = Xstrdup(defs->layout); - if (mdefs->layout[1] == NULL) + layout = Xstrdup(defs->layout); + if (layout == NULL) return FALSE; - squeeze_spaces(mdefs->layout[1]); - p = mdefs->layout[1]; + squeeze_spaces(layout); + mdefs->layout[1] = layout; + p = layout; for (i = 2; i <= XkbNumKbdGroups; i++) { if ((p = strchr(p, ','))) { *p++ = '\0'; @@ -538,13 +541,15 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs) } else { char *p; + char *variant; int i; - mdefs->variant[1] = Xstrdup(defs->variant); - if (mdefs->variant[1] == NULL) + variant = Xstrdup(defs->variant); + if (variant == NULL) return FALSE; - squeeze_spaces(mdefs->variant[1]); - p = mdefs->variant[1]; + squeeze_spaces(variant); + mdefs->variant[1] = variant; + p = variant; for (i = 2; i <= XkbNumKbdGroups; i++) { if ((p = strchr(p, ','))) { *p++ = '\0'; @@ -564,13 +569,13 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs) static void FreeMultiDefs(XkbRF_MultiDefsPtr defs) { - free(defs->options); - free(defs->layout[1]); - free(defs->variant[1]); + free((void *) defs->options); + free((void *) defs->layout[1]); + free((void *) defs->variant[1]); } static void -Apply(char *src, char **dst) +Apply(const char *src, char **dst) { if (src) { if (*src == '+' || *src == '!') { @@ -596,7 +601,7 @@ XkbRF_ApplyRule(XkbRF_RulePtr rule, XkbComponentNamesPtr names) } static Bool -CheckGroup(XkbRF_RulesPtr rules, char *group_name, char *name) +CheckGroup(XkbRF_RulesPtr rules, const char *group_name, const char *name) { int i; char *p; @@ -1013,15 +1018,15 @@ XkbRF_Free(XkbRF_RulesPtr rules, Bool freeRules) return; if (rules->rules) { for (i = 0, rule = rules->rules; i < rules->num_rules; i++, rule++) { - free(rule->model); - free(rule->layout); - free(rule->variant); - free(rule->option); - free(rule->keycodes); - free(rule->symbols); - free(rule->types); - free(rule->compat); - free(rule->geometry); + free((void *) rule->model); + free((void *) rule->layout); + free((void *) rule->variant); + free((void *) rule->option); + free((void *) rule->keycodes); + free((void *) rule->symbols); + free((void *) rule->types); + free((void *) rule->compat); + free((void *) rule->geometry); memset((char *) rule, 0, sizeof(XkbRF_RuleRec)); } free(rules->rules); @@ -1031,7 +1036,7 @@ XkbRF_Free(XkbRF_RulesPtr rules, Bool freeRules) if (rules->groups) { for (i = 0, group = rules->groups; i < rules->num_groups; i++, group++) { - free(group->name); + free((void *) group->name); free(group->words); } free(rules->groups); diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index f72655fc3..ca3831cdc 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -129,11 +129,11 @@ XkbFreeRMLVOSet(XkbRMLVOSet * rmlvo, Bool freeRMLVO) if (!rmlvo) return; - free(rmlvo->rules); - free(rmlvo->model); - free(rmlvo->layout); - free(rmlvo->variant); - free(rmlvo->options); + free((void *) rmlvo->rules); + free((void *) rmlvo->model); + free((void *) rmlvo->layout); + free((void *) rmlvo->variant); + free((void *) rmlvo->options); if (freeRMLVO) free(rmlvo); |