From: Colin Patrick McCabe Date: Thu, 4 Aug 2011 21:07:53 +0000 (-0700) Subject: Formatter: must use str("") to clear ostreams X-Git-Tag: v0.33~23^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=434be6c0f6175bcd82df0798c7ff2fa8f25830c8;p=ceph.git Formatter: must use str("") to clear ostreams Signed-off-by: Colin McCabe --- diff --git a/src/common/Formatter.cc b/src/common/Formatter.cc index f7d50dca4e42..cf64537aa3cb 100644 --- a/src/common/Formatter.cc +++ b/src/common/Formatter.cc @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -49,13 +50,16 @@ void JSONFormatter::flush(std::ostream& os) assert(m_stack.empty()); os << m_ss.str(); m_ss.clear(); + m_ss.str(""); } void JSONFormatter::reset() { m_stack.clear(); m_ss.clear(); + m_ss.str(""); m_pending_string.clear(); + m_pending_string.str(""); } void JSONFormatter::print_comma(json_formatter_stack_entry_d& entry) @@ -220,12 +224,15 @@ void XMLFormatter::flush(std::ostream& os) assert(m_sections.empty()); os << m_ss.str(); m_ss.clear(); + m_ss.str(""); } void XMLFormatter::reset() { m_ss.clear(); + m_ss.str(""); m_pending_string.clear(); + m_pending_string.str(""); m_sections.clear(); m_pending_string_name.clear(); }