summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2019-12-27 14:17:55 +0200
committerRan Benita <ran@unusedvar.com>2019-12-27 14:17:55 +0200
commit6ca1a0c9f6252242fa11e966f3779ba94af684c1 (patch)
tree536509ce8dbe9eba4c4e7720f0cb46ccb79e56ec
parentc3ac58a941fb3ab961873c939dbfea6f5ddc6ed0 (diff)
downloadlibxkbcommon-6ca1a0c9f6252242fa11e966f3779ba94af684c1.tar.gz
libxkbcommon-6ca1a0c9f6252242fa11e966f3779ba94af684c1.tar.bz2
libxkbcommon-6ca1a0c9f6252242fa11e966f3779ba94af684c1.zip
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>
-rw-r--r--src/xkbcomp/parser.y10
1 files changed, 4 insertions, 6 deletions
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;