From 588f2ef2f51d7bdf209820bfb244034863601939 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 25 Oct 2009 04:35:19 -0400 Subject: Fixed many compiler warnings from g++ 4.4 --- src/format.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/format.cc') 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(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(elem->min_width) - - static_cast(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(account_abbrev_length)) { + if (temp.length() > account_abbrev_length) { result << temp.extract(0, account_abbrev_length) << ":"; newlen -= temp.length() - account_abbrev_length; } else { -- cgit v1.2.3