From fd2e6c25024eefa5dfc36bed892360451862cb88 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 10 Aug 2008 02:52:38 -0400 Subject: Ledger now builds without any significant warnings, except for one file. Some of the warnings had to be temporarily disabled, but will be checked again once the code has moved into master. --- src/error.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/error.h') diff --git a/src/error.h b/src/error.h index fafef08e..253bcdbf 100644 --- a/src/error.h +++ b/src/error.h @@ -48,7 +48,7 @@ inline void throw_func(const string& message) { extern std::ostringstream _ctxt_buffer; #define add_error_context(msg) \ - ((static_cast(_ctxt_buffer.tellp()) == 0) ? \ + ((long(_ctxt_buffer.tellp()) == 0) ? \ (_ctxt_buffer << msg) : (_ctxt_buffer << std::endl << msg)) inline string error_context() { @@ -63,11 +63,13 @@ inline string file_context(const path& file, std::size_t line) { return buf.str(); } -inline string line_context(const string& line, long pos) { +inline string line_context(const string& line, istream_pos_type pos) { std::ostringstream buf; buf << " " << line << std::endl << " "; - long idx = pos < 0 ? line.length() - 1 : pos; - for (int i = 0; i < idx; i++) + istream_pos_type idx = (pos == istream_pos_type(0) ? + istream_pos_type(line.length()) : pos); + idx -= 1; + for (istream_pos_type i = 0; i < idx; i += 1) buf << " "; buf << "^" << std::endl; return buf.str(); -- cgit v1.2.3