diff options
author | kanreki <32443233+kanreki@users.noreply.github.com> | 2021-09-14 12:15:53 -0700 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2021-12-08 16:17:17 -0800 |
commit | 586abd208221761a6c93bc4568513e9cd4dc287d (patch) | |
tree | d3d6c8da7e4584665bb705c25a91c5c66083de65 /src/amount.cc | |
parent | ed5886921bcce0d1a261a37aa83bf135259b7d21 (diff) | |
download | fork-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/amount.cc')
-rw-r--r-- | src/amount.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/amount.cc b/src/amount.cc index 4eacdd09..0527c979 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -970,13 +970,13 @@ namespace { void parse_quantity(std::istream& in, string& value) { char buf[256]; - char c = peek_next_nonws(in); + int c = peek_next_nonws(in); int max = 255; char *p = buf; if (c == '-') { *p++ = c; max--; - in.get(c); + in.get(); } READ_INTO(in, p, max, c, std::isdigit(c) || c == '.' || c == ','); @@ -1005,10 +1005,10 @@ bool amount_t::parse(std::istream& in, const parse_flags_t& flags) commodity_t::flags_t comm_flags = COMMODITY_STYLE_DEFAULTS; - char c = peek_next_nonws(in); + int c = peek_next_nonws(in); if (c == '-') { negative = true; - in.get(c); + in.get(); c = peek_next_nonws(in); } |