r384@user1022: johnw | 2007-06-08 00:08:53 -0400
Corrected several minor warnings
This commit is contained in:
parent
ec850814fd
commit
b7b4c07926
8 changed files with 71 additions and 72 deletions
31
acprep
31
acprep
|
|
@ -49,21 +49,22 @@ LDFLAGS="$LIBDIRS"
|
|||
LOCAL=false
|
||||
|
||||
# Warning flags
|
||||
CXXFLAGS="$CXXFLAGS -Wall -Wextra -ansi"
|
||||
CXXFLAGS="$CXXFLAGS -Weffc++"
|
||||
CXXFLAGS="$CXXFLAGS -Wcast-align"
|
||||
CXXFLAGS="$CXXFLAGS -Wcast-qual"
|
||||
CXXFLAGS="$CXXFLAGS -Wconversion"
|
||||
CXXFLAGS="$CXXFLAGS -Wfloat-equal"
|
||||
CXXFLAGS="$CXXFLAGS -Wmissing-field-initializers"
|
||||
CXXFLAGS="$CXXFLAGS -Wno-endif-labels"
|
||||
CXXFLAGS="$CXXFLAGS -Wold-style-cast"
|
||||
CXXFLAGS="$CXXFLAGS -Woverloaded-virtual"
|
||||
CXXFLAGS="$CXXFLAGS -Wshorten-64-to-32"
|
||||
CXXFLAGS="$CXXFLAGS -Wsign-compare"
|
||||
CXXFLAGS="$CXXFLAGS -Wsign-promo"
|
||||
CXXFLAGS="$CXXFLAGS -Wstrict-null-sentinel"
|
||||
CXXFLAGS="$CXXFLAGS -Wwrite-strings"
|
||||
CXXFLAGS="$CXXFLAGS -Wall -ansi"
|
||||
#CXXFLAGS="$CXXFLAGS -Wextra"
|
||||
#CXXFLAGS="$CXXFLAGS -Weffc++"
|
||||
#CXXFLAGS="$CXXFLAGS -Wcast-align"
|
||||
#CXXFLAGS="$CXXFLAGS -Wcast-qual"
|
||||
#CXXFLAGS="$CXXFLAGS -Wconversion"
|
||||
#CXXFLAGS="$CXXFLAGS -Wfloat-equal"
|
||||
#CXXFLAGS="$CXXFLAGS -Wmissing-field-initializers"
|
||||
#CXXFLAGS="$CXXFLAGS -Wno-endif-labels"
|
||||
#CXXFLAGS="$CXXFLAGS -Wold-style-cast"
|
||||
#CXXFLAGS="$CXXFLAGS -Woverloaded-virtual"
|
||||
#CXXFLAGS="$CXXFLAGS -Wshorten-64-to-32"
|
||||
#CXXFLAGS="$CXXFLAGS -Wsign-compare"
|
||||
#CXXFLAGS="$CXXFLAGS -Wsign-promo"
|
||||
#CXXFLAGS="$CXXFLAGS -Wstrict-null-sentinel"
|
||||
#CXXFLAGS="$CXXFLAGS -Wwrite-strings"
|
||||
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
|
|
|
|||
|
|
@ -130,20 +130,16 @@ void transaction_node_t::parse_amount_expr(xpath_t::scope_t& scope,
|
|||
|
||||
// Parse the optional cost (@ PER-UNIT-COST, @@ TOTAL-COST)
|
||||
|
||||
unsigned int linenum = -1;
|
||||
|
||||
if (in.good() && ! in.eof()) {
|
||||
char c = peek_next_nonws(in);
|
||||
if (c == '@') {
|
||||
DEBUG("ledger.textual.parse", "line " << linenum << ": " <<
|
||||
"Found a price indicator");
|
||||
DEBUG("ledger.textual.parse", "Found a price indicator");
|
||||
bool per_unit = true;
|
||||
in.get(c);
|
||||
if (in.peek() == '@') {
|
||||
in.get(c);
|
||||
per_unit = false;
|
||||
DEBUG("ledger.textual.parse", "line " << linenum << ": " <<
|
||||
"And it's for a total price");
|
||||
DEBUG("ledger.textual.parse", "And it's for a total price");
|
||||
}
|
||||
|
||||
if (in.good() && ! in.eof()) {
|
||||
|
|
@ -179,22 +175,17 @@ void transaction_node_t::parse_amount_expr(xpath_t::scope_t& scope,
|
|||
transaction->entry->code));
|
||||
}
|
||||
|
||||
DEBUG("ledger.textual.parse", "line " << linenum << ": " <<
|
||||
"Total cost is " << cost);
|
||||
DEBUG("ledger.textual.parse", "line " << linenum << ": " <<
|
||||
"Per-unit cost is " << per_unit_cost);
|
||||
DEBUG("ledger.textual.parse", "line " << linenum << ": " <<
|
||||
"Annotated amount is " << base_amount);
|
||||
DEBUG("ledger.textual.parse", "line " << linenum << ": " <<
|
||||
"Bare amount is " << base_amount.number());
|
||||
DEBUG("ledger.textual.parse", "Total cost is " << cost);
|
||||
DEBUG("ledger.textual.parse", "Per-unit cost is " << per_unit_cost);
|
||||
DEBUG("ledger.textual.parse", "Annotated amount is " << base_amount);
|
||||
DEBUG("ledger.textual.parse", "Bare amount is " << base_amount.number());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
amount->in_place_reduce();
|
||||
|
||||
DEBUG("ledger.textual.parse", "line " << linenum << ": " <<
|
||||
"Reduced amount is " << *amount);
|
||||
DEBUG("ledger.textual.parse", "Reduced amount is " << *amount);
|
||||
}
|
||||
|
||||
void transaction_node_t::compile(xpath_t::scope_t& scope)
|
||||
|
|
|
|||
|
|
@ -121,13 +121,14 @@ optional<node_t::nameid_t> document_t::lookup_name_id(const string& name) const
|
|||
optional<node_t::nameid_t> document_t::lookup_builtin_id(const string& name)
|
||||
{
|
||||
int first = 0;
|
||||
int last = (int)ledger_builtins_size;
|
||||
int last = static_cast<int>(ledger_builtins_size);
|
||||
|
||||
while (first <= last) {
|
||||
int mid = (first + last) / 2; // compute mid point.
|
||||
|
||||
int result;
|
||||
if ((result = (int)name[0] - (int)ledger_builtins[mid][0]) == 0)
|
||||
if ((result = (static_cast<int>(name[0]) -
|
||||
static_cast<int>(ledger_builtins[mid][0]))) == 0)
|
||||
result = std::strcmp(name.c_str(), ledger_builtins[mid]);
|
||||
|
||||
if (result > 0)
|
||||
|
|
|
|||
|
|
@ -542,18 +542,22 @@ journal_t::~journal_t()
|
|||
// be deleted.
|
||||
for (entries_list::iterator i = entries.begin();
|
||||
i != entries.end();
|
||||
i++)
|
||||
i++) {
|
||||
if (! item_pool ||
|
||||
((char *) *i) < item_pool || ((char *) *i) >= item_pool_end)
|
||||
reinterpret_cast<char *>(*i) < item_pool ||
|
||||
reinterpret_cast<char *>(*i) >= item_pool_end) {
|
||||
checked_delete(*i);
|
||||
else
|
||||
} else {
|
||||
(*i)->~entry_t();
|
||||
}
|
||||
}
|
||||
|
||||
for (auto_entries_list::iterator i = auto_entries.begin();
|
||||
i != auto_entries.end();
|
||||
i++)
|
||||
if (! item_pool ||
|
||||
((char *) *i) < item_pool || ((char *) *i) >= item_pool_end)
|
||||
reinterpret_cast<char *>(*i) < item_pool ||
|
||||
reinterpret_cast<char *>(*i) >= item_pool_end)
|
||||
checked_delete(*i);
|
||||
else
|
||||
(*i)->~auto_entry_t();
|
||||
|
|
@ -562,7 +566,8 @@ journal_t::~journal_t()
|
|||
i != period_entries.end();
|
||||
i++)
|
||||
if (! item_pool ||
|
||||
((char *) *i) < item_pool || ((char *) *i) >= item_pool_end)
|
||||
reinterpret_cast<char *>(*i) < item_pool ||
|
||||
reinterpret_cast<char *>(*i) >= item_pool_end)
|
||||
checked_delete(*i);
|
||||
else
|
||||
(*i)->~period_entry_t();
|
||||
|
|
|
|||
|
|
@ -59,13 +59,14 @@ value_t report_t::abbrev(xml::xpath_t::call_scope_t& args)
|
|||
|
||||
elision_style_t style = session.elision_style;
|
||||
if (args.size() == 3)
|
||||
style = (elision_style_t)args[2].as_long();
|
||||
style = static_cast<elision_style_t>(args[2].as_long());
|
||||
|
||||
long abbrev_len = session.abbrev_length;
|
||||
if (args.size() == 4)
|
||||
abbrev_len = args[3].as_long();
|
||||
|
||||
return value_t(abbreviate(str, wid, style, true, (int)abbrev_len), true);
|
||||
return value_t(abbreviate(str, wid, style, true,
|
||||
static_cast<int>(abbrev_len)), true);
|
||||
}
|
||||
|
||||
value_t report_t::ftime(xml::xpath_t::call_scope_t& args)
|
||||
|
|
|
|||
|
|
@ -41,22 +41,22 @@ void value_t::storage_t::destroy()
|
|||
{
|
||||
switch (type) {
|
||||
case AMOUNT:
|
||||
((amount_t *)data)->~amount_t();
|
||||
reinterpret_cast<amount_t *>(data)->~amount_t();
|
||||
break;
|
||||
case BALANCE:
|
||||
checked_delete(*(balance_t **)data);
|
||||
checked_delete(*reinterpret_cast<balance_t **>(data));
|
||||
break;
|
||||
case BALANCE_PAIR:
|
||||
checked_delete(*(balance_pair_t **)data);
|
||||
checked_delete(*reinterpret_cast<balance_pair_t **>(data));
|
||||
break;
|
||||
case STRING:
|
||||
((string *)data)->~string();
|
||||
reinterpret_cast<string *>(data)->~string();
|
||||
break;
|
||||
case SEQUENCE:
|
||||
checked_delete(*(sequence_t **)data);
|
||||
checked_delete(*reinterpret_cast<sequence_t **>(data));
|
||||
break;
|
||||
case POINTER:
|
||||
((boost::any *)data)->~any();
|
||||
reinterpret_cast<boost::any *>(data)->~any();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -73,11 +73,11 @@ void value_t::initialize()
|
|||
|
||||
true_value = new storage_t;
|
||||
true_value->type = BOOLEAN;
|
||||
*(bool *) true_value->data = true;
|
||||
*reinterpret_cast<bool *>(true_value->data) = true;
|
||||
|
||||
false_value = new storage_t;
|
||||
false_value->type = BOOLEAN;
|
||||
*(bool *) false_value->data = false;
|
||||
*reinterpret_cast<bool *>(false_value->data) = false;
|
||||
|
||||
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(bool));
|
||||
BOOST_STATIC_ASSERT(sizeof(amount_t) >= sizeof(moment_t));
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ void read_bool(std::istream& in, bool& num)
|
|||
{
|
||||
read_guard(in, 0x2005);
|
||||
unsigned char val;
|
||||
in.read((char *)&val, sizeof(val));
|
||||
in.read(reinterpret_cast<char *>(&val), sizeof(val));
|
||||
num = val == 1;
|
||||
read_guard(in, 0x2006);
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ void read_bool(std::istream& in, bool& num)
|
|||
void read_bool(const char *& data, bool& num)
|
||||
{
|
||||
read_guard(data, 0x2005);
|
||||
unsigned char val = *((unsigned char *) data);
|
||||
const unsigned char val = *reinterpret_cast<const unsigned char *>(data);
|
||||
data += sizeof(unsigned char);
|
||||
num = val == 1;
|
||||
read_guard(data, 0x2006);
|
||||
|
|
@ -130,7 +130,7 @@ void write_bool(std::ostream& out, bool num)
|
|||
{
|
||||
write_guard(out, 0x2005);
|
||||
unsigned char val = num ? 1 : 0;
|
||||
out.write((char *)&val, sizeof(val));
|
||||
out.write(reinterpret_cast<char *>(&val), sizeof(val));
|
||||
write_guard(out, 0x2006);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,12 +37,12 @@ namespace binary {
|
|||
|
||||
template <typename T>
|
||||
inline void read_number_nocheck(std::istream& in, T& num) {
|
||||
in.read((char *)&num, sizeof(num));
|
||||
in.read(reinterpret_cast<char *>(&num), sizeof(num));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void read_number_nocheck(const char *& data, T& num) {
|
||||
num = *((T *) data);
|
||||
num = *reinterpret_cast<const T *>(data);
|
||||
data += sizeof(T);
|
||||
}
|
||||
|
||||
|
|
@ -71,14 +71,14 @@ inline T read_number_nocheck(const char *& data) {
|
|||
template <typename T>
|
||||
inline void read_number(std::istream& in, T& num) {
|
||||
read_guard(in, 0x2003);
|
||||
in.read((char *)&num, sizeof(num));
|
||||
in.read(reinterpret_cast<char *>(&num), sizeof(num));
|
||||
read_guard(in, 0x2004);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void read_number(const char *& data, T& num) {
|
||||
read_guard(data, 0x2003);
|
||||
num = *((T *) data);
|
||||
num = *reinterpret_cast<const T *>(data);
|
||||
data += sizeof(T);
|
||||
read_guard(data, 0x2004);
|
||||
}
|
||||
|
|
@ -124,19 +124,19 @@ void read_long(std::istream& in, T& num)
|
|||
unsigned char temp;
|
||||
if (len > 3) {
|
||||
read_number_nocheck(in, temp);
|
||||
num |= ((unsigned long)temp) << 24;
|
||||
num |= static_cast<unsigned long>(temp) << 24;
|
||||
}
|
||||
if (len > 2) {
|
||||
read_number_nocheck(in, temp);
|
||||
num |= ((unsigned long)temp) << 16;
|
||||
num |= static_cast<unsigned long>(temp) << 16;
|
||||
}
|
||||
if (len > 1) {
|
||||
read_number_nocheck(in, temp);
|
||||
num |= ((unsigned long)temp) << 8;
|
||||
num |= static_cast<unsigned long>(temp) << 8;
|
||||
}
|
||||
|
||||
read_number_nocheck(in, temp);
|
||||
num |= ((unsigned long)temp);
|
||||
num |= static_cast<unsigned long>(temp);
|
||||
|
||||
read_guard(in, 0x2002);
|
||||
}
|
||||
|
|
@ -153,19 +153,19 @@ void read_long(const char *& data, T& num)
|
|||
unsigned char temp;
|
||||
if (len > 3) {
|
||||
read_number_nocheck(data, temp);
|
||||
num |= ((unsigned long)temp) << 24;
|
||||
num |= static_cast<unsigned long>(temp) << 24;
|
||||
}
|
||||
if (len > 2) {
|
||||
read_number_nocheck(data, temp);
|
||||
num |= ((unsigned long)temp) << 16;
|
||||
num |= static_cast<unsigned long>(temp) << 16;
|
||||
}
|
||||
if (len > 1) {
|
||||
read_number_nocheck(data, temp);
|
||||
num |= ((unsigned long)temp) << 8;
|
||||
num |= static_cast<unsigned long>(temp) << 8;
|
||||
}
|
||||
|
||||
read_number_nocheck(data, temp);
|
||||
num |= ((unsigned long)temp);
|
||||
num |= static_cast<unsigned long>(temp);
|
||||
|
||||
read_guard(data, 0x2002);
|
||||
}
|
||||
|
|
@ -203,7 +203,7 @@ inline string read_string(const char *& data) {
|
|||
|
||||
template <typename T>
|
||||
inline void write_number_nocheck(std::ostream& out, T num) {
|
||||
out.write((char *)&num, sizeof(num));
|
||||
out.write(reinterpret_cast<char *>(&num), sizeof(num));
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL >= ALPHA
|
||||
|
|
@ -216,7 +216,7 @@ inline void write_number_nocheck(std::ostream& out, T num) {
|
|||
template <typename T>
|
||||
inline void write_number(std::ostream& out, T num) {
|
||||
write_guard(out, 0x2003);
|
||||
out.write((char *)&num, sizeof(num));
|
||||
out.write(reinterpret_cast<char *>(&num), sizeof(num));
|
||||
write_guard(out, 0x2004);
|
||||
}
|
||||
|
||||
|
|
@ -228,29 +228,29 @@ void write_long(std::ostream& out, T num)
|
|||
write_guard(out, 0x2001);
|
||||
|
||||
unsigned char len = 4;
|
||||
if (((unsigned long)num) < 0x00000100UL)
|
||||
if (static_cast<unsigned long>(num) < 0x00000100UL)
|
||||
len = 1;
|
||||
else if (((unsigned long)num) < 0x00010000UL)
|
||||
else if (static_cast<unsigned long>(num) < 0x00010000UL)
|
||||
len = 2;
|
||||
else if (((unsigned long)num) < 0x01000000UL)
|
||||
else if (static_cast<unsigned long>(num) < 0x01000000UL)
|
||||
len = 3;
|
||||
write_number_nocheck<unsigned char>(out, len);
|
||||
|
||||
unsigned char temp;
|
||||
if (len > 3) {
|
||||
temp = (((unsigned long)num) & 0xFF000000UL) >> 24;
|
||||
temp = (static_cast<unsigned long>(num) & 0xFF000000UL) >> 24;
|
||||
write_number_nocheck(out, temp);
|
||||
}
|
||||
if (len > 2) {
|
||||
temp = (((unsigned long)num) & 0x00FF0000UL) >> 16;
|
||||
temp = (static_cast<unsigned long>(num) & 0x00FF0000UL) >> 16;
|
||||
write_number_nocheck(out, temp);
|
||||
}
|
||||
if (len > 1) {
|
||||
temp = (((unsigned long)num) & 0x0000FF00UL) >> 8;
|
||||
temp = (static_cast<unsigned long>(num) & 0x0000FF00UL) >> 8;
|
||||
write_number_nocheck(out, temp);
|
||||
}
|
||||
|
||||
temp = (((unsigned long)num) & 0x000000FFUL);
|
||||
temp = (static_cast<unsigned long>(num) & 0x000000FFUL);
|
||||
write_number_nocheck(out, temp);
|
||||
|
||||
write_guard(out, 0x2002);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue