From fbd0e643d811da899110b1bc5f899284adef48e4 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 27 Dec 2019 21:51:34 +0200 Subject: [PATCH] xkbcomp: make a couple of casts explicit to mark them as checked This acknowledges some "possible loss of data cast" warnings from MSVC. Signed-off-by: Ran Benita --- src/xkbcomp/keycodes.c | 3 ++- src/xkbcomp/scanner.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c index 4b72d05..b8abf36 100644 --- a/src/xkbcomp/keycodes.c +++ b/src/xkbcomp/keycodes.c @@ -384,7 +384,8 @@ HandleKeycodeDef(KeyNamesInfo *info, KeycodeDef *stmt, enum merge_mode merge) return false; } - return AddKeyName(info, stmt->value, stmt->name, merge, false, true); + return AddKeyName(info, (xkb_keycode_t) stmt->value, + stmt->name, merge, false, true); } static bool diff --git a/src/xkbcomp/scanner.c b/src/xkbcomp/scanner.c index b70e5ca..65eef53 100644 --- a/src/xkbcomp/scanner.c +++ b/src/xkbcomp/scanner.c @@ -50,7 +50,9 @@ number(struct scanner *s, int64_t *out, int *out_tok) if (is_hex) *out = strtoul(start, &end, 16); else if (is_float) - *out = strtod(start, &end); + /* The parser currently just ignores floats, so the cast is + * fine - the value doesn't matter. */ + *out = (int64_t) strtod(start, &end); else *out = strtoul(start, &end, 10); if (errno != 0 || s->s + s->pos != end)