Commit c3ac58a941fb3ab961873c939dbfea6f5ddc6ed0

Ran Benita 2019-12-27T14:06:47

scanner-utils: avoid possible implicit truncating of line/column This increases the size of the struct a bit but it's not very important. Fixes these MSVC warnings: src\scanner-utils.h(112): warning C4267: '+=': conversion from 'size_t' to 'unsigned int', possible loss of data src\scanner-utils.h(147): warning C4267: '+=': conversion from 'size_t' to 'unsigned int', possible loss of data Signed-off-by: Ran Benita <ran@unusedvar.com>

diff --git a/src/scanner-utils.h b/src/scanner-utils.h
index 5fdb22a..dbf4eaa 100644
--- a/src/scanner-utils.h
+++ b/src/scanner-utils.h
@@ -49,9 +49,9 @@ struct scanner {
     size_t len;
     char buf[1024];
     size_t buf_pos;
-    unsigned line, column;
+    size_t line, column;
     /* The line/column of the start of the current token. */
-    unsigned token_line, token_column;
+    size_t token_line, token_column;
     const char *file_name;
     struct xkb_context *ctx;
     void *priv;
@@ -59,7 +59,7 @@ struct scanner {
 
 #define scanner_log(scanner, level, fmt, ...) \
     xkb_log((scanner)->ctx, (level), 0, \
-            "%s:%u:%u: " fmt "\n", \
+            "%s:%zu:%zu: " fmt "\n", \
              (scanner)->file_name, \
              (scanner)->token_line, (scanner)->token_column, ##__VA_ARGS__)