From 586abd208221761a6c93bc4568513e9cd4dc287d Mon Sep 17 00:00:00 2001 From: kanreki <32443233+kanreki@users.noreply.github.com> Date: Tue, 14 Sep 2021 12:15:53 -0700 Subject: Use correct int return type for stream input operations This makes it safe to compare results to -1 to indicate EOF, regardless of whether char is considered signed or unsigned; and so eliminates compiler warnings on platforms such as ARM. Fixes bug #2058. --- src/times.cc | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/times.cc') diff --git a/src/times.cc b/src/times.cc index bab4e0de..127cdd69 100644 --- a/src/times.cc +++ b/src/times.cc @@ -1621,17 +1621,10 @@ void date_parser_t::lexer_t::token_t::unexpected() void date_parser_t::lexer_t::token_t::expected(char wanted, char c) { - if (c == '\0' || c == -1) { - if (wanted == '\0' || wanted == -1) - throw_(date_error, _("Unexpected end")); - else - throw_(date_error, _f("Missing '%1%'") % wanted); - } else { - if (wanted == '\0' || wanted == -1) - throw_(date_error, _f("Invalid char '%1%'") % c); - else - throw_(date_error, _f("Invalid char '%1%' (wanted '%2%')") % c % wanted); - } + if (wanted == '\0') + throw_(date_error, _f("Invalid char '%1%'") % c); + else + throw_(date_error, _f("Invalid char '%1%' (wanted '%2%')") % c % wanted); } namespace { -- cgit v1.2.3