parser: use int64_t for all numbers Don't use int which can have different size on different machines. Also avoid some warnings from MSVC: xkbcomp/parser.y(760): warning C4244: '=': conversion from 'int64_t' to 'int', possible loss of data xkbcomp/parser.y(761): warning C4244: '=': conversion from 'int64_t' to 'int', possible loss of data xkbcomp/parser.y(767): warning C4244: '=': conversion from 'int64_t' to 'int', possible loss of data Signed-off-by: Ran Benita <ran@unusedvar.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
diff --git a/src/xkbcomp/parser.y b/src/xkbcomp/parser.y
index 4838eaa..45f9d90 100644
--- a/src/xkbcomp/parser.y
+++ b/src/xkbcomp/parser.y
@@ -162,7 +162,6 @@ resolve_keysym(const char *name, xkb_keysym_t *sym_rtrn)
%start XkbFile
%union {
- int ival;
int64_t num;
enum xkb_file_type file_type;
char *str;
@@ -195,8 +194,7 @@ resolve_keysym(const char *name, xkb_keysym_t *sym_rtrn)
%type <num> INTEGER FLOAT
%type <str> IDENT STRING
%type <atom> KEYNAME
-%type <num> KeyCode
-%type <ival> Number Integer Float SignedNumber DoodadType
+%type <num> KeyCode Number Integer Float SignedNumber DoodadType
%type <merge> MergeMode OptMergeMode
%type <file_type> XkbCompositeType FileType
%type <mapFlags> Flag Flags OptFlags
@@ -736,15 +734,15 @@ KeySym : IDENT
| Integer
{
if ($1 < 0) {
- parser_warn(param, "unrecognized keysym \"%d\"", $1);
+ parser_warn(param, "unrecognized keysym \"%ld\"", $1);
$$ = XKB_KEY_NoSymbol;
}
else if ($1 < 10) { /* XKB_KEY_0 .. XKB_KEY_9 */
$$ = XKB_KEY_0 + (xkb_keysym_t) $1;
}
else {
- char buf[17];
- snprintf(buf, sizeof(buf), "0x%x", $1);
+ char buf[32];
+ snprintf(buf, sizeof(buf), "0x%lx", $1);
if (!resolve_keysym(buf, &$$)) {
parser_warn(param, "unrecognized keysym \"%s\"", buf);
$$ = XKB_KEY_NoSymbol;