From 90986824a40a533fcbf9da7d82d5188146d6e2e7 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 21 Dec 2012 09:18:09 -0800 Subject: [PATCH] Fix tests. --- format.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/format.cc b/format.cc index ee4c9aea..55b2504d 100644 --- a/format.cc +++ b/format.cc @@ -123,7 +123,7 @@ void Formatter::FormatInt(T value, FormatSpec spec) { sign = '+'; ++size; } - size_t offset = buffer_.size(); + size_t start = buffer_.size(); char *p = 0; switch (spec.type) { case 0: case 'd': { @@ -179,13 +179,11 @@ void Formatter::FormatInt(T value, FormatSpec spec) { } if (sign) { if ((spec.flags & ZERO_FLAG) != 0) - buffer_[offset++] = sign; + buffer_[start++] = sign; else *p-- = sign; } - char *start = &buffer_[offset]; - if (start != p) - std::fill(start, p + 1, spec.fill); + std::fill(&buffer_[start], p + 1, spec.fill); } template