kbproto untanglement: XkbKeyNameLength

Define it ourselves as XKB_KEY_NAME_LENGTH and use that, instead of the
one from XKB.h.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
master
Daniel Stone 2012-08-21 11:21:19 +01:00
parent 3b6b214c78
commit f5dffd2b6e
13 changed files with 37 additions and 35 deletions

View File

@ -426,7 +426,7 @@ KeysymText(xkb_keysym_t sym)
}
const char *
KeyNameText(const char name[XkbKeyNameLength])
KeyNameText(const char name[XKB_KEY_NAME_LENGTH])
{
char *buf;
int len;

View File

@ -74,7 +74,7 @@ const char *
KeysymText(xkb_keysym_t sym);
const char *
KeyNameText(const char name[XkbKeyNameLength]);
KeyNameText(const char name[XKB_KEY_NAME_LENGTH]);
const char *
SIMatchText(unsigned type);

View File

@ -95,6 +95,8 @@ typedef uint32_t xkb_atom_t;
#define XKB_ATOM_NONE 0
#define XKB_LEVEL_INVALID 0xffffffff
#define XKB_KEY_NAME_LENGTH 4
struct xkb_context {
int refcnt;
@ -275,8 +277,8 @@ struct xkb_indicator_map {
};
struct xkb_key_alias {
char real[XkbKeyNameLength];
char alias[XkbKeyNameLength];
char real[XKB_KEY_NAME_LENGTH];
char alias[XKB_KEY_NAME_LENGTH];
};
struct xkb_controls {
@ -296,7 +298,7 @@ struct xkb_controls {
};
struct xkb_key {
char name[XkbKeyNameLength];
char name[XKB_KEY_NAME_LENGTH];
unsigned char explicit;

View File

@ -887,7 +887,7 @@ HandleRedirectKey(struct xkb_keymap *keymap, union xkb_action *action,
unsigned t1;
xkb_mod_mask_t t2;
unsigned long tmp;
char key_name[XkbKeyNameLength];
char key_name[XKB_KEY_NAME_LENGTH];
if (array_ndx != NULL)
return ReportActionNotArray(keymap, action->type, field);

View File

@ -110,7 +110,7 @@ ExprCreateBinary(enum expr_op_type op, ExprDef *left, ExprDef *right)
}
KeycodeDef *
KeycodeCreate(char keyName[XkbKeyNameLength], unsigned long value)
KeycodeCreate(char keyName[XKB_KEY_NAME_LENGTH], unsigned long value)
{
KeycodeDef *def;
@ -118,13 +118,13 @@ KeycodeCreate(char keyName[XkbKeyNameLength], unsigned long value)
def->common.type = STMT_KEYCODE;
def->common.next = NULL;
strncpy(def->name, keyName, XkbKeyNameLength);
strncpy(def->name, keyName, XKB_KEY_NAME_LENGTH);
def->value = value;
return def;
}
KeyAliasDef *
KeyAliasCreate(char alias[XkbKeyNameLength], char real[XkbKeyNameLength])
KeyAliasCreate(char alias[XKB_KEY_NAME_LENGTH], char real[XKB_KEY_NAME_LENGTH])
{
KeyAliasDef *def;
@ -132,8 +132,8 @@ KeyAliasCreate(char alias[XkbKeyNameLength], char real[XkbKeyNameLength])
def->common.type = STMT_ALIAS;
def->common.next = NULL;
strncpy(def->alias, alias, XkbKeyNameLength);
strncpy(def->real, real, XkbKeyNameLength);
strncpy(def->alias, alias, XKB_KEY_NAME_LENGTH);
strncpy(def->real, real, XKB_KEY_NAME_LENGTH);
return def;
}
@ -206,7 +206,7 @@ KeyTypeCreate(xkb_atom_t name, VarDef * body)
}
SymbolsDef *
SymbolsCreate(char keyName[XkbKeyNameLength], ExprDef *symbols)
SymbolsCreate(char keyName[XKB_KEY_NAME_LENGTH], ExprDef *symbols)
{
SymbolsDef *def;
@ -215,7 +215,7 @@ SymbolsCreate(char keyName[XkbKeyNameLength], ExprDef *symbols)
def->common.type = STMT_SYMBOLS;
def->common.next = NULL;
def->merge = MERGE_DEFAULT;
strncpy(def->keyName, keyName, XkbKeyNameLength);
strncpy(def->keyName, keyName, XKB_KEY_NAME_LENGTH);
def->symbols = symbols;
return def;
}

View File

@ -41,10 +41,10 @@ ExprDef *
ExprCreateBinary(enum expr_op_type op, ExprDef *left, ExprDef *right);
KeycodeDef *
KeycodeCreate(char keyName[XkbKeyNameLength], unsigned long value);
KeycodeCreate(char keyName[XKB_KEY_NAME_LENGTH], unsigned long value);
KeyAliasDef *
KeyAliasCreate(char keyName[XkbKeyNameLength], char real[XkbKeyNameLength]);
KeyAliasCreate(char keyName[XKB_KEY_NAME_LENGTH], char real[XKB_KEY_NAME_LENGTH]);
VModDef *
VModCreate(xkb_atom_t name, ExprDef *value);
@ -62,7 +62,7 @@ KeyTypeDef *
KeyTypeCreate(xkb_atom_t name, VarDef *body);
SymbolsDef *
SymbolsCreate(char keyName[XkbKeyNameLength], ExprDef *symbols);
SymbolsCreate(char keyName[XKB_KEY_NAME_LENGTH], ExprDef *symbols);
GroupCompatDef *
GroupCompatCreate(int group, ExprDef *def);

View File

@ -166,7 +166,7 @@ typedef struct _Expr {
xkb_atom_t str;
unsigned uval;
int ival;
char keyName[XkbKeyNameLength];
char keyName[XKB_KEY_NAME_LENGTH];
} value;
} ExprDef;
@ -187,15 +187,15 @@ typedef struct _VModDef {
typedef struct _KeycodeDef {
ParseCommon common;
enum merge_mode merge;
char name[XkbKeyNameLength];
char name[XKB_KEY_NAME_LENGTH];
unsigned long value;
} KeycodeDef;
typedef struct _KeyAliasDef {
ParseCommon common;
enum merge_mode merge;
char alias[XkbKeyNameLength];
char real[XkbKeyNameLength];
char alias[XKB_KEY_NAME_LENGTH];
char real[XKB_KEY_NAME_LENGTH];
} KeyAliasDef;
typedef struct _KeyTypeDef {
@ -208,7 +208,7 @@ typedef struct _KeyTypeDef {
typedef struct _SymbolsDef {
ParseCommon common;
enum merge_mode merge;
char keyName[XkbKeyNameLength];
char keyName[XKB_KEY_NAME_LENGTH];
ExprDef *symbols;
} SymbolsDef;

View File

@ -490,7 +490,7 @@ ExprResolveString(struct xkb_context *ctx, const ExprDef *expr,
bool
ExprResolveKeyName(struct xkb_context *ctx, const ExprDef *expr,
char name[XkbKeyNameLength])
char name[XKB_KEY_NAME_LENGTH])
{
switch (expr->op) {
case EXPR_VALUE:
@ -499,7 +499,7 @@ ExprResolveKeyName(struct xkb_context *ctx, const ExprDef *expr,
expr_value_type_to_string(expr->value_type));
return false;
}
strncpy(name, expr->value.keyName, XkbKeyNameLength);
strncpy(name, expr->value.keyName, XKB_KEY_NAME_LENGTH);
return true;
case EXPR_IDENT:

View File

@ -82,7 +82,7 @@ ExprResolveString(struct xkb_context *ctx, const ExprDef *expr,
bool
ExprResolveKeyName(struct xkb_context *ctx, const ExprDef *expr,
char name[XkbKeyNameLength]);
char name[XKB_KEY_NAME_LENGTH]);
bool
ExprResolveEnum(struct xkb_context *ctx, const ExprDef *expr,

View File

@ -164,7 +164,7 @@ ResizeKeyNameArrays(KeyNamesInfo *info, int newMax)
static void
InitAliasInfo(AliasInfo *info, enum merge_mode merge, unsigned file_id,
char alias[XkbKeyNameLength], char real[XkbKeyNameLength])
char alias[XKB_KEY_NAME_LENGTH], char real[XKB_KEY_NAME_LENGTH])
{
memset(info, 0, sizeof(*info));
info->merge = merge;
@ -886,12 +886,12 @@ bool
FindKeyNameForAlias(struct xkb_keymap *keymap, unsigned long lname,
unsigned long *real_name)
{
char name[XkbKeyNameLength];
char name[XKB_KEY_NAME_LENGTH];
struct xkb_key_alias *a;
LongToKeyName(lname, name);
darray_foreach(a, keymap->key_aliases) {
if (strncmp(name, a->alias, XkbKeyNameLength) == 0) {
if (strncmp(name, a->alias, XKB_KEY_NAME_LENGTH) == 0) {
*real_name = KeyNameToLong(a->real);
return true;
}

View File

@ -28,7 +28,7 @@
#define XKBCOMP_KEYCODES_H
static inline unsigned long
KeyNameToLong(const char name[XkbKeyNameLength])
KeyNameToLong(const char name[XKB_KEY_NAME_LENGTH])
{
return
(((unsigned long)name[0]) << 24) |
@ -38,7 +38,7 @@ KeyNameToLong(const char name[XkbKeyNameLength])
}
static inline void
LongToKeyName(unsigned long val, char name[XkbKeyNameLength])
LongToKeyName(unsigned long val, char name[XKB_KEY_NAME_LENGTH])
{
name[0] = ((val >> 24) & 0xff);
name[1] = ((val >> 16) & 0xff);
@ -49,7 +49,7 @@ LongToKeyName(unsigned long val, char name[XkbKeyNameLength])
static inline const char *
LongKeyNameText(unsigned long val)
{
char buf[XkbKeyNameLength];
char buf[XKB_KEY_NAME_LENGTH];
LongToKeyName(val, buf);
return KeyNameText(buf);
}

View File

@ -122,7 +122,7 @@ yyerror(struct YYLTYPE *loc, struct parser_param *param, const char *msg)
int64_t num;
enum xkb_file_type file_type;
char *str;
char keyName[XkbKeyNameLength];
char keyName[XKB_KEY_NAME_LENGTH];
xkb_atom_t sval;
enum merge_mode merge;
ParseCommon *any;
@ -678,7 +678,7 @@ Terminal : String
{
ExprDef *expr;
expr = ExprCreate(EXPR_VALUE, EXPR_TYPE_KEYNAME);
strncpy(expr->value.keyName, $1, XkbKeyNameLength);
strncpy(expr->value.keyName, $1, XKB_KEY_NAME_LENGTH);
$$ = expr;
}
;
@ -734,7 +734,7 @@ Integer : INTEGER { $$ = $1; }
KeyCode : INTEGER { $$ = $1; }
;
KeyName : KEYNAME { strncpy($$, $1, XkbKeyNameLength); }
KeyName : KEYNAME { strncpy($$, $1, XKB_KEY_NAME_LENGTH); }
;
Ident : IDENT { $$ = xkb_atom_steal(param->ctx, $1); }

View File

@ -81,13 +81,13 @@ scanner_error_extra(struct YYLTYPE *loc, struct scanner_extra *extra,
BEGIN(INITIAL);
*yyextra->s = '\0';
if (yyextra->s - yyextra->scanBuf > XkbKeyNameLength) {
if (yyextra->s - yyextra->scanBuf > XKB_KEY_NAME_LENGTH) {
scanner_error_extra(yylloc, yyextra,
"Key name too long");
return ERROR_TOK;
}
strncpy(yylval->keyName, yyextra->scanBuf, XkbKeyNameLength);
strncpy(yylval->keyName, yyextra->scanBuf, XKB_KEY_NAME_LENGTH);
return KEYNAME;
}