mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
hexEscapeChar: restore stream
The ostream passed as reference to `hexEscapeChar` is manipulated and its original state not restored. This fixes it. Seen via coverity in a downstream project.
This commit is contained in:
parent
bbf70ca74b
commit
188b3e6511
@ -44,9 +44,11 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void hexEscapeChar(std::ostream& os, unsigned char c) {
|
void hexEscapeChar(std::ostream& os, unsigned char c) {
|
||||||
|
std::ios_base::fmtflags f(os.flags());
|
||||||
os << "\\x"
|
os << "\\x"
|
||||||
<< std::uppercase << std::hex << std::setfill('0') << std::setw(2)
|
<< std::uppercase << std::hex << std::setfill('0') << std::setw(2)
|
||||||
<< static_cast<int>(c);
|
<< static_cast<int>(c);
|
||||||
|
os.flags(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user