From 8961eaaa9dc35c6654ff1651c4729253e3d2c628 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 26 Nov 2017 08:22:14 +0530 Subject: [PATCH] Fix compilation error on 32bot systems Fixes #185 --- kitty/parser.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kitty/parser.c b/kitty/parser.c index cefbeeec9..7edbaed66 100644 --- a/kitty/parser.c +++ b/kitty/parser.c @@ -13,13 +13,13 @@ extern PyTypeObject Screen_Type; // utils {{{ -static unsigned long pow10[] = { +static uint64_t pow10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000 }; -static inline unsigned long +static inline uint64_t utoi(uint32_t *buf, unsigned int sz) { - unsigned long ans = 0; + uint64_t ans = 0; uint32_t *p = buf; // Ignore leading zeros while(sz > 0) { @@ -27,7 +27,7 @@ utoi(uint32_t *buf, unsigned int sz) { else break; } if (sz < sizeof(pow10)/sizeof(pow10[0])) { - for (int i = sz-1, j=0; i >=0; i--, j++) { + for (int i = sz-1, j=0; i >= 0; i--, j++) { ans += (p[i] - '0') * pow10[j]; } } @@ -1053,7 +1053,7 @@ extern uint32_t *latin1_charset; static inline void _parse_bytes(Screen *screen, uint8_t *buf, Py_ssize_t len, PyObject DUMP_UNUSED *dump_callback) { uint32_t prev = screen->utf8_state; - for (unsigned int i = 0; i < len; i++) { + for (unsigned int i = 0; i < (unsigned int)len; i++) { if (screen->use_latin1) dispatch_unicode_char(screen, latin1_charset[buf[i]], dump_callback); else { switch (decode_utf8(&screen->utf8_state, &screen->utf8_codepoint, buf[i])) {