From: <sv...@ww...> - 2004-12-06 08:58:17
|
Author: mkrose Date: 2004-12-06 00:58:10 -0800 (Mon, 06 Dec 2004) New Revision: 1353 Modified: trunk/CSP/SimData/CHANGES.current trunk/CSP/SimData/Include/SimData/InterfaceRegistry.h trunk/CSP/SimData/Include/SimData/Trace.h trunk/CSP/SimData/SimData/Tests/test_CircularBuffer.cpp trunk/CSP/SimData/Source/Date.cpp Log: Fix a couple minor warnings under msvc. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1353 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2004-12-05 00:50:46 UTC (rev 1352) +++ trunk/CSP/SimData/CHANGES.current 2004-12-06 08:58:10 UTC (rev 1353) @@ -1,12 +1,15 @@ Version 0.4.0 (in progress) =========================== +2004-12-05: onsight + * Fix a couple minor warnings under msvc. + 2004-12-03: delta - * Updated SimData project files adding a simple project to build + * Updated SimData project files adding a simple project to build Config.cpp. Added a dependency from SimData onto Config and a custom pre-build step. - - * Changed _WIN32 to more vc++ specific protection for + + * Changed _WIN32 to more vc++ specific protection for SIMDATA_STATIC_CONST_DEF(x). 2004-12-02: onsight Modified: trunk/CSP/SimData/Include/SimData/InterfaceRegistry.h =================================================================== --- trunk/CSP/SimData/Include/SimData/InterfaceRegistry.h 2004-12-05 00:50:46 UTC (rev 1352) +++ trunk/CSP/SimData/Include/SimData/InterfaceRegistry.h 2004-12-06 08:58:10 UTC (rev 1353) @@ -615,8 +615,8 @@ } #define __SIMDATA_XML_BASE_SERIALIZE \ - inline void _base_serialize(SIMDATA(Writer) &writer) const { } \ - inline void _base_serialize(SIMDATA(Reader) &reader) { } \ + inline void _base_serialize(SIMDATA(Writer) &) const { } \ + inline void _base_serialize(SIMDATA(Reader) &) { } \ #define __SIMDATA_XML_BASE_SERIALIZE_EXTEND(basename) \ inline void _base_serialize(SIMDATA(Writer) &writer) const { basename::_serialize(writer); } \ Modified: trunk/CSP/SimData/Include/SimData/Trace.h =================================================================== --- trunk/CSP/SimData/Include/SimData/Trace.h 2004-12-05 00:50:46 UTC (rev 1352) +++ trunk/CSP/SimData/Include/SimData/Trace.h 2004-12-06 08:58:10 UTC (rev 1353) @@ -82,7 +82,7 @@ void error(int skip, bool segv=false); - virtual void _backtrace(std::ostream&, int skip) {} + virtual void _backtrace(std::ostream&, int /*skip*/) {} }; Modified: trunk/CSP/SimData/SimData/Tests/test_CircularBuffer.cpp =================================================================== --- trunk/CSP/SimData/SimData/Tests/test_CircularBuffer.cpp 2004-12-05 00:50:46 UTC (rev 1352) +++ trunk/CSP/SimData/SimData/Tests/test_CircularBuffer.cpp 2004-12-06 08:58:10 UTC (rev 1353) @@ -34,7 +34,7 @@ #include <deque> #define TEST_LOOP_COUNT 1000000 -#define DBG false +#define DBG(x) using namespace simdata; @@ -45,9 +45,9 @@ assert(b.getAllocatedSpace() == 0); assert(b.getMaximumAllocation() > 430); for (int i = 0; i < TEST_LOOP_COUNT; ++i) { - if (DBG) std::cerr << "iteration: " << i << "\n"; + DBG(std::cerr << "iteration: " << i << "\n";) uint8 *x = b.getWriteBuffer(1); - *x = i & 255; + *x = static_cast<uint8>(i & 255); b.commitWriteBuffer(); uint32 size; x = b.getReadBuffer(size); @@ -65,12 +65,12 @@ std::deque<uint8*> q_ptr; std::deque<uint32> q_size; for (int i = 0; i < TEST_LOOP_COUNT; ++i) { - if (DBG) std::cerr << "iteration: " << i << "\n"; + DBG(std::cerr << "iteration: " << i << "\n";) if (rand() & 1) { uint32 size; uint8 *x = b.getReadBuffer(size); if (x != 0) { - if (DBG) std::cerr << "read " << (void*)x << " " << size << "\n"; + DBG(std::cerr << "read " << (void*)x << " " << size << "\n";) assert(x == q_ptr.front()); q_ptr.pop_front(); assert(size == q_size.front()); @@ -78,24 +78,23 @@ b.releaseReadBuffer(); } else { assert(q_ptr.empty()); - if (DBG) std::cerr << "read --- empty!\n"; + DBG(std::cerr << "read --- empty!\n";) } } else { uint32 size = (rand() & 255); uint8 *x = b.getWriteBuffer(size); if (x != 0) { - if (DBG) std::cerr << "write " << (void*)x << " " << size << "\n"; + DBG(std::cerr << "write " << (void*)x << " " << size << "\n";) q_ptr.push_back(x); q_size.push_back(size); b.commitWriteBuffer(); } else { - if (DBG) std::cerr << "write --- full! " << q_ptr.size() << "\n"; + DBG(std::cerr << "write --- full! " << q_ptr.size() << "\n";) } } } } - void test() { testRandomUse(); testOneByte(); Modified: trunk/CSP/SimData/Source/Date.cpp =================================================================== --- trunk/CSP/SimData/Source/Date.cpp 2004-12-05 00:50:46 UTC (rev 1352) +++ trunk/CSP/SimData/Source/Date.cpp 2004-12-06 08:58:10 UTC (rev 1353) @@ -97,7 +97,7 @@ year_t years = static_cast<year_t>(nmonths / 12); month_t months = static_cast<month_t>(nmonths % 12); m_month = months + 1; - m_year += years; + m_year += static_cast<year_t>(years); int index = isLeap() ? 1 : 0; if (m_day > days_in_months[index][m_month]) { m_day = days_in_months[index][m_month]; @@ -108,7 +108,7 @@ void Date::subtractMonths(int nmonths) { year_t years = static_cast<year_t>(nmonths / 12); month_t months = static_cast<month_t>(nmonths % 12); - m_year -= years; + m_year -= static_cast<year_t>(years); if (m_month > months) { m_month -= months; } else { @@ -331,11 +331,10 @@ double DateZulu::getMST(radian_t longitude) const { double JD = getJulianDate(); double T = (JD - EPOCH) * SIMDATA_F1p0_36525p0; - double F = DAYSEC * (JD - (int) JD); - double GMST = COEFF0 - DAYSEC/2.0L - + ((COEFF1 + (COEFF2 + COEFF3 * T) * T) * T) + F; + double F = static_cast<double>(DAYSEC * (JD - static_cast<int>(JD))); + double GMST = static_cast<double>(COEFF0 - DAYSEC/2.0L + ((COEFF1 + (COEFF2 + COEFF3 * T) * T) * T) + F); GMST = GMST * SEC2RAD; - int n = (int) (GMST * (0.5/PI)); + int n = static_cast<int>(GMST * (0.5/PI)); if (n < 0) n--; return GMST - n*(2.0*PI) + longitude; } @@ -350,9 +349,10 @@ } double SimDate::update() { + calibrateRealTime(); SimTime dt = 0.0; if (!paused) { - SimTime t = get_realtime(); + SimTime t = getCalibratedRealTime(); dt = t - last_update; last_update = t; setTime(t - reference); |