mirror of
https://github.com/ceph/ceph
synced 2024-12-29 15:03:33 +00:00
common: restore constructor fmtflags on clear
This is to prevent fmtflags changes from a previous use (e.g. debug message) leaking into the the next (i.e. the next debug message). Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
parent
cb1e7e5fd0
commit
d0355acb36
@ -92,7 +92,7 @@ template<std::size_t SIZE>
|
||||
class StackStringStream : public std::basic_ostream<char>
|
||||
{
|
||||
public:
|
||||
StackStringStream() : basic_ostream<char>(&ssb) {}
|
||||
StackStringStream() : basic_ostream<char>(&ssb), default_fmtflags(flags()) {}
|
||||
StackStringStream(const StackStringStream& o) = delete;
|
||||
StackStringStream& operator=(const StackStringStream& o) = delete;
|
||||
StackStringStream(StackStringStream&& o) = delete;
|
||||
@ -101,6 +101,7 @@ public:
|
||||
|
||||
void reset() {
|
||||
clear(); /* reset state flags */
|
||||
flags(default_fmtflags); /* reset fmtflags to constructor defaults */
|
||||
ssb.clear();
|
||||
}
|
||||
|
||||
@ -110,6 +111,7 @@ public:
|
||||
|
||||
private:
|
||||
StackStringBuf<SIZE> ssb;
|
||||
fmtflags const default_fmtflags;
|
||||
};
|
||||
|
||||
/* In an ideal world, we could use StackStringStream indiscriminately, but alas
|
||||
|
Loading…
Reference in New Issue
Block a user