Corrects to code that compares balances to zero
This commit is contained in:
parent
4ab50df564
commit
f96daf5fde
1 changed files with 12 additions and 12 deletions
24
src/value.cc
24
src/value.cc
|
|
@ -788,19 +788,19 @@ bool value_t::is_less_than(const value_t& val) const
|
|||
case BALANCE:
|
||||
switch (val.type()) {
|
||||
case INTEGER:
|
||||
if (val.as_long() != 0)
|
||||
break;
|
||||
// fall through...
|
||||
case AMOUNT:
|
||||
case AMOUNT: {
|
||||
if (val.is_nonzero())
|
||||
break;
|
||||
|
||||
bool no_amounts = true;
|
||||
foreach (const balance_t::amounts_map::value_type& pair,
|
||||
as_balance().amounts) {
|
||||
if (pair.second > 0L)
|
||||
if (pair.second >= 0L)
|
||||
return false;
|
||||
no_amounts = false;
|
||||
}
|
||||
return true;
|
||||
return ! no_amounts;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -858,19 +858,19 @@ bool value_t::is_greater_than(const value_t& val) const
|
|||
case BALANCE:
|
||||
switch (val.type()) {
|
||||
case INTEGER:
|
||||
if (val.as_long() != 0)
|
||||
break;
|
||||
// fall through...
|
||||
case AMOUNT:
|
||||
case AMOUNT: {
|
||||
if (val.is_nonzero())
|
||||
break;
|
||||
|
||||
bool no_amounts = true;
|
||||
foreach (const balance_t::amounts_map::value_type& pair,
|
||||
as_balance().amounts) {
|
||||
if (pair.second < 0L)
|
||||
if (pair.second <= 0L)
|
||||
return false;
|
||||
no_amounts = false;
|
||||
}
|
||||
return true;
|
||||
return ! no_amounts;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue