From ab416f759f860ce25788bf618ff1538f5d523116 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 5 Mar 2010 22:08:40 -0500 Subject: Updated copyrights to 2003-2010 --- src/value.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/value.cc') diff --git a/src/value.cc b/src/value.cc index 7d079caf..43524d3f 100644 --- a/src/value.cc +++ b/src/value.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2009, John Wiegley. All rights reserved. + * Copyright (c) 2003-2010, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are -- cgit v1.2.3 From fd4fa8a1140c0c78f480551bff3d76165c47519c Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 5 Mar 2010 22:09:02 -0500 Subject: Change an exception test to a plain if --- src/value.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/value.cc') diff --git a/src/value.cc b/src/value.cc index 43524d3f..a1316568 100644 --- a/src/value.cc +++ b/src/value.cc @@ -857,12 +857,10 @@ bool value_t::is_less_than(const value_t& val) const case INTEGER: return as_amount() < val.as_long(); case AMOUNT: - try { + if (as_amount().commodity() == val.as_amount().commodity()) return as_amount() < val.as_amount(); - } - catch (const amount_error&) { + else return commodity_t::compare_by_commodity()(&as_amount(), &val.as_amount()); - } default: break; } -- cgit v1.2.3 From 7e79cd82cd4ad5f87f40e6beebdb53e65bb11168 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 6 Mar 2010 00:58:05 -0500 Subject: Corrected a case for value < value --- src/value.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/value.cc') diff --git a/src/value.cc b/src/value.cc index a1316568..54798162 100644 --- a/src/value.cc +++ b/src/value.cc @@ -857,7 +857,9 @@ bool value_t::is_less_than(const value_t& val) const case INTEGER: return as_amount() < val.as_long(); case AMOUNT: - if (as_amount().commodity() == val.as_amount().commodity()) + if (as_amount().commodity() == val.as_amount().commodity() || + ! as_amount().has_commodity() || + ! val.as_amount().has_commodity()) return as_amount() < val.as_amount(); else return commodity_t::compare_by_commodity()(&as_amount(), &val.as_amount()); -- cgit v1.2.3