diff options
author | John Wiegley <johnw@newartisans.com> | 2009-10-25 04:35:19 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-10-25 05:01:39 -0400 |
commit | 588f2ef2f51d7bdf209820bfb244034863601939 (patch) | |
tree | 7a473de7c117bf71bb802398823826ca4dfbfdca /src/format.cc | |
parent | dc66840dd745863c06ad6513f9f66d589bcc29d8 (diff) | |
download | fork-ledger-588f2ef2f51d7bdf209820bfb244034863601939.tar.gz fork-ledger-588f2ef2f51d7bdf209820bfb244034863601939.tar.bz2 fork-ledger-588f2ef2f51d7bdf209820bfb244034863601939.zip |
Fixed many compiler warnings from g++ 4.4
Diffstat (limited to 'src/format.cc')
-rw-r--r-- | src/format.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/format.cc b/src/format.cc index ecac1133..35f3d80f 100644 --- a/src/format.cc +++ b/src/format.cc @@ -345,7 +345,7 @@ void format_t::format(std::ostream& out_str, scope_t& scope) } DEBUG("format.expr", "value = (" << value << ")"); - value.print(out, elem->min_width, -1, + value.print(out, static_cast<int>(elem->min_width), -1, ! elem->has_flags(ELEMENT_ALIGN_LEFT)); } catch (const calc_error&) { @@ -362,14 +362,13 @@ void format_t::format(std::ostream& out_str, scope_t& scope) if (elem->max_width > 0 || elem->min_width > 0) { unistring temp(out.str()); + string result; - string result; if (elem->max_width > 0 && elem->max_width < temp.length()) { result = truncate(temp, elem->max_width); } else { result = temp.extract(); - for (int i = 0; i < (static_cast<int>(elem->min_width) - - static_cast<int>(temp.length())); i++) + for (std::size_t i = 0; i < elem->min_width - temp.length(); i++) result += " "; } out_str << result; @@ -379,8 +378,9 @@ void format_t::format(std::ostream& out_str, scope_t& scope) } } -string format_t::truncate(const unistring& ustr, std::size_t width, - const int account_abbrev_length) +string format_t::truncate(const unistring& ustr, + const std::size_t width, + const std::size_t account_abbrev_length) { assert(width < 4095); @@ -434,7 +434,7 @@ string format_t::truncate(const unistring& ustr, std::size_t width, if (newlen > width) { unistring temp(*i); - if (temp.length() > static_cast<std::size_t>(account_abbrev_length)) { + if (temp.length() > account_abbrev_length) { result << temp.extract(0, account_abbrev_length) << ":"; newlen -= temp.length() - account_abbrev_length; } else { |