diff --git a/etc/message.xml b/etc/message.xml
index 330ecee48..42bbef035 100644
--- a/etc/message.xml
+++ b/etc/message.xml
@@ -50,7 +50,7 @@
OpenCircuit
@@ -370,6 +370,14 @@
+ DisplayNameUpdate
+
+
ParcelVoiceInfo
+ SetDisplayNameReply
+
+
+ SimConsoleResponse
+
+
DirLandReply
-
-
+
+ NavMeshStatusUpdate
+
+
+ AgentStateUpdate
+
+
+
ScriptRunningReply
capBans
diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt
index 3ec482baf..5f86c3509 100644
--- a/indra/CMakeLists.txt
+++ b/indra/CMakeLists.txt
@@ -76,7 +76,6 @@ if (VIEWER)
add_subdirectory(${LIBS_OPEN_PREFIX}llcrashlogger)
add_subdirectory(${LIBS_OPEN_PREFIX}llplugin)
add_subdirectory(${LIBS_OPEN_PREFIX}llui)
- add_subdirectory(${LIBS_OPEN_PREFIX}llxuixml)
# viewer plugins directory
add_subdirectory(${LIBS_OPEN_PREFIX}plugins)
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 9006b2247..5c0d433be 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -190,10 +190,10 @@ if (LINUX)
endif (NOT STANDALONE)
if (${ARCH} STREQUAL "x86_64")
add_definitions(-DLINUX64=1 -pipe)
- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
- set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
- set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -ffast-math -funroll-loops")
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -ffast-math -funroll-loops")
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ffast-math")
+ set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ffast-math")
else (${ARCH} STREQUAL "x86_64")
if (NOT STANDALONE)
set(MARCH_FLAG " -march=pentium4")
@@ -327,7 +327,7 @@ else (STANDALONE)
glib-2.0
gstreamer-0.10
gtk-2.0
- llfreetype2
+ freetype2
pango-1.0
)
endif (STANDALONE)
diff --git a/indra/cmake/LLXUIXML.cmake b/indra/cmake/LLXUIXML.cmake
deleted file mode 100644
index b8bfe48c7..000000000
--- a/indra/cmake/LLXUIXML.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- cmake -*-
-
-set(LLXUIXML_INCLUDE_DIRS
- ${LIBS_OPEN_DIR}/llxuixml
- )
-
-set(LLXUIXML_LIBRARIES llxuixml)
diff --git a/indra/cmake/PNG.cmake b/indra/cmake/PNG.cmake
index 269b54de7..011b87f64 100644
--- a/indra/cmake/PNG.cmake
+++ b/indra/cmake/PNG.cmake
@@ -15,5 +15,5 @@ else (STANDALONE)
else(LINUX)
set(PNG_LIBRARIES png15)
endif()
- set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/libpng15)
+ set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/)
endif (STANDALONE)
diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h
index c80b71688..77c7fd6d7 100644
--- a/indra/llaudio/llaudioengine.h
+++ b/indra/llaudio/llaudioengine.h
@@ -43,11 +43,11 @@
#include "lluuid.h"
#include "llframetimer.h"
#include "llassettype.h"
+#include "llextendedstatus.h"
#include "lllistener.h"
const F32 LL_WIND_UPDATE_INTERVAL = 0.1f;
-const F32 LL_ROLLOFF_MULTIPLIER_UNDER_WATER = 5.f; // How much sounds are weaker under water
const F32 LL_WIND_UNDERWATER_CENTER_FREQ = 20.f;
const F32 ATTACHED_OBJECT_TIMEOUT = 5.0f;
diff --git a/indra/llaudio/llaudioengine_fmodex.cpp b/indra/llaudio/llaudioengine_fmodex.cpp
index d57ef7f3a..ba2b6615c 100644
--- a/indra/llaudio/llaudioengine_fmodex.cpp
+++ b/indra/llaudio/llaudioengine_fmodex.cpp
@@ -72,6 +72,8 @@ bool attemptDelayLoad()
FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int outchannels);
+FMOD::ChannelGroup *LLAudioEngine_FMODEX::mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT] = {0};
+
LLAudioEngine_FMODEX::LLAudioEngine_FMODEX(bool enable_profiler)
{
mInited = false;
@@ -130,9 +132,9 @@ bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata)
LL_DEBUGS("AppInit") << "LLAudioEngine_FMODEX::init() initializing FMOD" << LL_ENDL;
- result = FMOD::Memory_Initialize(NULL, 0, &decode_alloc, &decode_realloc, &decode_dealloc, FMOD_MEMORY_STREAM_DECODE | FMOD_MEMORY_STREAM_FILE);
- if(Check_FMOD_Error(result, "FMOD::Memory_Initialize"))
- return false;
+ //result = FMOD::Memory_Initialize(NULL, 0, &decode_alloc, &decode_realloc, &decode_dealloc, FMOD_MEMORY_STREAM_DECODE | FMOD_MEMORY_STREAM_FILE);
+ //if(Check_FMOD_Error(result, "FMOD::Memory_Initialize"))
+ // return false;
result = FMOD::System_Create(&mSystem);
if(Check_FMOD_Error(result, "FMOD::System_Create"))
@@ -159,7 +161,13 @@ bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata)
U32 fmod_flags = FMOD_INIT_NORMAL;
if(mEnableProfiler)
+ {
fmod_flags |= FMOD_INIT_ENABLE_PROFILE;
+ mSystem->createChannelGroup("None", &mChannelGroups[AUDIO_TYPE_NONE]);
+ mSystem->createChannelGroup("SFX", &mChannelGroups[AUDIO_TYPE_SFX]);
+ mSystem->createChannelGroup("UI", &mChannelGroups[AUDIO_TYPE_UI]);
+ mSystem->createChannelGroup("Ambient", &mChannelGroups[AUDIO_TYPE_AMBIENT]);
+ }
#if LL_LINUX
bool audio_ok = false;
@@ -604,6 +612,9 @@ void LLAudioChannelFMODEX::play()
Check_FMOD_Error(mChannelp->setPaused(false), "FMOD::Channel::pause");
getSource()->setPlayedOnce(true);
+
+ if(LLAudioEngine_FMODEX::mChannelGroups[getSource()->getType()])
+ mChannelp->setChannelGroup(LLAudioEngine_FMODEX::mChannelGroups[getSource()->getType()]);
}
diff --git a/indra/llaudio/llaudioengine_fmodex.h b/indra/llaudio/llaudioengine_fmodex.h
index f6f920e10..6b780128f 100644
--- a/indra/llaudio/llaudioengine_fmodex.h
+++ b/indra/llaudio/llaudioengine_fmodex.h
@@ -44,6 +44,7 @@ namespace FMOD
{
class System;
class Channel;
+ class ChannelGroup;
class Sound;
class DSP;
}
@@ -83,6 +84,9 @@ protected:
FMOD::DSP *mWindDSP;
FMOD::System *mSystem;
bool mEnableProfiler;
+
+public:
+ static FMOD::ChannelGroup *mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT];
};
diff --git a/indra/llaudio/lllistener_fmodex.cpp b/indra/llaudio/lllistener_fmodex.cpp
index 43749e6b1..e70dc7c60 100644
--- a/indra/llaudio/lllistener_fmodex.cpp
+++ b/indra/llaudio/lllistener_fmodex.cpp
@@ -106,6 +106,15 @@ void LLListener_FMODEX::commitDeferredChanges()
void LLListener_FMODEX::setRolloffFactor(F32 factor)
{
+ //An internal FMODEx optimization skips 3D updates if there have not been changes to the 3D sound environment.
+ //Sadly, a change in rolloff is not accounted for, thus we must touch the listener properties as well.
+ //In short: Changing the position ticks a dirtyflag inside fmodex, which makes it not skip 3D processing next update call.
+ if(mRolloffFactor != factor)
+ {
+ LLVector3 pos = mVelocity - LLVector3(0.f,0.f,.1f);
+ mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)pos.mV, NULL, NULL, NULL);
+ mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)mVelocity.mV, NULL, NULL, NULL);
+ }
mRolloffFactor = factor;
mSystem->set3DSettings(mDopplerFactor, 1.f, mRolloffFactor);
}
diff --git a/indra/llaudio/llstreamingaudio_fmodex.cpp b/indra/llaudio/llstreamingaudio_fmodex.cpp
index fa7044e67..d4e52d340 100644
--- a/indra/llaudio/llstreamingaudio_fmodex.cpp
+++ b/indra/llaudio/llstreamingaudio_fmodex.cpp
@@ -172,7 +172,6 @@ void LLStreamingAudio_FMODEX::update()
if(mFMODInternetStreamChannelp)
{
- //llinfos << "progress = " << progress << llendl;
if(!mMetaData)
mMetaData = new LLSD;
@@ -396,12 +395,12 @@ LLAudioStreamManagerFMODEX::LLAudioStreamManagerFMODEX(FMOD::System *system, con
{
mInternetStreamURL = url;
- FMOD_CREATESOUNDEXINFO exinfo;
+ /*FMOD_CREATESOUNDEXINFO exinfo;
memset(&exinfo,0,sizeof(exinfo));
exinfo.cbsize = sizeof(exinfo);
- exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_MPEG; //Hint to speed up loading.
+ exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_OGGVORBIS; //Hint to speed up loading.*/
- FMOD_RESULT result = mSystem->createStream(url.c_str(), FMOD_2D | FMOD_NONBLOCKING | FMOD_IGNORETAGS, &exinfo, &mInternetStream);
+ FMOD_RESULT result = mSystem->createStream(url.c_str(), FMOD_2D | FMOD_NONBLOCKING | FMOD_IGNORETAGS, 0, &mInternetStream);
if (result!= FMOD_OK)
{
@@ -484,4 +483,4 @@ void LLStreamingAudio_FMODEX::setBufferSizes(U32 streambuffertime, U32 decodebuf
settings.cbsize=sizeof(settings);
settings.defaultDecodeBufferSize = decodebuffertime;//ms
mSystem->setAdvancedSettings(&settings);
-}
\ No newline at end of file
+}
diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp
index 85291530c..6818be493 100644
--- a/indra/llcharacter/llcharacter.cpp
+++ b/indra/llcharacter/llcharacter.cpp
@@ -38,7 +38,6 @@
#include "llcharacter.h"
#include "llstring.h"
-#include "llfasttimer.h"
#define SKEL_HEADER "Linden Skeleton 1.0"
@@ -194,19 +193,14 @@ void LLCharacter::requestStopMotion( LLMotion* motion)
//-----------------------------------------------------------------------------
// updateMotions()
//-----------------------------------------------------------------------------
-static LLFastTimer::DeclareTimer FTM_UPDATE_ANIMATION("Update Animation");
-static LLFastTimer::DeclareTimer FTM_UPDATE_HIDDEN_ANIMATION("Update Hidden Anim");
-
void LLCharacter::updateMotions(e_update_t update_type)
{
if (update_type == HIDDEN_UPDATE)
{
- LLFastTimer t(FTM_UPDATE_HIDDEN_ANIMATION);
mMotionController.updateMotionsMinimal();
}
else
{
- LLFastTimer t(FTM_UPDATE_ANIMATION);
// unpause if the number of outstanding pause requests has dropped to the initial one
if (mMotionController.isPaused() && mPauseRequest->getNumRefs() == 1)
{
diff --git a/indra/llcharacter/llheadrotmotion.cpp b/indra/llcharacter/llheadrotmotion.cpp
index 9d12ee98d..0ee378f3b 100644
--- a/indra/llcharacter/llheadrotmotion.cpp
+++ b/indra/llcharacter/llheadrotmotion.cpp
@@ -250,9 +250,9 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask)
head_rot_local = nlerp(head_slerp_amt, mLastHeadRot, head_rot_local);
mLastHeadRot = head_rot_local;
- if(mNeckState->getJoint() && mNeckState->getJoint()->getParent()) //Guess this has crashed? Taken from snowglobe -Shyotl
+ // Set the head rotation.
+ if(mNeckState->getJoint() && mNeckState->getJoint()->getParent())
{
- // Set the head rotation.
LLQuaternion torsoRotLocal = mNeckState->getJoint()->getParent()->getWorldRotation() * currentInvRootRotWorld;
head_rot_local = head_rot_local * ~torsoRotLocal;
mNeckState->setRotation( nlerp(NECK_LAG, LLQuaternion::DEFAULT, head_rot_local) );
diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp
index 3b7dbec33..d040a1a22 100644
--- a/indra/llcharacter/llmotioncontroller.cpp
+++ b/indra/llcharacter/llmotioncontroller.cpp
@@ -637,9 +637,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty
motionp->fadeIn();
}
- // **********************
+ //**********************
// MOTION INACTIVE
- // **********************
+ //**********************
if (motionp->isStopped() && mAnimTime > motionp->getStopTime() + motionp->getEaseOutDuration())
{
// this motion has gone on too long, deactivate it
@@ -659,9 +659,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty
}
}
- // **********************
+ //**********************
// MOTION EASE OUT
- // **********************
+ //**********************
else if (motionp->isStopped() && mAnimTime > motionp->getStopTime())
{
// is this the first iteration in the ease out phase?
@@ -684,9 +684,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty
update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature);
}
- // **********************
+ //**********************
// MOTION ACTIVE
- // **********************
+ //**********************
else if (mAnimTime > motionp->mActivationTimestamp + motionp->getEaseInDuration())
{
posep->setWeight(motionp->getFadeWeight());
@@ -707,9 +707,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty
update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature);
}
- // **********************
+ //**********************
// MOTION EASE IN
- // **********************
+ //**********************
else if (mAnimTime >= motionp->mActivationTimestamp)
{
if (mLastTime < motionp->mActivationTimestamp)
@@ -837,6 +837,7 @@ void LLMotionController::updateMotions(bool force_update)
}
updateLoadingMotions();
+
return;
}
diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h
index a70efa9dd..694e27f37 100644
--- a/indra/llcharacter/llvisualparam.h
+++ b/indra/llcharacter/llvisualparam.h
@@ -93,6 +93,7 @@ class LLVisualParam
{
public:
typedef boost::function visual_param_mapper;
+
LLVisualParam();
virtual ~LLVisualParam();
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index cf1e564ae..f7c64c146 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -54,6 +54,7 @@ set(llcommon_SOURCE_FILES
llformat.cpp
llframetimer.cpp
llheartbeat.cpp
+ llinitparam.cpp
llinstancetracker.cpp
llindraconfigfile.cpp
llliveappconfig.cpp
@@ -173,6 +174,7 @@ set(llcommon_HEADER_FILES
llheartbeat.h
llhttpstatuscodes.h
llindexedqueue.h
+ llinitparam.h
llinstancetracker.h
llindraconfigfile.h
llkeythrottle.h
@@ -214,6 +216,7 @@ set(llcommon_HEADER_FILES
llsingleton.h
llskiplist.h
llskipmap.h
+ llsortedvector.h
llstack.h
llstacktrace.h
llstat.h
@@ -228,6 +231,7 @@ set(llcommon_HEADER_FILES
llthreadsafequeue.h
lltimer.h
lltreeiterators.h
+ lltypeinfolookup.h
lluri.h
lluuid.h
lluuidhashmap.h
diff --git a/indra/llcommon/linden_common.h b/indra/llcommon/linden_common.h
index d486359c7..b6fdef4ca 100644
--- a/indra/llcommon/linden_common.h
+++ b/indra/llcommon/linden_common.h
@@ -33,6 +33,11 @@
#ifndef LL_LINDEN_COMMON_H
#define LL_LINDEN_COMMON_H
+// *NOTE: Please keep includes here to a minimum!
+//
+// Files included here are included in every library .cpp file and
+// are not precompiled.
+
#include "cwdebug.h"
#if defined(LL_WINDOWS) && defined(_DEBUG)
@@ -55,34 +60,11 @@
#include
#include
-// Work around Microsoft compiler warnings in STL headers
-#ifdef LL_WINDOWS
-#pragma warning (disable : 4702) // unreachable code
-#pragma warning (disable : 4244) // conversion from time_t to S32
-#endif // LL_WINDOWS
-
-// *TODO: Eliminate these, most library .cpp files don't need them.
-// Add them to llviewerprecompiledheaders.h if necessary.
-#include
-#include
-#include
-#include
-
-#ifdef LL_WINDOWS
-// Reenable warnings we disabled above
-#pragma warning (3 : 4702) // unreachable code, we like level 3, not 4
-// moved msvc warnings to llpreprocessor.h *TODO - delete this comment after merge conflicts are unlikely -brad
-#endif // LL_WINDOWS
-
// Linden only libs in alpha-order other than stdtypes.h
// *NOTE: Please keep includes here to a minimum, see above.
#include "stdtypes.h"
#include "lldefs.h"
#include "llerror.h"
-#include "llextendedstatus.h"
-// Don't do this, adds 15K lines of header code to every library file.
-//#include "llfasttimer.h"
#include "llfile.h"
-#include "llformat.h"
#endif
diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp
index 88c64bde1..e0c24fc97 100644
--- a/indra/llcommon/llassettype.cpp
+++ b/indra/llcommon/llassettype.cpp
@@ -148,7 +148,7 @@ const char *LLAssetType::lookup(LLAssetType::EType asset_type)
}
// static
-LLAssetType::EType LLAssetType::lookup( const char* name )
+LLAssetType::EType LLAssetType::lookup(const char* name)
{
return lookup(ll_safe_string(name));
}
@@ -186,7 +186,7 @@ const char *LLAssetType::lookupHumanReadable(LLAssetType::EType asset_type)
}
// static
-LLAssetType::EType LLAssetType::lookupHumanReadable( const char* name )
+LLAssetType::EType LLAssetType::lookupHumanReadable(const char* name)
{
return lookupHumanReadable(ll_safe_string(name));
}
@@ -208,12 +208,9 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_
return AT_NONE;
}
-//NOTE: LLAssetType::lookupDragAndDropType & LLAssetType::generateDescriptionFor moved to newview/llviewerassettype.h
-
// static
bool LLAssetType::lookupCanLink(EType asset_type)
{
- //Check that enabling all these other types as linkable doesn't break things.
const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
const AssetEntry *entry = dict->lookup(asset_type);
if (entry)
@@ -221,9 +218,6 @@ bool LLAssetType::lookupCanLink(EType asset_type)
return entry->mCanLink;
}
return false;
-
- /*return (asset_type == AT_CLOTHING || asset_type == AT_OBJECT || asset_type == AT_CATEGORY ||
- asset_type == AT_BODYPART || asset_type == AT_GESTURE);*/
}
// static
@@ -268,4 +262,3 @@ bool LLAssetType::lookupIsAssetIDKnowable(EType asset_type)
}
return false;
}
-
diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llcommon/llinitparam.cpp
similarity index 100%
rename from indra/llxuixml/llinitparam.cpp
rename to indra/llcommon/llinitparam.cpp
diff --git a/indra/llxuixml/llinitparam.h b/indra/llcommon/llinitparam.h
similarity index 98%
rename from indra/llxuixml/llinitparam.h
rename to indra/llcommon/llinitparam.h
index 7285d3c48..993f16d04 100644
--- a/indra/llxuixml/llinitparam.h
+++ b/indra/llcommon/llinitparam.h
@@ -35,6 +35,7 @@
#include
#include "llerror.h"
+#include "llstl.h"
namespace LLInitParam
{
@@ -205,20 +206,12 @@ namespace LLInitParam
mutable std::string mValueName;
};
- class Parser
+ class LL_COMMON_API Parser
{
LOG_CLASS(Parser);
public:
- struct CompareTypeID
- {
- bool operator()(const std::type_info* lhs, const std::type_info* rhs) const
- {
- return lhs->before(*rhs);
- }
- };
-
typedef std::vector > name_stack_t;
typedef std::pair name_stack_range_t;
typedef std::vector possible_values_t;
@@ -227,9 +220,9 @@ namespace LLInitParam
typedef bool (*parser_write_func_t)(Parser& parser, const void*, name_stack_t&);
typedef boost::function parser_inspect_func_t;
- typedef std::map parser_read_func_map_t;
- typedef std::map parser_write_func_map_t;
- typedef std::map parser_inspect_func_map_t;
+ typedef std::map parser_read_func_map_t;
+ typedef std::map parser_write_func_map_t;
+ typedef std::map parser_inspect_func_map_t;
Parser(parser_read_func_map_t& read_map, parser_write_func_map_t& write_map, parser_inspect_func_map_t& inspect_map)
: mParseSilently(false),
@@ -301,7 +294,7 @@ namespace LLInitParam
class Param;
// various callbacks and constraints associated with an individual param
- struct ParamDescriptor
+ struct LL_COMMON_API ParamDescriptor
{
struct UserData
{
@@ -341,7 +334,7 @@ namespace LLInitParam
typedef boost::shared_ptr ParamDescriptorPtr;
// each derived Block class keeps a static data structure maintaining offsets to various params
- class BlockDescriptor
+ class LL_COMMON_API BlockDescriptor
{
public:
BlockDescriptor();
@@ -369,7 +362,7 @@ namespace LLInitParam
class BaseBlock* mCurrentBlockPtr; // pointer to block currently being constructed
};
- class BaseBlock
+ class LL_COMMON_API BaseBlock
{
public:
//TODO: implement in terms of owned_ptr
@@ -566,7 +559,7 @@ namespace LLInitParam
static bool equals(const BaseBlock::Lazy& a, const BaseBlock::Lazy& b) { return !a.empty() || !b.empty(); }
};
- class Param
+ class LL_COMMON_API Param
{
public:
void setProvided(bool is_provided = true)
@@ -1253,15 +1246,16 @@ namespace LLInitParam
return mValues.back();
}
- void add(const value_t& item)
+ self_t& add(const value_t& item)
{
param_value_t param_value;
param_value.setValue(item);
mValues.push_back(param_value);
setProvided();
+ return *this;
}
- void add(const typename name_value_lookup_t::name_t& name)
+ self_t& add(const typename name_value_lookup_t::name_t& name)
{
value_t value;
@@ -1271,6 +1265,8 @@ namespace LLInitParam
add(value);
mValues.back().setValueName(name);
}
+
+ return *this;
}
// implicit conversion
@@ -1441,13 +1437,14 @@ namespace LLInitParam
return mValues.back();
}
- void add(const value_t& item)
+ self_t& add(const value_t& item)
{
mValues.push_back(item);
setProvided();
+ return *this;
}
- void add(const typename name_value_lookup_t::name_t& name)
+ self_t& add(const typename name_value_lookup_t::name_t& name)
{
value_t value;
@@ -1457,6 +1454,7 @@ namespace LLInitParam
add(value);
mValues.back().setValueName(name);
}
+ return *this;
}
// implicit conversion
@@ -2057,8 +2055,8 @@ namespace LLInitParam
// block param interface
- bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name);
- void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const;
+ LL_COMMON_API bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name);
+ LL_COMMON_API void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const;
bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const
{
//TODO: implement LLSD params as schema type Any
diff --git a/indra/llcommon/llkeythrottle.h b/indra/llcommon/llkeythrottle.h
index 4ac689163..7544ab1d1 100644
--- a/indra/llcommon/llkeythrottle.h
+++ b/indra/llcommon/llkeythrottle.h
@@ -174,6 +174,7 @@ public:
F64 averageCount = curr.count + prevCount * (1.0 - timeInCurrent);
return averageCount;
}
+
// call each time the key wants use
State noteAction(const T& id, S32 weight = 1)
{
diff --git a/indra/llcommon/lllslconstants.h b/indra/llcommon/lllslconstants.h
index 06af6dd29..42aaad985 100644
--- a/indra/llcommon/lllslconstants.h
+++ b/indra/llcommon/lllslconstants.h
@@ -73,6 +73,15 @@ const S32 LSL_PRIM_TEXGEN = 22;
const S32 LSL_PRIM_POINT_LIGHT = 23;
const S32 LSL_PRIM_CAST_SHADOWS = 24;
const S32 LSL_PRIM_GLOW = 25;
+const S32 LSL_PRIM_TEXT = 26;
+const S32 LSL_PRIM_NAME = 27;
+const S32 LSL_PRIM_DESC = 28;
+const S32 LSL_PRIM_ROT_LOCAL = 29;
+const S32 LSL_PRIM_PHYSICS_SHAPE_TYPE = 30;
+const S32 LSL_PRIM_OMEGA = 32;
+const S32 LSL_PRIM_POS_LOCAL = 33;
+const S32 LSL_PRIM_LINK_TARGET = 34;
+const S32 LSL_PRIM_SLICE = 35;
const S32 LSL_PRIM_TYPE_BOX = 0;
const S32 LSL_PRIM_TYPE_CYLINDER= 1;
@@ -132,6 +141,15 @@ const S32 LSL_PRIM_SCULPT_TYPE_MASK = 7;
const S32 LSL_PRIM_SCULPT_FLAG_INVERT = 64;
const S32 LSL_PRIM_SCULPT_FLAG_MIRROR = 128;
+const S32 LSL_PRIM_PHYSICS_SHAPE_PRIM = 0;
+const S32 LSL_PRIM_PHYSICS_SHAPE_NONE = 1;
+const S32 LSL_PRIM_PHYSICS_SHAPE_CONVEX = 2;
+
+const S32 LSL_DENSITY = 1;
+const S32 LSL_FRICTION = 2;
+const S32 LSL_RESTITUTION = 4;
+const S32 LSL_GRAVITY_MULTIPLIER = 8;
+
const S32 LSL_ALL_SIDES = -1;
const S32 LSL_LINK_ROOT = 1;
const S32 LSL_LINK_FIRST_CHILD = 2;
@@ -189,6 +207,13 @@ const S32 OBJECT_RUNNING_SCRIPT_COUNT = 9;
const S32 OBJECT_TOTAL_SCRIPT_COUNT = 10;
const S32 OBJECT_SCRIPT_MEMORY = 11;
const S32 OBJECT_SCRIPT_TIME = 12;
+const S32 OBJECT_PRIM_EQUIVALENCE = 13;
+const S32 OBJECT_SERVER_COST = 14;
+const S32 OBJECT_STREAMING_COST = 15;
+const S32 OBJECT_PHYSICS_COST = 16;
+
+// llTextBox() magic token string - yes it's a hack.
+char const* const TEXTBOX_MAGIC_TOKEN = "!!llTextBox!!";
// changed() event flags
const U32 CHANGED_NONE = 0x0;
@@ -216,4 +241,156 @@ const U32 LSL_STATUS_INTERNAL_ERROR = 1999;
// Start per-function errors below, starting at 2000:
const U32 LSL_STATUS_WHITELIST_FAILED = 2001;
+
+// Memory profiling support
+const S32 LSL_PROFILE_SCRIPT_NONE = 0;
+const S32 LSL_PROFILE_SCRIPT_MEMORY = 1;
+
+// HTTP responses contents type
+const S32 LSL_CONTENT_TYPE_TEXT = 0;
+const S32 LSL_CONTENT_TYPE_HTML = 1;
+
+// Ray casting
+const S32 LSL_RCERR_UNKNOWN = -1;
+const S32 LSL_RCERR_SIM_PERF_LOW = -2;
+const S32 LSL_RCERR_CAST_TIME_EXCEEDED = -3;
+
+const S32 LSL_RC_REJECT_TYPES = 0;
+const S32 LSL_RC_DETECT_PHANTOM = 1;
+const S32 LSL_RC_DATA_FLAGS = 2;
+const S32 LSL_RC_MAX_HITS = 3;
+
+const S32 LSL_RC_REJECT_AGENTS = 1;
+const S32 LSL_RC_REJECT_PHYSICAL = 2;
+const S32 LSL_RC_REJECT_NONPHYSICAL = 4;
+const S32 LSL_RC_REJECT_LAND = 8;
+
+const S32 LSL_RC_GET_NORMAL = 1;
+const S32 LSL_RC_GET_ROOT_KEY = 2;
+const S32 LSL_RC_GET_LINK_NUM = 4;
+
+// Estate management
+const S32 LSL_ESTATE_ACCESS_ALLOWED_AGENT_ADD = 4;
+const S32 LSL_ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 8;
+const S32 LSL_ESTATE_ACCESS_ALLOWED_GROUP_ADD = 16;
+const S32 LSL_ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 32;
+const S32 LSL_ESTATE_ACCESS_BANNED_AGENT_ADD = 64;
+const S32 LSL_ESTATE_ACCESS_BANNED_AGENT_REMOVE = 128;
+
+// Key Frame Motion:
+const S32 LSL_KFM_COMMAND = 0;
+const S32 LSL_KFM_MODE = 1;
+const S32 LSL_KFM_DATA = 2;
+const S32 LSL_KFM_FORWARD = 0;
+const S32 LSL_KFM_LOOP = 1;
+const S32 LSL_KFM_PING_PONG = 2;
+const S32 LSL_KFM_REVERSE = 3;
+const S32 LSL_KFM_ROTATION = 1;
+const S32 LSL_KFM_TRANSLATION = 2;
+const S32 LSL_KFM_CMD_PLAY = 0;
+const S32 LSL_KFM_CMD_STOP = 1;
+const S32 LSL_KFM_CMD_PAUSE = 2;
+
+// Second Life Server/12 12.04.30.255166 constants for llGetAgentList
+const S32 AGENT_LIST_PARCEL = 1;
+const S32 AGENT_LIST_PARCEL_OWNER = 2;
+const S32 AGENT_LIST_REGION = 4;
+
+
+// --- SL Constants ABOVE this line ---
+// --- OpenSim / Aurora-Sim constants Below ---
+// OpenSim Constants (\OpenSim\Region\ScriptEngine\Shared\Api\Runtime\LSL_Constants.cs)
+// Constants for cmWindlight (\OpenSim\Region\ScriptEngine\Shared\Api\Runtime\CM_Constants.cs)
+const S32 CHANGED_ANIMATION = 16384;
+const S32 PARCEL_DETAILS_CLAIMDATE = 10; // used by OpenSim osSetParcelDetails
+const S32 STATS_TIME_DILATION = 0;
+const S32 STATS_SIM_FPS = 1;
+const S32 STATS_PHYSICS_FPS = 2;
+const S32 STATS_AGENT_UPDATES = 3;
+const S32 STATS_ROOT_AGENTS = 4;
+const S32 STATS_CHILD_AGENTS = 5;
+const S32 STATS_TOTAL_PRIMS = 6;
+const S32 STATS_ACTIVE_PRIMS = 7;
+const S32 STATS_FRAME_MS = 8;
+const S32 STATS_NET_MS = 9;
+const S32 STATS_PHYSICS_MS = 10;
+const S32 STATS_IMAGE_MS = 11;
+const S32 STATS_OTHER_MS = 12;
+const S32 STATS_IN_PACKETS_PER_SECOND = 13;
+const S32 STATS_OUT_PACKETS_PER_SECOND = 14;
+const S32 STATS_UNACKED_BYTES = 15;
+const S32 STATS_AGENT_MS = 16;
+const S32 STATS_PENDING_DOWNLOADS = 17;
+const S32 STATS_PENDING_UPLOADS = 18;
+const S32 STATS_ACTIVE_SCRIPTS = 19;
+const S32 STATS_SCRIPT_LPS = 20;
+// osNPC
+const S32 OS_NPC_FLY = 0;
+const S32 OS_NPC_NO_FLY = 1;
+const S32 OS_NPC_LAND_AT_TARGET = 2;
+const S32 OS_NPC_SIT_NOW = 0;
+const U32 OS_NPC_CREATOR_OWNED = 0x1;
+const U32 OS_NPC_NOT_OWNED = 0x2;
+const U32 OS_NPC_SENSE_AS_AGENT = 0x4;
+const U32 OS_NPC_RUNNING = 4;
+// Lightshare / Windlight
+const S32 WL_WATER_COLOR = 0;
+const S32 WL_WATER_FOG_DENSITY_EXPONENT = 1;
+const S32 WL_UNDERWATER_FOG_MODIFIER = 2;
+const S32 WL_REFLECTION_WAVELET_SCALE = 3;
+const S32 WL_FRESNEL_SCALE = 4;
+const S32 WL_FRESNEL_OFFSET = 5;
+const S32 WL_REFRACT_SCALE_ABOVE = 6;
+const S32 WL_REFRACT_SCALE_BELOW = 7;
+const S32 WL_BLUR_MULTIPLIER = 8;
+const S32 WL_BIG_WAVE_DIRECTION = 9;
+const S32 WL_LITTLE_WAVE_DIRECTION = 10;
+const S32 WL_NORMAL_MAP_TEXTURE = 11;
+const S32 WL_HORIZON = 12;
+const S32 WL_HAZE_HORIZON = 13;
+const S32 WL_BLUE_DENSITY = 14;
+const S32 WL_HAZE_DENSITY = 15;
+const S32 WL_DENSITY_MULTIPLIER = 16;
+const S32 WL_DISTANCE_MULTIPLIER = 17;
+const S32 WL_MAX_ALTITUDE = 18;
+const S32 WL_SUN_MOON_COLOR = 19;
+const S32 WL_AMBIENT = 20;
+const S32 WL_EAST_ANGLE = 21;
+const S32 WL_SUN_GLOW_FOCUS = 22;
+const S32 WL_SUN_GLOW_SIZE = 23;
+const S32 WL_SCENE_GAMMA = 24;
+const S32 WL_STAR_BRIGHTNESS = 25;
+const S32 WL_CLOUD_COLOR = 26;
+const S32 WL_CLOUD_XY_DENSITY = 27;
+const S32 WL_CLOUD_COVERAGE = 28;
+const S32 WL_CLOUD_SCALE = 29;
+const S32 WL_CLOUD_DETAIL_XY_DENSITY = 30;
+const S32 WL_CLOUD_SCROLL_X = 31;
+const S32 WL_CLOUD_SCROLL_Y = 32;
+const S32 WL_CLOUD_SCROLL_Y_LOCK = 33;
+const S32 WL_CLOUD_SCROLL_X_LOCK = 34;
+const S32 WL_DRAW_CLASSIC_CLOUDS = 35;
+const S32 WL_SUN_MOON_POSITION = 36;
+// Aurora-Sim Constants (\Aurora\AuroraDotNetEngine\APIs\AA_Constants.cs) -->
+const S32 BOT_FOLLOW_FLAG_NONE = 0;
+const S32 BOT_FOLLOW_FLAG_INDEFINITELY = 1;
+const S32 BOT_FOLLOW_WALK = 0;
+const S32 BOT_FOLLOW_RUN = 1;
+const S32 BOT_FOLLOW_FLY = 2;
+const S32 BOT_FOLLOW_TELEPORT = 3;
+const S32 BOT_FOLLOW_WAIT = 4;
+const S32 BOT_FOLLOW_TRIGGER_HERE_EVENT = 1;
+const S32 BOT_FOLLOW_FLAG_FORCEDIRECTPATH = 4;
+// string constants from Aurora-Sim
+char const* const ENABLE_GRAVITY = "enable_gravity";
+char const* const GRAVITY_FORCE_X = "gravity_force_x";
+char const* const GRAVITY_FORCE_Y = "gravity_force_y";
+char const* const GRAVITY_FORCE_Z = "gravity_force_z";
+char const* const ADD_GRAVITY_POINT = "add_gravity_point";
+char const* const ADD_GRAVITY_FORCE = "add_gravity_force";
+char const* const START_TIME_REVERSAL_SAVING = "start_time_reversal_saving";
+char const* const STOP_TIME_REVERSAL_SAVING = "stop_time_reversal_saving";
+char const* const START_TIME_REVERSAL = "start_time_reversal";
+char const* const STOP_TIME_REVERSAL = "stop_time_reversal";
+
#endif
diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp
index dee0d50e1..9532410b7 100644
--- a/indra/llcommon/llprocessor.cpp
+++ b/indra/llcommon/llprocessor.cpp
@@ -376,24 +376,24 @@ private:
// uses the MSVC compiler intrinsics __cpuid() and __rdtsc().
// Delays for the specified amount of milliseconds
-static void _Delay(unsigned int ms)
+static void _Delay(unsigned int ms)
{
- LARGE_INTEGER freq, c1, c2;
- __int64 x;
+ LARGE_INTEGER freq, c1, c2;
+ __int64 x;
- // Get High-Res Timer frequency
+ // Get High-Res Timer frequency
if (!QueryPerformanceFrequency(&freq))
return;
-
+
// Convert ms to High-Res Timer value
x = freq.QuadPart/1000*ms;
- // Get first snapshot of High-Res Timer value
+ // Get first snapshot of High-Res Timer value
QueryPerformanceCounter(&c1);
do
{
- // Get second snapshot
- QueryPerformanceCounter(&c2);
+ // Get second snapshot
+ QueryPerformanceCounter(&c2);
}while(c2.QuadPart-c1.QuadPart < x);
// Loop while (second-first < x)
}
diff --git a/indra/llcommon/llprocessor.h b/indra/llcommon/llprocessor.h
index 00cd5a555..fc2c8dacf 100644
--- a/indra/llcommon/llprocessor.h
+++ b/indra/llcommon/llprocessor.h
@@ -52,5 +52,4 @@ private:
LLProcessorInfoImpl* mImpl;
};
-
-#endif
+#endif // LLPROCESSOR_H
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index dce07410b..61dc62388 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -60,6 +60,9 @@ static const char LEGACY_NON_HEADER[] = "";
const std::string LLSD_BINARY_HEADER("LLSD/Binary");
const std::string LLSD_XML_HEADER("LLSD/XML");
+//used to deflate a gzipped asset (currently used for navmeshes)
+#define windowBits 15
+#define ENABLE_ZLIB_GZIP 32
/**
* LLSDSerialize
*/
@@ -2172,3 +2175,80 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
free(result);
return true;
}
+//This unzip function will only work with a gzip header and trailer - while the contents
+//of the actual compressed data is the same for either format (gzip vs zlib ), the headers
+//and trailers are different for the formats.
+U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize, std::istream& is, S32 size )
+{
+ U8* result = NULL;
+ U32 cur_size = 0;
+ z_stream strm;
+
+ const U32 CHUNK = 0x4000;
+
+ U8 *in = new U8[size];
+ is.read((char*) in, size);
+
+ U8 out[CHUNK];
+
+ strm.zalloc = Z_NULL;
+ strm.zfree = Z_NULL;
+ strm.opaque = Z_NULL;
+ strm.avail_in = size;
+ strm.next_in = in;
+
+
+ S32 ret = inflateInit2(&strm, windowBits | ENABLE_ZLIB_GZIP );
+ do
+ {
+ strm.avail_out = CHUNK;
+ strm.next_out = out;
+ ret = inflate(&strm, Z_NO_FLUSH);
+ if (ret == Z_STREAM_ERROR)
+ {
+ inflateEnd(&strm);
+ free(result);
+ delete [] in;
+ valid = false;
+ }
+
+ switch (ret)
+ {
+ case Z_NEED_DICT:
+ ret = Z_DATA_ERROR;
+ case Z_DATA_ERROR:
+ case Z_MEM_ERROR:
+ inflateEnd(&strm);
+ free(result);
+ delete [] in;
+ valid = false;
+ break;
+ }
+
+ U32 have = CHUNK-strm.avail_out;
+
+ result = (U8*) realloc(result, cur_size + have);
+ memcpy(result+cur_size, out, have);
+ cur_size += have;
+
+ } while (ret == Z_OK);
+
+ inflateEnd(&strm);
+ delete [] in;
+
+ if (ret != Z_STREAM_END)
+ {
+ free(result);
+ valid = false;
+ return NULL;
+ }
+
+ //result now points to the decompressed LLSD block
+ {
+ outsize= cur_size;
+ valid = true;
+ }
+
+ return result;
+}
+
diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h
index 9a45f56a7..09150615c 100644
--- a/indra/llcommon/llsdserialize.h
+++ b/indra/llcommon/llsdserialize.h
@@ -755,6 +755,9 @@ public:
LLPointer p = new LLSDXMLParser;
return p->parse(str, sd, LLSDSerialize::SIZE_UNLIMITED);
}
+ // Line oriented parser, 30% faster than fromXML(), but can
+ // only be used when you know you have the complete XML
+ // document available in the stream.
static S32 fromXMLDocument(LLSD& sd, std::istream& str)
{
LLPointer p = new LLSDXMLParser();
@@ -791,4 +794,5 @@ public:
//dirty little zip functions -- yell at davep
LL_COMMON_API std::string zip_llsd(LLSD& data);
LL_COMMON_API bool unzip_llsd(LLSD& data, std::istream& is, S32 size);
+LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize,std::istream& is, S32 size);
#endif // LL_LLSDSERIALIZE_H
diff --git a/indra/llcommon/llsortedvector.h b/indra/llcommon/llsortedvector.h
new file mode 100644
index 000000000..391b82ee4
--- /dev/null
+++ b/indra/llcommon/llsortedvector.h
@@ -0,0 +1,152 @@
+/**
+ * @file llsortedvector.h
+ * @author Nat Goodspeed
+ * @date 2012-04-08
+ * @brief LLSortedVector class wraps a vector that we maintain in sorted
+ * order so we can perform binary-search lookups.
+ *
+ * $LicenseInfo:firstyear=2012&license=viewerlgpl$
+ * Copyright (c) 2012, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+#if ! defined(LL_LLSORTEDVECTOR_H)
+#define LL_LLSORTEDVECTOR_H
+
+#include
+#include
+
+/**
+ * LLSortedVector contains a std::vector that we keep sorted on the
+ * first of the pair. This makes insertion somewhat more expensive than simple
+ * std::vector::push_back(), but allows us to use binary search for lookups.
+ * It's intended for small aggregates where lookup is far more performance-
+ * critical than insertion; in such cases a binary search on a small, sorted
+ * std::vector can be more performant than a std::map lookup.
+ */
+template
+class LLSortedVector
+{
+public:
+ typedef LLSortedVector self;
+ typedef KEY key_type;
+ typedef VALUE mapped_type;
+ typedef std::pair value_type;
+ typedef std::vector PairVector;
+ typedef typename PairVector::iterator iterator;
+ typedef typename PairVector::const_iterator const_iterator;
+
+ /// Empty
+ LLSortedVector() {}
+
+ /// Fixed initial size
+ LLSortedVector(std::size_t size):
+ mVector(size)
+ {}
+
+ /// Bulk load
+ template
+ LLSortedVector(ITER begin, ITER end):
+ mVector(begin, end)
+ {
+ // Allow caller to dump in a bunch of (pairs convertible to)
+ // value_type if desired, but make sure we sort afterwards.
+ std::sort(mVector.begin(), mVector.end());
+ }
+
+ /// insert(key, value)
+ std::pair insert(const key_type& key, const mapped_type& value)
+ {
+ return insert(value_type(key, value));
+ }
+
+ /// insert(value_type)
+ std::pair insert(const value_type& pair)
+ {
+ typedef std::pair iterbool;
+ iterator found = std::lower_bound(mVector.begin(), mVector.end(), pair,
+ less());
+ // have to check for end() before it's even valid to dereference
+ if (found == mVector.end())
+ {
+ std::size_t index(mVector.size());
+ mVector.push_back(pair);
+ // don't forget that push_back() invalidates 'found'
+ return iterbool(mVector.begin() + index, true);
+ }
+ if (found->first == pair.first)
+ {
+ return iterbool(found, false);
+ }
+ // remember that insert() invalidates 'found' -- save index
+ std::size_t index(found - mVector.begin());
+ mVector.insert(found, pair);
+ // okay, convert from index back to iterator
+ return iterbool(mVector.begin() + index, true);
+ }
+
+ iterator begin() { return mVector.begin(); }
+ iterator end() { return mVector.end(); }
+ const_iterator begin() const { return mVector.begin(); }
+ const_iterator end() const { return mVector.end(); }
+
+ bool empty() const { return mVector.empty(); }
+ std::size_t size() const { return mVector.size(); }
+
+ /// find
+ iterator find(const key_type& key)
+ {
+ iterator found = std::lower_bound(mVector.begin(), mVector.end(),
+ value_type(key, mapped_type()),
+ less());
+ if (found == mVector.end() || found->first != key)
+ return mVector.end();
+ return found;
+ }
+
+ const_iterator find(const key_type& key) const
+ {
+ return const_cast(this)->find(key);
+ }
+
+private:
+ // Define our own 'less' comparator so we can specialize without messing
+ // with std::less.
+ template
+ struct less: public std::less {};
+
+ // Specialize 'less' for an LLSortedVector::value_type involving
+ // std::type_info*. This is one of LLSortedVector's foremost use cases. We
+ // specialize 'less' rather than just defining a specific comparator
+ // because LLSortedVector should be usable for other key_types as well.
+ template
+ struct less< std::pair >:
+ public std::binary_function,
+ std::pair,
+ bool>
+ {
+ bool operator()(const std::pair& lhs,
+ const std::pair& rhs) const
+ {
+ return lhs.first->before(*rhs.first);
+ }
+ };
+
+ // Same as above, but with const std::type_info*.
+ template
+ struct less< std::pair >:
+ public std::binary_function,
+ std::pair,
+ bool>
+ {
+ bool operator()(const std::pair& lhs,
+ const std::pair& rhs) const
+ {
+ return lhs.first->before(*rhs.first);
+ }
+ };
+
+ PairVector mVector;
+};
+
+#endif /* ! defined(LL_LLSORTEDVECTOR_H) */
diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h
index 18842f276..105b69d34 100644
--- a/indra/llcommon/llstl.h
+++ b/indra/llcommon/llstl.h
@@ -39,7 +39,7 @@
#include
#include
#include
-#include "stdtypes.h" // llcommon/stdtypes.h, needed for S32 and U32.
+#include
// Use to compare the first element only of a pair
// e.g. typedef std::set, compare_pair > some_pair_set_t;
@@ -477,4 +477,54 @@ 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 to use std::type_info::before().
+ * See MAINT-1175. It is NEVER a good idea to directly compare std::type_info*
+ * because, on Linux, you might get different std::type_info* pointers for the
+ * same type (from different load modules)!
+ */
+namespace std
+{
+ template <>
+ struct less:
+ public std::binary_function
+ {
+ bool operator()(const std::type_info* lhs, const std::type_info* rhs) const
+ {
+ return before(lhs, rhs);
+ }
+ };
+
+ template <>
+ struct less:
+ public std::binary_function
+ {
+ bool operator()(std::type_info* lhs, std::type_info* rhs) const
+ {
+ return before(lhs, rhs);
+ }
+ };
+} // std
+
#endif // LL_LLSTL_H
diff --git a/indra/llcommon/llstrider.h b/indra/llcommon/llstrider.h
index 7d1b80710..b4f310a51 100644
--- a/indra/llcommon/llstrider.h
+++ b/indra/llcommon/llstrider.h
@@ -42,10 +42,10 @@ template class LLStrider
U8* mBytep;
};
U32 mSkip;
- //U32 mTypeSize;
+
public:
- LLStrider() { mObjectp = NULL; /*mTypeSize = */mSkip = sizeof(Object); }
+ LLStrider() { mObjectp = NULL; mSkip = sizeof(Object); }
~LLStrider() { }
const LLStrider