[Coverity] Not restoring ostream format (STREAM_FORMAT_STATE)

This commit is contained in:
Peter D. Barnes, Jr.
2013-05-28 17:39:46 -07:00
parent ab03dfed2a
commit dac21f5413
3 changed files with 6 additions and 4 deletions

View File

@@ -547,7 +547,7 @@ TestRunnerImpl::PrintReport (TestCase *test, std::ostream *os, bool xml, int lev
double user = test->m_result->clock.GetElapsedUser () / MS_PER_SEC;
double system = test->m_result->clock.GetElapsedSystem () / MS_PER_SEC;
(*os).precision (3);
std::streamsize oldPrecision = (*os).precision (3);
*os << std::fixed;
std::string statusString = test->IsFailed ()?"FAIL":"PASS";
@@ -604,7 +604,8 @@ TestRunnerImpl::PrintReport (TestCase *test, std::ostream *os, bool xml, int lev
}
}
os->unsetf(std::ios_base::floatfield);
(*os).unsetf(std::ios_base::floatfield);
(*os).precision (oldPrecision);
}
void

View File

@@ -194,6 +194,8 @@ SpectrumIdealPhyTestCase::DoRun (void)
Simulator::Run ();
double throughputBps = (g_rxBytes * 8.0) / testDuration;
std::clog.unsetf(std::ios_base::floatfield);
if (m_rateIsAchievable)
{
NS_TEST_ASSERT_MSG_EQ_TOL (throughputBps, m_phyRate, m_phyRate*0.01, "throughput does not match PHY rate");
@@ -203,7 +205,6 @@ SpectrumIdealPhyTestCase::DoRun (void)
NS_TEST_ASSERT_MSG_EQ (throughputBps, 0.0, "PHY rate is not achievable but throughput is non-zero");
}
std::clog.unsetf(std::ios_base::floatfield);
Simulator::Destroy ();
}

View File

@@ -314,7 +314,7 @@ void
CtrlBAckResponseHeader::Print (std::ostream &os) const
{
NS_LOG_FUNCTION (this << &os);
os << "TID_INFO=" << m_tidInfo << ", StartingSeq=" << std::hex << m_startingSeq;
os << "TID_INFO=" << m_tidInfo << ", StartingSeq=" << std::hex << m_startingSeq << std::dec;
}
uint32_t