Cured several harmless compiler warnings

This commit is contained in:
John Wiegley 2009-03-04 04:31:34 -04:00
parent 2d63c9364a
commit 9d4e888ef5
6 changed files with 12 additions and 4 deletions

View file

@ -402,10 +402,12 @@ commodity_t::exchange(const amount_t& amount,
{ {
DEBUG("commodity.prices.add", "exchange: " << amount << " for " << cost); DEBUG("commodity.prices.add", "exchange: " << amount << " for " << cost);
DEBUG("commodity.prices.add", "exchange: is-per-unit = " << is_per_unit); DEBUG("commodity.prices.add", "exchange: is-per-unit = " << is_per_unit);
#if defined(DEBUG_ON)
if (moment) if (moment)
DEBUG("commodity.prices.add", "exchange: moment = " << *moment); DEBUG("commodity.prices.add", "exchange: moment = " << *moment);
if (tag) if (tag)
DEBUG("commodity.prices.add", "exchange: tag = " << *tag); DEBUG("commodity.prices.add", "exchange: tag = " << *tag);
#endif
commodity_t& commodity(amount.commodity()); commodity_t& commodity(amount.commodity());

View file

@ -360,7 +360,8 @@ void format_t::format(std::ostream& out_str, scope_t& scope)
result = truncate(temp, elem->max_width); result = truncate(temp, elem->max_width);
} else { } else {
result = temp.extract(); result = temp.extract();
for (int i = 0; i < (int)elem->min_width - (int)temp.length(); i++) for (int i = 0; i < (static_cast<int>(elem->min_width) -
static_cast<int>(temp.length())); i++)
result += " "; result += " ";
} }
out_str << result; out_str << result;

View file

@ -477,7 +477,7 @@ void global_scope_t::visit_man_page() const
throw std::logic_error(_("Failed to fork child process")); throw std::logic_error(_("Failed to fork child process"));
} }
else if (pid == 0) { // child else if (pid == 0) { // child
execlp("man", "man", "1", "ledger", (char *)0); execlp("man", "man", "1", "ledger", NULL);
// We should never, ever reach here // We should never, ever reach here
perror("execlp: man"); perror("execlp: man");

View file

@ -43,12 +43,14 @@ bool item_t::has_tag(const string& tag) const
return false; return false;
} }
string_map::const_iterator i = metadata->find(tag); string_map::const_iterator i = metadata->find(tag);
#if defined(DEBUG_ON)
if (SHOW_DEBUG("item.meta")) { if (SHOW_DEBUG("item.meta")) {
if (i == metadata->end()) if (i == metadata->end())
DEBUG("item.meta", "Item does not have this tag"); DEBUG("item.meta", "Item does not have this tag");
else else
DEBUG("item.meta", "Item has the tag!"); DEBUG("item.meta", "Item has the tag!");
} }
#endif
return i != metadata->end(); return i != metadata->end();
} }

View file

@ -90,8 +90,7 @@ namespace {
#else #else
path basename(pager_path.leaf()); path basename(pager_path.leaf());
#endif #endif
execlp(pager_path.string().c_str(), basename.string().c_str(), execlp(pager_path.string().c_str(), basename.string().c_str(), NULL);
(char *)0);
// We should never, ever reach here // We should never, ever reach here
perror((std::string("execlp: ") + pager_path.string()).c_str()); perror((std::string("execlp: ") + pager_path.string()).c_str());

View file

@ -431,8 +431,10 @@ void auto_xact_t::extend_xact(xact_base_t& xact, bool post_handler)
<< "amount " << initial_post->amount << " (precision " << "amount " << initial_post->amount << " (precision "
<< initial_post->amount.precision() << ")"); << initial_post->amount.precision() << ")");
#if defined(DEBUG_ON)
if (initial_post->amount.keep_precision()) if (initial_post->amount.keep_precision())
DEBUG("xact.extend", " precision is kept"); DEBUG("xact.extend", " precision is kept");
#endif
DEBUG("xact.extend", DEBUG("xact.extend",
"Posting on line " << post->beg_line << ": " "Posting on line " << post->beg_line << ": "
@ -440,10 +442,12 @@ void auto_xact_t::extend_xact(xact_base_t& xact, bool post_handler)
<< " (precision " << post->amount.precision() << " (precision " << post->amount.precision()
<< " != " << amt.precision() << ")"); << " != " << amt.precision() << ")");
#if defined(DEBUG_ON)
if (post->amount.keep_precision()) if (post->amount.keep_precision())
DEBUG("xact.extend", " precision is kept"); DEBUG("xact.extend", " precision is kept");
if (amt.keep_precision()) if (amt.keep_precision())
DEBUG("xact.extend", " amt precision is kept"); DEBUG("xact.extend", " amt precision is kept");
#endif
} }
account_t * account = post->account; account_t * account = post->account;