diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-13 00:42:25 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-13 00:42:25 -0400 |
commit | 40f553228f5a28034c6635fdcb4c86af28a385ed (patch) | |
tree | 2c40305c9f9841a4c3d453a4a5c49ec69056b4b2 /src/error.cc | |
parent | 556211e623cad88213e5087b5c9c36e754d9aa02 (diff) | |
parent | b1b4e2aadff5983d443d70c09ea86a41b015873f (diff) | |
download | fork-ledger-40f553228f5a28034c6635fdcb4c86af28a385ed.tar.gz fork-ledger-40f553228f5a28034c6635fdcb4c86af28a385ed.tar.bz2 fork-ledger-40f553228f5a28034c6635fdcb4c86af28a385ed.zip |
Merge branch 'next'
Diffstat (limited to 'src/error.cc')
-rw-r--r-- | src/error.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/error.cc b/src/error.cc index cfc91ff1..39ac63ea 100644 --- a/src/error.cc +++ b/src/error.cc @@ -43,6 +43,7 @@ std::ostringstream _desc_buffer; string error_context() { string context = _ctxt_buffer.str(); + _ctxt_buffer.clear(); _ctxt_buffer.str(""); return context; } @@ -54,9 +55,9 @@ string file_context(const path& file, const std::size_t line) return buf.str(); } -string line_context(const string& line, - const string::size_type pos, - const string::size_type end_pos) +string line_context(const string& line, + const string::size_type pos, + const string::size_type end_pos) { std::ostringstream buf; buf << " " << line << "\n"; @@ -65,24 +66,24 @@ string line_context(const string& line, buf << " "; if (end_pos == 0) { for (string::size_type i = 0; i < pos; i += 1) - buf << " "; + buf << " "; buf << "^"; } else { for (string::size_type i = 0; i < end_pos; i += 1) { - if (i >= pos) - buf << "^"; - else - buf << " "; + if (i >= pos) + buf << "^"; + else + buf << " "; } } } return buf.str(); } -string source_context(const path& file, - const istream_pos_type pos, - const istream_pos_type end_pos, - const string& prefix) +string source_context(const path& file, + const istream_pos_type pos, + const istream_pos_type end_pos, + const string& prefix) { const std::streamoff len = end_pos - pos; if (! len || file == path("/dev/stdin")) |