Skip to content

Commit

Permalink
Fix -Wtautological-constant-out-of-range-compare warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
magiblot committed Nov 8, 2023
1 parent 9045dda commit e9fac37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions source/platform/far2l.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
6 changes: 3 additions & 3 deletions source/platform/terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit e9fac37

Please sign in to comment.