summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-21 21:57:55 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-21 21:57:55 -0400
commitc6d2420d097cecc0d327c97980b916f5b455a0fd (patch)
tree945719d71ece2cbb56f0c1592d29bcdd47bd5b02 /src
parent4b159527a51a2e2006da2e29bc936e05b970ecdd (diff)
downloadfork-ledger-c6d2420d097cecc0d327c97980b916f5b455a0fd.tar.gz
fork-ledger-c6d2420d097cecc0d327c97980b916f5b455a0fd.tar.bz2
fork-ledger-c6d2420d097cecc0d327c97980b916f5b455a0fd.zip
Fixed an accumulator bug that was mangling errors
Diffstat (limited to 'src')
-rw-r--r--src/accum.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/accum.cc b/src/accum.cc
index ac98c8cf..d1de4965 100644
--- a/src/accum.cc
+++ b/src/accum.cc
@@ -46,6 +46,7 @@ std::streamsize straccbuf::xsputn(const char * s, std::streamsize num)
// Every item thereafter is an argument that substitutes for %# in the
// format string
+ bool matched = false;
for (const char * p = str.c_str(); *p; p++) {
if (*p == '%') {
const char * q = p + 1;
@@ -53,6 +54,7 @@ std::streamsize straccbuf::xsputn(const char * s, std::streamsize num)
std::size_t(*q - '0') == index) {
p++;
buf << std::string(s, num);
+ matched = true;
} else {
buf << *p;
}
@@ -60,9 +62,11 @@ std::streamsize straccbuf::xsputn(const char * s, std::streamsize num)
buf << *p;
}
}
+ if (! matched)
+ buf << std::string(s, num);
+
str = buf.str();
index++;
-
return num;
}
}