summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-01-29 18:23:57 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-01-29 18:23:57 -0400
commit05c77351e458c08873c813264005f61f828b5383 (patch)
treefa83d3826d8c113b5ec273671ce6cab3d9fe5388
parent119b5dc1975bfc00fb3f376e6ba28594dee12583 (diff)
downloadfork-ledger-05c77351e458c08873c813264005f61f828b5383.tar.gz
fork-ledger-05c77351e458c08873c813264005f61f828b5383.tar.bz2
fork-ledger-05c77351e458c08873c813264005f61f828b5383.zip
Stopped using the generic "unsigned int" in favor of more specific types.
-rw-r--r--src/account.h14
-rw-r--r--src/amount.cc2
-rw-r--r--src/amount.h4
-rw-r--r--src/cache.cc8
-rw-r--r--src/expr.cc4
-rw-r--r--src/expr.h4
-rw-r--r--src/filters.cc8
-rw-r--r--src/filters.h10
-rw-r--r--src/format.cc6
-rw-r--r--src/format.h2
-rw-r--r--src/gnucash.cc16
-rw-r--r--src/gnucash.h8
-rw-r--r--src/journal.h20
-rw-r--r--src/ofx.cc10
-rw-r--r--src/ofx.h10
-rw-r--r--src/op.h12
-rw-r--r--src/option.cc2
-rw-r--r--src/output.cc12
-rw-r--r--src/qif.cc22
-rw-r--r--src/qif.h10
-rw-r--r--src/scope.h12
-rw-r--r--src/utils.cc4
-rw-r--r--src/utils.h2
-rw-r--r--src/xact.cc2
-rw-r--r--src/xact.h14
-rw-r--r--src/xml.cc12
-rw-r--r--src/xml.h10
27 files changed, 120 insertions, 120 deletions
diff --git a/src/account.h b/src/account.h
index cd33606b..e9413bc1 100644
--- a/src/account.h
+++ b/src/account.h
@@ -108,13 +108,13 @@ class account_t : public scope_t
#define ACCOUNT_EXT_HAS_NON_VIRTUALS 0x08
#define ACCOUNT_EXT_HAS_UNB_VIRTUALS 0x10
- value_t value;
- value_t total;
- value_t sort_value;
- unsigned int count; // xacts counted toward amount
- unsigned int total_count; // xacts counted toward total
- unsigned int virtuals;
- unsigned short dflags;
+ value_t value;
+ value_t total;
+ value_t sort_value;
+ std::size_t count; // xacts counted toward amount
+ std::size_t total_count; // xacts counted toward total
+ std::size_t virtuals;
+ uint_least8_t dflags;
xdata_t()
: supports_flags<>(), count(0), total_count(0),
diff --git a/src/amount.cc b/src/amount.cc
index b097be5a..032022cf 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -1341,7 +1341,7 @@ void amount_t::read(const char *& data,
}
}
-void amount_t::write(std::ostream& out, unsigned int index) const
+void amount_t::write(std::ostream& out, std::size_t index) const
{
using namespace ledger::binary;
diff --git a/src/amount.h b/src/amount.h
index 0c49392d..887420f5 100644
--- a/src/amount.h
+++ b/src/amount.h
@@ -104,7 +104,7 @@ public:
* The number of places of precision by which values are extended to
* avoid losing precision during division and multiplication.
*/
- static const unsigned int extend_by_digits = 6U;
+ static const std::size_t extend_by_digits = 6U;
/**
* The current_pool is a static variable indicating which commodity
@@ -805,7 +805,7 @@ public:
void read(const char *& data,
char ** pool = NULL,
char ** pool_next = NULL);
- void write(std::ostream& out, unsigned int index = 0) const;
+ void write(std::ostream& out, std::size_t index = 0) const;
/*@}*/
diff --git a/src/cache.cc b/src/cache.cc
index f0a111e7..4e546718 100644
--- a/src/cache.cc
+++ b/src/cache.cc
@@ -517,10 +517,10 @@ void write_account(std::ostream& out, account_t * account)
write_account(out, pair.second);
}
-unsigned int read_journal(std::istream& in,
- const path& file,
- journal_t& journal,
- account_t * master)
+std::size_t read_journal(std::istream& in,
+ const path& file,
+ journal_t& journal,
+ account_t * master)
{
using namespace binary;
diff --git a/src/expr.cc b/src/expr.cc
index e03c2710..e71abfd2 100644
--- a/src/expr.cc
+++ b/src/expr.cc
@@ -86,7 +86,7 @@ expr_t& expr_t::operator=(const expr_t& _expr)
return *this;
}
-void expr_t::parse(const string& _str, const unsigned int flags)
+void expr_t::parse(const string& _str, const uint32_t flags)
{
if (! parser.get())
throw_(parse_error, "Value expression parser not initialized");
@@ -96,7 +96,7 @@ void expr_t::parse(const string& _str, const unsigned int flags)
compiled = false;
}
-void expr_t::parse(std::istream& in, const unsigned int flags,
+void expr_t::parse(std::istream& in, const uint32_t flags,
const string * original_string)
{
if (! parser.get())
diff --git a/src/expr.h b/src/expr.h
index de729de1..5e877d98 100644
--- a/src/expr.h
+++ b/src/expr.h
@@ -108,8 +108,8 @@ public:
str = txt;
}
- void parse(const string& _str, const unsigned int flags = 0);
- void parse(std::istream& in, const unsigned int flags = 0,
+ void parse(const string& _str, const uint32_t flags = 0);
+ void parse(std::istream& in, const uint32_t flags = 0,
const string * original_string = NULL);
void compile(scope_t& scope);
diff --git a/src/filters.cc b/src/filters.cc
index a1ac52c4..bfa85a42 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -125,7 +125,7 @@ void sort_xacts::post_accumulated_xacts()
}
namespace {
- string to_hex(unsigned int * message_digest)
+ string to_hex(uint_least32_t * message_digest)
{
std::ostringstream buf;
@@ -140,9 +140,9 @@ namespace {
void anonymize_xacts::operator()(xact_t& xact)
{
- SHA1 sha;
- unsigned int message_digest[5];
- bool copy_entry_details = false;
+ SHA1 sha;
+ uint_least32_t message_digest[5];
+ bool copy_entry_details = false;
if (last_entry != xact.entry) {
entry_temps.push_back(*xact.entry);
diff --git a/src/filters.h b/src/filters.h
index 3f3c28f0..6103f3f0 100644
--- a/src/filters.h
+++ b/src/filters.h
@@ -296,11 +296,11 @@ inline void clear_entries_xacts(std::list<entry_t>& entries_list) {
class collapse_xacts : public item_handler<xact_t>
{
- value_t subtotal;
- unsigned int count;
- entry_t * last_entry;
- xact_t * last_xact;
- account_t totals_account;
+ value_t subtotal;
+ std::size_t count;
+ entry_t * last_entry;
+ xact_t * last_xact;
+ account_t totals_account;
std::list<entry_t> entry_temps;
std::list<xact_t> xact_temps;
diff --git a/src/format.cc b/src/format.cc
index 6ead3ac8..c9ced082 100644
--- a/src/format.cc
+++ b/src/format.cc
@@ -323,12 +323,12 @@ void format_t::format(std::ostream& out_str, scope_t& scope)
}
}
-string format_t::truncate(const unistring& ustr, unsigned int width,
+string format_t::truncate(const unistring& ustr, std::size_t width,
const bool is_account)
{
assert(width < 4095);
- const unsigned int len = ustr.length();
+ const std::size_t len = ustr.length();
if (len <= width)
return ustr.extract();
@@ -361,7 +361,7 @@ string format_t::truncate(const unistring& ustr, unsigned int width,
std::ostringstream result;
- unsigned int newlen = len;
+ std::size_t newlen = len;
for (std::list<string>::iterator i = parts.begin();
i != parts.end();
i++) {
diff --git a/src/format.h b/src/format.h
index fbfe452e..19b19eea 100644
--- a/src/format.h
+++ b/src/format.h
@@ -185,7 +185,7 @@ public:
elem->dump(out);
}
- static string truncate(const unistring& str, unsigned int width,
+ static string truncate(const unistring& str, std::size_t width,
const bool is_account = false);
};
diff --git a/src/gnucash.cc b/src/gnucash.cc
index ed3a8457..a1fa40a3 100644
--- a/src/gnucash.cc
+++ b/src/gnucash.cc
@@ -55,14 +55,14 @@ static amount_t curr_quant;
static XML_Parser current_parser;
static accounts_map accounts_by_id;
static account_comm_map account_comms;
-static unsigned int count;
+static std::size_t count;
static string have_error;
static std::istream * instreamp;
-static unsigned int offset;
+static std::size_t offset;
static XML_Parser parser;
static path pathname;
-static unsigned int src_idx;
+static std::size_t src_idx;
static istream_pos_type beg_pos;
static unsigned long beg_line;
@@ -376,11 +376,11 @@ bool gnucash_parser_t::test(std::istream& in) const
return true;
}
-unsigned int gnucash_parser_t::parse(std::istream& in,
- session_t& session,
- journal_t& journal,
- account_t * master,
- const path * original_file)
+std::size_t gnucash_parser_t::parse(std::istream& in,
+ session_t& session,
+ journal_t& journal,
+ account_t * master,
+ const path * original_file)
{
#if 0
char buf[BUFSIZ];
diff --git a/src/gnucash.h b/src/gnucash.h
index d6f863e3..948e34fe 100644
--- a/src/gnucash.h
+++ b/src/gnucash.h
@@ -41,11 +41,11 @@ class gnucash_parser_t : public journal_t::parser_t
public:
virtual bool test(std::istream& in) const;
- virtual unsigned int parse(std::istream& in,
- session_t& session,
+ virtual std::size_t parse(std::istream& in,
+ session_t& session,
journal_t& journal,
- account_t * master = NULL,
- const path * original_file = NULL);
+ account_t * master = NULL,
+ const path * original_file = NULL);
};
} // namespace ledger
diff --git a/src/journal.h b/src/journal.h
index 68ecaefd..2a4a4d9d 100644
--- a/src/journal.h
+++ b/src/journal.h
@@ -96,11 +96,11 @@ public:
virtual bool test(std::istream& in) const = 0;
- virtual unsigned int parse(std::istream& in,
- session_t& session,
- journal_t& journal,
- account_t * master = NULL,
- const path * original_file = NULL) = 0;
+ virtual std::size_t parse(std::istream& in,
+ session_t& session,
+ journal_t& journal,
+ account_t * master = NULL,
+ const path * original_file = NULL) = 0;
};
class binary_parser_t : public parser_t
@@ -108,11 +108,11 @@ public:
public:
virtual bool test(std::istream& in) const;
- virtual unsigned int parse(std::istream& in,
- session_t& session,
- journal_t& journal,
- account_t * master = NULL,
- const path * original_file = NULL);
+ virtual std::size_t parse(std::istream& in,
+ session_t& session,
+ journal_t& journal,
+ account_t * master = NULL,
+ const path * original_file = NULL);
};
bool valid() const;
diff --git a/src/ofx.cc b/src/ofx.cc
index b637bef4..4a54eaad 100644
--- a/src/ofx.cc
+++ b/src/ofx.cc
@@ -230,11 +230,11 @@ bool ofx_parser_t::test(std::istream& in) const
return true;
}
-unsigned int ofx_parser_t::parse(std::istream&,
- session_t& session,
- journal_t& journal,
- account_t * master,
- const path * original_file)
+std::size_t ofx_parser_t::parse(std::istream& in,
+ session_t& session,
+ journal_t& journal,
+ account_t * master,
+ const path * original_file)
{
if (! original_file)
return 0;
diff --git a/src/ofx.h b/src/ofx.h
index 88bf5b01..9657cb47 100644
--- a/src/ofx.h
+++ b/src/ofx.h
@@ -41,11 +41,11 @@ class ofx_parser_t : public journal_t::parser_t
public:
virtual bool test(std::istream& in) const;
- virtual unsigned int parse(std::istream& in,
- session_t& session,
- journal_t& journal,
- account_t * master = NULL,
- const path * original_file = NULL);
+ virtual std::size_t parse(std::istream& in,
+ session_t& session,
+ journal_t& journal,
+ account_t * master = NULL,
+ const path * original_file = NULL);
};
} // namespace ledger
diff --git a/src/op.h b/src/op.h
index d8f572d6..9d7e862a 100644
--- a/src/op.h
+++ b/src/op.h
@@ -49,7 +49,7 @@ private:
mutable short refc;
ptr_op_t left_;
- variant<unsigned int, // used by constant INDEX
+ variant<std::size_t, // used by constant INDEX
value_t, // used by constant VALUE
string, // used by constant IDENT
mask_t, // used by constant MASK
@@ -122,16 +122,16 @@ public:
}
bool is_index() const {
- return data.type() == typeid(unsigned int);
+ return data.type() == typeid(std::size_t);
}
- unsigned int& as_index_lval() {
+ std::size_t& as_index_lval() {
assert(kind == INDEX);
- return boost::get<unsigned int>(data);
+ return boost::get<std::size_t>(data);
}
- const unsigned int& as_index() const {
+ const std::size_t& as_index() const {
return const_cast<op_t *>(this)->as_index_lval();
}
- void set_index(unsigned int val) {
+ void set_index(std::size_t val) {
data = val;
}
diff --git a/src/option.cc b/src/option.cc
index fa7e659d..65de3d1f 100644
--- a/src/option.cc
+++ b/src/option.cc
@@ -110,7 +110,7 @@ void process_environment(const char ** envp, const string& tag,
scope_t& scope)
{
const char * tag_p = tag.c_str();
- unsigned int tag_len = tag.length();
+ std::size_t tag_len = tag.length();
for (const char ** p = envp; *p; p++)
if (! tag_p || std::strncmp(*p, tag_p, tag_len) == 0) {
diff --git a/src/output.cc b/src/output.cc
index a641bae9..372981ab 100644
--- a/src/output.cc
+++ b/src/output.cc
@@ -177,12 +177,12 @@ void format_accounts::operator()(account_t& account)
bool format_accounts::disp_subaccounts_p(account_t& account,
account_t *& to_show)
{
- bool display = false;
- unsigned int counted = 0;
- bool matches = should_display(account);
- bool computed = false;
- value_t acct_total;
- value_t result;
+ bool display = false;
+ std::size_t counted = 0;
+ bool matches = should_display(account);
+ bool computed = false;
+ value_t acct_total;
+ value_t result;
to_show = NULL;
diff --git a/src/qif.cc b/src/qif.cc
index 387e111f..b40a5591 100644
--- a/src/qif.cc
+++ b/src/qif.cc
@@ -39,8 +39,8 @@ namespace ledger {
static char line[MAX_LINE + 1];
static path pathname;
-static unsigned int src_idx;
-static unsigned int linenum;
+static std::size_t src_idx;
+static std::size_t linenum;
static inline char * get_line(std::istream& in) {
in.getline(line, MAX_LINE);
@@ -53,9 +53,9 @@ static inline char * get_line(std::istream& in) {
bool qif_parser_t::test(std::istream& in) const
{
- char magic[sizeof(unsigned int) + 1];
- in.read(magic, sizeof(unsigned int));
- magic[sizeof(unsigned int)] = '\0';
+ char magic[sizeof(uint32_t) + 1];
+ in.read(magic, sizeof(uint32_t));
+ magic[sizeof(uint32_t)] = '\0';
in.clear();
in.seekg(0, std::ios::beg);
@@ -64,17 +64,17 @@ bool qif_parser_t::test(std::istream& in) const
std::strcmp(magic, "\r\n!T") == 0);
}
-unsigned int qif_parser_t::parse(std::istream& in,
- session_t& session,
- journal_t& journal,
- account_t * master,
- const path * original_file)
+std::size_t qif_parser_t::parse(std::istream& in,
+ session_t& session,
+ journal_t& journal,
+ account_t * master,
+ const path * original_file)
{
std::auto_ptr<entry_t> entry;
std::auto_ptr<amount_t> amount;
xact_t * xact;
- unsigned int count = 0;
+ std::size_t count = 0;
account_t * misc = NULL;
commodity_t * def_commodity = NULL;
bool saw_splits = false;
diff --git a/src/qif.h b/src/qif.h
index 2461c1b2..162f20ec 100644
--- a/src/qif.h
+++ b/src/qif.h
@@ -41,11 +41,11 @@ class qif_parser_t : public journal_t::parser_t
public:
virtual bool test(std::istream& in) const;
- virtual unsigned int parse(std::istream& in,
- session_t& session,
- journal_t& journal,
- account_t * master = NULL,
- const path * original_file = NULL);
+ virtual std::size_t parse(std::istream& in,
+ session_t& session,
+ journal_t& journal,
+ account_t * master = NULL,
+ const path * original_file = NULL);
};
} // namespace ledger
diff --git a/src/scope.h b/src/scope.h
index db9191de..db74a45c 100644
--- a/src/scope.h
+++ b/src/scope.h
@@ -151,10 +151,10 @@ public:
return args;
}
- value_t& operator[](const unsigned int index) {
+ value_t& operator[](const std::size_t index) {
return args[index];
}
- const value_t& operator[](const unsigned int index) const {
+ const value_t& operator[](const std::size_t index) const {
return args[index];
}
@@ -182,9 +182,9 @@ public:
: value(scope.resolve(name).template as_pointer<T>()) {
TRACE_CTOR(ptr_t, "scope_t&, const string&");
}
- ptr_t(call_scope_t& scope, const unsigned int idx)
+ ptr_t(call_scope_t& scope, const std::size_t idx)
: value(scope[idx].template as_pointer<T>()) {
- TRACE_CTOR(ptr_t, "call_scope_t&, const unsigned int");
+ TRACE_CTOR(ptr_t, "call_scope_t&, const std::size_t");
}
~ptr_t() throw() {
TRACE_DTOR(ptr_t);
@@ -215,9 +215,9 @@ public:
}
}
- var_t(call_scope_t& scope, const unsigned int idx)
+ var_t(call_scope_t& scope, const std::size_t idx)
{
- TRACE_CTOR(var_t, "call_scope_t&, const unsigned int");
+ TRACE_CTOR(var_t, "call_scope_t&, const std::size_t");
if (idx < scope.size())
value = scope[idx];
diff --git a/src/utils.cc b/src/utils.cc
index 94330843..b1714879 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -72,7 +72,7 @@ typedef std::pair<std::string, std::size_t> allocation_pair;
typedef std::map<void *, allocation_pair> live_memory_map;
typedef std::multimap<void *, allocation_pair> live_objects_map;
-typedef std::pair<unsigned int, std::size_t> count_size_pair;
+typedef std::pair<std::size_t, std::size_t> count_size_pair;
typedef std::map<std::string, count_size_pair> object_count_map;
static live_memory_map * live_memory = NULL;
@@ -432,7 +432,7 @@ std::ostream * _log_stream = &std::cerr;
std::ostringstream _log_buffer;
#if defined(TRACING_ON)
-unsigned int _trace_level;
+uint8_t _trace_level;
#endif
#ifdef BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK
diff --git a/src/utils.h b/src/utils.h
index 0c144693..248b59df 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -286,7 +286,7 @@ bool logger_func(log_level_t level);
#if defined(TRACING_ON)
-extern unsigned int _trace_level;
+extern uint8_t _trace_level;
#define SHOW_TRACE(lvl) \
(ledger::_log_level >= ledger::LOG_TRACE && lvl <= ledger::_trace_level)
diff --git a/src/xact.cc b/src/xact.cc
index 05cbff54..60294db9 100644
--- a/src/xact.cc
+++ b/src/xact.cc
@@ -237,7 +237,7 @@ xact_context::xact_context(const xact_t& _xact, const string& desc) throw()
: file_context("", 0, desc), xact(_xact)
{
const paths_list& sources(xact.entry->journal->sources);
- unsigned int x = 0;
+ std::size_t x = 0;
foreach (const path& path, sources)
if (x == xact.entry->src_idx) {
file = path;
diff --git a/src/xact.h b/src/xact.h
index 0fcb430e..22690ac3 100644
--- a/src/xact.h
+++ b/src/xact.h
@@ -114,13 +114,13 @@ public:
#define XACT_EXT_COMPOUND 0x40
#define XACT_EXT_MATCHES 0x80
- value_t total;
- value_t sort_value;
- value_t value;
- unsigned int index;
- date_t date;
- account_t * account;
- void * ptr;
+ value_t total;
+ value_t sort_value;
+ value_t value;
+ std::size_t index;
+ date_t date;
+ account_t * account;
+ void * ptr;
optional<xacts_list> component_xacts;
diff --git a/src/xml.cc b/src/xml.cc
index 0d04c158..3ab3a5e3 100644
--- a/src/xml.cc
+++ b/src/xml.cc
@@ -36,7 +36,7 @@
namespace ledger {
static irr::io::IrrXMLReader * current_parser;
-static unsigned int count;
+static std::size_t count;
static journal_t * curr_journal;
static entry_t * curr_entry;
@@ -213,11 +213,11 @@ bool xml_parser_t::test(std::istream& in) const
return true;
}
-unsigned int xml_parser_t::parse(std::istream& in,
- session_t& session,
- journal_t& journal,
- account_t * master,
- const path * original_file)
+std::size_t xml_parser_t::parse(std::istream& in,
+ session_t& session,
+ journal_t& journal,
+ account_t * master,
+ const path * original_file)
{
TRACE_START(xml_parsing_total, 1, "Total time spent parsing XML:");
diff --git a/src/xml.h b/src/xml.h
index 8e1c5af7..a8fa242e 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -75,11 +75,11 @@ class xml_parser_t : public journal_t::parser_t
public:
virtual bool test(std::istream& in) const;
- virtual unsigned int parse(std::istream& in,
- session_t& session,
- journal_t& journal,
- account_t * master = NULL,
- const path * original_file = NULL);
+ virtual std::size_t parse(std::istream& in,
+ session_t& session,
+ journal_t& journal,
+ account_t * master = NULL,
+ const path * original_file = NULL);
};
class format_xml_entries : public format_entries