summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-15 10:12:04 +0100
committerJohn Wiegley <johnw@newartisans.com>2010-06-15 05:14:00 -0400
commit968a6f3c0ac4690a6fc74e8d84058bce91019c2e (patch)
tree25874de7e90c34224c842e6b716ca9e82fe01028 /src
parent76b1ed68509d11308d50710f0542cef8fa437329 (diff)
downloadfork-ledger-968a6f3c0ac4690a6fc74e8d84058bce91019c2e.tar.gz
fork-ledger-968a6f3c0ac4690a6fc74e8d84058bce91019c2e.tar.bz2
fork-ledger-968a6f3c0ac4690a6fc74e8d84058bce91019c2e.zip
Changes for building with Visual Studio 2008
Diffstat (limited to 'src')
-rw-r--r--src/amount.h4
-rw-r--r--src/commodity.h2
-rw-r--r--src/expr.cc2
-rw-r--r--src/filters.cc8
-rw-r--r--src/filters.h7
-rw-r--r--src/generate.cc4
-rw-r--r--src/global.cc4
-rw-r--r--src/main.cc2
-rw-r--r--src/op.cc2
-rw-r--r--src/option.cc4
-rw-r--r--src/parser.cc2
-rw-r--r--src/query.h3
-rw-r--r--src/quotes.cc2
-rw-r--r--src/stream.cc6
-rw-r--r--src/textual.cc8
-rw-r--r--src/token.cc4
-rw-r--r--src/utils.h4
-rw-r--r--src/xact.cc2
18 files changed, 42 insertions, 28 deletions
diff --git a/src/amount.h b/src/amount.h
index 929251d8..1dfb4234 100644
--- a/src/amount.h
+++ b/src/amount.h
@@ -60,8 +60,8 @@
namespace ledger {
class commodity_t;
-class annotation_t;
-class keep_details_t;
+struct annotation_t;
+struct keep_details_t;
DECLARE_EXCEPTION(amount_error, std::runtime_error);
diff --git a/src/commodity.h b/src/commodity.h
index f2275d0e..24cd5a08 100644
--- a/src/commodity.h
+++ b/src/commodity.h
@@ -49,7 +49,7 @@
namespace ledger {
-class keep_details_t;
+struct keep_details_t;
class commodity_pool_t;
DECLARE_EXCEPTION(commodity_error, std::runtime_error);
diff --git a/src/expr.cc b/src/expr.cc
index defa5b79..0769d575 100644
--- a/src/expr.cc
+++ b/src/expr.cc
@@ -76,7 +76,7 @@ value_t expr_t::real_calc(scope_t& scope)
try {
return ptr->calc(scope, &locus);
}
- catch (const std::exception& err) {
+ catch (const std::exception&) {
if (locus) {
string current_context = error_context();
diff --git a/src/filters.cc b/src/filters.cc
index 69183991..03baadc6 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -93,7 +93,7 @@ pass_down_posts::pass_down_posts(post_handler_ptr handler,
try {
item_handler<post_t>::operator()(*post);
}
- catch (const std::exception& err) {
+ catch (const std::exception&) {
add_error_context(item_context(*post, _("While handling posting")));
throw;
}
@@ -256,9 +256,9 @@ void anonymize_posts::render_commodity(amount_t& amt)
void anonymize_posts::operator()(post_t& post)
{
- SHA1 sha;
- uint_least32_t message_digest[5];
- bool copy_xact_details = false;
+ SHA1 sha;
+ unsigned int message_digest[5];
+ bool copy_xact_details = false;
if (last_xact != post.xact) {
temps.copy_xact(*post.xact);
diff --git a/src/filters.h b/src/filters.h
index 0f414151..9102d4f1 100644
--- a/src/filters.h
+++ b/src/filters.h
@@ -74,9 +74,9 @@ public:
report_t& _report,
expr_t _group_by_expr)
: post_chain(_post_chain), report(_report),
- group_by_expr(_group_by_expr),
- preflush_func(bind(&post_splitter::print_title, this, _1)) {
+ group_by_expr(_group_by_expr) {
TRACE_CTOR(post_splitter, "scope_t&, post_handler_ptr, expr_t");
+ preflush_func = bind(&post_splitter::print_title, this, _1);
}
virtual ~post_splitter() {
TRACE_DTOR(post_splitter);
@@ -350,8 +350,7 @@ class anonymize_posts : public item_handler<post_t>
public:
anonymize_posts(post_handler_ptr handler)
: item_handler<post_t>(handler), next_comm_id(0), last_xact(NULL),
- rnd_gen(static_cast<unsigned int>(reinterpret_cast<uintmax_t>(this) +
- static_cast<uintmax_t>(std::time(0)))),
+ rnd_gen(static_cast<unsigned int>(static_cast<uintmax_t>(std::time(0)))),
integer_range(1, 2000000000L),
integer_gen(rnd_gen, integer_range) {
TRACE_CTOR(anonymize_posts, "post_handler_ptr");
diff --git a/src/generate.cc b/src/generate.cc
index fbfca342..05f754e6 100644
--- a/src/generate.cc
+++ b/src/generate.cc
@@ -367,13 +367,13 @@ post_t * generate_posts_iterator::operator()()
post = posts();
}
}
- catch (std::exception& err) {
+ catch (std::exception&) {
add_error_context(_("While parsing generated transaction (seed %1):")
<< seed);
add_error_context(buf.str());
throw;
}
- catch (int status) {
+ catch (int) {
add_error_context(_("While parsing generated transaction (seed %1):")
<< seed);
add_error_context(buf.str());
diff --git a/src/global.cc b/src/global.cc
index b1466cae..c0698376 100644
--- a/src/global.cc
+++ b/src/global.cc
@@ -422,6 +422,7 @@ expr_t::func_t global_scope_t::look_for_command(scope_t& scope,
void global_scope_t::visit_man_page() const
{
+#ifndef WIN32
int pid = fork();
if (pid < 0) {
throw std::logic_error(_("Failed to fork child process"));
@@ -436,6 +437,7 @@ void global_scope_t::visit_man_page() const
int status = -1;
wait(&status);
+#endif
exit(0); // parent
}
@@ -471,7 +473,7 @@ void handle_debug_options(int argc, char * argv[])
// global in utils.h
_trace_level = boost::lexical_cast<uint8_t>(argv[i + 1]);
}
- catch (const boost::bad_lexical_cast& e) {
+ catch (const boost::bad_lexical_cast&) {
throw std::logic_error(_("Argument to --trace must be an integer"));
}
i++;
diff --git a/src/main.cc b/src/main.cc
index e0da3a25..ef611f51 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -70,7 +70,9 @@ int main(int argc, char * argv[], char * envp[])
filesystem::path::default_name_check(filesystem::portable_posix_name);
std::signal(SIGINT, sigint_handler);
+#ifndef WIN32
std::signal(SIGPIPE, sigpipe_handler);
+#endif
#if defined(HAVE_GETTEXT)
::textdomain("ledger");
diff --git a/src/op.cc b/src/op.cc
index d7588b66..95ad5abd 100644
--- a/src/op.cc
+++ b/src/op.cc
@@ -406,7 +406,7 @@ value_t expr_t::op_t::calc(scope_t& scope, ptr_op_t * locus, const int depth)
return result;
}
- catch (const std::exception& err) {
+ catch (const std::exception&) {
if (locus && ! *locus)
*locus = this;
throw;
diff --git a/src/option.cc b/src/option.cc
index 16f7713d..dae0f0af 100644
--- a/src/option.cc
+++ b/src/option.cc
@@ -86,7 +86,7 @@ namespace {
opt(args);
}
- catch (const std::exception& err) {
+ catch (const std::exception&) {
if (name[0] == '-')
add_error_context(_("While parsing option '%1'") << name);
@@ -137,7 +137,7 @@ void process_environment(const char ** envp, const string& tag,
if (! value.empty())
process_option(string("$") + buf, string(buf), scope, q + 1, value);
}
- catch (const std::exception& err) {
+ catch (const std::exception&) {
add_error_context(_("While parsing environment variable option '%1':")
<< *p);
throw;
diff --git a/src/parser.cc b/src/parser.cc
index a15775d1..9a1ebf6f 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -484,7 +484,7 @@ expr_t::parser_t::parse(std::istream& in,
return top_node;
}
- catch (const std::exception& err) {
+ catch (const std::exception&) {
if (original_string) {
add_error_context(_("While parsing value expression:"));
diff --git a/src/query.h b/src/query.h
index e3821f19..02f8f4e7 100644
--- a/src/query.h
+++ b/src/query.h
@@ -48,6 +48,9 @@ namespace ledger {
class query_t : public predicate_t
{
+protected:
+ class parser_t;
+
public:
class lexer_t
{
diff --git a/src/quotes.cc b/src/quotes.cc
index 90c1f3eb..0cc8d06b 100644
--- a/src/quotes.cc
+++ b/src/quotes.cc
@@ -62,6 +62,7 @@ commodity_quote_from_script(commodity_t& commodity,
DEBUG("commodity.download", "invoking command: " << getquote_cmd);
bool success = true;
+#ifndef WIN32
if (FILE * fp = popen(getquote_cmd.c_str(), "r")) {
if (std::feof(fp) || ! std::fgets(buf, 255, fp))
success = false;
@@ -103,6 +104,7 @@ commodity_quote_from_script(commodity_t& commodity,
// Don't try to download this commodity again.
commodity.add_flags(COMMODITY_NOMARKET);
}
+#endif
return none;
}
diff --git a/src/stream.cc b/src/stream.cc
index 79faa05a..001e7760 100644
--- a/src/stream.cc
+++ b/src/stream.cc
@@ -63,6 +63,7 @@ namespace {
*/
int do_fork(std::ostream ** os, const path& pager_path)
{
+#ifndef WIN32
int pfd[2];
int status = pipe(pfd);
@@ -104,6 +105,9 @@ namespace {
*os = new fdstream(pfd[1]);
}
return pfd[1];
+#else
+ return 0;
+#endif
}
}
@@ -120,6 +124,7 @@ void output_stream_t::initialize(const optional<path>& output_file,
void output_stream_t::close()
{
+#ifndef WIN32
if (os != &std::cout) {
checked_delete(os);
os = &std::cout;
@@ -134,6 +139,7 @@ void output_stream_t::close()
if (! WIFEXITED(status) || WEXITSTATUS(status) != 0)
throw std::logic_error(_("Error in the pager"));
}
+#endif
}
} // namespace ledger
diff --git a/src/textual.cc b/src/textual.cc
index 800d0c4e..828a093d 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -611,7 +611,7 @@ void instance_t::automated_xact_directive(char * line)
ae.release();
}
- catch (const std::exception& err) {
+ catch (const std::exception&) {
if (reveal_context) {
add_error_context(_("While parsing automated transaction:"));
add_error_context(source_context(pathname, pos, curr_pos, "> "));
@@ -657,7 +657,7 @@ void instance_t::period_xact_directive(char * line)
}
}
- catch (const std::exception& err) {
+ catch (const std::exception&) {
if (reveal_context) {
add_error_context(_("While parsing periodic transaction:"));
add_error_context(source_context(pathname, pos, curr_pos, "> "));
@@ -1359,7 +1359,7 @@ post_t * instance_t::parse_post(char * line,
return post.release();
}
- catch (const std::exception& err) {
+ catch (const std::exception&) {
add_error_context(_("While parsing posting:"));
add_error_context(line_context(buf, beg, len));
throw;
@@ -1557,7 +1557,7 @@ xact_t * instance_t::parse_xact(char * line,
return xact.release();
}
- catch (const std::exception& err) {
+ catch (const std::exception&) {
if (reveal_context) {
add_error_context(_("While parsing transaction:"));
add_error_context(source_context(xact->pos->pathname,
diff --git a/src/token.cc b/src/token.cc
index 9dfff065..67cff65e 100644
--- a/src/token.cc
+++ b/src/token.cc
@@ -437,7 +437,7 @@ void expr_t::token_t::next(std::istream& in, const parse_flags_t& pflags,
length = static_cast<std::size_t>(in.tellg() - pos);
}
}
- catch (const std::exception& err) {
+ catch (const std::exception&) {
kind = ERROR;
length = static_cast<std::size_t>(in.tellg() - pos);
throw;
@@ -449,7 +449,7 @@ void expr_t::token_t::next(std::istream& in, const parse_flags_t& pflags,
void expr_t::token_t::rewind(std::istream& in)
{
- in.seekg(- length, std::ios::cur);
+ in.seekg(- int(length), std::ios::cur);
if (in.fail())
throw_(parse_error, _("Failed to rewind input stream"));
}
diff --git a/src/utils.h b/src/utils.h
index 40fa57cc..a228d166 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -645,7 +645,7 @@ inline char peek_next_nonws(std::istream& in) {
*_p = '\0'; \
}
-inline string to_hex(uint_least32_t * message_digest, const int len = 1)
+inline string to_hex(unsigned int * message_digest, const int len = 1)
{
std::ostringstream buf;
@@ -664,7 +664,7 @@ inline string sha1sum(const string& str)
SHA1 sha;
sha.Reset();
sha << str.c_str();
- uint_least32_t message_digest[5];
+ unsigned int message_digest[5];
sha.Result(message_digest);
return to_hex(message_digest, 5);
}
diff --git a/src/xact.cc b/src/xact.cc
index d8ed3f8b..4fe3e6e6 100644
--- a/src/xact.cc
+++ b/src/xact.cc
@@ -787,7 +787,7 @@ void auto_xact_t::extend_xact(xact_base_t& xact)
xact.verify();
}
- catch (const std::exception& err) {
+ catch (const std::exception&) {
add_error_context(item_context(*this, _("While applying automated transaction")));
add_error_context(item_context(xact, _("While extending transaction")));
throw;