Rip out old workarounds, hacks and macros for newer C++ features not being supported back in the day.

Adds LL_COMPILE_TIME_MESSAGE support to Linux.

llfinite -> std::isfinite
llisnan -> std::isnan
vector_shrink_to_fit -> vector.shrink_to_fit
This commit is contained in:
Lirusaito
2016-02-14 17:37:10 -05:00
parent 379543a405
commit 6e3f404a1c
38 changed files with 98 additions and 299 deletions

View File

@@ -1382,7 +1382,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
}
if (mJointMotionList->mDuration > MAX_ANIM_DURATION ||
!llfinite(mJointMotionList->mDuration))
!std::isfinite(mJointMotionList->mDuration))
{
LL_WARNS() << "invalid animation duration" << LL_ENDL;
return FALSE;
@@ -1407,14 +1407,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
// get loop
//-------------------------------------------------------------------------
if (!dp.unpackF32(mJointMotionList->mLoopInPoint, "loop_in_point") ||
!llfinite(mJointMotionList->mLoopInPoint))
!std::isfinite(mJointMotionList->mLoopInPoint))
{
LL_WARNS() << "can't read loop point" << LL_ENDL;
return FALSE;
}
if (!dp.unpackF32(mJointMotionList->mLoopOutPoint, "loop_out_point") ||
!llfinite(mJointMotionList->mLoopOutPoint))
!std::isfinite(mJointMotionList->mLoopOutPoint))
{
LL_WARNS() << "can't read loop point" << LL_ENDL;
return FALSE;
@@ -1430,14 +1430,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
// get easeIn and easeOut
//-------------------------------------------------------------------------
if (!dp.unpackF32(mJointMotionList->mEaseInDuration, "ease_in_duration") ||
!llfinite(mJointMotionList->mEaseInDuration))
!std::isfinite(mJointMotionList->mEaseInDuration))
{
LL_WARNS() << "can't read easeIn" << LL_ENDL;
return FALSE;
}
if (!dp.unpackF32(mJointMotionList->mEaseOutDuration, "ease_out_duration") ||
!llfinite(mJointMotionList->mEaseOutDuration))
!std::isfinite(mJointMotionList->mEaseOutDuration))
{
LL_WARNS() << "can't read easeOut" << LL_ENDL;
return FALSE;
@@ -1608,7 +1608,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if (old_version)
{
if (!dp.unpackF32(time, "time") ||
!llfinite(time))
!std::isfinite(time))
{
LL_WARNS() << "can't read rotation key (" << k << ")" << LL_ENDL;
return FALSE;
@@ -1702,7 +1702,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if (old_version)
{
if (!dp.unpackF32(pos_key.mTime, "time") ||
!llfinite(pos_key.mTime))
!std::isfinite(pos_key.mTime))
{
LL_WARNS() << "can't read position key (" << k << ")" << LL_ENDL;
return FALSE;
@@ -1907,28 +1907,28 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
// constraintp->mTargetConstraintDir *= constraintp->mSourceConstraintOffset.magVec();
}
if (!dp.unpackF32(constraintp->mEaseInStartTime, "ease_in_start") || !llfinite(constraintp->mEaseInStartTime))
if (!dp.unpackF32(constraintp->mEaseInStartTime, "ease_in_start") || !std::isfinite(constraintp->mEaseInStartTime))
{
LL_WARNS() << "can't read constraint ease in start time" << LL_ENDL;
delete constraintp;
return FALSE;
}
if (!dp.unpackF32(constraintp->mEaseInStopTime, "ease_in_stop") || !llfinite(constraintp->mEaseInStopTime))
if (!dp.unpackF32(constraintp->mEaseInStopTime, "ease_in_stop") || !std::isfinite(constraintp->mEaseInStopTime))
{
LL_WARNS() << "can't read constraint ease in stop time" << LL_ENDL;
delete constraintp;
return FALSE;
}
if (!dp.unpackF32(constraintp->mEaseOutStartTime, "ease_out_start") || !llfinite(constraintp->mEaseOutStartTime))
if (!dp.unpackF32(constraintp->mEaseOutStartTime, "ease_out_start") || !std::isfinite(constraintp->mEaseOutStartTime))
{
LL_WARNS() << "can't read constraint ease out start time" << LL_ENDL;
delete constraintp;
return FALSE;
}
if (!dp.unpackF32(constraintp->mEaseOutStopTime, "ease_out_stop") || !llfinite(constraintp->mEaseOutStopTime))
if (!dp.unpackF32(constraintp->mEaseOutStopTime, "ease_out_stop") || !std::isfinite(constraintp->mEaseOutStopTime))
{
LL_WARNS() << "can't read constraint ease out stop time" << LL_ENDL;
delete constraintp;

View File

@@ -96,16 +96,6 @@
#include "llthread.h"
#include "llerror.h"
// g++ 4.2.x (and before?) have the bug that when you try to pass a temporary
// to a function taking a const reference, it still calls the copy constructor.
// Define this to hack around that.
// Note that the chosen solution ONLY works for copying an AI*Access object that
// is passed to a function: the lifetime of the copied object must not be longer
// than the original (or at least, it shouldn't be used anymore after the
// original is destructed). This will be guaranteed if the code also compiles
// on a compiler that doesn't need this hack.
#define AI_NEED_ACCESS_CC (defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ < 3)) || (__GNUC__ < 4)))
template<typename T, typename RWLOCK> struct AIReadAccessConst;
template<typename T, typename RWLOCK> struct AIReadAccess;
template<typename T, typename RWLOCK> struct AIWriteAccess;
@@ -339,9 +329,6 @@ struct AIReadAccessConst
AIReadAccessConst(AIThreadSafe<T, RWLOCK> const& wrapper, bool high_priority = false)
: mWrapper(const_cast<AIThreadSafe<T, RWLOCK>&>(wrapper)),
mState(readlocked)
#if AI_NEED_ACCESS_CC
, mIsCopyConstructed(false)
#endif
{
mWrapper.mRWLock.rdlock(high_priority);
}
@@ -350,9 +337,6 @@ struct AIReadAccessConst
// These should never be dynamically allocated, so there is no need to make this virtual.
~AIReadAccessConst()
{
#if AI_NEED_ACCESS_CC
if (mIsCopyConstructed) return;
#endif
if (mState == readlocked)
mWrapper.mRWLock.rdunlock();
else if (mState == writelocked)
@@ -371,23 +355,14 @@ protected:
//! Constructor used by AIReadAccess.
AIReadAccessConst(AIThreadSafe<T, RWLOCK>& wrapper, state_type state)
: mWrapper(wrapper), mState(state)
#if AI_NEED_ACCESS_CC
, mIsCopyConstructed(false)
#endif
{ }
AIThreadSafe<T, RWLOCK>& mWrapper; //!< Reference to the object that we provide access to.
state_type const mState; //!< The lock state that mWrapper is in.
#if AI_NEED_ACCESS_CC
bool mIsCopyConstructed;
public:
AIReadAccessConst(AIReadAccessConst const& orig) : mWrapper(orig.mWrapper), mState(orig.mState), mIsCopyConstructed(true) { }
#else
private:
// Disallow copy constructing directly.
AIReadAccessConst(AIReadAccessConst const&);
#endif
};
/**
@@ -596,9 +571,6 @@ struct AIAccessConst
{
//! Construct a AIAccessConst from a constant AIThreadSafeSimple.
AIAccessConst(AIThreadSafeSimple<T, MUTEX> const& wrapper) : mWrapper(const_cast<AIThreadSafeSimple<T, MUTEX>&>(wrapper))
#if AI_NEED_ACCESS_CC
, mIsCopyConstructed(false)
#endif
{
this->mWrapper.mMutex.lock();
}
@@ -611,9 +583,6 @@ struct AIAccessConst
~AIAccessConst()
{
#if AI_NEED_ACCESS_CC
if (mIsCopyConstructed) return;
#endif
this->mWrapper.mMutex.unlock();
}
@@ -625,15 +594,9 @@ struct AIAccessConst
protected:
AIThreadSafeSimple<T, MUTEX>& mWrapper; //!< Reference to the object that we provide access to.
#if AI_NEED_ACCESS_CC
bool mIsCopyConstructed;
public:
AIAccessConst(AIAccessConst const& orig) : mWrapper(orig.mWrapper), mIsCopyConstructed(true) { }
#else
private:
// Disallow copy constructing directly.
AIAccessConst(AIAccessConst const&);
#endif
};
/**
@@ -817,14 +780,9 @@ struct AISTAccessConst
protected:
AIThreadSafeSingleThread<T>& mWrapper; //!< Reference to the object that we provide access to.
#if AI_NEED_ACCESS_CC
public:
AISTAccessConst(AISTAccessConst const& orig) : mWrapper(orig.mWrapper) { }
#else
private:
// Disallow copy constructing directly.
AISTAccessConst(AISTAccessConst const&);
#endif
};
/**

View File

@@ -50,7 +50,7 @@
#include "boost/atomic.hpp"
template<typename T>
struct impl_atomic_type { typedef boost::atomic<T> type; };
#elif defined(USE_STD_ATOMIC) && defined(LL_CPP11)
#elif defined(USE_STD_ATOMIC)
#include <atomic>
template<typename T>
struct impl_atomic_type { typedef std::atomic<T> type; };

View File

@@ -142,11 +142,7 @@ void LLDate::toStream(std::ostream& s) const
}
s << std::dec << std::setfill('0');
#if( LL_WINDOWS || __GNUC__ > 2)
s << std::right;
#else
s.setf(ios::right);
#endif
s << std::setw(4) << (exp_time.tm_year + 1900)
<< '-' << std::setw(2) << (exp_time.tm_mon + 1)
<< '-' << std::setw(2) << (exp_time.tm_mday)

View File

@@ -109,9 +109,9 @@
#endif
// Check for C++11 support
#if __cplusplus >= 201100L || _MSC_VER >= 1800
# define LL_CPP11
// Require C++11 support
#if __cplusplus < 201100L && _MSC_VER < 1800
#error C++11 support is required to build this project.
#endif
#if LL_WINDOWS
@@ -211,11 +211,7 @@
#endif
#endif
#if defined(LL_WINDOWS) || __cplusplus >= 201103L
# define LL_TYPEOF(exp) decltype(exp)
#else
# define LL_TYPEOF(exp) typeof(exp)
#endif
#define LL_TYPEOF(exp) decltype(exp)
#define LL_TO_STRING_HELPER(x) #x
#define LL_TO_STRING(x) LL_TO_STRING_HELPER(x)
@@ -226,8 +222,8 @@
#if LL_WINDOWS
#define LL_COMPILE_TIME_MESSAGE(msg) __pragma(message(LL_FILE_LINENO_MSG(msg)))
#else
// no way to get gcc 4.2 to print a user-defined diagnostic message only when a macro is used
#define LL_COMPILE_TIME_MESSAGE(msg)
#define PRAGMA_MSG(x) _Pragma(#x)
#define LL_COMPILE_TIME_MESSAGE(msg) PRAGMA_MSG(message msg)
#endif
#endif // not LL_LINDEN_PREPROCESSOR_H

View File

@@ -31,7 +31,6 @@
#include "llsd.h"
#include "llerror.h"
#include "../llmath/llmath.h"
#include "llformat.h"
#include "llsdserialize.h"
#include "stringize.h"
@@ -249,10 +248,10 @@ namespace
};
LLSD::Boolean ImplReal::asBoolean() const
{ return !llisnan(mValue) && mValue != 0.0; }
{ return !std::isnan(mValue) && mValue != 0.0; }
LLSD::Integer ImplReal::asInteger() const
{ return !llisnan(mValue) ? (LLSD::Integer)mValue : 0; }
{ return !std::isnan(mValue) ? (LLSD::Integer)mValue : 0; }
LLSD::String ImplReal::asString() const
{ return llformat("%lg", mValue); }

View File

@@ -1330,13 +1330,7 @@ S32 LLSDNotationFormatter::format_impl(const LLSD& data, std::ostream& ostr, U32
break;
case LLSD::TypeBoolean:
if(mBoolAlpha ||
#if( LL_WINDOWS || __GNUC__ > 2)
(ostr.flags() & std::ios::boolalpha)
#else
(ostr.flags() & 0x0100)
#endif
)
if(mBoolAlpha || (ostr.flags() & std::ios::boolalpha))
{
ostr << (data.asBoolean()
? NOTATION_TRUE_SERIAL : NOTATION_FALSE_SERIAL);

View File

@@ -221,14 +221,7 @@ template <typename T>
//Singu note: This has been generalized to support a broader range of map-esque containers
inline bool is_in_map(const T& inmap, typename T::key_type const& key)
{
if(inmap.find(key) == inmap.end())
{
return false;
}
else
{
return true;
}
return inmap.find(key) != inmap.end();
}
// Similar to get_ptr_in_map, but for any type with a valid T(0) constructor.
@@ -328,19 +321,6 @@ inline T* vector_append(std::vector<T>& invec, S32 N)
return &(invec[sz]);
}
template <typename T>
inline void vector_shrink_to_fit(std::vector<T>& invec)
{
//For Windows: We always assume vs2010 or later, which support this c++11 feature with no configuration needed.
//For GCC: __cplusplus >= 201103L indicates C++11 support. __GXX_EXPERIMENTAL_CXX0X being set indicates experimental c++0x support. C++11 support replaces C++0x support.
// std::vector::shrink_to_fit was added to GCCs C++0x implementation in version 4.5.0.
#if defined(LL_WINDOWS) || __cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X) && __GNUC_MINOR__ >= 5)
invec.shrink_to_fit();
#else
std::vector<T>(invec).swap(invec);
#endif
}
// call function f to n members starting at first. similar to std::for_each
template <class InputIter, class Size, class Function>
Function ll_for_n(InputIter first, Size n, Function f)
@@ -528,27 +508,6 @@ llbind2nd(const _Operation& __oper, const _Tp& __x)
return llbinder2nd<_Operation>(__oper, _Arg2_type(__x));
}
/**
* Compare std::type_info* pointers a la std::less. We break this out as a
* separate function for use in two different std::less specializations.
*/
inline
bool before(const std::type_info* lhs, const std::type_info* rhs)
{
#if LL_LINUX && defined(__GNUC__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4))
// If we're building on Linux with gcc, and it's either gcc 3.x or
// 4.{0,1,2,3}, then we have to use a workaround. Note that we use gcc on
// Mac too, and some people build with gcc on Windows (cygwin or mingw).
// On Linux, different load modules may produce different type_info*
// pointers for the same type. Have to compare name strings to get good
// results.
return strcmp(lhs->name(), rhs->name()) < 0;
#else // not Linux, or gcc 4.4+
// Just use before(), as we normally would
return lhs->before(*rhs);
#endif
}
/**
* Specialize std::less<std::type_info*> to use std::type_info::before().
* See MAINT-1175. It is NEVER a good idea to directly compare std::type_info*
@@ -563,7 +522,7 @@ namespace std
{
bool operator()(const std::type_info* lhs, const std::type_info* rhs) const
{
return before(lhs, rhs);
return lhs->before(*rhs);
}
};
@@ -573,7 +532,7 @@ namespace std
{
bool operator()(std::type_info* lhs, std::type_info* rhs) const
{
return before(lhs, rhs);
return lhs->before(*rhs);
}
};
} // std

View File

@@ -201,7 +201,7 @@ protected:
#include <boost/thread/condition_variable.hpp>
typedef boost::recursive_mutex LLMutexImpl;
typedef boost::condition_variable_any LLConditionVariableImpl;
#elif defined(USE_STD_MUTEX) && defined(LL_CPP11)
#elif defined(USE_STD_MUTEX)
#include <mutex>
typedef std::recursive_mutex LLMutexImpl;
typedef std::condition_variable_any LLConditionVariableImpl;

View File

@@ -307,8 +307,6 @@ struct lluuid_less
typedef std::set<LLUUID, lluuid_less> uuid_list_t;
#ifdef LL_CPP11
namespace std {
template <> struct hash<LLUUID>
{
@@ -319,7 +317,6 @@ namespace std {
}
};
}
#endif
namespace boost {
template<> class hash<LLUUID>

View File

@@ -108,8 +108,4 @@ typedef U8 LLPCode;
#define LL_ARRAY_SIZE( _kArray ) ( sizeof( (_kArray) ) / sizeof( _kArray[0] ) )
#if LL_LINUX && __GNUC__ <= 2
typedef int intptr_t;
#endif
#endif

View File

@@ -161,7 +161,7 @@ private:
F32 _min(const F32& a, const F32& b) const { return llmin(a, b); }
F32 _max(const F32& a, const F32& b) const { return llmax(a, b); }
bool checkNaN(const F32& a) const { return !llisnan(a); }
bool checkNaN(const F32& a) const { return !std::isnan(a); }
//FIX* non ambiguous function fix making SIN() work for calc -Cryogenic Blitz
F32 _sin(const F32& a) const { return sin(DEG_TO_RAD * a); }

View File

@@ -41,23 +41,6 @@
// llcommon depend on llmath.
#include "is_approx_equal_fraction.h"
// work around for Windows & older gcc non-standard function names.
#if LL_WINDOWS
#include <float.h>
#define llisnan(val) _isnan(val)
#define llfinite(val) _finite(val)
#elif (LL_LINUX && __GNUC__ <= 2)
#define llisnan(val) isnan(val)
#define llfinite(val) isfinite(val)
#elif LL_SOLARIS
#define llisnan(val) isnan(val)
#define llfinite(val) (val <= std::numeric_limits<double>::max())
#else
#define llisnan(val) std::isnan(val)
#define llfinite(val) std::isfinite(val)
#endif
// Single Precision Floating Point Routines
// (There used to be more defined here, but they appeared to be redundant and
// were breaking some other includes. Removed by Falcon, reviewed by Andrew, 11/25/09)
@@ -156,36 +139,12 @@ inline F64 llabs(const F64 a)
inline S32 lltrunc( F32 f )
{
#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined(_WIN64) && !(_MSC_VER >= 1800)
// Avoids changing the floating point control word.
// Add or subtract 0.5 - epsilon and then round
const static U32 zpfp[] = { 0xBEFFFFFF, 0x3EFFFFFF };
S32 result;
__asm {
fld f
mov eax, f
shr eax, 29
and eax, 4
fadd dword ptr [zpfp + eax]
fistp result
}
return result;
#else
#ifdef LL_CPP11
return (S32)trunc(f);
#else
return (S32)f;
#endif
#endif
return (S32)trunc(f);
}
inline S32 lltrunc( F64 f )
{
#ifdef LL_CPP11
return (S32)trunc(f);
#else
return (S32)f;
#endif
}
inline S32 llfloor( F32 f )
@@ -217,29 +176,17 @@ inline S32 llceil( F32 f )
// Use this round. Does an arithmetic round (0.5 always rounds up)
inline S32 ll_round(const F32 val)
{
#ifdef LL_CPP11
return (S32)round(val);
#else
return llfloor(val + 0.5f);
#endif
}
inline F32 ll_round(F32 val, F32 nearest)
{
#ifdef LL_CPP11
return F32(round(val * (1.0f / nearest))) * nearest;
#else
return F32(floor(val * (1.0f / nearest) + 0.5f)) * nearest;
#endif
}
inline F64 ll_round(F64 val, F64 nearest)
{
#ifdef LL_CPP11
return F64(round(val * (1.0 / nearest))) * nearest;
#else
return F64(floor(val * (1.0 / nearest) + 0.5)) * nearest;
#endif
}
// these provide minimum peak error

View File

@@ -696,7 +696,7 @@ public:
(mData.size() > gOctreeReserveCapacity && mData.capacity() > gOctreeReserveCapacity + mData.size() - 1 - (mData.size() - gOctreeReserveCapacity - 1) % 4))
{
//Shrink to lowest possible (reserve)+4*i size.. Say reserve is 5, here are [size,capacity] pairs. [10,13],[9,9],[8,9],[7,9],[6,9],[5,5],[4,5],[3,5],[2,5],[1,5],[0,5]
vector_shrink_to_fit(mData);
mData.shrink_to_fit();
}
#ifdef LL_OCTREE_STATS
if(old_cap != mData.capacity())

View File

@@ -166,7 +166,7 @@ public:
// checker
inline BOOL LLQuaternion::isFinite() const
{
return (llfinite(mQ[VX]) && llfinite(mQ[VY]) && llfinite(mQ[VZ]) && llfinite(mQ[VS]));
return (std::isfinite(mQ[VX]) && std::isfinite(mQ[VY]) && std::isfinite(mQ[VZ]) && std::isfinite(mQ[VS]));
}
inline BOOL LLQuaternion::isIdentity() const

View File

@@ -167,8 +167,8 @@ void calc_tangent_from_triangle(
float r = ((rd*rd) > FLT_EPSILON) ? (1.0f / rd)
: ((rd > 0.0f) ? 1024.f : -1024.f); //some made up large ratio for division by zero
llassert(llfinite(r));
llassert(!llisnan(r));
llassert(std::isfinite(r));
llassert(!std::isnan(r));
LLVector4a sdir(
(t2 * x1 - t1 * x2) * r,
@@ -5989,13 +5989,13 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)
normal.set(0,0,1);
}
llassert(llfinite(normal.getF32ptr()[0]));
llassert(llfinite(normal.getF32ptr()[1]));
llassert(llfinite(normal.getF32ptr()[2]));
llassert(std::isfinite(normal.getF32ptr()[0]));
llassert(std::isfinite(normal.getF32ptr()[1]));
llassert(std::isfinite(normal.getF32ptr()[2]));
llassert(!llisnan(normal.getF32ptr()[0]));
llassert(!llisnan(normal.getF32ptr()[1]));
llassert(!llisnan(normal.getF32ptr()[2]));
llassert(!std::isnan(normal.getF32ptr()[0]));
llassert(!std::isnan(normal.getF32ptr()[1]));
llassert(!std::isnan(normal.getF32ptr()[2]));
for (S32 i = 0; i < num_vertices; i++)
{
@@ -6810,8 +6810,8 @@ void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVe
float r = ((rd*rd) > FLT_EPSILON) ? (1.0f / rd)
: ((rd > 0.0f) ? 1024.f : -1024.f); //some made up large ratio for division by zero
llassert(llfinite(r));
llassert(!llisnan(r));
llassert(std::isfinite(r));
llassert(!std::isnan(r));
LLVector4a sdir((t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r,
(t2 * z1 - t1 * z2) * r);

View File

@@ -250,7 +250,7 @@ inline F32 LLVector2::normalize(void)
// checker
inline bool LLVector2::isFinite() const
{
return (llfinite(mV[VX]) && llfinite(mV[VY]));
return (std::isfinite(mV[VX]) && std::isfinite(mV[VY]));
}
// deprecated

View File

@@ -191,7 +191,7 @@ inline LLVector3d::LLVector3d(const LLVector3d &copy)
// checker
inline BOOL LLVector3d::isFinite() const
{
return (llfinite(mdV[VX]) && llfinite(mdV[VY]) && llfinite(mdV[VZ]));
return (std::isfinite(mdV[VX]) && std::isfinite(mdV[VY]) && std::isfinite(mdV[VZ]));
}

View File

@@ -76,7 +76,7 @@ BOOL LLVector3::clampLength( F32 length_limit )
BOOL changed = FALSE;
F32 len = length();
if (llfinite(len))
if (std::isfinite(len))
{
if ( len > length_limit)
{
@@ -97,7 +97,7 @@ BOOL LLVector3::clampLength( F32 length_limit )
for (S32 i = 0; i < 3; ++i)
{
F32 abs_component = fabs(mV[i]);
if (llfinite(abs_component))
if (std::isfinite(abs_component))
{
if (abs_component > max_abs_component)
{

View File

@@ -199,7 +199,7 @@ inline LLVector3::LLVector3(const LLVector3 &copy)
// checker
inline BOOL LLVector3::isFinite() const
{
return (llfinite(mV[VX]) && llfinite(mV[VY]) && llfinite(mV[VZ]));
return (std::isfinite(mV[VX]) && std::isfinite(mV[VY]) && std::isfinite(mV[VZ]));
}

View File

@@ -194,7 +194,7 @@ inline LLVector4::LLVector4(const LLVector3 &vec, F32 w)
inline BOOL LLVector4::isFinite() const
{
return (llfinite(mV[VX]) && llfinite(mV[VY]) && llfinite(mV[VZ]) && llfinite(mV[VW]));
return (std::isfinite(mV[VX]) && std::isfinite(mV[VY]) && std::isfinite(mV[VZ]) && std::isfinite(mV[VW]));
}
// Clear and Assignment Functions

View File

@@ -200,7 +200,7 @@ void LLXform::setPosition(const LLVector3& pos)
void LLXform::setPosition(const F32 x, const F32 y, const F32 z)
{
setChanged(TRANSLATED);
if (llfinite(x) && llfinite(y) && llfinite(z))
if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z))
mPosition.setVec(x,y,z);
else
{
@@ -212,7 +212,7 @@ void LLXform::setPosition(const F32 x, const F32 y, const F32 z)
void LLXform::setPositionX(const F32 x)
{
setChanged(TRANSLATED);
if (llfinite(x))
if (std::isfinite(x))
mPosition.mV[VX] = x;
else
{
@@ -224,7 +224,7 @@ void LLXform::setPositionX(const F32 x)
void LLXform::setPositionY(const F32 y)
{
setChanged(TRANSLATED);
if (llfinite(y))
if (std::isfinite(y))
mPosition.mV[VY] = y;
else
{
@@ -236,7 +236,7 @@ void LLXform::setPositionY(const F32 y)
void LLXform::setPositionZ(const F32 z)
{
setChanged(TRANSLATED);
if (llfinite(z))
if (std::isfinite(z))
mPosition.mV[VZ] = z;
else
{
@@ -268,7 +268,7 @@ void LLXform::setScale(const LLVector3& scale)
void LLXform::setScale(const F32 x, const F32 y, const F32 z)
{
setChanged(SCALED);
if (llfinite(x) && llfinite(y) && llfinite(z))
if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z))
mScale.setVec(x,y,z);
else
{
@@ -290,7 +290,7 @@ void LLXform::setRotation(const LLQuaternion& rot)
void LLXform::setRotation(const F32 x, const F32 y, const F32 z)
{
setChanged(ROTATED);
if (llfinite(x) && llfinite(y) && llfinite(z))
if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z))
{
mRotation.setQuat(x,y,z);
}
@@ -303,7 +303,7 @@ void LLXform::setRotation(const F32 x, const F32 y, const F32 z)
void LLXform::setRotation(const F32 x, const F32 y, const F32 z, const F32 s)
{
setChanged(ROTATED);
if (llfinite(x) && llfinite(y) && llfinite(z) && llfinite(s))
if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z) && std::isfinite(s))
{
mRotation.mQ[VX] = x; mRotation.mQ[VY] = y; mRotation.mQ[VZ] = z; mRotation.mQ[VS] = s;
}

View File

@@ -233,17 +233,10 @@ int LLBufferStreamBuf::sync()
}
// virtual
#if( LL_WINDOWS || __GNUC__ > 2)
LLBufferStreamBuf::pos_type LLBufferStreamBuf::seekoff(
LLBufferStreamBuf::off_type off,
std::ios::seekdir way,
std::ios::openmode which)
#else
streampos LLBufferStreamBuf::seekoff(
streamoff off,
std::ios::seekdir way,
std::ios::openmode which)
#endif
{
if(!mBuffer
|| ((way == std::ios::beg) && (off < 0))
@@ -318,12 +311,8 @@ streampos LLBufferStreamBuf::seekoff(
}
}
#if( LL_WINDOWS || __GNUC__ > 2 )
S32 rv = (S32)(intptr_t)address;
return (pos_type)rv;
#else
return (streampos)address;
#endif
}

View File

@@ -48,10 +48,8 @@ public:
virtual ~LLBufferStreamBuf();
protected:
#if( LL_WINDOWS || __GNUC__ > 2 )
typedef std::streambuf::pos_type pos_type;
typedef std::streambuf::off_type off_type;
#endif
/* @name streambuf vrtual implementations
*/
@@ -87,17 +85,10 @@ protected:
* or both masked together.
* @return Returns the new position or an invalid position on failure.
*/
#if( LL_WINDOWS || __GNUC__ > 2)
virtual pos_type seekoff(
off_type off,
std::ios::seekdir way,
std::ios::openmode which);
#else
virtual streampos seekoff(
streamoff off,
std::ios::seekdir way,
std::ios::openmode which);
#endif
/*
* @brief Get s sequence of characters from the input

View File

@@ -168,7 +168,7 @@ void LLNameValue::init(const char *name, const char *data, const char *type, con
}
// finite checks
if (!llfinite(t1) || !llfinite(t2) || !llfinite(t3))
if (!std::isfinite(t1) || !std::isfinite(t2) || !std::isfinite(t3))
{
t1 = 0.f;
t2 = 0.f;

View File

@@ -326,7 +326,7 @@ void LLTemplateMessageReader::getF32(const char *block, const char *var,
{
getData(block, var, &d, sizeof(F32), blocknum);
if( !llfinite( d ) )
if( !std::isfinite( d ) )
{
LL_WARNS() << "non-finite in getF32Fast " << block << " " << var
<< LL_ENDL;
@@ -339,7 +339,7 @@ void LLTemplateMessageReader::getF64(const char *block, const char *var,
{
getData(block, var, &d, sizeof(F64), blocknum);
if( !llfinite( d ) )
if( !std::isfinite( d ) )
{
LL_WARNS() << "non-finite in getF64Fast " << block << " " << var
<< LL_ENDL;

View File

@@ -528,7 +528,7 @@ inline BOOL LLPrimitive::isApp(const LLPCode pcode)
// Special case for setPosition. If not check-for-finite, fall through to LLXform method.
void LLPrimitive::setPosition(const F32 x, const F32 y, const F32 z)
{
if (llfinite(x) && llfinite(y) && llfinite(z))
if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z))
{
LLXform::setPosition(x, y, z);
}
@@ -565,7 +565,7 @@ void LLPrimitive::setAngularVelocity(const LLVector3& avel)
void LLPrimitive::setAngularVelocity(const F32 x, const F32 y, const F32 z)
{
if (llfinite(x) && llfinite(y) && llfinite(z))
if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z))
{
mAngularVelocity.setVec(x,y,z);
}
@@ -589,7 +589,7 @@ void LLPrimitive::setVelocity(const LLVector3& vel)
void LLPrimitive::setVelocity(const F32 x, const F32 y, const F32 z)
{
if (llfinite(x) && llfinite(y) && llfinite(z))
if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z))
{
mVelocity.setVec(x,y,z);
}
@@ -601,7 +601,7 @@ void LLPrimitive::setVelocity(const F32 x, const F32 y, const F32 z)
void LLPrimitive::setVelocityX(const F32 x)
{
if (llfinite(x))
if (std::isfinite(x))
{
mVelocity.mV[VX] = x;
}
@@ -613,7 +613,7 @@ void LLPrimitive::setVelocityX(const F32 x)
void LLPrimitive::setVelocityY(const F32 y)
{
if (llfinite(y))
if (std::isfinite(y))
{
mVelocity.mV[VY] = y;
}
@@ -625,7 +625,7 @@ void LLPrimitive::setVelocityY(const F32 y)
void LLPrimitive::setVelocityZ(const F32 z)
{
if (llfinite(z))
if (std::isfinite(z))
{
mVelocity.mV[VZ] = z;
}
@@ -661,7 +661,7 @@ void LLPrimitive::setAcceleration(const LLVector3& accel)
void LLPrimitive::setAcceleration(const F32 x, const F32 y, const F32 z)
{
if (llfinite(x) && llfinite(y) && llfinite(z))
if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z))
{
mAcceleration.setVec(x,y,z);
}

View File

@@ -417,7 +417,7 @@ S32 LLTextureEntry::setOffsetT(F32 t)
S32 LLTextureEntry::setRotation(F32 theta)
{
if (mRotation != theta && llfinite(theta))
if (mRotation != theta && std::isfinite(theta))
{
mRotation = theta;
return TEM_CHANGE_TEXTURE;

View File

@@ -865,7 +865,6 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
dumpObjectLog(ret);
error_str = get_object_log(ret);
#if LL_WINDOWS
std::stringstream ostr;
//dump shader source for debugging
for (GLuint i = 0; i < count; i++)
@@ -882,19 +881,6 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
}
LL_WARNS("ShaderLoading") << "\n" << ostr.str() << LL_ENDL;
#else
std::string str;
for (GLuint i = 0; i < count; i++) {
str.append(text[i]);
if (i % 128 == 0)
{
LL_WARNS("ShaderLoading") << str << LL_ENDL;
str = "";
}
}
#endif
glDeleteObjectARB(ret); //no longer need handle
ret = 0;
}

View File

@@ -257,7 +257,7 @@ class AIConstListIterator {
typedef AIListIterator<T> iterator;
_Container const* mContainer;
_Iterator mConstIterator; // This has to be an _Iterator instead of _ConstIterator, because the compiler doesn't accept a const_iterator for erase yet (C++11 does).
_ConstIterator mConstIterator;
void ref(void)
{
@@ -289,7 +289,7 @@ class AIConstListIterator {
typedef T const& reference;
AIConstListIterator(void) : mContainer(NULL) { }
AIConstListIterator(_Container const* __c, _Iterator const& __i) : mContainer(__c), mConstIterator(__i)
AIConstListIterator(_Container const* __c, _ConstIterator const& __i) : mContainer(__c), mConstIterator(__i)
{
llassert(mContainer);
ref();
@@ -343,7 +343,7 @@ class AIConstListIterator {
_Self& operator++()
{
_Iterator cur = mConstIterator;
_ConstIterator cur = mConstIterator;
++cur;
unref();
while(cur != mContainer->end() && cur->dead)
@@ -364,7 +364,7 @@ class AIConstListIterator {
_Self& operator--()
{
_Iterator cur = mConstIterator;
_ConstIterator cur = mConstIterator;
--cur;
unref();
while(cur->dead)

View File

@@ -136,7 +136,7 @@ inline F32 bytestream2float(const U8 *stream, S32 &offset)
{
S32 value = bytestream2integer(stream, offset);
F32 fpvalue = *(F32 *)&value;
if (!llfinite(fpvalue))
if (!std::isfinite(fpvalue))
{
fpvalue = 0;
set_fault(stream, LSRF_MATH);
@@ -155,7 +155,7 @@ inline void bytestream_int2float(U8 *stream, S32 &offset)
S32 value = bytestream2integer(stream, offset);
offset -= 4;
F32 fpvalue = (F32)value;
if (!llfinite(fpvalue))
if (!std::isfinite(fpvalue))
{
fpvalue = 0;
set_fault(stream, LSRF_MATH);
@@ -230,21 +230,21 @@ inline void bytestream2vector(LLVector3 &vector, const U8 *stream, S32 &offset)
{
S32 value = bytestream2integer(stream, offset);
vector.mV[VZ] = *(F32 *)&value;
if (!llfinite(vector.mV[VZ]))
if (!std::isfinite(vector.mV[VZ]))
{
vector.mV[VZ] = 0;
set_fault(stream, LSRF_MATH);
}
value = bytestream2integer(stream, offset);
vector.mV[VY] = *(F32 *)&value;
if (!llfinite(vector.mV[VY]))
if (!std::isfinite(vector.mV[VY]))
{
vector.mV[VY] = 0;
set_fault(stream, LSRF_MATH);
}
value = bytestream2integer(stream, offset);
vector.mV[VX] = *(F32 *)&value;
if (!llfinite(vector.mV[VX]))
if (!std::isfinite(vector.mV[VX]))
{
vector.mV[VX] = 0;
set_fault(stream, LSRF_MATH);
@@ -265,28 +265,28 @@ inline void bytestream2quaternion(LLQuaternion &quat, const U8 *stream, S32 &off
{
S32 value = bytestream2integer(stream, offset);
quat.mQ[VS] = *(F32 *)&value;
if (!llfinite(quat.mQ[VS]))
if (!std::isfinite(quat.mQ[VS]))
{
quat.mQ[VS] = 0;
set_fault(stream, LSRF_MATH);
}
value = bytestream2integer(stream, offset);
quat.mQ[VZ] = *(F32 *)&value;
if (!llfinite(quat.mQ[VZ]))
if (!std::isfinite(quat.mQ[VZ]))
{
quat.mQ[VZ] = 0;
set_fault(stream, LSRF_MATH);
}
value = bytestream2integer(stream, offset);
quat.mQ[VY] = *(F32 *)&value;
if (!llfinite(quat.mQ[VY]))
if (!std::isfinite(quat.mQ[VY]))
{
quat.mQ[VY] = 0;
set_fault(stream, LSRF_MATH);
}
value = bytestream2integer(stream, offset);
quat.mQ[VX] = *(F32 *)&value;
if (!llfinite(quat.mQ[VX]))
if (!std::isfinite(quat.mQ[VX]))
{
quat.mQ[VX] = 0;
set_fault(stream, LSRF_MATH);
@@ -315,7 +315,7 @@ inline F32 get_register_fp(U8 *stream, LSCRIPTRegisters reg)
{
S32 offset = gLSCRIPTRegisterAddresses[reg];
F32 value = bytestream2float(stream, offset);
if (!llfinite(value))
if (!std::isfinite(value))
{
value = 0;
set_fault(stream, LSRF_MATH);
@@ -390,7 +390,7 @@ inline F32 add_register_fp(U8 *stream, LSCRIPTRegisters reg, F32 value)
S32 offset = gLSCRIPTRegisterAddresses[reg];
F32 newvalue = bytestream2float(stream, offset);
newvalue += value;
if (!llfinite(newvalue))
if (!std::isfinite(newvalue))
{
newvalue = 0;
set_fault(stream, LSRF_MATH);
@@ -587,7 +587,7 @@ inline F32 lscript_pop_float(U8 *stream)
{
S32 sp = get_register(stream, LREG_SP);
F32 value = bytestream2float(stream, sp);
if (!llfinite(value))
if (!std::isfinite(value))
{
value = 0;
set_fault(stream, LSRF_MATH);
@@ -727,7 +727,7 @@ inline void lscript_local_get(U8 *stream, S32 address, F32 &value)
{
if (lscript_check_local(stream, address, LSCRIPTDataSize[LST_FLOATINGPOINT]))
value = bytestream2float(stream, address);
if (!llfinite(value))
if (!std::isfinite(value))
{
value = 0;
set_fault(stream, LSRF_MATH);
@@ -757,7 +757,7 @@ inline void lscript_global_get(U8 *stream, S32 address, F32 &value)
{
if (lscript_check_global(stream, address, LSCRIPTDataSize[LST_FLOATINGPOINT]))
value = bytestream2float(stream, address);
if (!llfinite(value))
if (!std::isfinite(value))
{
value = 0;
set_fault(stream, LSRF_MATH);
@@ -1058,7 +1058,7 @@ inline F32 safe_instruction_bytestream2float(U8 *stream, S32 &offset)
if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_INTEGER]))
{
F32 value = bytestream2float(stream, offset);
if (!llfinite(value))
if (!std::isfinite(value))
{
value = 0;
set_fault(stream, LSRF_MATH);

View File

@@ -272,13 +272,11 @@ BOOL LLPanelFriends::postBuild()
{
mFriendsList = getChild<LLScrollListCtrl>("friend_list");
mFriendsList->setCommitOnSelectionChange(true);
/* Singu TODO: Update to C++11 and make everything cleaner here
auto single_selection(boost::bind(&LLScrollListCtrl::getCurrentID, mFriendsList));
auto selection(boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList));
*/
mFriendsList->setCommitCallback(boost::bind(&LLPanelFriends::onSelectName, this));
//getChild<LLUICtrl>("buddy_group_combobox")->setCommitCallback(boost::bind(&LLPanelFriends::setContactGroup, this, _2));
mFriendsList->setDoubleClickCallback(boost::bind(LLAvatarActions::startIM, boost::bind(&LLScrollListCtrl::getCurrentID, mFriendsList)));
mFriendsList->setDoubleClickCallback(boost::bind(LLAvatarActions::startIM, single_selection));
// <dogmode>
// Contact search and group system.
@@ -294,13 +292,13 @@ BOOL LLPanelFriends::postBuild()
U32 changed_mask = LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE;
refreshNames(changed_mask);
getChild<LLUICtrl>("im_btn")->setCommitCallback(boost::bind(&LLPanelFriends::onClickIM, this, boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList)));
//getChild<LLUICtrl>("assign_btn")->setCommitCallback(boost::bind(ASFloaterContactGroups::show, boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList)));
getChild<LLUICtrl>("profile_btn")->setCommitCallback(boost::bind(LLAvatarActions::showProfiles, boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList), false));
getChild<LLUICtrl>("offer_teleport_btn")->setCommitCallback(boost::bind(static_cast<void(*)(const uuid_vec_t&)>(LLAvatarActions::offerTeleport), boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList)));
getChild<LLUICtrl>("pay_btn")->setCommitCallback(boost::bind(LLAvatarActions::pay, boost::bind(&LLScrollListCtrl::getCurrentID, mFriendsList)));
getChild<LLUICtrl>("im_btn")->setCommitCallback(boost::bind(&LLPanelFriends::onClickIM, this, selection));
//getChild<LLUICtrl>("assign_btn")->setCommitCallback(boost::bind(ASFloaterContactGroups::show, selection));
getChild<LLUICtrl>("profile_btn")->setCommitCallback(boost::bind(LLAvatarActions::showProfiles, selection, false));
getChild<LLUICtrl>("offer_teleport_btn")->setCommitCallback(boost::bind(static_cast<void(*)(const uuid_vec_t&)>(LLAvatarActions::offerTeleport), selection));
getChild<LLUICtrl>("pay_btn")->setCommitCallback(boost::bind(LLAvatarActions::pay, single_selection));
getChild<LLUICtrl>("add_btn")->setCommitCallback(boost::bind(&LLPanelFriends::onClickAddFriend, this));
getChild<LLUICtrl>("remove_btn")->setCommitCallback(boost::bind(LLAvatarActions::removeFriendsDialog, boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList)));
getChild<LLUICtrl>("remove_btn")->setCommitCallback(boost::bind(LLAvatarActions::removeFriendsDialog, selection));
//getChild<LLUICtrl>("export_btn")->setCommitCallback(boost::bind(&LLPanelFriends::onClickExport, this)); Making Dummy View -HgB
//getChild<LLUICtrl>("import_btn")->setCommitCallback(boost::bind(&LLPanelFriends::onClickImport, this)); Making Dummy View -HgB

View File

@@ -38,7 +38,6 @@
#include "llavatarname.h"
#include "llfloater.h"
#include "llvoinventorylistener.h"
#include <boost/container/map.hpp>
//class LLTool;
class LLObjectSelection;
@@ -85,9 +84,9 @@ private:
std::map<LLUUID,std::pair<U32,U32> > mInventoryNums; //<scripts,total>
std::vector<LLUUID> mQueue;
// </edit>
boost::container::map<LLUUID, boost::signals2::scoped_connection> mOwnerNameCacheConnection;
boost::container::map<LLUUID, boost::signals2::scoped_connection> mLastOwnerNameCacheConnection; // <edit/>
boost::container::map<LLUUID, boost::signals2::scoped_connection> mCreatorNameCacheConnection;
std::map<LLUUID, boost::signals2::scoped_connection> mOwnerNameCacheConnection;
std::map<LLUUID, boost::signals2::scoped_connection> mLastOwnerNameCacheConnection; // <edit/>
std::map<LLUUID, boost::signals2::scoped_connection> mCreatorNameCacheConnection;
};
#endif //LL_LLFLOATERINSPECT_H

View File

@@ -441,7 +441,7 @@ bool LLHUDEffectPointAt::calcTargetPosition()
mTargetPos -= mSourceObject->getRenderPosition();
if (!llfinite(mTargetPos.lengthSquared()))
if (!std::isfinite(mTargetPos.lengthSquared()))
{
return false;
}

View File

@@ -97,13 +97,7 @@ public:
}
std::string verb = params[1].asString();
#if LL_WINDOWS // C++11
while (!verb.empty() && std::ispunct(verb.back()))
verb.pop_back();
#else
for (size_t i = verb.size()-1; i >= 0 && std::ispunct(verb[i]); --i)
verb.erase(i);
#endif
for (; !verb.empty() && std::ispunct(verb.back()); verb.pop_back());
if (verb == "about")
{
LLAvatarActions::showProfile(avatar_id);

View File

@@ -1822,7 +1822,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
LLVector3 diff = new_pos_parent - test_pos_parent ;
F32 mag_sqr = diff.magVecSquared() ;
if(llfinite(mag_sqr))
if(std::isfinite(mag_sqr))
{
setPositionParent(new_pos_parent);
}

View File

@@ -3912,7 +3912,7 @@ void LLVivoxVoiceClient::sessionState::removeParticipant(const std::string& uri)
vector_replace_with_last(mParticipantList, iter);
if (mParticipantList.empty() || mParticipantList.capacity() - mParticipantList.size() > 16)
{
vector_shrink_to_fit(mParticipantList);
mParticipantList.shrink_to_fit();
}
mParticipantsChanged = true;
LL_DEBUGS("Voice") << "participant \"" << uri << "\" (" << iter->mAvatarID << ") removed." << LL_ENDL;
@@ -3929,7 +3929,7 @@ void LLVivoxVoiceClient::sessionState::removeAllParticipants()
// Singu Note: mParticipantList has replaced both mParticipantsByURI and mParticipantsByUUID, meaning we don't have two maps to maintain any longer.
mParticipantList.clear();
vector_shrink_to_fit(mParticipantList);
mParticipantList.shrink_to_fit();
}
void LLVivoxVoiceClient::getParticipantList(std::set<LLUUID> &participants)

View File

@@ -408,7 +408,7 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable)
else
inv_camera_dist_squared = 1.f;
llassert(llfinite(inv_camera_dist_squared));
llassert(std::isfinite(inv_camera_dist_squared));
llassert(!llisnan(inv_camera_dist_squared));
F32 area = part->mScale.mV[0] * part->mScale.mV[1] * inv_camera_dist_squared;