diff options
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llpreprocessor.h | 5 | ||||
-rw-r--r-- | indra/llcommon/llqueuedthread.cpp | 2 | ||||
-rw-r--r-- | indra/llcommon/llrand.cpp | 2 | ||||
-rw-r--r-- | indra/llcommon/llsdparam.cpp | 2 | ||||
-rw-r--r-- | indra/llcommon/llsdserialize.cpp | 6 | ||||
-rw-r--r-- | indra/llcommon/llsdserialize_xml.cpp | 2 | ||||
-rw-r--r-- | indra/llcommon/llsingleton.h | 7 | ||||
-rw-r--r-- | indra/llcommon/llstring.cpp | 2 | ||||
-rw-r--r-- | indra/llcommon/lltimer.cpp | 2 | ||||
-rw-r--r-- | indra/llcommon/lltraceaccumulators.cpp | 18 | ||||
-rw-r--r-- | indra/llcommon/lltraceaccumulators.h | 26 | ||||
-rw-r--r-- | indra/llcommon/lltracerecording.cpp | 14 | ||||
-rw-r--r-- | indra/llcommon/lltracerecording.h | 9 | ||||
-rw-r--r-- | indra/llcommon/llunittype.h | 9 | ||||
-rw-r--r-- | indra/llcommon/tests/lleventfilter_test.cpp | 14 | ||||
-rw-r--r-- | indra/llcommon/tests/llsdserialize_test.cpp | 2 | ||||
-rw-r--r-- | indra/llcommon/tests/lltrace_test.cpp | 4 | ||||
-rw-r--r-- | indra/llcommon/tests/llunits_test.cpp | 2 |
18 files changed, 75 insertions, 53 deletions
diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index 0248e8f8b9..a528cc7fd8 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -74,9 +74,6 @@ #ifndef LL_MSVC #define LL_MSVC 1 #endif - #if _MSC_VER < 1400 - #define LL_MSVC7 //Visual C++ 2003 or earlier - #endif #endif // Deal with minor differences on Unixy OSes. @@ -130,8 +127,6 @@ #endif // level 4 warnings that we need to disable: -#pragma warning (disable : 4244) // possible loss of data on conversions -#pragma warning (disable : 4396) // the inline specifier cannot be used when a friend declaration refers to a specialization of a function template #pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class #pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class #endif // LL_MSVC diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index 7d77f6f6a9..1c4ac5a7bf 100644 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -483,7 +483,7 @@ void LLQueuedThread::processRequest(LLQueuedThread::QueuedRequest* req) if (sleep_time.count() > 0) { - ms_sleep(sleep_time.count()); + ms_sleep((U32)sleep_time.count()); } } processRequest(req); diff --git a/indra/llcommon/llrand.cpp b/indra/llcommon/llrand.cpp index 25d75af568..2c51e6f07f 100644 --- a/indra/llcommon/llrand.cpp +++ b/indra/llcommon/llrand.cpp @@ -85,7 +85,7 @@ inline F32 ll_internal_random<F32>() // Per Monty, it's important to clamp using the correct fmodf() rather // than expanding to F64 for fmod() and then truncating back to F32. Prior // to this change, we were getting sporadic ll_frand() == 1.0 results. - F32 rv{ narrow<F32>(gRandomGenerator()) }; + F32 rv{ narrow<F64>(gRandomGenerator()) }; if(!((rv >= 0.0f) && (rv < 1.0f))) return fmodf(rv, 1.0f); return rv; } diff --git a/indra/llcommon/llsdparam.cpp b/indra/llcommon/llsdparam.cpp index b981be4d0a..3ae153a67c 100644 --- a/indra/llcommon/llsdparam.cpp +++ b/indra/llcommon/llsdparam.cpp @@ -149,7 +149,7 @@ bool LLParamSDParser::readF32(Parser& parser, void* val_ptr) { LLParamSDParser& self = static_cast<LLParamSDParser&>(parser); - *((F32*)val_ptr) = self.mCurReadSD->asReal(); + *((F32*)val_ptr) = (F32)self.mCurReadSD->asReal(); return true; } diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 15002580c9..5e267c6805 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -231,7 +231,7 @@ bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, llssize max_bytes) } // Since we've already read 'inbuf' bytes into 'hdr_buf', prepend that // data to whatever remains in 'str'. - LLMemoryStreamBuf already(reinterpret_cast<const U8*>(hdr_buf), inbuf); + LLMemoryStreamBuf already(reinterpret_cast<const U8*>(hdr_buf), (S32)inbuf); cat_streambuf prebuff(&already, str.rdbuf()); std::istream prepend(&prebuff); #if 1 @@ -566,7 +566,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c data, NOTATION_FALSE_SERIAL, false); - if(PARSE_FAILURE == cnt) parse_count = cnt; + if(PARSE_FAILURE == cnt) parse_count = (S32)cnt; else account(cnt); } else @@ -592,7 +592,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c if(isalpha(c)) { auto cnt = deserialize_boolean(istr,data,NOTATION_TRUE_SERIAL,true); - if(PARSE_FAILURE == cnt) parse_count = cnt; + if(PARSE_FAILURE == cnt) parse_count = (S32)cnt; else account(cnt); } else diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index 88cbb3b984..dd00c39180 100644 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp @@ -554,7 +554,7 @@ void LLSDXMLParser::Impl::parsePart(const char* buf, llssize len) if ( buf != NULL && len > 0 ) { - XML_Status status = XML_Parse(mParser, buf, len, false); + XML_Status status = XML_Parse(mParser, buf, (int)len, 0); if (status == XML_STATUS_ERROR) { LL_INFOS() << "Unexpected XML parsing error at start" << LL_ENDL; diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 7c6be25309..316831cd74 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -37,7 +37,8 @@ #include "llmainthreadtask.h" #ifdef LL_WINDOWS -#pragma warning( disable : 4506 ) // no definition for inline function +#pragma warning(push) +#pragma warning(disable : 4506) // no definition for inline function #endif class LLSingletonBase: private boost::noncopyable @@ -861,4 +862,8 @@ private: template <class T> T* LLSimpleton<T>::sInstance{ nullptr }; +#ifdef LL_WINDOWS +#pragma warning(pop) +#endif + #endif diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 6f3d193d6b..c57f8b1e96 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -250,7 +250,7 @@ LLWString utf16str_to_wstring(const U16* utf16str, size_t len) while (i < len) { llwchar cur_char; - i += utf16chars_to_wchar(chars16+i, &cur_char); + i += (S32)utf16chars_to_wchar(chars16+i, &cur_char); wout += cur_char; } return wout; diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index a3e871661c..e5c0970d35 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -101,7 +101,7 @@ U32 micro_sleep(U64 us, U32 max_yields) WaitForSingleObject(timer, INFINITE); CloseHandle(timer); #else - Sleep(us / 1000); + Sleep((DWORD)(us / 1000)); #endif return 0; diff --git a/indra/llcommon/lltraceaccumulators.cpp b/indra/llcommon/lltraceaccumulators.cpp index 8741087f3a..dc9a87eb80 100644 --- a/indra/llcommon/lltraceaccumulators.cpp +++ b/indra/llcommon/lltraceaccumulators.cpp @@ -100,7 +100,7 @@ bool AccumulatorBufferGroup::isCurrent() const return mCounts.isCurrent(); } -void AccumulatorBufferGroup::append( const AccumulatorBufferGroup& other ) +void AccumulatorBufferGroup::append(const AccumulatorBufferGroup& other) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; mCounts.addSamples(other.mCounts, SEQUENTIAL); @@ -109,7 +109,7 @@ void AccumulatorBufferGroup::append( const AccumulatorBufferGroup& other ) mStackTimers.addSamples(other.mStackTimers, SEQUENTIAL); } -void AccumulatorBufferGroup::merge( const AccumulatorBufferGroup& other) +void AccumulatorBufferGroup::merge(const AccumulatorBufferGroup& other) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; mCounts.addSamples(other.mCounts, NON_SEQUENTIAL); @@ -140,7 +140,7 @@ void AccumulatorBufferGroup::sync() F64 SampleAccumulator::mergeSumsOfSquares(const SampleAccumulator& a, const SampleAccumulator& b) { - const F64 epsilon = 0.0000001; + constexpr F64 epsilon = 0.0000001; if (a.getSamplingTime() > epsilon && b.getSamplingTime() > epsilon) { @@ -170,7 +170,7 @@ F64 SampleAccumulator::mergeSumsOfSquares(const SampleAccumulator& a, const Samp return a.getSumOfSquares(); } -void SampleAccumulator::addSamples( const SampleAccumulator& other, EBufferAppendType append_type ) +void SampleAccumulator::addSamples(const SampleAccumulator& other, EBufferAppendType append_type) { if (append_type == NON_SEQUENTIAL) { @@ -205,7 +205,7 @@ void SampleAccumulator::addSamples( const SampleAccumulator& other, EBufferAppen } } -void SampleAccumulator::reset( const SampleAccumulator* other ) +void SampleAccumulator::reset(const SampleAccumulator* other) { mLastValue = other ? other->mLastValue : NaN; mHasValue = other ? other->mHasValue : false; @@ -243,7 +243,7 @@ F64 EventAccumulator::mergeSumsOfSquares(const EventAccumulator& a, const EventA return a.mSumOfSquares; } -void EventAccumulator::addSamples( const EventAccumulator& other, EBufferAppendType append_type ) +void EventAccumulator::addSamples(const EventAccumulator& other, EBufferAppendType append_type) { if (other.mNumSamples) { @@ -269,12 +269,12 @@ void EventAccumulator::addSamples( const EventAccumulator& other, EBufferAppendT } } -void EventAccumulator::reset( const EventAccumulator* other ) +void EventAccumulator::reset(const EventAccumulator* other) { mNumSamples = 0; mSum = 0; - mMin = F32(NaN); - mMax = F32(NaN); + mMin = NaN; + mMax = NaN; mMean = NaN; mSumOfSquares = 0; mLastValue = other ? other->mLastValue : NaN; diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index ba7acf9547..0a2e2bf997 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -39,7 +39,7 @@ namespace LLTrace { - const F64 NaN = std::numeric_limits<double>::quiet_NaN(); + constexpr F64 NaN = std::numeric_limits<double>::quiet_NaN(); enum EBufferAppendType { @@ -251,8 +251,8 @@ namespace LLTrace EventAccumulator() : mSum(0), - mMin(F32(NaN)), - mMax(F32(NaN)), + mMin(NaN), + mMax(NaN), mMean(NaN), mSumOfSquares(0), mNumSamples(0), @@ -288,11 +288,11 @@ namespace LLTrace void sync(F64SecondsImplicit) {} F64 getSum() const { return mSum; } - F32 getMin() const { return mMin; } - F32 getMax() const { return mMax; } + F64 getMin() const { return mMin; } + F64 getMax() const { return mMax; } F64 getLastValue() const { return mLastValue; } F64 getMean() const { return mMean; } - F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mNumSamples); } + F64 getStandardDeviation() const { return sqrt(mSumOfSquares / mNumSamples); } F64 getSumOfSquares() const { return mSumOfSquares; } S32 getSampleCount() const { return mNumSamples; } bool hasValue() const { return mNumSamples > 0; } @@ -307,7 +307,7 @@ namespace LLTrace F64 mMean, mSumOfSquares; - F32 mMin, + F64 mMin, mMax; S32 mNumSamples; @@ -322,8 +322,8 @@ namespace LLTrace SampleAccumulator() : mSum(0), - mMin(F32(NaN)), - mMax(F32(NaN)), + mMin(NaN), + mMax(NaN), mMean(NaN), mSumOfSquares(0), mLastSampleTimeStamp(0), @@ -378,11 +378,11 @@ namespace LLTrace } F64 getSum() const { return mSum; } - F32 getMin() const { return mMin; } - F32 getMax() const { return mMax; } + F64 getMin() const { return mMin; } + F64 getMax() const { return mMax; } F64 getLastValue() const { return mLastValue; } F64 getMean() const { return mMean; } - F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mTotalSamplingTime); } + F64 getStandardDeviation() const { return sqrt(mSumOfSquares / mTotalSamplingTime); } F64 getSumOfSquares() const { return mSumOfSquares; } F64SecondsImplicit getSamplingTime() const { return mTotalSamplingTime; } S32 getSampleCount() const { return mNumSamples; } @@ -402,7 +402,7 @@ namespace LLTrace mLastSampleTimeStamp, mTotalSamplingTime; - F32 mMin, + F64 mMin, mMax; S32 mNumSamples; diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index 1ec83be7cb..c23adca7e8 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -229,7 +229,7 @@ F32 Recording::getPerSec(const StatType<TimeBlockAccumulator::CallCountFacet>& s update(); const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; - return (F32)(accumulator.mCalls + (active_accumulator ? active_accumulator->mCalls : 0)) / mElapsedSeconds.value(); + return (F32)(accumulator.mCalls + (active_accumulator ? active_accumulator->mCalls : 0)) / (F32)mElapsedSeconds.value(); } bool Recording::hasValue(const StatType<CountAccumulator>& stat) @@ -296,11 +296,11 @@ F64 Recording::getMean( const StatType<SampleAccumulator>& stat ) const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : NULL; if (active_accumulator && active_accumulator->hasValue()) { - F32 t = 0.0f; + F64 t = 0.0; S32 div = accumulator.getSampleCount() + active_accumulator->getSampleCount(); if (div > 0) { - t = active_accumulator->getSampleCount() / div; + t = (F64)active_accumulator->getSampleCount() / (F64)div; } return lerp(accumulator.getMean(), active_accumulator->getMean(), t); } @@ -319,7 +319,7 @@ F64 Recording::getStandardDeviation( const StatType<SampleAccumulator>& stat ) if (active_accumulator && active_accumulator->hasValue()) { F64 sum_of_squares = SampleAccumulator::mergeSumsOfSquares(accumulator, *active_accumulator); - return sqrtf(sum_of_squares / (accumulator.getSamplingTime() + active_accumulator->getSamplingTime())); + return sqrt(sum_of_squares / (F64)(accumulator.getSamplingTime() + active_accumulator->getSamplingTime())); } else { @@ -382,11 +382,11 @@ F64 Recording::getMean( const StatType<EventAccumulator>& stat ) const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; if (active_accumulator && active_accumulator->hasValue()) { - F32 t = 0.0f; + F64 t = 0.0; S32 div = accumulator.getSampleCount() + active_accumulator->getSampleCount(); if (div > 0) { - t = active_accumulator->getSampleCount() / div; + t = (F64)active_accumulator->getSampleCount() / (F64)div; } return lerp(accumulator.getMean(), active_accumulator->getMean(), t); } @@ -405,7 +405,7 @@ F64 Recording::getStandardDeviation( const StatType<EventAccumulator>& stat ) if (active_accumulator && active_accumulator->hasValue()) { F64 sum_of_squares = EventAccumulator::mergeSumsOfSquares(accumulator, *active_accumulator); - return sqrtf(sum_of_squares / (accumulator.getSampleCount() + active_accumulator->getSampleCount())); + return sqrt(sum_of_squares / (F64)(accumulator.getSampleCount() + active_accumulator->getSampleCount())); } else { diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 985f06cd59..ad4c91d85b 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -35,6 +35,11 @@ #include "llpointer.h" #include <limits> +#ifdef LL_WINDOWS +#pragma warning(push) +#pragma warning(disable : 4244) // possible loss of data on conversions +#endif + class LLStopWatchControlsMixinCommon { public: @@ -714,4 +719,8 @@ namespace LLTrace }; } +#ifdef LL_WINDOWS +#pragma warning(pop) +#endif + #endif // LL_LLTRACERECORDING_H diff --git a/indra/llcommon/llunittype.h b/indra/llcommon/llunittype.h index 83ce0d05a8..bb1408609a 100644 --- a/indra/llcommon/llunittype.h +++ b/indra/llcommon/llunittype.h @@ -31,6 +31,11 @@ #include "llpreprocessor.h" #include "llerror.h" +#ifdef LL_WINDOWS +#pragma warning(push) +#pragma warning(disable : 4244) // possible loss of data on conversions +#endif + //lightweight replacement of type traits for simple type equality check template<typename S, typename T> struct LLIsSameType @@ -846,4 +851,8 @@ LL_FORCE_INLINE S2 ll_convert_units(LLUnit<S1, base_unit_name> in, LLUnit<S2, un typedef LLUnit<U64, ns::unit_name> U64##unit_name; \ typedef LLUnitImplicit<U64, ns::unit_name> U64##unit_name##Implicit +#ifdef LL_WINDOWS +#pragma warning(pop) +#endif + #endif //LL_UNITTYPE_H diff --git a/indra/llcommon/tests/lleventfilter_test.cpp b/indra/llcommon/tests/lleventfilter_test.cpp index a01d7fe415..d7b80e2545 100644 --- a/indra/llcommon/tests/lleventfilter_test.cpp +++ b/indra/llcommon/tests/lleventfilter_test.cpp @@ -81,13 +81,13 @@ class TestEventThrottle: public LLEventThrottleBase public: TestEventThrottle(F32 interval): LLEventThrottleBase(interval), - mAlarmRemaining(-1), - mTimerRemaining(-1) + mAlarmRemaining(-1.f), + mTimerRemaining(-1.f) {} TestEventThrottle(LLEventPump& source, F32 interval): LLEventThrottleBase(source, interval), - mAlarmRemaining(-1), - mTimerRemaining(-1) + mAlarmRemaining(-1.f), + mTimerRemaining(-1.f) {} /*----- implementation of LLEventThrottleBase timing functionality -----*/ @@ -100,12 +100,12 @@ public: virtual bool alarmRunning() const /*override*/ { // decrementing to exactly 0 should mean the alarm fires - return mAlarmRemaining > 0; + return mAlarmRemaining > 0.f; } virtual void alarmCancel() /*override*/ { - mAlarmRemaining = -1; + mAlarmRemaining = -1.f; } virtual void timerSet(F32 interval) /*override*/ @@ -116,7 +116,7 @@ public: virtual F32 timerGetRemaining() const /*override*/ { // LLTimer.getRemainingTimeF32() never returns negative; 0.0 means expired - return (mTimerRemaining > 0.0)? mTimerRemaining : 0.0; + return (mTimerRemaining > 0.0f)? mTimerRemaining : 0.0f; } /*------------------- methods for manipulating time --------------------*/ diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index fb2af1d2db..fae9f7023f 100644 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -1809,7 +1809,7 @@ namespace tut std::string q("\""); std::string qPYTHON(q + PYTHON + q); std::string qscript(q + scriptfile.getName() + q); - int rc = _spawnl(_P_WAIT, PYTHON.c_str(), qPYTHON.c_str(), qscript.c_str(), + int rc = (int)_spawnl(_P_WAIT, PYTHON.c_str(), qPYTHON.c_str(), qscript.c_str(), std::forward<ARGS>(args)..., NULL); if (rc == -1) { diff --git a/indra/llcommon/tests/lltrace_test.cpp b/indra/llcommon/tests/lltrace_test.cpp index 8851f87b91..923a67ac8e 100644 --- a/indra/llcommon/tests/lltrace_test.cpp +++ b/indra/llcommon/tests/lltrace_test.cpp @@ -32,6 +32,10 @@ #include "lltracerecording.h" #include "../test/lltut.h" +#ifdef LL_WINDOWS +#pragma warning(disable : 4244) // possible loss of data on conversions +#endif + namespace LLUnits { // using powers of 2 to allow strict floating point equality diff --git a/indra/llcommon/tests/llunits_test.cpp b/indra/llcommon/tests/llunits_test.cpp index 49f2d3085a..98a58eb47e 100644 --- a/indra/llcommon/tests/llunits_test.cpp +++ b/indra/llcommon/tests/llunits_test.cpp @@ -262,7 +262,7 @@ namespace tut F32 float_val = quatloos_implicit; ensure("implicit units convert implicitly to regular values", float_val == 16); - S32 int_val = quatloos_implicit; + S32 int_val = (S32)quatloos_implicit; ensure("implicit units convert implicitly to regular values", int_val == 16); // conversion of implicits |