diff options
Diffstat (limited to 'src/accum.cc')
-rw-r--r-- | src/accum.cc | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/accum.cc b/src/accum.cc index 62e36deb..157f459d 100644 --- a/src/accum.cc +++ b/src/accum.cc @@ -40,8 +40,6 @@ std::streamsize straccbuf::xsputn(const char * s, std::streamsize num) if (index == 0) { // The first item received is the format string str = std::string(s, num); - index++; - return num; } else { std::ostringstream buf; @@ -51,26 +49,26 @@ std::streamsize straccbuf::xsputn(const char * s, std::streamsize num) bool matched = false; for (const char * p = str.c_str(); *p; p++) { if (*p == '%') { - const char * q = p + 1; - if (*q && *q != '%' && std::isdigit(*q) && - std::string::size_type(*q - '0') == index) { - p++; - buf << std::string(s, num); - matched = true; - } else { - buf << *p; - } + const char * q = p + 1; + if (*q && *q != '%' && std::isdigit(*q) && + std::string::size_type(*q - '0') == index) { + p++; + buf << std::string(s, num); + matched = true; + } else { + buf << *p; + } } else { - buf << *p; + buf << *p; } } if (! matched) buf << std::string(s, num); str = buf.str(); - index++; - return num; } + index++; + return num; } } // namespace ledger |