summaryrefslogtreecommitdiff
path: root/src/print.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-02-17 15:17:52 -0600
committerJohn Wiegley <johnw@newartisans.com>2012-02-17 15:17:52 -0600
commitc3a9a7d2c584a7651426b3516f4e9991c8063e02 (patch)
tree6a7748588d90d3d9e0032903548b3411d7277dd6 /src/print.cc
parentc6b51a2635bdf7da803dd2fc8251d6c290f134a4 (diff)
downloadfork-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/print.cc')
-rw-r--r--src/print.cc20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/print.cc b/src/print.cc
index ffa4e9eb..b7f72bf0 100644
--- a/src/print.cc
+++ b/src/print.cc
@@ -98,8 +98,9 @@ namespace {
string leader = buf.str();
out << leader;
- std::size_t columns = (report.HANDLED(columns_) ?
- report.HANDLER(columns_).value.to_long() : 80);
+ std::size_t columns =
+ (report.HANDLED(columns_) ?
+ static_cast<std::size_t>(report.HANDLER(columns_).value.to_long()) : 80);
if (xact.note)
print_note(out, *xact.note, columns, unistring(leader).length());
@@ -152,17 +153,18 @@ namespace {
std::size_t account_width =
(report.HANDLER(account_width_).specified ?
- report.HANDLER(account_width_).value.to_long() : 36);
+ static_cast<std::size_t>(report.HANDLER(account_width_).value.to_long()) : 36);
if (account_width < name.length())
account_width = name.length();
if (! post->has_flags(POST_CALCULATED) || report.HANDLED(generated)) {
out << name.extract();
- int slip = (static_cast<int>(account_width) -
- static_cast<int>(name.length()));
+ std::string::size_type slip =
+ (static_cast<std::string::size_type>(account_width) -
+ static_cast<std::string::size_type>(name.length()));
if (slip > 0) {
- out.width(slip);
+ out.width(static_cast<std::streamsize>(slip));
out << ' ';
}
@@ -185,8 +187,10 @@ namespace {
string trimmed_amt(amt);
trim_left(trimmed_amt);
- int amt_slip = (static_cast<int>(amt.length()) -
- static_cast<int>(trimmed_amt.length()));
+ std::string::size_type amt_slip =
+ (static_cast<std::string::size_type>(amt.length()) -
+ static_cast<std::string::size_type>(trimmed_amt.length()));
+
if (slip + amt_slip < 2)
amtbuf << string(2 - (slip + amt_slip), ' ');
amtbuf << amt;