summaryrefslogtreecommitdiff
path: root/value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-07-30 05:12:46 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-07-30 05:12:46 -0400
commit2aff35215fbe24459aa4057d5b31ea7490046ca6 (patch)
tree6a79a3d84e352e3b3647484b0daf38b1ae6aa81f /value.cc
parent230d7fd6027d05422f4bb26e9bfb3758a9cb16ea (diff)
downloadfork-ledger-2aff35215fbe24459aa4057d5b31ea7490046ca6.tar.gz
fork-ledger-2aff35215fbe24459aa4057d5b31ea7490046ca6.tar.bz2
fork-ledger-2aff35215fbe24459aa4057d5b31ea7490046ca6.zip
Enabled a huge number of warning flags for g++ in acprep, and fixed them all
except for several unused parameter warnings (because there is so much code still #if 0'd out), and one implicit conversion from long long to long which still has to be dealt with.
Diffstat (limited to 'value.cc')
-rw-r--r--value.cc27
1 files changed, 15 insertions, 12 deletions
diff --git a/value.cc b/value.cc
index a540068c..6c257c00 100644
--- a/value.cc
+++ b/value.cc
@@ -42,28 +42,33 @@ value_t::storage_t& value_t::storage_t::operator=(const value_t::storage_t& rhs)
switch (type) {
case DATETIME:
- new((datetime_t *) data) datetime_t(*(datetime_t *) rhs.data);
+ new(reinterpret_cast<datetime_t *>(data))
+ datetime_t(*reinterpret_cast<datetime_t *>(const_cast<char *>(rhs.data)));
break;
case AMOUNT:
- new((amount_t *) data) amount_t(*(amount_t *) rhs.data);
+ new(reinterpret_cast<amount_t *>(data))
+ amount_t(*reinterpret_cast<amount_t *>(const_cast<char *>(rhs.data)));
break;
case BALANCE:
- *(balance_t **) data = new balance_t(**(balance_t **) rhs.data);
+ *reinterpret_cast<balance_t **>(data) =
+ new balance_t(**reinterpret_cast<balance_t **>(const_cast<char *>(rhs.data)));
break;
case BALANCE_PAIR:
- *(balance_pair_t **) data =
- new balance_pair_t(**(balance_pair_t **) rhs.data);
+ *reinterpret_cast<balance_pair_t **>(data) =
+ new balance_pair_t(**reinterpret_cast<balance_pair_t **>(const_cast<char *>(rhs.data)));
break;
case STRING:
- new((string *) data) string(*(string *) rhs.data);
+ new(reinterpret_cast<string *>(data))
+ string(*reinterpret_cast<string *>(const_cast<char *>(rhs.data)));
break;
case SEQUENCE:
- *(sequence_t **) data = new sequence_t(**(sequence_t **) rhs.data);
+ *reinterpret_cast<sequence_t **>(data) =
+ new sequence_t(**reinterpret_cast<sequence_t **>(const_cast<char *>(rhs.data)));
break;
default:
@@ -105,9 +110,7 @@ void value_t::storage_t::destroy()
void value_t::initialize()
{
-#if 0
LOGGER("value.initialize");
-#endif
true_value = new storage_t;
true_value->type = BOOLEAN;
@@ -117,6 +120,7 @@ void value_t::initialize()
false_value->type = BOOLEAN;
*reinterpret_cast<bool *>(false_value->data) = false;
+#if 0
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(bool));
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(datetime_t));
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(long));
@@ -126,8 +130,8 @@ void value_t::initialize()
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(string));
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(sequence_t *));
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(boost::any));
+#endif
-#if 0
DEBUG_(std::setw(3) << std::right << sizeof(bool)
<< " sizeof(bool)");
DEBUG_(std::setw(3) << std::right << sizeof(datetime_t)
@@ -146,7 +150,6 @@ void value_t::initialize()
<< " sizeof(sequence_t *)");
DEBUG_(std::setw(3) << std::right << sizeof(boost::any)
<< " sizeof(boost::any)");
-#endif
}
void value_t::shutdown()
@@ -285,7 +288,7 @@ void value_t::in_place_simplify()
LOGGER("amounts.values.simplify");
if (is_realzero()) {
- DEBUG_("Zeroing type " << type());
+ DEBUG_("Zeroing type " << static_cast<int>(type()));
set_long(0L);
return;
}