summaryrefslogtreecommitdiff
path: root/src/query.cc
diff options
context:
space:
mode:
authorkanreki <32443233+kanreki@users.noreply.github.com>2021-09-14 12:15:53 -0700
committerJohn Wiegley <johnw@newartisans.com>2021-12-08 16:17:17 -0800
commit586abd208221761a6c93bc4568513e9cd4dc287d (patch)
treed3d6c8da7e4584665bb705c25a91c5c66083de65 /src/query.cc
parented5886921bcce0d1a261a37aa83bf135259b7d21 (diff)
downloadfork-ledger-586abd208221761a6c93bc4568513e9cd4dc287d.tar.gz
fork-ledger-586abd208221761a6c93bc4568513e9cd4dc287d.tar.bz2
fork-ledger-586abd208221761a6c93bc4568513e9cd4dc287d.zip
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.
Diffstat (limited to 'src/query.cc')
-rw-r--r--src/query.cc32
1 files changed, 2 insertions, 30 deletions
diff --git a/src/query.cc b/src/query.cc
index 883bea40..0eb7dd85 100644
--- a/src/query.cc
+++ b/src/query.cc
@@ -220,37 +220,9 @@ test_ident:
return token_t(token_t::UNKNOWN);
}
-void query_t::lexer_t::token_t::unexpected()
+void query_t::lexer_t::token_t::expected(char wanted)
{
- kind_t prev_kind = kind;
-
- kind = UNKNOWN;
-
- switch (prev_kind) {
- case END_REACHED:
- throw_(parse_error, _("Unexpected end of expression"));
- case TERM:
- throw_(parse_error, _f("Unexpected string '%1%'") % *value);
- default:
- throw_(parse_error, _f("Unexpected token '%1%'") % symbol());
- }
-}
-
-void query_t::lexer_t::token_t::expected(char wanted, char c)
-{
- kind = UNKNOWN;
-
- if (c == '\0' || c == -1) {
- if (wanted == '\0' || wanted == -1)
- throw_(parse_error, _("Unexpected end"));
- else
- throw_(parse_error, _f("Missing '%1%'") % wanted);
- } else {
- if (wanted == '\0' || wanted == -1)
- throw_(parse_error, _f("Invalid char '%1%'") % c);
- else
- throw_(parse_error, _f("Invalid char '%1%' (wanted '%2%')") % c % wanted);
- }
+ throw_(parse_error, _f("Missing '%1%'") % wanted);
}
expr_t::ptr_op_t