diff options
author | John Wiegley <johnw@newartisans.com> | 2012-02-17 15:17:52 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-02-17 15:17:52 -0600 |
commit | c3a9a7d2c584a7651426b3516f4e9991c8063e02 (patch) | |
tree | 6a7748588d90d3d9e0032903548b3411d7277dd6 /src/textual.cc | |
parent | c6b51a2635bdf7da803dd2fc8251d6c290f134a4 (diff) | |
download | fork-ledger-c3a9a7d2c584a7651426b3516f4e9991c8063e02.tar.gz fork-ledger-c3a9a7d2c584a7651426b3516f4e9991c8063e02.tar.bz2 fork-ledger-c3a9a7d2c584a7651426b3516f4e9991c8063e02.zip |
Fixed many Clang type conversion warnings with static_cast
Diffstat (limited to 'src/textual.cc')
-rw-r--r-- | src/textual.cc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/textual.cc b/src/textual.cc index a11cdebd..c7c49e2a 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -1079,7 +1079,7 @@ post_t * instance_t::parse_post(char * line, char buf[MAX_LINE + 1]; std::strcpy(buf, line); - std::size_t beg = 0; + std::streamsize beg = 0; try { @@ -1135,7 +1135,7 @@ post_t * instance_t::parse_post(char * line, p++; e--; } - string name(p, e - p); + string name(p, static_cast<std::string::size_type>(e - p)); DEBUG("textual.parse", "line " << linenum << ": " << "Parsed account name " << name); @@ -1166,8 +1166,8 @@ post_t * instance_t::parse_post(char * line, // Parse the optional amount if (next && *next && (*next != ';' && *next != '=')) { - beg = next - line; - ptristream stream(next, len - beg); + beg = static_cast<std::streamsize>(next - line); + ptristream stream(next, static_cast<std::size_t>(len - beg)); if (*next != '(') // indicates a value expression post->amount.parse(stream, PARSE_NO_REDUCE); @@ -1223,7 +1223,7 @@ post_t * instance_t::parse_post(char * line, << "And it's for a total price"); } - beg = ++next - line; + beg = static_cast<std::streamsize>(++next - line); p = skip_ws(next); if (*p) { @@ -1237,8 +1237,8 @@ post_t * instance_t::parse_post(char * line, throw parse_error(_("Posting is missing a cost amount")); } - beg = p - line; - ptristream cstream(p, len - beg); + beg = static_cast<std::streamsize>(p - line); + ptristream cstream(p, static_cast<std::size_t>(len - beg)); if (*p != '(') // indicates a value expression post->cost->parse(cstream, PARSE_NO_MIGRATE); @@ -1288,14 +1288,14 @@ post_t * instance_t::parse_post(char * line, DEBUG("textual.parse", "line " << linenum << ": " << "Found a balance assignment indicator"); - beg = ++next - line; + beg = static_cast<std::streamsize>(++next - line); p = skip_ws(next); if (*p) { post->assigned_amount = amount_t(); - beg = p - line; - ptristream stream(p, len - beg); + beg = static_cast<std::streamsize>(p - line); + ptristream stream(p, static_cast<std::size_t>(len - beg)); if (*p != '(') // indicates a value expression post->assigned_amount->parse(stream, PARSE_NO_MIGRATE); @@ -1398,7 +1398,8 @@ post_t * instance_t::parse_post(char * line, } catch (const std::exception&) { add_error_context(_("While parsing posting:")); - add_error_context(line_context(buf, beg, len)); + add_error_context(line_context(buf, static_cast<std::string::size_type>(beg), + static_cast<std::string::size_type>(len))); throw; } } |