scanner: make line and column unsigned Signed-off-by: Ran Benita <ran234@gmail.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 42 43 44 45 46 47
diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c
index 838bf1b..b8c8e0c 100644
--- a/src/xkbcomp/rules.c
+++ b/src/xkbcomp/rules.c
@@ -150,11 +150,11 @@ enum rules_token {
/* C99 is stupid. Just use the 1 variant when there are no args. */
#define scanner_error1(scanner, msg) \
- log_warn((scanner)->ctx, "rules/%s:%d:%d: %s\n", \
+ log_warn((scanner)->ctx, "rules/%s:%u:%u: %s\n", \
(scanner)->file_name, \
(scanner)->token_line, (scanner)->token_column, msg)
#define scanner_error(scanner, fmt, ...) \
- log_warn((scanner)->ctx, "rules/%s:%d:%d: " fmt "\n", \
+ log_warn((scanner)->ctx, "rules/%s:%u:%u: " fmt "\n", \
(scanner)->file_name, \
(scanner)->token_line, (scanner)->token_column, __VA_ARGS__)
diff --git a/src/xkbcomp/scanner-utils.h b/src/xkbcomp/scanner-utils.h
index 13de976..2341d33 100644
--- a/src/xkbcomp/scanner-utils.h
+++ b/src/xkbcomp/scanner-utils.h
@@ -49,9 +49,9 @@ struct scanner {
size_t len;
char buf[1024];
size_t buf_pos;
- int line, column;
+ unsigned line, column;
/* The line/column of the start of the current token. */
- int token_line, token_column;
+ unsigned token_line, token_column;
const char *file_name;
struct xkb_context *ctx;
};
diff --git a/src/xkbcomp/scanner.c b/src/xkbcomp/scanner.c
index 45a5940..67e8e3f 100644
--- a/src/xkbcomp/scanner.c
+++ b/src/xkbcomp/scanner.c
@@ -28,7 +28,7 @@
static void
scanner_log(enum xkb_log_level level, struct scanner *s, const char *msg)
{
- xkb_log(s->ctx, level, 0, "%s:%d:%d: %s\n", s->file_name,
+ xkb_log(s->ctx, level, 0, "%s:%u:%u: %s\n", s->file_name,
s->token_line, s->token_column, msg);
}