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.
This commit is contained in:
parent
230d7fd602
commit
2aff35215f
26 changed files with 154 additions and 137 deletions
|
|
@ -114,6 +114,15 @@ std::ostream& operator<<(std::ostream& out, const account_t& account)
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expr_t::ptr_op_t account_t::lookup(const string& name)
|
||||||
|
{
|
||||||
|
switch (name[0]) {
|
||||||
|
case 'a':
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return expr_t::ptr_op_t();
|
||||||
|
}
|
||||||
|
|
||||||
bool account_t::valid() const
|
bool account_t::valid() const
|
||||||
{
|
{
|
||||||
if (depth > 256) {
|
if (depth > 256) {
|
||||||
|
|
|
||||||
10
account.h
10
account.h
|
|
@ -33,6 +33,7 @@
|
||||||
#define _ACCOUNT_H
|
#define _ACCOUNT_H
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "scope.h"
|
||||||
|
|
||||||
namespace ledger {
|
namespace ledger {
|
||||||
|
|
||||||
|
|
@ -40,7 +41,7 @@ class account_t;
|
||||||
|
|
||||||
typedef std::map<const string, account_t *> accounts_map;
|
typedef std::map<const string, account_t *> accounts_map;
|
||||||
|
|
||||||
class account_t
|
class account_t : public scope_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef unsigned long ident_t;
|
typedef unsigned long ident_t;
|
||||||
|
|
@ -58,12 +59,13 @@ class account_t
|
||||||
account_t(account_t * _parent = NULL,
|
account_t(account_t * _parent = NULL,
|
||||||
const string& _name = "",
|
const string& _name = "",
|
||||||
const optional<string>& _note = none)
|
const optional<string>& _note = none)
|
||||||
: parent(_parent), name(_name), note(_note),
|
: scope_t(), parent(_parent), name(_name), note(_note),
|
||||||
depth(parent ? parent->depth + 1 : 0), data(NULL), ident(0) {
|
depth(parent ? parent->depth + 1 : 0), data(NULL), ident(0) {
|
||||||
TRACE_CTOR(account_t, "account_t *, const string&, const string&");
|
TRACE_CTOR(account_t, "account_t *, const string&, const string&");
|
||||||
}
|
}
|
||||||
account_t(const account_t& other)
|
account_t(const account_t& other)
|
||||||
: parent(other.parent),
|
: scope_t(),
|
||||||
|
parent(other.parent),
|
||||||
name(other.name),
|
name(other.name),
|
||||||
note(other.note),
|
note(other.note),
|
||||||
depth(other.depth),
|
depth(other.depth),
|
||||||
|
|
@ -91,6 +93,8 @@ class account_t
|
||||||
|
|
||||||
account_t * find_account(const string& name, bool auto_create = true);
|
account_t * find_account(const string& name, bool auto_create = true);
|
||||||
|
|
||||||
|
virtual expr_t::ptr_op_t lookup(const string& name);
|
||||||
|
|
||||||
bool valid() const;
|
bool valid() const;
|
||||||
|
|
||||||
friend class journal_t;
|
friend class journal_t;
|
||||||
|
|
|
||||||
32
acprep
32
acprep
|
|
@ -28,7 +28,9 @@ autoreconf --force --install
|
||||||
|
|
||||||
INCDIRS="-I/sw/include -I/opt/local/include"
|
INCDIRS="-I/sw/include -I/opt/local/include"
|
||||||
INCDIRS="$INCDIRS -I/usr/local/include"
|
INCDIRS="$INCDIRS -I/usr/local/include"
|
||||||
INCDIRS="$INCDIRS -I/usr/local/include/boost-1_35"
|
INCDIRS="$INCDIRS -isystem /usr/local/include/boost-1_35"
|
||||||
|
INCDIRS="$INCDIRS -isystem /usr/local/include/boost-1_35/boost"
|
||||||
|
INCDIRS="$INCDIRS -isystem /usr/local/include/boost-1_35/boost/type_traits"
|
||||||
|
|
||||||
LIBDIRS="-L/sw/lib -L/opt/local/lib"
|
LIBDIRS="-L/sw/lib -L/opt/local/lib"
|
||||||
LIBDIRS="$LIBDIRS -L/usr/local/lib"
|
LIBDIRS="$LIBDIRS -L/usr/local/lib"
|
||||||
|
|
@ -65,21 +67,21 @@ LOCAL=false
|
||||||
|
|
||||||
# Warning flags
|
# Warning flags
|
||||||
CXXFLAGS="$CXXFLAGS -Wall -ansi -Winvalid-pch"
|
CXXFLAGS="$CXXFLAGS -Wall -ansi -Winvalid-pch"
|
||||||
#CXXFLAGS="$CXXFLAGS -Wextra"
|
CXXFLAGS="$CXXFLAGS -Wextra"
|
||||||
#CXXFLAGS="$CXXFLAGS -Weffc++"
|
#CXXFLAGS="$CXXFLAGS -Weffc++"
|
||||||
#CXXFLAGS="$CXXFLAGS -Wcast-align"
|
CXXFLAGS="$CXXFLAGS -Wcast-align"
|
||||||
#CXXFLAGS="$CXXFLAGS -Wcast-qual"
|
CXXFLAGS="$CXXFLAGS -Wcast-qual"
|
||||||
#CXXFLAGS="$CXXFLAGS -Wconversion"
|
CXXFLAGS="$CXXFLAGS -Wconversion"
|
||||||
#CXXFLAGS="$CXXFLAGS -Wfloat-equal"
|
CXXFLAGS="$CXXFLAGS -Wfloat-equal"
|
||||||
#CXXFLAGS="$CXXFLAGS -Wmissing-field-initializers"
|
CXXFLAGS="$CXXFLAGS -Wmissing-field-initializers"
|
||||||
#CXXFLAGS="$CXXFLAGS -Wno-endif-labels"
|
CXXFLAGS="$CXXFLAGS -Wno-endif-labels"
|
||||||
#CXXFLAGS="$CXXFLAGS -Wold-style-cast"
|
CXXFLAGS="$CXXFLAGS -Wold-style-cast"
|
||||||
#CXXFLAGS="$CXXFLAGS -Woverloaded-virtual"
|
CXXFLAGS="$CXXFLAGS -Woverloaded-virtual"
|
||||||
#CXXFLAGS="$CXXFLAGS -Wshorten-64-to-32"
|
CXXFLAGS="$CXXFLAGS -Wshorten-64-to-32"
|
||||||
#CXXFLAGS="$CXXFLAGS -Wsign-compare"
|
CXXFLAGS="$CXXFLAGS -Wsign-compare"
|
||||||
#CXXFLAGS="$CXXFLAGS -Wsign-promo"
|
CXXFLAGS="$CXXFLAGS -Wsign-promo"
|
||||||
#CXXFLAGS="$CXXFLAGS -Wstrict-null-sentinel"
|
CXXFLAGS="$CXXFLAGS -Wstrict-null-sentinel"
|
||||||
#CXXFLAGS="$CXXFLAGS -Wwrite-strings"
|
CXXFLAGS="$CXXFLAGS -Wwrite-strings"
|
||||||
|
|
||||||
|
|
||||||
while [ -n "$1" ]; do
|
while [ -n "$1" ]; do
|
||||||
|
|
|
||||||
27
amount.cc
27
amount.cc
|
|
@ -1283,7 +1283,7 @@ void amount_t::read(std::istream& in)
|
||||||
quantity = new bigint_t;
|
quantity = new bigint_t;
|
||||||
|
|
||||||
unsigned short len;
|
unsigned short len;
|
||||||
in.read((char *)&len, sizeof(len));
|
in.read(reinterpret_cast<char *>(&len), sizeof(len));
|
||||||
assert(len < 4096);
|
assert(len < 4096);
|
||||||
in.read(buf, len);
|
in.read(buf, len);
|
||||||
mpz_import(MPZ(quantity), len / sizeof(short), 1, sizeof(short),
|
mpz_import(MPZ(quantity), len / sizeof(short), 1, sizeof(short),
|
||||||
|
|
@ -1294,10 +1294,10 @@ void amount_t::read(std::istream& in)
|
||||||
if (negative)
|
if (negative)
|
||||||
mpz_neg(MPZ(quantity), MPZ(quantity));
|
mpz_neg(MPZ(quantity), MPZ(quantity));
|
||||||
|
|
||||||
in.read((char *)&quantity->prec, sizeof(quantity->prec));
|
in.read(reinterpret_cast<char *>(&quantity->prec), sizeof(quantity->prec));
|
||||||
|
|
||||||
bigint_t::flags_t tflags;
|
bigint_t::flags_t tflags;
|
||||||
in.read((char *)&tflags, sizeof(tflags));
|
in.read(reinterpret_cast<char *>(&tflags), sizeof(tflags));
|
||||||
quantity->set_flags(tflags);
|
quantity->set_flags(tflags);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -1328,13 +1328,14 @@ void amount_t::read(const char *& data)
|
||||||
|
|
||||||
if (byte < 3) {
|
if (byte < 3) {
|
||||||
if (byte == 2) {
|
if (byte == 2) {
|
||||||
quantity = new((bigint_t *)bigints_next) bigint_t;
|
quantity = new(reinterpret_cast<bigint_t *>(bigints_next)) bigint_t;
|
||||||
bigints_next += sizeof(bigint_t);
|
bigints_next += sizeof(bigint_t);
|
||||||
} else {
|
} else {
|
||||||
quantity = new bigint_t;
|
quantity = new bigint_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short len = *((unsigned short *) data);
|
unsigned short len =
|
||||||
|
*reinterpret_cast<unsigned short *>(const_cast<char *>(data));
|
||||||
data += sizeof(unsigned short);
|
data += sizeof(unsigned short);
|
||||||
mpz_import(MPZ(quantity), len / sizeof(short), 1, sizeof(short),
|
mpz_import(MPZ(quantity), len / sizeof(short), 1, sizeof(short),
|
||||||
0, 0, data);
|
0, 0, data);
|
||||||
|
|
@ -1344,18 +1345,18 @@ void amount_t::read(const char *& data)
|
||||||
if (negative)
|
if (negative)
|
||||||
mpz_neg(MPZ(quantity), MPZ(quantity));
|
mpz_neg(MPZ(quantity), MPZ(quantity));
|
||||||
|
|
||||||
quantity->prec = *((precision_t *) data);
|
quantity->prec = *reinterpret_cast<precision_t *>(const_cast<char *>(data));
|
||||||
data += sizeof(precision_t);
|
data += sizeof(precision_t);
|
||||||
quantity->set_flags(*((flags_t *) data));
|
quantity->set_flags(*reinterpret_cast<flags_t *>(const_cast<char *>(data)));
|
||||||
data += sizeof(flags_t);
|
data += sizeof(flags_t);
|
||||||
|
|
||||||
if (byte == 2)
|
if (byte == 2)
|
||||||
quantity->add_flags(BIGINT_BULK_ALLOC);
|
quantity->add_flags(BIGINT_BULK_ALLOC);
|
||||||
} else {
|
} else {
|
||||||
uint_fast32_t index = *((uint_fast32_t *) data);
|
uint_fast32_t index = *reinterpret_cast<uint_fast32_t *>(const_cast<char *>(data));
|
||||||
data += sizeof(uint_fast32_t);
|
data += sizeof(uint_fast32_t);
|
||||||
|
|
||||||
quantity = (bigint_t *) (bigints + (index - 1) * sizeof(bigint_t));
|
quantity = reinterpret_cast<bigint_t *>(bigints + (index - 1) * sizeof(bigint_t));
|
||||||
DEBUG("amounts.refs",
|
DEBUG("amounts.refs",
|
||||||
quantity << " ref++, now " << (quantity->ref + 1));
|
quantity << " ref++, now " << (quantity->ref + 1));
|
||||||
quantity->ref++;
|
quantity->ref++;
|
||||||
|
|
@ -1393,7 +1394,7 @@ void amount_t::write(std::ostream& out, bool optimized) const
|
||||||
std::size_t size;
|
std::size_t size;
|
||||||
mpz_export(buf, &size, 1, sizeof(short), 0, 0, MPZ(quantity));
|
mpz_export(buf, &size, 1, sizeof(short), 0, 0, MPZ(quantity));
|
||||||
unsigned short len = size * sizeof(short);
|
unsigned short len = size * sizeof(short);
|
||||||
out.write((char *)&len, sizeof(len));
|
out.write(reinterpret_cast<char *>(&len), sizeof(len));
|
||||||
if (len) {
|
if (len) {
|
||||||
assert(len < 4096);
|
assert(len < 4096);
|
||||||
out.write(buf, len);
|
out.write(buf, len);
|
||||||
|
|
@ -1402,10 +1403,10 @@ void amount_t::write(std::ostream& out, bool optimized) const
|
||||||
byte = mpz_sgn(MPZ(quantity)) < 0 ? 1 : 0;
|
byte = mpz_sgn(MPZ(quantity)) < 0 ? 1 : 0;
|
||||||
out.write(&byte, sizeof(byte));
|
out.write(&byte, sizeof(byte));
|
||||||
|
|
||||||
out.write((char *)&quantity->prec, sizeof(quantity->prec));
|
out.write(reinterpret_cast<char *>(&quantity->prec), sizeof(quantity->prec));
|
||||||
bigint_t::flags_t tflags = quantity->flags() & ~BIGINT_BULK_ALLOC;
|
bigint_t::flags_t tflags = quantity->flags() & ~BIGINT_BULK_ALLOC;
|
||||||
assert(sizeof(tflags) == sizeof(bigint_t::flags_t));
|
assert(sizeof(tflags) == sizeof(bigint_t::flags_t));
|
||||||
out.write((char *)&tflags, sizeof(tflags));
|
out.write(reinterpret_cast<char *>(&tflags), sizeof(tflags));
|
||||||
} else {
|
} else {
|
||||||
assert(quantity->ref > 1);
|
assert(quantity->ref > 1);
|
||||||
|
|
||||||
|
|
@ -1413,7 +1414,7 @@ void amount_t::write(std::ostream& out, bool optimized) const
|
||||||
// out a reference to which one it was.
|
// out a reference to which one it was.
|
||||||
byte = 3;
|
byte = 3;
|
||||||
out.write(&byte, sizeof(byte));
|
out.write(&byte, sizeof(byte));
|
||||||
out.write((char *)&quantity->index, sizeof(quantity->index));
|
out.write(reinterpret_cast<char *>(&quantity->index), sizeof(quantity->index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
12
binary.cc
12
binary.cc
|
|
@ -560,7 +560,7 @@ void write_amount(std::ostream& out, const amount_t& amt)
|
||||||
|
|
||||||
void write_value(std::ostream& out, const value_t& val)
|
void write_value(std::ostream& out, const value_t& val)
|
||||||
{
|
{
|
||||||
write_long(out, (int)val.type());
|
write_long(out, static_cast<int>(val.type()));
|
||||||
|
|
||||||
switch (val.type()) {
|
switch (val.type()) {
|
||||||
case value_t::BOOLEAN:
|
case value_t::BOOLEAN:
|
||||||
|
|
@ -880,9 +880,9 @@ unsigned int journal_t::read(std::istream& in,
|
||||||
item_pool = item_pool;
|
item_pool = item_pool;
|
||||||
item_pool_end = item_pool + pool_size;
|
item_pool_end = item_pool + pool_size;
|
||||||
|
|
||||||
entry_t * entry_pool = (entry_t *) item_pool;
|
entry_t * entry_pool = reinterpret_cast<entry_t *>(item_pool);
|
||||||
xact_t * xact_pool = (xact_t *) (item_pool +
|
xact_t * xact_pool = reinterpret_cast<xact_t *>(item_pool +
|
||||||
sizeof(entry_t) * count);
|
(sizeof(entry_t) * count));
|
||||||
bigints_index = 0;
|
bigints_index = 0;
|
||||||
bigints = bigints_next = (item_pool + sizeof(entry_t) * count +
|
bigints = bigints_next = (item_pool + sizeof(entry_t) * count +
|
||||||
sizeof(xact_t) * xact_count);
|
sizeof(xact_t) * xact_count);
|
||||||
|
|
@ -1153,8 +1153,8 @@ void journal_t::write(std::ostream& out)
|
||||||
|
|
||||||
// Back-patch the count for amounts
|
// Back-patch the count for amounts
|
||||||
|
|
||||||
unsigned long data_size = (((unsigned long) out.tellp()) -
|
unsigned long data_size = (static_cast<unsigned long>(out.tellp()) -
|
||||||
((unsigned long) data_val) -
|
static_cast<unsigned long>(data_val) -
|
||||||
sizeof(unsigned long));
|
sizeof(unsigned long));
|
||||||
out.seekp(data_val);
|
out.seekp(data_val);
|
||||||
write_number<unsigned long>(out, data_size);
|
write_number<unsigned long>(out, data_size);
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ void commodity_t::parse_symbol(std::istream& in, string& symbol)
|
||||||
else
|
else
|
||||||
throw_(amount_error, "Quoted commodity symbol lacks closing quote");
|
throw_(amount_error, "Quoted commodity symbol lacks closing quote");
|
||||||
} else {
|
} else {
|
||||||
READ_INTO(in, buf, 255, c, ! invalid_chars[(unsigned char)c]);
|
READ_INTO(in, buf, 255, c, ! invalid_chars[static_cast<unsigned char>(c)]);
|
||||||
}
|
}
|
||||||
symbol = buf;
|
symbol = buf;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
emacs.cc
4
emacs.cc
|
|
@ -13,7 +13,7 @@ void format_emacs_xacts::write_entry(entry_t& entry)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
out << (((unsigned long)entry.beg_line) + 1) << " ";
|
out << (static_cast<unsigned long>(entry.beg_line) + 1) << " ";
|
||||||
|
|
||||||
tm when = boost::posix_time::to_tm(entry.date());
|
tm when = boost::posix_time::to_tm(entry.date());
|
||||||
std::time_t date = std::mktime(&when); // jww (2008-04-20): Is this GMT or local?
|
std::time_t date = std::mktime(&when); // jww (2008-04-20): Is this GMT or local?
|
||||||
|
|
@ -49,7 +49,7 @@ void format_emacs_xacts::operator()(xact_t& xact)
|
||||||
out << "\n";
|
out << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
out << " (" << (((unsigned long)xact.beg_line) + 1) << " ";
|
out << " (" << (static_cast<unsigned long>(xact.beg_line) + 1) << " ";
|
||||||
out << "\"" << xact_account(xact)->fullname() << "\" \""
|
out << "\"" << xact_account(xact)->fullname() << "\" \""
|
||||||
<< xact.amount << "\"";
|
<< xact.amount << "\"";
|
||||||
|
|
||||||
|
|
|
||||||
2
entry.cc
2
entry.cc
|
|
@ -327,7 +327,7 @@ bool entry_base_t::finalize()
|
||||||
}
|
}
|
||||||
|
|
||||||
entry_t::entry_t(const entry_t& e)
|
entry_t::entry_t(const entry_t& e)
|
||||||
: entry_base_t(e), _date(e._date), _date_eff(e._date_eff),
|
: entry_base_t(e), scope_t(), _date(e._date), _date_eff(e._date_eff),
|
||||||
code(e.code), payee(e.payee)
|
code(e.code), payee(e.payee)
|
||||||
{
|
{
|
||||||
TRACE_CTOR(entry_t, "copy");
|
TRACE_CTOR(entry_t, "copy");
|
||||||
|
|
|
||||||
4
entry.h
4
entry.h
|
|
@ -143,7 +143,7 @@ public:
|
||||||
TRACE_CTOR(auto_entry_t, "");
|
TRACE_CTOR(auto_entry_t, "");
|
||||||
}
|
}
|
||||||
auto_entry_t(const auto_entry_t& other)
|
auto_entry_t(const auto_entry_t& other)
|
||||||
: predicate(other.predicate) {
|
: entry_base_t(), predicate(other.predicate) {
|
||||||
TRACE_CTOR(auto_entry_t, "copy");
|
TRACE_CTOR(auto_entry_t, "copy");
|
||||||
}
|
}
|
||||||
auto_entry_t(const string& _predicate)
|
auto_entry_t(const string& _predicate)
|
||||||
|
|
@ -170,7 +170,7 @@ struct auto_entry_finalizer_t : public entry_finalizer_t
|
||||||
TRACE_CTOR(auto_entry_finalizer_t, "");
|
TRACE_CTOR(auto_entry_finalizer_t, "");
|
||||||
}
|
}
|
||||||
auto_entry_finalizer_t(const auto_entry_finalizer_t& other)
|
auto_entry_finalizer_t(const auto_entry_finalizer_t& other)
|
||||||
: journal(other.journal) {
|
: entry_finalizer_t(), journal(other.journal) {
|
||||||
TRACE_CTOR(auto_entry_finalizer_t, "copy");
|
TRACE_CTOR(auto_entry_finalizer_t, "copy");
|
||||||
}
|
}
|
||||||
auto_entry_finalizer_t(journal_t * _journal) : journal(_journal) {
|
auto_entry_finalizer_t(journal_t * _journal) : journal(_journal) {
|
||||||
|
|
|
||||||
2
error.h
2
error.h
|
|
@ -74,7 +74,7 @@ public:
|
||||||
|
|
||||||
str_exception(const string& why,
|
str_exception(const string& why,
|
||||||
error_context * ctxt = NULL) throw()
|
error_context * ctxt = NULL) throw()
|
||||||
: std::logic_error(why) {
|
: std::logic_error(why), context() {
|
||||||
if (ctxt)
|
if (ctxt)
|
||||||
context.push_back(ctxt);
|
context.push_back(ctxt);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -928,7 +928,8 @@ bool display_account(const account_t& account,
|
||||||
if (disp_subaccounts_p(account, disp_pred, account_to_show))
|
if (disp_subaccounts_p(account, disp_pred, account_to_show))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return ! account_to_show && (! disp_pred || (*disp_pred)(account));
|
return (! account_to_show &&
|
||||||
|
(! disp_pred || (*disp_pred)(const_cast<account_t&>(account))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void format_accounts::operator()(account_t& account)
|
void format_accounts::operator()(account_t& account)
|
||||||
|
|
|
||||||
2
main.cc
2
main.cc
|
|
@ -152,7 +152,7 @@ static int read_and_report(ledger::report_t& report, int argc, char * argv[],
|
||||||
// rightmost '/' character in the pager pathname. See manpage
|
// rightmost '/' character in the pager pathname. See manpage
|
||||||
// for strrchr.
|
// for strrchr.
|
||||||
execlp(report.pager->native_file_string().c_str(),
|
execlp(report.pager->native_file_string().c_str(),
|
||||||
basename(*report.pager).c_str(), (char *)0);
|
basename(*report.pager).c_str(), NULL);
|
||||||
perror("execl");
|
perror("execl");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
mask.cc
2
mask.cc
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
namespace ledger {
|
namespace ledger {
|
||||||
|
|
||||||
mask_t::mask_t(const string& pat) : exclude(false)
|
mask_t::mask_t(const string& pat) : exclude(false), expr()
|
||||||
{
|
{
|
||||||
TRACE_CTOR(mask_t, "const string&");
|
TRACE_CTOR(mask_t, "const string&");
|
||||||
|
|
||||||
|
|
|
||||||
6
op.cc
6
op.cc
|
|
@ -717,7 +717,7 @@ value_t expr_t::op_t::calc(scope_t& scope)
|
||||||
case INDEX: {
|
case INDEX: {
|
||||||
call_scope_t args(scope);
|
call_scope_t args(scope);
|
||||||
|
|
||||||
if (as_index() >= 0 && as_index() < args.size())
|
if (as_index() < args.size())
|
||||||
return args[as_index()];
|
return args[as_index()];
|
||||||
else
|
else
|
||||||
throw_(calc_error, "Reference to non-existing argument " << as_index());
|
throw_(calc_error, "Reference to non-existing argument " << as_index());
|
||||||
|
|
@ -792,7 +792,7 @@ bool expr_t::op_t::print(std::ostream& out, print_context_t& context) const
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
if (context.start_pos && this == context.op_to_find) {
|
if (context.start_pos && this == context.op_to_find) {
|
||||||
*context.start_pos = (long)out.tellp() - 1;
|
*context.start_pos = static_cast<unsigned long>(out.tellp()) - 1;
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -968,7 +968,7 @@ bool expr_t::op_t::print(std::ostream& out, print_context_t& context) const
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.end_pos && this == context.op_to_find)
|
if (context.end_pos && this == context.op_to_find)
|
||||||
*context.end_pos = (long)out.tellp() - 1;
|
*context.end_pos = static_cast<unsigned long>(out.tellp()) - 1;
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ void process_environment(const char ** envp, const string& tag,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_arguments(int argc, char ** argv, const bool anywhere,
|
void process_arguments(int, char ** argv, const bool anywhere,
|
||||||
scope_t& scope, std::list<string>& args)
|
scope_t& scope, std::list<string>& args)
|
||||||
{
|
{
|
||||||
for (char ** i = argv; *i; i++) {
|
for (char ** i = argv; *i; i++) {
|
||||||
|
|
|
||||||
|
|
@ -59,13 +59,8 @@ public:
|
||||||
TRACE_DTOR(item_predicate);
|
TRACE_DTOR(item_predicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator()(const T& item) const {
|
bool operator()(T& item) const {
|
||||||
#if 0
|
return ! predicate || predicate.calc(item).strip_annotations();
|
||||||
template context_t<T> context(item);
|
|
||||||
return ! predicate || predicate->calc(context).strip_annotations();
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
namespace ledger {
|
namespace ledger {
|
||||||
|
|
||||||
#define xact_next(x) ((xact_t *)xact_xdata(*x).ptr)
|
#define xact_next(x) reinterpret_cast<xact_t *>(xact_xdata(*x).ptr)
|
||||||
#define xact_next_ptr(x) ((xact_t **)&xact_xdata(*x).ptr)
|
#define xact_next_ptr(x) reinterpret_cast<xact_t **>(&xact_xdata(*x).ptr)
|
||||||
|
|
||||||
static bool search_for_balance(amount_t& amount,
|
static bool search_for_balance(amount_t& amount,
|
||||||
xact_t ** prev, xact_t * next)
|
xact_t ** prev, xact_t * next)
|
||||||
|
|
|
||||||
|
|
@ -199,16 +199,16 @@ See LICENSE file included with the distribution for details and disclaimer.\n";
|
||||||
// Debug options
|
// Debug options
|
||||||
//
|
//
|
||||||
|
|
||||||
value_t option_trace_(scope_t& locals) {
|
value_t option_trace_(scope_t&) {
|
||||||
return NULL_VALUE;
|
return NULL_VALUE;
|
||||||
}
|
}
|
||||||
value_t option_debug_(scope_t& locals) {
|
value_t option_debug_(scope_t&) {
|
||||||
return NULL_VALUE;
|
return NULL_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
value_t option_verify(scope_t&) {
|
value_t option_verify(scope_t&) {
|
||||||
return NULL_VALUE;
|
return NULL_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
value_t option_verbose(scope_t&) {
|
value_t option_verbose(scope_t&) {
|
||||||
#if defined(LOGGING_ON)
|
#if defined(LOGGING_ON)
|
||||||
if (_log_level < LOG_INFO)
|
if (_log_level < LOG_INFO)
|
||||||
|
|
|
||||||
28
textual.cc
28
textual.cc
|
|
@ -112,7 +112,7 @@ xact_t * parse_xact(char * line, account_t * account,
|
||||||
|
|
||||||
// Parse the account name
|
// Parse the account name
|
||||||
|
|
||||||
unsigned long account_beg = in.tellg();
|
unsigned long account_beg = static_cast<unsigned long>(in.tellg());
|
||||||
unsigned long account_end = account_beg;
|
unsigned long account_end = account_beg;
|
||||||
while (! in.eof()) {
|
while (! in.eof()) {
|
||||||
in.get(p);
|
in.get(p);
|
||||||
|
|
@ -166,7 +166,7 @@ xact_t * parse_xact(char * line, account_t * account,
|
||||||
goto parse_assign;
|
goto parse_assign;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
unsigned long beg = (long)in.tellg();
|
unsigned long beg = static_cast<unsigned long>(in.tellg());
|
||||||
|
|
||||||
xact->amount_expr =
|
xact->amount_expr =
|
||||||
parse_amount_expr(in, xact->amount, xact.get(),
|
parse_amount_expr(in, xact->amount, xact.get(),
|
||||||
|
|
@ -185,7 +185,7 @@ xact_t * parse_xact(char * line, account_t * account,
|
||||||
if (xact->amount_expr->is_constant())
|
if (xact->amount_expr->is_constant())
|
||||||
xact->amount_expr = expr_t();
|
xact->amount_expr = expr_t();
|
||||||
|
|
||||||
unsigned long end = (long)in.tellg();
|
unsigned long end = static_cast<unsigned long>(in.tellg());
|
||||||
xact->amount_expr->set_text(string(line, beg, end - beg));
|
xact->amount_expr->set_text(string(line, beg, end - beg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -219,7 +219,7 @@ xact_t * parse_xact(char * line, account_t * account,
|
||||||
xact->cost = amount_t();
|
xact->cost = amount_t();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
unsigned long beg = (long)in.tellg();
|
unsigned long beg = static_cast<unsigned long>(in.tellg());
|
||||||
|
|
||||||
xact->cost_expr =
|
xact->cost_expr =
|
||||||
parse_amount_expr(in, *xact->cost, xact.get(),
|
parse_amount_expr(in, *xact->cost, xact.get(),
|
||||||
|
|
@ -227,7 +227,7 @@ xact_t * parse_xact(char * line, account_t * account,
|
||||||
EXPR_PARSE_NO_ASSIGN);
|
EXPR_PARSE_NO_ASSIGN);
|
||||||
|
|
||||||
if (xact->cost_expr) {
|
if (xact->cost_expr) {
|
||||||
unsigned long end = (long)in.tellg();
|
unsigned long end = static_cast<unsigned long>(in.tellg());
|
||||||
if (per_unit)
|
if (per_unit)
|
||||||
xact->cost_expr->set_text(string("@") +
|
xact->cost_expr->set_text(string("@") +
|
||||||
string(line, beg, end - beg));
|
string(line, beg, end - beg));
|
||||||
|
|
@ -296,7 +296,7 @@ xact_t * parse_xact(char * line, account_t * account,
|
||||||
|
|
||||||
try {
|
try {
|
||||||
#if 0
|
#if 0
|
||||||
unsigned long beg = (long)in.tellg();
|
unsigned long beg = static_cast<unsigned long>(in.tellg());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (parse_amount_expr(in, amt, xact.get(),
|
if (parse_amount_expr(in, amt, xact.get(),
|
||||||
|
|
@ -308,7 +308,7 @@ xact_t * parse_xact(char * line, account_t * account,
|
||||||
"XACT assign: parsed amt = " << amt);
|
"XACT assign: parsed amt = " << amt);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
unsigned long end = (long)in.tellg();
|
unsigned long end = static_cast<unsigned long>(in.tellg());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
amount_t diff;
|
amount_t diff;
|
||||||
|
|
@ -367,7 +367,7 @@ xact_t * parse_xact(char * line, account_t * account,
|
||||||
if (p == ';') {
|
if (p == ';') {
|
||||||
in.get(p);
|
in.get(p);
|
||||||
p = peek_next_nonws(in);
|
p = peek_next_nonws(in);
|
||||||
xact->note = &line[in.tellg()];
|
xact->note = &line[static_cast<unsigned long>(in.tellg())];
|
||||||
DEBUG("ledger.textual.parse", "line " << linenum << ": " <<
|
DEBUG("ledger.textual.parse", "line " << linenum << ": " <<
|
||||||
"Parsed a note '" << *xact->note << "'");
|
"Parsed a note '" << *xact->note << "'");
|
||||||
|
|
||||||
|
|
@ -396,7 +396,7 @@ xact_t * parse_xact(char * line, account_t * account,
|
||||||
}
|
}
|
||||||
catch (error * err) {
|
catch (error * err) {
|
||||||
err->context.push_back
|
err->context.push_back
|
||||||
(new line_context(line, (long)in.tellg() - 1,
|
(new line_context(line, static_cast<unsigned long>(in.tellg()) - 1,
|
||||||
! err_desc.empty() ?
|
! err_desc.empty() ?
|
||||||
err_desc : "While parsing transaction:"));
|
err_desc : "While parsing transaction:"));
|
||||||
throw err;
|
throw err;
|
||||||
|
|
@ -499,7 +499,7 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master,
|
||||||
unsigned long beg_line = linenum;
|
unsigned long beg_line = linenum;
|
||||||
|
|
||||||
while (! in.eof() && (in.peek() == ' ' || in.peek() == '\t')) {
|
while (! in.eof() && (in.peek() == ' ' || in.peek() == '\t')) {
|
||||||
unsigned long beg_pos = (unsigned long)in.tellg();
|
unsigned long beg_pos = static_cast<unsigned long>(in.tellg());
|
||||||
|
|
||||||
line[0] = '\0';
|
line[0] = '\0';
|
||||||
in.getline(line, MAX_LINE);
|
in.getline(line, MAX_LINE);
|
||||||
|
|
@ -677,7 +677,7 @@ unsigned int textual_parser_t::parse(std::istream& in,
|
||||||
|
|
||||||
INFO("Parsing file '" << pathname.string() << "'");
|
INFO("Parsing file '" << pathname.string() << "'");
|
||||||
|
|
||||||
unsigned long beg_pos = in.tellg();
|
unsigned long beg_pos = static_cast<unsigned long>(in.tellg());
|
||||||
unsigned long end_pos;
|
unsigned long end_pos;
|
||||||
unsigned long beg_line = linenum;
|
unsigned long beg_line = linenum;
|
||||||
|
|
||||||
|
|
@ -1009,7 +1009,7 @@ unsigned int textual_parser_t::parse(std::istream& in,
|
||||||
journal.remove_entry_finalizer(&auto_entry_finalizer);
|
journal.remove_entry_finalizer(&auto_entry_finalizer);
|
||||||
|
|
||||||
if (errors > 0)
|
if (errors > 0)
|
||||||
throw (int)errors;
|
throw static_cast<int>(errors);
|
||||||
|
|
||||||
TRACE_STOP(parsing_total, 1);
|
TRACE_STOP(parsing_total, 1);
|
||||||
|
|
||||||
|
|
@ -1101,11 +1101,11 @@ void write_textual_journal(journal_t& journal,
|
||||||
|
|
||||||
while (pos < base->end_pos) {
|
while (pos < base->end_pos) {
|
||||||
in.get(c);
|
in.get(c);
|
||||||
pos = in.tellg(); // pos++;
|
pos = static_cast<unsigned long>(in.tellg()); // pos++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
in.get(c);
|
in.get(c);
|
||||||
pos = in.tellg(); // pos++;
|
pos = static_cast<unsigned long>(in.tellg()); // pos++;
|
||||||
out.put(c);
|
out.put(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
times.h
3
times.h
|
|
@ -103,7 +103,8 @@ struct interval_t
|
||||||
|
|
||||||
interval_t(const string& desc)
|
interval_t(const string& desc)
|
||||||
: years(0), months(0), days(0),
|
: years(0), months(0), days(0),
|
||||||
hours(0), minutes(0), seconds(0), advanced(false) {
|
hours(0), minutes(0), seconds(0),
|
||||||
|
begin(), end(), advanced(false) {
|
||||||
TRACE_CTOR(interval_t, "const string&");
|
TRACE_CTOR(interval_t, "const string&");
|
||||||
std::istringstream stream(desc);
|
std::istringstream stream(desc);
|
||||||
parse(stream);
|
parse(stream);
|
||||||
|
|
|
||||||
4
token.cc
4
token.cc
|
|
@ -331,7 +331,7 @@ void expr_t::token_t::next(std::istream& in, const unsigned int pflags)
|
||||||
// When in relaxed parsing mode, we want to migrate commodity
|
// When in relaxed parsing mode, we want to migrate commodity
|
||||||
// flags so that any precision specified by the user updates the
|
// flags so that any precision specified by the user updates the
|
||||||
// current maximum displayed precision.
|
// current maximum displayed precision.
|
||||||
pos = (long)in.tellg();
|
pos = static_cast<unsigned long>(in.tellg());
|
||||||
|
|
||||||
amount_t::flags_t parse_flags = 0;
|
amount_t::flags_t parse_flags = 0;
|
||||||
if (pflags & EXPR_PARSE_NO_MIGRATE)
|
if (pflags & EXPR_PARSE_NO_MIGRATE)
|
||||||
|
|
@ -381,7 +381,7 @@ void expr_t::token_t::unexpected()
|
||||||
|
|
||||||
void expr_t::token_t::unexpected(char c, char wanted)
|
void expr_t::token_t::unexpected(char c, char wanted)
|
||||||
{
|
{
|
||||||
if ((unsigned char) c == 0xff) {
|
if (static_cast<unsigned char>(c) == 0xff) {
|
||||||
if (wanted)
|
if (wanted)
|
||||||
throw_(parse_error, "Missing '" << wanted << "'");
|
throw_(parse_error, "Missing '" << wanted << "'");
|
||||||
else
|
else
|
||||||
|
|
|
||||||
27
value.cc
27
value.cc
|
|
@ -42,28 +42,33 @@ value_t::storage_t& value_t::storage_t::operator=(const value_t::storage_t& rhs)
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DATETIME:
|
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;
|
break;
|
||||||
|
|
||||||
case AMOUNT:
|
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;
|
break;
|
||||||
|
|
||||||
case BALANCE:
|
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;
|
break;
|
||||||
|
|
||||||
case BALANCE_PAIR:
|
case BALANCE_PAIR:
|
||||||
*(balance_pair_t **) data =
|
*reinterpret_cast<balance_pair_t **>(data) =
|
||||||
new balance_pair_t(**(balance_pair_t **) rhs.data);
|
new balance_pair_t(**reinterpret_cast<balance_pair_t **>(const_cast<char *>(rhs.data)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STRING:
|
case STRING:
|
||||||
new((string *) data) string(*(string *) rhs.data);
|
new(reinterpret_cast<string *>(data))
|
||||||
|
string(*reinterpret_cast<string *>(const_cast<char *>(rhs.data)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SEQUENCE:
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -105,9 +110,7 @@ void value_t::storage_t::destroy()
|
||||||
|
|
||||||
void value_t::initialize()
|
void value_t::initialize()
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
LOGGER("value.initialize");
|
LOGGER("value.initialize");
|
||||||
#endif
|
|
||||||
|
|
||||||
true_value = new storage_t;
|
true_value = new storage_t;
|
||||||
true_value->type = BOOLEAN;
|
true_value->type = BOOLEAN;
|
||||||
|
|
@ -117,6 +120,7 @@ void value_t::initialize()
|
||||||
false_value->type = BOOLEAN;
|
false_value->type = BOOLEAN;
|
||||||
*reinterpret_cast<bool *>(false_value->data) = false;
|
*reinterpret_cast<bool *>(false_value->data) = false;
|
||||||
|
|
||||||
|
#if 0
|
||||||
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(bool));
|
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(bool));
|
||||||
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(datetime_t));
|
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(datetime_t));
|
||||||
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(long));
|
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(string));
|
||||||
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(sequence_t *));
|
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(sequence_t *));
|
||||||
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(boost::any));
|
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(boost::any));
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 0
|
|
||||||
DEBUG_(std::setw(3) << std::right << sizeof(bool)
|
DEBUG_(std::setw(3) << std::right << sizeof(bool)
|
||||||
<< " sizeof(bool)");
|
<< " sizeof(bool)");
|
||||||
DEBUG_(std::setw(3) << std::right << sizeof(datetime_t)
|
DEBUG_(std::setw(3) << std::right << sizeof(datetime_t)
|
||||||
|
|
@ -146,7 +150,6 @@ void value_t::initialize()
|
||||||
<< " sizeof(sequence_t *)");
|
<< " sizeof(sequence_t *)");
|
||||||
DEBUG_(std::setw(3) << std::right << sizeof(boost::any)
|
DEBUG_(std::setw(3) << std::right << sizeof(boost::any)
|
||||||
<< " sizeof(boost::any)");
|
<< " sizeof(boost::any)");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void value_t::shutdown()
|
void value_t::shutdown()
|
||||||
|
|
@ -285,7 +288,7 @@ void value_t::in_place_simplify()
|
||||||
LOGGER("amounts.values.simplify");
|
LOGGER("amounts.values.simplify");
|
||||||
|
|
||||||
if (is_realzero()) {
|
if (is_realzero()) {
|
||||||
DEBUG_("Zeroing type " << type());
|
DEBUG_("Zeroing type " << static_cast<int>(type()));
|
||||||
set_long(0L);
|
set_long(0L);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
64
value.h
64
value.h
|
|
@ -474,11 +474,11 @@ public:
|
||||||
bool& as_boolean_lval() {
|
bool& as_boolean_lval() {
|
||||||
assert(is_boolean());
|
assert(is_boolean());
|
||||||
_dup();
|
_dup();
|
||||||
return *(bool *) storage->data;
|
return *reinterpret_cast<bool *>(storage->data);
|
||||||
}
|
}
|
||||||
const bool& as_boolean() const {
|
const bool& as_boolean() const {
|
||||||
assert(is_boolean());
|
assert(is_boolean());
|
||||||
return *(bool *) storage->data;
|
return *reinterpret_cast<bool *>(storage->data);
|
||||||
}
|
}
|
||||||
void set_boolean(const bool val) {
|
void set_boolean(const bool val) {
|
||||||
set_type(BOOLEAN);
|
set_type(BOOLEAN);
|
||||||
|
|
@ -491,15 +491,15 @@ public:
|
||||||
long& as_long_lval() {
|
long& as_long_lval() {
|
||||||
assert(is_long());
|
assert(is_long());
|
||||||
_dup();
|
_dup();
|
||||||
return *(long *) storage->data;
|
return *reinterpret_cast<long *>(storage->data);
|
||||||
}
|
}
|
||||||
const long& as_long() const {
|
const long& as_long() const {
|
||||||
assert(is_long());
|
assert(is_long());
|
||||||
return *(long *) storage->data;
|
return *reinterpret_cast<long *>(storage->data);
|
||||||
}
|
}
|
||||||
void set_long(const long val) {
|
void set_long(const long val) {
|
||||||
set_type(INTEGER);
|
set_type(INTEGER);
|
||||||
*(long *) storage->data = val;
|
*reinterpret_cast<long *>(storage->data) = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_datetime() const {
|
bool is_datetime() const {
|
||||||
|
|
@ -508,15 +508,15 @@ public:
|
||||||
datetime_t& as_datetime_lval() {
|
datetime_t& as_datetime_lval() {
|
||||||
assert(is_datetime());
|
assert(is_datetime());
|
||||||
_dup();
|
_dup();
|
||||||
return *(datetime_t *) storage->data;
|
return *reinterpret_cast<datetime_t *>(storage->data);
|
||||||
}
|
}
|
||||||
const datetime_t& as_datetime() const {
|
const datetime_t& as_datetime() const {
|
||||||
assert(is_datetime());
|
assert(is_datetime());
|
||||||
return *(datetime_t *) storage->data;
|
return *reinterpret_cast<datetime_t *>(storage->data);
|
||||||
}
|
}
|
||||||
void set_datetime(const datetime_t& val) {
|
void set_datetime(const datetime_t& val) {
|
||||||
set_type(DATETIME);
|
set_type(DATETIME);
|
||||||
new((datetime_t *) storage->data) datetime_t(val);
|
new(reinterpret_cast<datetime_t *>(storage->data)) datetime_t(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_amount() const {
|
bool is_amount() const {
|
||||||
|
|
@ -525,20 +525,20 @@ public:
|
||||||
amount_t& as_amount_lval() {
|
amount_t& as_amount_lval() {
|
||||||
assert(is_amount());
|
assert(is_amount());
|
||||||
_dup();
|
_dup();
|
||||||
amount_t& amt(*(amount_t *) storage->data);
|
amount_t& amt(*reinterpret_cast<amount_t *>(storage->data));
|
||||||
assert(amt.valid());
|
assert(amt.valid());
|
||||||
return amt;
|
return amt;
|
||||||
}
|
}
|
||||||
const amount_t& as_amount() const {
|
const amount_t& as_amount() const {
|
||||||
assert(is_amount());
|
assert(is_amount());
|
||||||
amount_t& amt(*(amount_t *) storage->data);
|
amount_t& amt(*reinterpret_cast<amount_t *>(storage->data));
|
||||||
assert(amt.valid());
|
assert(amt.valid());
|
||||||
return amt;
|
return amt;
|
||||||
}
|
}
|
||||||
void set_amount(const amount_t& val) {
|
void set_amount(const amount_t& val) {
|
||||||
assert(val.valid());
|
assert(val.valid());
|
||||||
set_type(AMOUNT);
|
set_type(AMOUNT);
|
||||||
new((amount_t *) storage->data) amount_t(val);
|
new(reinterpret_cast<amount_t *>(storage->data)) amount_t(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_balance() const {
|
bool is_balance() const {
|
||||||
|
|
@ -547,20 +547,20 @@ public:
|
||||||
balance_t& as_balance_lval() {
|
balance_t& as_balance_lval() {
|
||||||
assert(is_balance());
|
assert(is_balance());
|
||||||
_dup();
|
_dup();
|
||||||
balance_t& bal(**(balance_t **) storage->data);
|
balance_t& bal(**reinterpret_cast<balance_t **>(storage->data));
|
||||||
assert(bal.valid());
|
assert(bal.valid());
|
||||||
return bal;
|
return bal;
|
||||||
}
|
}
|
||||||
const balance_t& as_balance() const {
|
const balance_t& as_balance() const {
|
||||||
assert(is_balance());
|
assert(is_balance());
|
||||||
balance_t& bal(**(balance_t **) storage->data);
|
balance_t& bal(**reinterpret_cast<balance_t **>(storage->data));
|
||||||
assert(bal.valid());
|
assert(bal.valid());
|
||||||
return bal;
|
return bal;
|
||||||
}
|
}
|
||||||
void set_balance(const balance_t& val) {
|
void set_balance(const balance_t& val) {
|
||||||
assert(val.valid());
|
assert(val.valid());
|
||||||
set_type(BALANCE);
|
set_type(BALANCE);
|
||||||
*(balance_t **) storage->data = new balance_t(val);
|
*reinterpret_cast<balance_t **>(storage->data) = new balance_t(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_balance_pair() const {
|
bool is_balance_pair() const {
|
||||||
|
|
@ -569,20 +569,20 @@ public:
|
||||||
balance_pair_t& as_balance_pair_lval() {
|
balance_pair_t& as_balance_pair_lval() {
|
||||||
assert(is_balance_pair());
|
assert(is_balance_pair());
|
||||||
_dup();
|
_dup();
|
||||||
balance_pair_t& bal_pair(**(balance_pair_t **) storage->data);
|
balance_pair_t& bal_pair(**reinterpret_cast<balance_pair_t **>(storage->data));
|
||||||
assert(bal_pair.valid());
|
assert(bal_pair.valid());
|
||||||
return bal_pair;
|
return bal_pair;
|
||||||
}
|
}
|
||||||
const balance_pair_t& as_balance_pair() const {
|
const balance_pair_t& as_balance_pair() const {
|
||||||
assert(is_balance_pair());
|
assert(is_balance_pair());
|
||||||
balance_pair_t& bal_pair(**(balance_pair_t **) storage->data);
|
balance_pair_t& bal_pair(**reinterpret_cast<balance_pair_t **>(storage->data));
|
||||||
assert(bal_pair.valid());
|
assert(bal_pair.valid());
|
||||||
return bal_pair;
|
return bal_pair;
|
||||||
}
|
}
|
||||||
void set_balance_pair(const balance_pair_t& val) {
|
void set_balance_pair(const balance_pair_t& val) {
|
||||||
assert(val.valid());
|
assert(val.valid());
|
||||||
set_type(BALANCE_PAIR);
|
set_type(BALANCE_PAIR);
|
||||||
*(balance_pair_t **) storage->data = new balance_pair_t(val);
|
*reinterpret_cast<balance_pair_t **>(storage->data) = new balance_pair_t(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_string() const {
|
bool is_string() const {
|
||||||
|
|
@ -591,19 +591,19 @@ public:
|
||||||
string& as_string_lval() {
|
string& as_string_lval() {
|
||||||
assert(is_string());
|
assert(is_string());
|
||||||
_dup();
|
_dup();
|
||||||
return *(string *) storage->data;
|
return *reinterpret_cast<string *>(storage->data);
|
||||||
}
|
}
|
||||||
const string& as_string() const {
|
const string& as_string() const {
|
||||||
assert(is_string());
|
assert(is_string());
|
||||||
return *(string *) storage->data;
|
return *reinterpret_cast<string *>(storage->data);
|
||||||
}
|
}
|
||||||
void set_string(const string& val = "") {
|
void set_string(const string& val = "") {
|
||||||
set_type(STRING);
|
set_type(STRING);
|
||||||
new((string *) storage->data) string(val);
|
new(reinterpret_cast<string *>(storage->data)) string(val);
|
||||||
}
|
}
|
||||||
void set_string(const char * val = "") {
|
void set_string(const char * val = "") {
|
||||||
set_type(STRING);
|
set_type(STRING);
|
||||||
new((string *) storage->data) string(val);
|
new(reinterpret_cast<string *>(storage->data)) string(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_sequence() const {
|
bool is_sequence() const {
|
||||||
|
|
@ -612,15 +612,15 @@ public:
|
||||||
sequence_t& as_sequence_lval() {
|
sequence_t& as_sequence_lval() {
|
||||||
assert(is_sequence());
|
assert(is_sequence());
|
||||||
_dup();
|
_dup();
|
||||||
return **(sequence_t **) storage->data;
|
return **reinterpret_cast<sequence_t **>(storage->data);
|
||||||
}
|
}
|
||||||
const sequence_t& as_sequence() const {
|
const sequence_t& as_sequence() const {
|
||||||
assert(is_sequence());
|
assert(is_sequence());
|
||||||
return **(sequence_t **) storage->data;
|
return **reinterpret_cast<sequence_t **>(storage->data);
|
||||||
}
|
}
|
||||||
void set_sequence(const sequence_t& val) {
|
void set_sequence(const sequence_t& val) {
|
||||||
set_type(SEQUENCE);
|
set_type(SEQUENCE);
|
||||||
*(sequence_t **) storage->data = new sequence_t(val);
|
*reinterpret_cast<sequence_t **>(storage->data) = new sequence_t(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_pointer() const {
|
bool is_pointer() const {
|
||||||
|
|
@ -629,42 +629,42 @@ public:
|
||||||
boost::any& as_any_pointer_lval() {
|
boost::any& as_any_pointer_lval() {
|
||||||
assert(is_pointer());
|
assert(is_pointer());
|
||||||
_dup();
|
_dup();
|
||||||
return *(boost::any *) storage->data;
|
return *reinterpret_cast<boost::any *>(storage->data);
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T * as_pointer_lval() {
|
T * as_pointer_lval() {
|
||||||
assert(is_pointer());
|
assert(is_pointer());
|
||||||
_dup();
|
_dup();
|
||||||
return any_cast<T *>(*(boost::any *) storage->data);
|
return any_cast<T *>(*reinterpret_cast<boost::any *>(storage->data));
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T& as_ref_lval() {
|
T& as_ref_lval() {
|
||||||
assert(is_pointer());
|
assert(is_pointer());
|
||||||
_dup();
|
_dup();
|
||||||
return *any_cast<T *>(*(boost::any *) storage->data);
|
return *any_cast<T *>(*reinterpret_cast<boost::any *>(storage->data));
|
||||||
}
|
}
|
||||||
const boost::any& as_any_pointer() const {
|
const boost::any& as_any_pointer() const {
|
||||||
assert(is_pointer());
|
assert(is_pointer());
|
||||||
return *(boost::any *) storage->data;
|
return *reinterpret_cast<boost::any *>(storage->data);
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T * as_pointer() const {
|
T * as_pointer() const {
|
||||||
assert(is_pointer());
|
assert(is_pointer());
|
||||||
return any_cast<T *>(*(boost::any *) storage->data);
|
return any_cast<T *>(*reinterpret_cast<boost::any *>(storage->data));
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T& as_ref() const {
|
T& as_ref() const {
|
||||||
assert(is_pointer());
|
assert(is_pointer());
|
||||||
return *any_cast<T *>(*(boost::any *) storage->data);
|
return *any_cast<T *>(*reinterpret_cast<boost::any *>(storage->data));
|
||||||
}
|
}
|
||||||
void set_any_pointer(const boost::any& val) {
|
void set_any_pointer(const boost::any& val) {
|
||||||
set_type(POINTER);
|
set_type(POINTER);
|
||||||
new((boost::any *) storage->data) boost::any(val);
|
new(reinterpret_cast<boost::any *>(storage->data)) boost::any(val);
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void set_pointer(T * val) {
|
void set_pointer(T * val) {
|
||||||
set_type(POINTER);
|
set_type(POINTER);
|
||||||
new((boost::any *) storage->data) boost::any(val);
|
new(reinterpret_cast<boost::any *>(storage->data)) boost::any(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
4
walk.cc
4
walk.cc
|
|
@ -44,7 +44,7 @@ xact_xdata_t& xact_xdata(const xact_t& xact)
|
||||||
{
|
{
|
||||||
if (! xact.data)
|
if (! xact.data)
|
||||||
xact.data = new xact_xdata_t();
|
xact.data = new xact_xdata_t();
|
||||||
return *((xact_xdata_t *) xact.data);
|
return *static_cast<xact_xdata_t *>(xact.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_xact_to(const xact_t& xact, value_t& value)
|
void add_xact_to(const xact_t& xact, value_t& value)
|
||||||
|
|
@ -887,7 +887,7 @@ account_xdata_t& account_xdata(const account_t& account)
|
||||||
if (! account.data)
|
if (! account.data)
|
||||||
account.data = new account_xdata_t();
|
account.data = new account_xdata_t();
|
||||||
|
|
||||||
return *((account_xdata_t *) account.data);
|
return *static_cast<account_xdata_t *>(account.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sum_accounts(account_t& account)
|
void sum_accounts(account_t& account)
|
||||||
|
|
|
||||||
10
walk.h
10
walk.h
|
|
@ -145,7 +145,7 @@ inline bool xact_has_xdata(const xact_t& xact) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline xact_xdata_t& xact_xdata_(const xact_t& xact) {
|
inline xact_xdata_t& xact_xdata_(const xact_t& xact) {
|
||||||
return *((xact_xdata_t *) xact.data);
|
return *static_cast<xact_xdata_t *>(xact.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
xact_xdata_t& xact_xdata(const xact_t& xact);
|
xact_xdata_t& xact_xdata(const xact_t& xact);
|
||||||
|
|
@ -264,7 +264,7 @@ public:
|
||||||
class ignore_xacts : public item_handler<xact_t>
|
class ignore_xacts : public item_handler<xact_t>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void operator()(xact_t& xact) {}
|
virtual void operator()(xact_t&) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class clear_xact_xdata : public item_handler<xact_t>
|
class clear_xact_xdata : public item_handler<xact_t>
|
||||||
|
|
@ -272,7 +272,7 @@ class clear_xact_xdata : public item_handler<xact_t>
|
||||||
public:
|
public:
|
||||||
virtual void operator()(xact_t& xact) {
|
virtual void operator()(xact_t& xact) {
|
||||||
if (xact.data) {
|
if (xact.data) {
|
||||||
checked_delete((xact_xdata_t *) xact.data);
|
checked_delete(static_cast<xact_xdata_t *>(xact.data));
|
||||||
xact.data = NULL;
|
xact.data = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -939,7 +939,7 @@ inline bool account_has_xdata(const account_t& account) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline account_xdata_t& account_xdata_(const account_t& account) {
|
inline account_xdata_t& account_xdata_(const account_t& account) {
|
||||||
return *((account_xdata_t *) account.data);
|
return *static_cast<account_xdata_t *>(account.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
account_xdata_t& account_xdata(const account_t& account);
|
account_xdata_t& account_xdata(const account_t& account);
|
||||||
|
|
@ -1019,7 +1019,7 @@ class clear_account_xdata : public item_handler<account_t>
|
||||||
public:
|
public:
|
||||||
virtual void operator()(account_t& acct) {
|
virtual void operator()(account_t& acct) {
|
||||||
if (acct.data) {
|
if (acct.data) {
|
||||||
checked_delete((account_xdata_t *) acct.data);
|
checked_delete(static_cast<account_xdata_t *>(acct.data));
|
||||||
acct.data = NULL;
|
acct.data = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
xact.h
1
xact.h
|
|
@ -93,6 +93,7 @@ class xact_t : public supports_flags<>, public scope_t
|
||||||
}
|
}
|
||||||
xact_t(const xact_t& xact)
|
xact_t(const xact_t& xact)
|
||||||
: supports_flags<>(xact),
|
: supports_flags<>(xact),
|
||||||
|
scope_t(),
|
||||||
entry(xact.entry),
|
entry(xact.entry),
|
||||||
state(xact.state),
|
state(xact.state),
|
||||||
account(xact.account),
|
account(xact.account),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue