misc: Restore ostream flags where needed
This patch ensures we adhere to the normal ostream usage rules, and restore the flags after modifying them.
This commit is contained in:
parent
addfd89dce
commit
32c111eda4
|
@ -88,6 +88,8 @@ _format_integer(std::ostream &out, const T &data, Format &fmt)
|
|||
{
|
||||
using namespace std;
|
||||
|
||||
ios::fmtflags flags(out.flags());
|
||||
|
||||
switch (fmt.base) {
|
||||
case Format::hex:
|
||||
out.setf(std::ios::hex, std::ios::basefield);
|
||||
|
@ -137,6 +139,8 @@ _format_integer(std::ostream &out, const T &data, Format &fmt)
|
|||
out.setf(std::ios::uppercase);
|
||||
|
||||
out << data;
|
||||
|
||||
out.flags(flags);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -145,6 +149,8 @@ _format_float(std::ostream &out, const T &data, Format &fmt)
|
|||
{
|
||||
using namespace std;
|
||||
|
||||
ios::fmtflags flags(out.flags());
|
||||
|
||||
switch (fmt.float_format) {
|
||||
case Format::scientific:
|
||||
if (fmt.precision != -1) {
|
||||
|
@ -189,6 +195,8 @@ _format_float(std::ostream &out, const T &data, Format &fmt)
|
|||
}
|
||||
|
||||
out << data;
|
||||
|
||||
out.flags(flags);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -418,12 +418,16 @@ System::workItemEnd(uint32_t tid, uint32_t workid)
|
|||
void
|
||||
System::printSystems()
|
||||
{
|
||||
ios::fmtflags flags(cerr.flags());
|
||||
|
||||
vector<System *>::iterator i = systemList.begin();
|
||||
vector<System *>::iterator end = systemList.end();
|
||||
for (; i != end; ++i) {
|
||||
System *sys = *i;
|
||||
cerr << "System " << sys->name() << ": " << hex << sys << endl;
|
||||
}
|
||||
|
||||
cerr.flags(flags);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue