From e9fac379992815aaadcba99f55d8d34b7037a311 Mon Sep 17 00:00:00 2001 From: magiblot Date: Wed, 8 Nov 2023 19:26:25 +0100 Subject: [PATCH] Fix -Wtautological-constant-out-of-range-compare warnings --- source/platform/far2l.cpp | 4 ++-- source/platform/terminal.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/platform/far2l.cpp b/source/platform/far2l.cpp index 8b1a6f3b..bda55b6d 100644 --- a/source/platform/far2l.cpp +++ b/source/platform/far2l.cpp @@ -79,10 +79,10 @@ ParseResult parseFar2lInput(GetChBuf &buf, TEvent &ev, InputState &state) noexce enum { k = 32 }; char s[4*k]; size_t len = 0; - char c; + int c; while (c = buf.getUnbuffered(), c != -1 && c != '\x07') if (len < sizeof(s)) - s[len++] = c; + s[len++] = (char) c; char o[3*k]; TStringView out = decodeBase64({s, len}, o); if (!out.empty()) diff --git a/source/platform/terminal.cpp b/source/platform/terminal.cpp index 09a5320a..bb3ab735 100644 --- a/source/platform/terminal.cpp +++ b/source/platform/terminal.cpp @@ -864,10 +864,10 @@ char *TermIO::readUntilBelOrSt(GetChBuf &buf) noexcept { size_t capacity = 1024; size_t len = 0; - char prev = '\0'; if (char *s = (char *) malloc(capacity)) { - char c; + int prev = '\0'; + int c; while (c = buf.getUnbuffered(), c != -1) { if (c == '\x07') // BEL @@ -885,7 +885,7 @@ char *TermIO::readUntilBelOrSt(GetChBuf &buf) noexcept s = (free(s), nullptr); } if (s) - s[len++] = c; + s[len++] = (char) c; prev = c; } if (s)