summaryrefslogtreecommitdiff
path: root/validate.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-03-18 09:48:54 -0400
committerJeffrey Walton <noloader@gmail.com>2017-03-18 09:48:54 -0400
commit71afcadadbae515484fa0e021291ae67a1684dfc (patch)
treeb9f2f3c467e55e183c90a4a38efd4163a5e083aa /validate.h
parent6c6391bfdade1949c1c1aaaff8a9c629169b6b3e (diff)
downloadcryptopp-git-71afcadadbae515484fa0e021291ae67a1684dfc.tar.gz
Clear Coverity STREAM_FORMAT_STATE (CID 177736, 177737, 177732)
Yet another attempt to clear the stream state finding.
Diffstat (limited to 'validate.h')
-rw-r--r--validate.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/validate.h b/validate.h
index c8aa436f..ad690c28 100644
--- a/validate.h
+++ b/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)