Clear Coverity STREAM_FORMAT_STATE (CID 177736, 177737, 177732)
Yet another attempt to clear the stream state finding.pull/398/head
parent
6c6391bfda
commit
71afcadadb
21
validate.h
21
validate.h
|
|
@ -121,6 +121,7 @@ bool TestHuffmanCodes();
|
|||
bool TestASN1Parse();
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// Coverity findings in benchmark and validation routines
|
||||
class StreamState
|
||||
{
|
||||
|
|
@ -145,6 +146,26 @@ private:
|
|||
std::ios_base::fmtflags m_fmt;
|
||||
std::ostream::char_type m_fill;
|
||||
};
|
||||
#endif
|
||||
|
||||
class StreamState
|
||||
{
|
||||
public:
|
||||
StreamState(std::ostream& out)
|
||||
: m_out(out), m_state(NULLPTR)
|
||||
{
|
||||
m_state.copyfmt(m_out);
|
||||
}
|
||||
|
||||
~StreamState()
|
||||
{
|
||||
m_out.copyfmt(m_state);
|
||||
}
|
||||
|
||||
private:
|
||||
std::ostream& m_out;
|
||||
std::ios m_state;
|
||||
};
|
||||
|
||||
// Safer functions on Windows for C&A, https://github.com/weidai11/cryptopp/issues/55
|
||||
static std::string TimeToString(const time_t& t)
|
||||
|
|
|
|||
Loading…
Reference in New Issue