Summer cleaning - removed a lot of llcommon dependencies to speed up build times

consolidated most indra-specific constants in llcommon under indra_constants.h
fixed issues with operations on mixed unit types (implicit and explicit)
made LL_INFOS() style macros variadic in order to subsume other logging methods
such as ll_infos
added optional tag output to error recorders
master
Richard Linden 2013-07-30 19:13:45 -07:00
parent 19f7fb6ccc
commit a2e22732f1
334 changed files with 2476 additions and 6063 deletions

View File

@ -35,8 +35,7 @@
#include "llavatarappearance.h"
#include "llavatarappearancedefines.h"
#include "llavatarjointmesh.h"
#include "imageids.h"
#include "lldeleteutils.h"
#include "llstl.h"
#include "lldir.h"
#include "llpolymorph.h"
#include "llpolymesh.h"
@ -135,9 +134,9 @@ LLAvatarAppearance::LLAvatarXmlInfo::~LLAvatarXmlInfo()
std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer());
std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer());
std::for_each(mAttachmentInfoList.begin(), mAttachmentInfoList.end(), DeletePointer());
deleteAndClear(mTexSkinColorInfo);
deleteAndClear(mTexHairColorInfo);
deleteAndClear(mTexEyeColorInfo);
delete_and_clear(mTexSkinColorInfo);
delete_and_clear(mTexHairColorInfo);
delete_and_clear(mTexEyeColorInfo);
std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer());
std::for_each(mDriverInfoList.begin(), mDriverInfoList.end(), DeletePointer());
std::for_each(mMorphMaskInfoList.begin(), mMorphMaskInfoList.end(), DeletePointer());
@ -222,7 +221,7 @@ void LLAvatarAppearance::initInstance()
mesh->setMeshID(mesh_index);
mesh->setPickName(mesh_dict->mPickName);
mesh->setIsTransparent(FALSE);
switch((int)mesh_index)
switch((S32)mesh_index)
{
case MESH_ID_HAIR:
mesh->setIsTransparent(TRUE);
@ -258,7 +257,7 @@ void LLAvatarAppearance::initInstance()
++iter)
{
LLAvatarJointMesh* mesh = (*iter);
mBakedTextureDatas[(int)baked_texture_index].mJointMeshes.push_back(mesh);
mBakedTextureDatas[(S32)baked_texture_index].mJointMeshes.push_back(mesh);
}
}
@ -269,13 +268,13 @@ void LLAvatarAppearance::initInstance()
// virtual
LLAvatarAppearance::~LLAvatarAppearance()
{
deleteAndClear(mTexSkinColor);
deleteAndClear(mTexHairColor);
deleteAndClear(mTexEyeColor);
delete_and_clear(mTexSkinColor);
delete_and_clear(mTexHairColor);
delete_and_clear(mTexEyeColor);
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
deleteAndClear(mBakedTextureDatas[i].mTexLayerSet);
delete_and_clear(mBakedTextureDatas[i].mTexLayerSet);
mBakedTextureDatas[i].mJointMeshes.clear();
for (morph_list_t::iterator iter2 = mBakedTextureDatas[i].mMaskedMorphs.begin();
@ -290,11 +289,11 @@ LLAvatarAppearance::~LLAvatarAppearance()
mJointMap.clear();
clearSkeleton();
deleteAndClearArray(mCollisionVolumes);
delete_and_clear_array(mCollisionVolumes);
deleteAndClear(mTexSkinColor);
deleteAndClear(mTexHairColor);
deleteAndClear(mTexEyeColor);
delete_and_clear(mTexSkinColor);
delete_and_clear(mTexHairColor);
delete_and_clear(mTexEyeColor);
std::for_each(mPolyMeshes.begin(), mPolyMeshes.end(), DeletePairedPointer());
mPolyMeshes.clear();
@ -320,14 +319,14 @@ void LLAvatarAppearance::initClass()
BOOL success = sXMLTree.parseFile( xmlFile, FALSE );
if (!success)
{
llerrs << "Problem reading avatar configuration file:" << xmlFile << llendl;
llerrs << "Problem reading avatar configuration file:" << xmlFile << LL_ENDL;
}
// now sanity check xml file
LLXmlTreeNode* root = sXMLTree.getRoot();
if (!root)
{
llerrs << "No root node found in avatar configuration file: " << xmlFile << llendl;
llerrs << "No root node found in avatar configuration file: " << xmlFile << LL_ENDL;
return;
}
@ -336,14 +335,14 @@ void LLAvatarAppearance::initClass()
//-------------------------------------------------------------------------
if( !root->hasName( "linden_avatar" ) )
{
llerrs << "Invalid avatar file header: " << xmlFile << llendl;
llerrs << "Invalid avatar file header: " << xmlFile << LL_ENDL;
}
std::string version;
static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version");
if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") )
{
llerrs << "Invalid avatar file version: " << version << " in file: " << xmlFile << llendl;
llerrs << "Invalid avatar file version: " << version << " in file: " << xmlFile << LL_ENDL;
}
S32 wearable_def_version = 1;
@ -356,7 +355,7 @@ void LLAvatarAppearance::initClass()
LLXmlTreeNode* skeleton_node = root->getChildByName( "skeleton" );
if (!skeleton_node)
{
llerrs << "No skeleton in avatar configuration file: " << xmlFile << llendl;
llerrs << "No skeleton in avatar configuration file: " << xmlFile << LL_ENDL;
return;
}
@ -364,14 +363,14 @@ void LLAvatarAppearance::initClass()
static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name");
if (!skeleton_node->getFastAttributeString(file_name_string, skeleton_file_name))
{
llerrs << "No file name in skeleton node in avatar config file: " << xmlFile << llendl;
llerrs << "No file name in skeleton node in avatar config file: " << xmlFile << LL_ENDL;
}
std::string skeleton_path;
skeleton_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,skeleton_file_name);
if (!parseSkeletonFile(skeleton_path))
{
llerrs << "Error parsing skeleton file: " << skeleton_path << llendl;
llerrs << "Error parsing skeleton file: " << skeleton_path << LL_ENDL;
}
// Process XML data
@ -384,43 +383,43 @@ void LLAvatarAppearance::initClass()
sAvatarSkeletonInfo = new LLAvatarSkeletonInfo;
if (!sAvatarSkeletonInfo->parseXml(sSkeletonXMLTree.getRoot()))
{
llerrs << "Error parsing skeleton XML file: " << skeleton_path << llendl;
llerrs << "Error parsing skeleton XML file: " << skeleton_path << LL_ENDL;
}
// parse avatar_lad.xml
if (sAvatarXmlInfo)
{ //this can happen if a login attempt failed
deleteAndClear(sAvatarXmlInfo);
delete_and_clear(sAvatarXmlInfo);
}
sAvatarXmlInfo = new LLAvatarXmlInfo;
if (!sAvatarXmlInfo->parseXmlSkeletonNode(root))
{
llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl;
llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
}
if (!sAvatarXmlInfo->parseXmlMeshNodes(root))
{
llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl;
llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
}
if (!sAvatarXmlInfo->parseXmlColorNodes(root))
{
llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl;
llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
}
if (!sAvatarXmlInfo->parseXmlLayerNodes(root))
{
llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl;
llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
}
if (!sAvatarXmlInfo->parseXmlDriverNodes(root))
{
llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl;
llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
}
if (!sAvatarXmlInfo->parseXmlMorphNodes(root))
{
llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl;
llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL;
}
}
void LLAvatarAppearance::cleanupClass()
{
deleteAndClear(sAvatarXmlInfo);
delete_and_clear(sAvatarXmlInfo);
// *TODO: What about sAvatarSkeletonInfo ???
sSkeletonXMLTree.cleanup();
sXMLTree.cleanup();
@ -527,7 +526,7 @@ BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename)
if (!parsesuccess)
{
llerrs << "Can't parse skeleton file: " << filename << llendl;
llerrs << "Can't parse skeleton file: " << filename << LL_ENDL;
return FALSE;
}
@ -535,13 +534,13 @@ BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename)
LLXmlTreeNode* root = sSkeletonXMLTree.getRoot();
if (!root)
{
llerrs << "No root node found in avatar skeleton file: " << filename << llendl;
llerrs << "No root node found in avatar skeleton file: " << filename << LL_ENDL;
return FALSE;
}
if( !root->hasName( "linden_skeleton" ) )
{
llerrs << "Invalid avatar skeleton file header: " << filename << llendl;
llerrs << "Invalid avatar skeleton file header: " << filename << LL_ENDL;
return FALSE;
}
@ -549,7 +548,7 @@ BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename)
static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version");
if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") )
{
llerrs << "Invalid avatar skeleton file version: " << version << " in file: " << filename << llendl;
llerrs << "Invalid avatar skeleton file version: " << version << " in file: " << filename << LL_ENDL;
return FALSE;
}
@ -568,7 +567,7 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent
joint = getCharacterJoint(joint_num);
if (!joint)
{
llwarns << "Too many bones" << llendl;
llwarns << "Too many bones" << LL_ENDL;
return FALSE;
}
joint->setName( info->mName );
@ -577,7 +576,7 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent
{
if (volume_num >= (S32)mNumCollisionVolumes)
{
llwarns << "Too many bones" << llendl;
llwarns << "Too many bones" << LL_ENDL;
return FALSE;
}
joint = (&mCollisionVolumes[volume_num]);
@ -647,7 +646,7 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info)
//-------------------------------------------------------------------------
if (!allocateCharacterJoints(info->mNumBones))
{
llerrs << "Can't allocate " << info->mNumBones << " joints" << llendl;
llerrs << "Can't allocate " << info->mNumBones << " joints" << LL_ENDL;
return FALSE;
}
@ -658,7 +657,7 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info)
{
if (!allocateCollisionVolumes(info->mNumCollisionVolumes))
{
llerrs << "Can't allocate " << info->mNumCollisionVolumes << " collision volumes" << llendl;
llerrs << "Can't allocate " << info->mNumCollisionVolumes << " collision volumes" << LL_ENDL;
return FALSE;
}
}
@ -671,7 +670,7 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info)
LLAvatarBoneInfo *info = *iter;
if (!setupBone(info, NULL, current_volume_num, current_joint_num))
{
llerrs << "Error parsing bone in skeleton file" << llendl;
llerrs << "Error parsing bone in skeleton file" << LL_ENDL;
return FALSE;
}
}
@ -731,17 +730,17 @@ void LLAvatarAppearance::buildCharacter()
stop_glerror();
// gPrintMessagesThisFrame = TRUE;
lldebugs << "Avatar load took " << timer.getElapsedTimeF32() << " seconds." << llendl;
lldebugs << "Avatar load took " << timer.getElapsedTimeF32() << " seconds." << LL_ENDL;
if (!status)
{
if (isSelf())
{
llerrs << "Unable to load user's avatar" << llendl;
llerrs << "Unable to load user's avatar" << LL_ENDL;
}
else
{
llwarns << "Unable to load other's avatar" << llendl;
llwarns << "Unable to load other's avatar" << LL_ENDL;
}
return;
}
@ -790,7 +789,7 @@ void LLAvatarAppearance::buildCharacter()
mEyeLeftp &&
mEyeRightp))
{
llerrs << "Failed to create avatar." << llendl;
llerrs << "Failed to create avatar." << LL_ENDL;
return;
}
@ -811,21 +810,21 @@ BOOL LLAvatarAppearance::loadAvatar()
// avatar_skeleton.xml
if( !buildSkeleton(sAvatarSkeletonInfo) )
{
llwarns << "avatar file: buildSkeleton() failed" << llendl;
llwarns << "avatar file: buildSkeleton() failed" << LL_ENDL;
return FALSE;
}
// avatar_lad.xml : <skeleton>
if( !loadSkeletonNode() )
{
llwarns << "avatar file: loadNodeSkeleton() failed" << llendl;
llwarns << "avatar file: loadNodeSkeleton() failed" << LL_ENDL;
return FALSE;
}
// avatar_lad.xml : <mesh>
if( !loadMeshNodes() )
{
llwarns << "avatar file: loadNodeMesh() failed" << llendl;
llwarns << "avatar file: loadNodeMesh() failed" << LL_ENDL;
return FALSE;
}
@ -835,13 +834,13 @@ BOOL LLAvatarAppearance::loadAvatar()
mTexSkinColor = new LLTexGlobalColor( this );
if( !mTexSkinColor->setInfo( sAvatarXmlInfo->mTexSkinColorInfo ) )
{
llwarns << "avatar file: mTexSkinColor->setInfo() failed" << llendl;
llwarns << "avatar file: mTexSkinColor->setInfo() failed" << LL_ENDL;
return FALSE;
}
}
else
{
llwarns << "<global_color> name=\"skin_color\" not found" << llendl;
llwarns << "<global_color> name=\"skin_color\" not found" << LL_ENDL;
return FALSE;
}
if( sAvatarXmlInfo->mTexHairColorInfo )
@ -849,13 +848,13 @@ BOOL LLAvatarAppearance::loadAvatar()
mTexHairColor = new LLTexGlobalColor( this );
if( !mTexHairColor->setInfo( sAvatarXmlInfo->mTexHairColorInfo ) )
{
llwarns << "avatar file: mTexHairColor->setInfo() failed" << llendl;
llwarns << "avatar file: mTexHairColor->setInfo() failed" << LL_ENDL;
return FALSE;
}
}
else
{
llwarns << "<global_color> name=\"hair_color\" not found" << llendl;
llwarns << "<global_color> name=\"hair_color\" not found" << LL_ENDL;
return FALSE;
}
if( sAvatarXmlInfo->mTexEyeColorInfo )
@ -863,26 +862,26 @@ BOOL LLAvatarAppearance::loadAvatar()
mTexEyeColor = new LLTexGlobalColor( this );
if( !mTexEyeColor->setInfo( sAvatarXmlInfo->mTexEyeColorInfo ) )
{
llwarns << "avatar file: mTexEyeColor->setInfo() failed" << llendl;
llwarns << "avatar file: mTexEyeColor->setInfo() failed" << LL_ENDL;
return FALSE;
}
}
else
{
llwarns << "<global_color> name=\"eye_color\" not found" << llendl;
llwarns << "<global_color> name=\"eye_color\" not found" << LL_ENDL;
return FALSE;
}
// avatar_lad.xml : <layer_set>
if (sAvatarXmlInfo->mLayerInfoList.empty())
{
llwarns << "avatar file: missing <layer_set> node" << llendl;
llwarns << "avatar file: missing <layer_set> node" << LL_ENDL;
return FALSE;
}
if (sAvatarXmlInfo->mMorphMaskInfoList.empty())
{
llwarns << "avatar file: missing <morph_masks> node" << llendl;
llwarns << "avatar file: missing <morph_masks> node" << LL_ENDL;
return FALSE;
}
@ -924,14 +923,14 @@ BOOL LLAvatarAppearance::loadAvatar()
LLVisualParam*(LLAvatarAppearance::*avatar_function)(S32)const = &LLAvatarAppearance::getVisualParam;
if( !driver_param->linkDrivenParams(boost::bind(avatar_function,(LLAvatarAppearance*)this,_1 ), false))
{
llwarns << "could not link driven params for avatar " << getID().asString() << " param id: " << driver_param->getID() << llendl;
llwarns << "could not link driven params for avatar " << getID().asString() << " param id: " << driver_param->getID() << LL_ENDL;
continue;
}
}
else
{
delete driver_param;
llwarns << "avatar file: driver_param->parseData() failed" << llendl;
llwarns << "avatar file: driver_param->parseData() failed" << LL_ENDL;
return FALSE;
}
}
@ -1051,17 +1050,17 @@ BOOL LLAvatarAppearance::loadMeshNodes()
}
else
{
llwarns << "Avatar file: <mesh> has invalid lod setting " << lod << llendl;
llwarns << "Avatar file: <mesh> has invalid lod setting " << lod << LL_ENDL;
return FALSE;
}
}
else
{
llwarns << "Ignoring unrecognized mesh type: " << type << llendl;
llwarns << "Ignoring unrecognized mesh type: " << type << LL_ENDL;
return FALSE;
}
// llinfos << "Parsing mesh data for " << type << "..." << llendl;
// llinfos << "Parsing mesh data for " << type << "..." << LL_ENDL;
// If this isn't set to white (1.0), avatars will *ALWAYS* be darker than their surroundings.
// Do not touch!!!
@ -1091,7 +1090,7 @@ BOOL LLAvatarAppearance::loadMeshNodes()
if( !poly_mesh )
{
llwarns << "Failed to load mesh of type " << type << llendl;
llwarns << "Failed to load mesh of type " << type << LL_ENDL;
return FALSE;
}
@ -1151,7 +1150,7 @@ BOOL LLAvatarAppearance::loadLayersets()
{
stop_glerror();
delete layer_set;
llwarns << "avatar file: layer_set->setInfo() failed" << llendl;
llwarns << "avatar file: layer_set->setInfo() failed" << LL_ENDL;
return FALSE;
}
@ -1174,7 +1173,7 @@ BOOL LLAvatarAppearance::loadLayersets()
// if no baked texture was found, warn and cleanup
if (baked_index == BAKED_NUM_INDICES)
{
llwarns << "<layer_set> has invalid body_region attribute" << llendl;
llwarns << "<layer_set> has invalid body_region attribute" << LL_ENDL;
delete layer_set;
return FALSE;
}
@ -1192,7 +1191,7 @@ BOOL LLAvatarAppearance::loadLayersets()
}
else
{
llwarns << "Could not find layer named " << morph->mLayer << " to set morph flag" << llendl;
llwarns << "Could not find layer named " << morph->mLayer << " to set morph flag" << LL_ENDL;
success = FALSE;
}
}
@ -1288,7 +1287,7 @@ BOOL LLAvatarAppearance::isValid() const
// This should only be called on ourself.
if (!isSelf())
{
llerrs << "Called LLAvatarAppearance::isValid() on when isSelf() == false" << llendl;
llerrs << "Called LLAvatarAppearance::isValid() on when isSelf() == false" << LL_ENDL;
}
return TRUE;
}
@ -1453,7 +1452,7 @@ LLTexLayerSet* LLAvatarAppearance::getAvatarLayerSet(EBakedTextureIndex baked_in
//-----------------------------------------------------------------------------
BOOL LLAvatarAppearance::allocateCollisionVolumes( U32 num )
{
deleteAndClearArray(mCollisionVolumes);
delete_and_clear_array(mCollisionVolumes);
mNumCollisionVolumes = 0;
mCollisionVolumes = new LLAvatarJointCollisionVolume[num];
@ -1477,7 +1476,7 @@ BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node)
static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
if (!node->getFastAttributeString(name_string, mName))
{
llwarns << "Bone without name" << llendl;
llwarns << "Bone without name" << LL_ENDL;
return FALSE;
}
}
@ -1492,28 +1491,28 @@ BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node)
}
else
{
llwarns << "Invalid node " << node->getName() << llendl;
llwarns << "Invalid node " << node->getName() << LL_ENDL;
return FALSE;
}
static LLStdStringHandle pos_string = LLXmlTree::addAttributeString("pos");
if (!node->getFastAttributeVector3(pos_string, mPos))
{
llwarns << "Bone without position" << llendl;
llwarns << "Bone without position" << LL_ENDL;
return FALSE;
}
static LLStdStringHandle rot_string = LLXmlTree::addAttributeString("rot");
if (!node->getFastAttributeVector3(rot_string, mRot))
{
llwarns << "Bone without rotation" << llendl;
llwarns << "Bone without rotation" << LL_ENDL;
return FALSE;
}
static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale");
if (!node->getFastAttributeVector3(scale_string, mScale))
{
llwarns << "Bone without scale" << llendl;
llwarns << "Bone without scale" << LL_ENDL;
return FALSE;
}
@ -1522,7 +1521,7 @@ BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node)
static LLStdStringHandle pivot_string = LLXmlTree::addAttributeString("pivot");
if (!node->getFastAttributeVector3(pivot_string, mPivot))
{
llwarns << "Bone without pivot" << llendl;
llwarns << "Bone without pivot" << LL_ENDL;
return FALSE;
}
}
@ -1550,7 +1549,7 @@ BOOL LLAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node)
static LLStdStringHandle num_bones_string = LLXmlTree::addAttributeString("num_bones");
if (!node->getFastAttributeS32(num_bones_string, mNumBones))
{
llwarns << "Couldn't find number of bones." << llendl;
llwarns << "Couldn't find number of bones." << LL_ENDL;
return FALSE;
}
@ -1564,7 +1563,7 @@ BOOL LLAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node)
if (!info->parseXml(child))
{
delete info;
llwarns << "Error parsing bone in skeleton file" << llendl;
llwarns << "Error parsing bone in skeleton file" << LL_ENDL;
return FALSE;
}
mBoneInfoList.push_back(info);
@ -1581,7 +1580,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro
LLXmlTreeNode* node = root->getChildByName( "skeleton" );
if( !node )
{
llwarns << "avatar file: missing <skeleton>" << llendl;
llwarns << "avatar file: missing <skeleton>" << LL_ENDL;
return FALSE;
}
@ -1596,11 +1595,11 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro
{
if (child->getChildByName("param_morph"))
{
llwarns << "Can't specify morph param in skeleton definition." << llendl;
llwarns << "Can't specify morph param in skeleton definition." << LL_ENDL;
}
else
{
llwarns << "Unknown param type." << llendl;
llwarns << "Unknown param type." << LL_ENDL;
}
continue;
}
@ -1625,7 +1624,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro
static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
if (!child->getFastAttributeString(name_string, info->mName))
{
llwarns << "No name supplied for attachment point." << llendl;
llwarns << "No name supplied for attachment point." << LL_ENDL;
delete info;
continue;
}
@ -1633,7 +1632,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro
static LLStdStringHandle joint_string = LLXmlTree::addAttributeString("joint");
if (!child->getFastAttributeString(joint_string, info->mJointName))
{
llwarns << "No bone declared in attachment point " << info->mName << llendl;
llwarns << "No bone declared in attachment point " << info->mName << LL_ENDL;
delete info;
continue;
}
@ -1659,7 +1658,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro
static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id");
if (!child->getFastAttributeS32(id_string, info->mAttachmentID))
{
llwarns << "No id supplied for attachment point " << info->mName << llendl;
llwarns << "No id supplied for attachment point " << info->mName << LL_ENDL;
delete info;
continue;
}
@ -1694,7 +1693,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root)
static LLStdStringHandle type_string = LLXmlTree::addAttributeString("type");
if( !node->getFastAttributeString( type_string, info->mType ) )
{
llwarns << "Avatar file: <mesh> is missing type attribute. Ignoring element. " << llendl;
llwarns << "Avatar file: <mesh> is missing type attribute. Ignoring element. " << LL_ENDL;
delete info;
return FALSE; // Ignore this element
}
@ -1702,7 +1701,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root)
static LLStdStringHandle lod_string = LLXmlTree::addAttributeString("lod");
if (!node->getFastAttributeS32( lod_string, info->mLOD ))
{
llwarns << "Avatar file: <mesh> is missing lod attribute. Ignoring element. " << llendl;
llwarns << "Avatar file: <mesh> is missing lod attribute. Ignoring element. " << LL_ENDL;
delete info;
return FALSE; // Ignore this element
}
@ -1710,7 +1709,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root)
static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name");
if( !node->getFastAttributeString( file_name_string, info->mMeshFileName ) )
{
llwarns << "Avatar file: <mesh> is missing file_name attribute. Ignoring: " << info->mType << llendl;
llwarns << "Avatar file: <mesh> is missing file_name attribute. Ignoring: " << info->mType << LL_ENDL;
delete info;
return FALSE; // Ignore this element
}
@ -1741,11 +1740,11 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root)
{
if (child->getChildByName("param_skeleton"))
{
llwarns << "Can't specify skeleton param in a mesh definition." << llendl;
llwarns << "Can't specify skeleton param in a mesh definition." << LL_ENDL;
}
else
{
llwarns << "Unknown param type." << llendl;
llwarns << "Unknown param type." << LL_ENDL;
}
continue;
}
@ -1786,14 +1785,14 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root
{
if (mTexSkinColorInfo)
{
llwarns << "avatar file: multiple instances of skin_color" << llendl;
llwarns << "avatar file: multiple instances of skin_color" << LL_ENDL;
return FALSE;
}
mTexSkinColorInfo = new LLTexGlobalColorInfo;
if( !mTexSkinColorInfo->parseXml( color_node ) )
{
deleteAndClear(mTexSkinColorInfo);
llwarns << "avatar file: mTexSkinColor->parseXml() failed" << llendl;
delete_and_clear(mTexSkinColorInfo);
llwarns << "avatar file: mTexSkinColor->parseXml() failed" << LL_ENDL;
return FALSE;
}
}
@ -1801,14 +1800,14 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root
{
if (mTexHairColorInfo)
{
llwarns << "avatar file: multiple instances of hair_color" << llendl;
llwarns << "avatar file: multiple instances of hair_color" << LL_ENDL;
return FALSE;
}
mTexHairColorInfo = new LLTexGlobalColorInfo;
if( !mTexHairColorInfo->parseXml( color_node ) )
{
deleteAndClear(mTexHairColorInfo);
llwarns << "avatar file: mTexHairColor->parseXml() failed" << llendl;
delete_and_clear(mTexHairColorInfo);
llwarns << "avatar file: mTexHairColor->parseXml() failed" << LL_ENDL;
return FALSE;
}
}
@ -1816,13 +1815,13 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root
{
if (mTexEyeColorInfo)
{
llwarns << "avatar file: multiple instances of eye_color" << llendl;
llwarns << "avatar file: multiple instances of eye_color" << LL_ENDL;
return FALSE;
}
mTexEyeColorInfo = new LLTexGlobalColorInfo;
if( !mTexEyeColorInfo->parseXml( color_node ) )
{
llwarns << "avatar file: mTexEyeColor->parseXml() failed" << llendl;
llwarns << "avatar file: mTexEyeColor->parseXml() failed" << LL_ENDL;
return FALSE;
}
}
@ -1848,7 +1847,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root
else
{
delete layer_info;
llwarns << "avatar file: layer_set->parseXml() failed" << llendl;
llwarns << "avatar file: layer_set->parseXml() failed" << LL_ENDL;
return FALSE;
}
}
@ -1877,7 +1876,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* roo
else
{
delete driver_info;
llwarns << "avatar file: driver_param->parseXml() failed" << llendl;
llwarns << "avatar file: driver_param->parseXml() failed" << LL_ENDL;
return FALSE;
}
}
@ -1906,7 +1905,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root
static LLStdStringHandle name_string = LLXmlTree::addAttributeString("morph_name");
if (!grand_child->getFastAttributeString(name_string, info->mName))
{
llwarns << "No name supplied for morph mask." << llendl;
llwarns << "No name supplied for morph mask." << LL_ENDL;
delete info;
continue;
}
@ -1914,7 +1913,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root
static LLStdStringHandle region_string = LLXmlTree::addAttributeString("body_region");
if (!grand_child->getFastAttributeString(region_string, info->mRegion))
{
llwarns << "No region supplied for morph mask." << llendl;
llwarns << "No region supplied for morph mask." << LL_ENDL;
delete info;
continue;
}
@ -1922,7 +1921,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root
static LLStdStringHandle layer_string = LLXmlTree::addAttributeString("layer");
if (!grand_child->getFastAttributeString(layer_string, info->mLayer))
{
llwarns << "No layer supplied for morph mask." << llendl;
llwarns << "No layer supplied for morph mask." << LL_ENDL;
delete info;
continue;
}

View File

@ -28,7 +28,6 @@
// Header Files
//-----------------------------------------------------------------------------
#include "linden_common.h"
#include "imageids.h"
#include "llfasttimer.h"
#include "llrender.h"
@ -317,7 +316,7 @@ void LLAvatarJointMesh::setMesh( LLPolyMesh *mesh )
setupJoint((LLAvatarJoint*)getRoot());
}
// llinfos << "joint render entries: " << mMesh->mJointRenderData.count() << llendl;
LL_DEBUGS() << "joint render entries: " << mMesh->mJointRenderData.size() << LL_ENDL;
}
//-----------------------------------------------------------------------------
@ -325,10 +324,11 @@ void LLAvatarJointMesh::setMesh( LLPolyMesh *mesh )
//-----------------------------------------------------------------------------
void LLAvatarJointMesh::setupJoint(LLAvatarJoint* current_joint)
{
// llinfos << "Mesh: " << getName() << llendl;
LL_DEBUGS() << "Mesh: " << getName() << LL_ENDL;
// S32 joint_count = 0;
S32 joint_count = 0;
U32 sj;
for (sj=0; sj<mNumSkinJoints; sj++)
{
LLSkinJoint &js = mSkinJoints[sj];
@ -341,23 +341,20 @@ void LLAvatarJointMesh::setupJoint(LLAvatarJoint* current_joint)
// we've found a skinjoint for this joint..
// is the last joint in the array our parent?
if(mMesh->mJointRenderData.count() && mMesh->mJointRenderData[mMesh->mJointRenderData.count() - 1]->mWorldMatrix == &current_joint->getParent()->getWorldMatrix())
if(mMesh->mJointRenderData.size() && mMesh->mJointRenderData[mMesh->mJointRenderData.size() - 1]->mWorldMatrix == &current_joint->getParent()->getWorldMatrix())
{
// ...then just add ourselves
LLAvatarJoint* jointp = js.mJoint;
mMesh->mJointRenderData.put(new LLJointRenderData(&jointp->getWorldMatrix(), &js));
// llinfos << "joint " << joint_count << js.mJoint->getName() << llendl;
// joint_count++;
mMesh->mJointRenderData.push_back(new LLJointRenderData(&jointp->getWorldMatrix(), &js));
LL_DEBUGS() << "joint " << joint_count++ << js.mJoint->getName() << LL_ENDL;
}
// otherwise add our parent and ourselves
else
{
mMesh->mJointRenderData.put(new LLJointRenderData(&current_joint->getParent()->getWorldMatrix(), NULL));
// llinfos << "joint " << joint_count << current_joint->getParent()->getName() << llendl;
// joint_count++;
mMesh->mJointRenderData.put(new LLJointRenderData(&current_joint->getWorldMatrix(), &js));
// llinfos << "joint " << joint_count << current_joint->getName() << llendl;
// joint_count++;
mMesh->mJointRenderData.push_back(new LLJointRenderData(&current_joint->getParent()->getWorldMatrix(), NULL));
LL_DEBUGS() << "joint " << joint_count++ << current_joint->getParent()->getName() << LL_ENDL;
mMesh->mJointRenderData.push_back(new LLJointRenderData(&current_joint->getWorldMatrix(), &js));
LL_DEBUGS() << "joint " << joint_count++ << current_joint->getName() << LL_ENDL;
}
}

View File

@ -29,6 +29,7 @@
#include "llviewervisualparam.h"
#include "llwearabletype.h"
#include <deque>
class LLAvatarAppearance;
class LLDriverParam;

View File

@ -161,8 +161,8 @@ void LLPolyMeshSharedData::freeMeshData()
// mVertFaceMap.deleteAllData();
}
// compate_int is used by the qsort function to sort the index array
int compare_int(const void *a, const void *b);
// compare_int is used by the qsort function to sort the index array
S32 compare_int(const void *a, const void *b);
//-----------------------------------------------------------------------------
// genIndices()
@ -547,10 +547,10 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )
// S32 j;
// for(j = 0; j < 3; j++)
// {
// LLDynamicArray<S32> *face_list = mVertFaceMap.getIfThere(face[j]);
// std::vector<S32> *face_list = mVertFaceMap.getIfThere(face[j]);
// if (!face_list)
// {
// face_list = new LLDynamicArray<S32>;
// face_list = new std::vector<S32>;
// mVertFaceMap.addData(face[j], face_list);
// }
// face_list->put(i);
@ -808,15 +808,8 @@ LLPolyMesh::LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_
//-----------------------------------------------------------------------------
LLPolyMesh::~LLPolyMesh()
{
S32 i;
for (i = 0; i < mJointRenderData.count(); i++)
{
delete mJointRenderData[i];
mJointRenderData[i] = NULL;
}
ll_aligned_free_16(mVertexData);
delete_and_clear(mJointRenderData);
ll_aligned_free_16(mVertexData);
}

View File

@ -36,7 +36,6 @@
#include "llquaternion.h"
#include "llpolymorph.h"
#include "lljoint.h"
//#include "lldarray.h"
class LLSkinJoint;
class LLAvatarAppearance;
@ -322,7 +321,7 @@ public:
void setAvatar(LLAvatarAppearance* avatarp) { mAvatarp = avatarp; }
LLAvatarAppearance* getAvatar() { return mAvatarp; }
LLDynamicArray<LLJointRenderData*> mJointRenderData;
std::vector<LLJointRenderData*> mJointRenderData;
U32 mFaceVertexOffset;
U32 mFaceVertexCount;

View File

@ -28,7 +28,7 @@
// Header Files
//-----------------------------------------------------------------------------
#include "llpreprocessor.h"
#include "llerrorlegacy.h"
#include "llerror.h"
#include "llavatarappearance.h"
#include "llavatarjoint.h"
#include "llpolymorph.h"

View File

@ -39,7 +39,6 @@
//#include "llpolymorph.h"
#include "lljoint.h"
#include "llviewervisualparam.h"
//#include "lldarray.h"
//class LLSkinJoint;
class LLAvatarAppearance;

View File

@ -30,7 +30,6 @@
#include "llavatarappearance.h"
#include "llcrc.h"
#include "imageids.h"
#include "llimagej2c.h"
#include "llimagetga.h"
#include "lldir.h"

View File

@ -28,7 +28,6 @@
#define LL_LLWEARABLE_H
#include "llavatarappearancedefines.h"
#include "llextendedstatus.h"
#include "llpermissions.h"
#include "llsaleinfo.h"
#include "llwearabletype.h"

View File

@ -41,6 +41,7 @@
#include "vorbis/codec.h"
#include "vorbis/vorbisfile.h"
#include <iterator>
#include <deque>
extern LLAudioEngine *gAudiop;
@ -114,7 +115,7 @@ size_t vfs_read(void *ptr, size_t size, size_t nmemb, void *datasource)
}
}
int vfs_seek(void *datasource, ogg_int64_t offset, int whence)
S32 vfs_seek(void *datasource, ogg_int64_t offset, S32 whence)
{
LLVFile *file = (LLVFile *)datasource;
@ -150,7 +151,7 @@ int vfs_seek(void *datasource, ogg_int64_t offset, int whence)
}
}
int vfs_close (void *datasource)
S32 vfs_close (void *datasource)
{
LLVFile *file = (LLVFile *)datasource;
delete file;
@ -209,7 +210,7 @@ BOOL LLVorbisDecodeState::initDecode()
return FALSE;
}
int r = ov_open_callbacks(mInFilep, &mVF, NULL, 0, vfs_callbacks);
S32 r = ov_open_callbacks(mInFilep, &mVF, NULL, 0, vfs_callbacks);
if(r < 0)
{
llwarns << r << " Input to vorbis decode does not appear to be an Ogg bitstream: " << mUUID << llendl;
@ -542,7 +543,7 @@ public:
void processQueue(const F32 num_secs = 0.005);
protected:
LLLinkedQueue<LLUUID> mDecodeQueue;
std::deque<LLUUID> mDecodeQueue;
LLPointer<LLVorbisDecodeState> mCurrentDecodep;
};
@ -617,7 +618,7 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs)
if (!done)
{
if (!mDecodeQueue.getLength())
if (mDecodeQueue.empty())
{
// Nothing else on the queue.
done = TRUE;
@ -625,7 +626,8 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs)
else
{
LLUUID uuid;
mDecodeQueue.pop(uuid);
uuid = mDecodeQueue.front();
mDecodeQueue.pop_front();
if (gAudiop->hasDecodedFile(uuid))
{
// This file has already been decoded, don't decode it again.
@ -683,7 +685,7 @@ BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
{
// Just put it on the decode queue.
//llinfos << "addDecodeRequest for " << uuid << " has local asset file already" << llendl;
mImpl->mDecodeQueue.push(uuid);
mImpl->mDecodeQueue.push_back(uuid);
return TRUE;
}

View File

@ -28,7 +28,6 @@
#include "stdtypes.h"
#include "lllinkedqueue.h"
#include "lluuid.h"
#include "llassettype.h"

View File

@ -187,7 +187,7 @@ void LLAudioEngine::stopInternetStream()
}
// virtual
void LLAudioEngine::pauseInternetStream(int pause)
void LLAudioEngine::pauseInternetStream(S32 pause)
{
if (mStreamingAudioImpl)
mStreamingAudioImpl->pause(pause);

View File

@ -88,7 +88,7 @@ public:
enum LLAudioPlayState
{
// isInternetStreamPlaying() returns an *int*, with
// isInternetStreamPlaying() returns an *S32*, with
// 0 = stopped, 1 = playing, 2 = paused.
AUDIO_STOPPED = 0,
AUDIO_PLAYING = 1,
@ -160,7 +160,7 @@ public:
// Internet stream methods - these will call down into the *mStreamingAudioImpl if it exists
void startInternetStream(const std::string& url);
void stopInternetStream();
void pauseInternetStream(int pause);
void pauseInternetStream(S32 pause);
void updateInternetStream(); // expected to be called often
LLAudioPlayState isInternetStreamPlaying();
// use a value from 0.0 to 1.0, inclusive

View File

@ -49,9 +49,9 @@ class LLStreamingAudio_FMODEX : public LLStreamingAudioInterface
/*virtual*/ void start(const std::string& url);
/*virtual*/ void stop();
/*virtual*/ void pause(int pause);
/*virtual*/ void pause(S32 pause);
/*virtual*/ void update();
/*virtual*/ int isPlaying();
/*virtual*/ S32 isPlaying();
/*virtual*/ void setGain(F32 vol);
/*virtual*/ F32 getGain();
/*virtual*/ std::string getURL();

View File

@ -29,7 +29,7 @@
#include <map>
#include "string_table.h"
#include "llstringtable.h"
#include "lluuid.h"
//-----------------------------------------------------------------------------

View File

@ -35,7 +35,7 @@
#include "lljoint.h"
#include "llmotioncontroller.h"
#include "llvisualparam.h"
#include "string_table.h"
#include "llstringtable.h"
#include "llpointer.h"
#include "llthread.h"

View File

@ -173,27 +173,7 @@ S32 LLGesture::getMaxSerialSize()
LLGestureList::LLGestureList()
: mList(0)
{
// add some gestures for debugging
// LLGesture *gesture = NULL;
/*
gesture = new LLGesture(KEY_F2, MASK_NONE, ":-)",
SND_CHIRP, "dance2", ":-)" );
mList.put(gesture);
gesture = new LLGesture(KEY_F3, MASK_NONE, "/dance",
SND_OBJECT_CREATE, "dance3", "(dances)" );
mList.put(gesture);
gesture = new LLGesture(KEY_F4, MASK_NONE, "/boogie",
LLUUID::null, "dance4", LLStringUtil::null );
mList.put(gesture);
gesture = new LLGesture(KEY_F5, MASK_SHIFT, "/tongue",
LLUUID::null, "Express_Tongue_Out", LLStringUtil::null );
mList.put(gesture);
*/
}
{}
LLGestureList::~LLGestureList()
{
@ -203,12 +183,7 @@ LLGestureList::~LLGestureList()
void LLGestureList::deleteAll()
{
S32 count = mList.count();
for (S32 i = 0; i < count; i++)
{
delete mList.get(i);
}
mList.reset();
delete_and_clear(mList);
}
// Iterates through space delimited tokens in string, triggering any gestures found.
@ -235,9 +210,9 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin
std::string cur_token_lower = *token_iter;
LLStringUtil::toLower(cur_token_lower);
for (S32 i = 0; i < mList.count(); i++)
for (U32 i = 0; i < mList.size(); i++)
{
gesture = mList.get(i);
gesture = mList.at(i);
if (gesture->trigger(cur_token_lower))
{
if( !gesture->getOutputString().empty() )
@ -286,9 +261,9 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin
BOOL LLGestureList::trigger(KEY key, MASK mask)
{
for (S32 i = 0; i < mList.count(); i++)
for (U32 i = 0; i < mList.size(); i++)
{
LLGesture* gesture = mList.get(i);
LLGesture* gesture = mList.at(i);
if( gesture )
{
if (gesture->trigger(key, mask))
@ -308,7 +283,7 @@ BOOL LLGestureList::trigger(KEY key, MASK mask)
U8 *LLGestureList::serialize(U8 *buffer) const
{
// a single S32 serves as the header that tells us how many to read
S32 count = mList.count();
U32 count = mList.size();
htonmemcpy(buffer, &count, MVT_S32, 4);
buffer += sizeof(count);
@ -345,7 +320,7 @@ U8 *LLGestureList::deserialize(U8 *buffer, S32 max_size)
tmp += sizeof(count);
mList.reserve_block(count);
mList.resize(count);
for (S32 i = 0; i < count; i++)
{

View File

@ -31,7 +31,6 @@
#include "llanimationstates.h"
#include "lluuid.h"
#include "llstring.h"
#include "lldarray.h"
class LLGesture
{
@ -67,12 +66,12 @@ public:
static S32 getMaxSerialSize();
protected:
KEY mKey; // usually a function key
MASK mMask; // usually MASK_NONE, or MASK_SHIFT
KEY mKey; // usually a function key
MASK mMask; // usually MASK_NONE, or MASK_SHIFT
std::string mTrigger; // string, no whitespace allowed
std::string mTriggerLower; // lowercase version of mTrigger
LLUUID mSoundItemID; // ItemID of sound to play, LLUUID::null if none
std::string mAnimation; // canonical name of animation or face animation
LLUUID mSoundItemID; // ItemID of sound to play, LLUUID::null if none
std::string mAnimation; // canonical name of animation or face animation
std::string mOutputString; // string to say
static const S32 MAX_SERIAL_SIZE;
@ -91,9 +90,9 @@ public:
BOOL triggerAndReviseString(const std::string &string, std::string* revised_string);
// Used for construction from UI
S32 count() const { return mList.count(); }
virtual LLGesture* get(S32 i) const { return mList.get(i); }
virtual void put(LLGesture* gesture) { mList.put( gesture ); }
S32 count() const { return mList.size(); }
virtual LLGesture* get(S32 i) const { return mList.at(i); }
virtual void put(LLGesture* gesture) { mList.push_back( gesture ); }
void deleteAll();
// non-endian-neutral serialization
@ -106,7 +105,7 @@ protected:
virtual LLGesture *create_gesture(U8 **buffer, S32 max_size);
protected:
LLDynamicArray<LLGesture*> mList;
std::vector<LLGesture*> mList;
static const S32 SERIAL_HEADER_SIZE;
};

View File

@ -560,7 +560,7 @@ void LLJoint::clampRotation(LLQuaternion old_rot, LLQuaternion new_rot)
// LLVector3 old_axis = main_axis * old_rot;
// LLVector3 new_axis = main_axis * new_rot;
// for (S32 i = 0; i < mConstraintSilhouette.count() - 1; i++)
// for (S32 i = 0; i < mConstraintSilhouette.size() - 1; i++)
// {
// LLVector3 vert1 = mConstraintSilhouette[i];
// LLVector3 vert2 = mConstraintSilhouette[i + 1];

View File

@ -33,13 +33,11 @@
#include <string>
#include <list>
#include "linked_lists.h"
#include "v3math.h"
#include "v4math.h"
#include "m4math.h"
#include "llquaternion.h"
#include "xform.h"
#include "lldarray.h"
const S32 LL_CHARACTER_MAX_JOINTS_PER_MESH = 15;
const U32 LL_CHARACTER_MAX_JOINTS = 32; // must be divisible by 4!

View File

@ -135,8 +135,6 @@ void LLJointSolverRP3::setTwist( F32 twist )
//-----------------------------------------------------------------------------
void LLJointSolverRP3::solve()
{
// llinfos << llendl;
// llinfos << "LLJointSolverRP3::solve()" << llendl;
//-------------------------------------------------------------------------
// setup joints in their base rotations
@ -152,15 +150,15 @@ void LLJointSolverRP3::solve()
LLVector3 cPos = mJointC->getWorldPosition();
LLVector3 gPos = mJointGoal->getWorldPosition();
// llinfos << "bPosLocal = " << mJointB->getPosition() << llendl;
// llinfos << "cPosLocal = " << mJointC->getPosition() << llendl;
// llinfos << "bRotLocal = " << mJointB->getRotation() << llendl;
// llinfos << "cRotLocal = " << mJointC->getRotation() << llendl;
// llinfos << "aPos : " << aPos << llendl;
// llinfos << "bPos : " << bPos << llendl;
// llinfos << "cPos : " << cPos << llendl;
// llinfos << "gPos : " << gPos << llendl;
LL_DEBUGS("JointSolver") << "LLJointSolverRP3::solve()" << LL_NEWLINE
<< "bPosLocal = " << mJointB->getPosition() << LL_NEWLINE
<< "cPosLocal = " << mJointC->getPosition() << LL_NEWLINE
<< "bRotLocal = " << mJointB->getRotation() << LL_NEWLINE
<< "cRotLocal = " << mJointC->getRotation() << LL_NEWLINE
<< "aPos : " << aPos << LL_NEWLINE
<< "bPos : " << bPos << LL_NEWLINE
<< "cPos : " << cPos << LL_NEWLINE
<< "gPos : " << gPos << LL_ENDL;
//-------------------------------------------------------------------------
// get the poleVector in world space
@ -184,11 +182,6 @@ void LLJointSolverRP3::solve()
LLVector3 acVec = cPos - aPos;
LLVector3 agVec = gPos - aPos;
// llinfos << "abVec : " << abVec << llendl;
// llinfos << "bcVec : " << bcVec << llendl;
// llinfos << "acVec : " << acVec << llendl;
// llinfos << "agVec : " << agVec << llendl;
//-------------------------------------------------------------------------
// compute needed lengths of those vectors
//-------------------------------------------------------------------------
@ -196,16 +189,19 @@ void LLJointSolverRP3::solve()
F32 bcLen = bcVec.magVec();
F32 agLen = agVec.magVec();
// llinfos << "abLen : " << abLen << llendl;
// llinfos << "bcLen : " << bcLen << llendl;
// llinfos << "agLen : " << agLen << llendl;
//-------------------------------------------------------------------------
// compute component vector of (A->B) orthogonal to (A->C)
//-------------------------------------------------------------------------
LLVector3 abacCompOrthoVec = abVec - acVec * ((abVec * acVec)/(acVec * acVec));
// llinfos << "abacCompOrthoVec : " << abacCompOrthoVec << llendl;
LL_DEBUGS("JointSolver") << "abVec : " << abVec << LL_NEWLINE
<< "bcVec : " << bcVec << LL_NEWLINE
<< "acVec : " << acVec << LL_NEWLINE
<< "agVec : " << agVec << LL_NEWLINE
<< "abLen : " << abLen << LL_NEWLINE
<< "bcLen : " << bcLen << LL_NEWLINE
<< "agLen : " << agLen << LL_NEWLINE
<< "abacCompOrthoVec : " << abacCompOrthoVec << LL_ENDL;
//-------------------------------------------------------------------------
// compute the normal of the original ABC plane (and store for later)
@ -273,13 +269,17 @@ void LLJointSolverRP3::solve()
LLQuaternion bRot(theta - abbcAng, abbcOrthoVec);
// llinfos << "abbcAng : " << abbcAng << llendl;
// llinfos << "abbcOrthoVec : " << abbcOrthoVec << llendl;
// llinfos << "agLenSq : " << agLenSq << llendl;
// llinfos << "cosTheta : " << cosTheta << llendl;
// llinfos << "theta : " << theta << llendl;
// llinfos << "bRot : " << bRot << llendl;
// llinfos << "theta abbcAng theta-abbcAng: " << theta*180.0/F_PI << " " << abbcAng*180.0f/F_PI << " " << (theta - abbcAng)*180.0f/F_PI << llendl;
LL_DEBUGS("JointSolver") << "abbcAng : " << abbcAng << LL_NEWLINE
<< "abbcOrthoVec : " << abbcOrthoVec << LL_NEWLINE
<< "agLenSq : " << agLenSq << LL_NEWLINE
<< "cosTheta : " << cosTheta << LL_NEWLINE
<< "theta : " << theta << LL_NEWLINE
<< "bRot : " << bRot << LL_NEWLINE
<< "theta abbcAng theta-abbcAng: "
<< theta*180.0/F_PI << " "
<< abbcAng*180.0f/F_PI << " "
<< (theta - abbcAng)*180.0f/F_PI
<< LL_ENDL;
//-------------------------------------------------------------------------
// compute rotation that rotates new A->C to A->G
@ -293,9 +293,9 @@ void LLJointSolverRP3::solve()
LLQuaternion cgRot;
cgRot.shortestArc( acVec, agVec );
// llinfos << "bcVec : " << bcVec << llendl;
// llinfos << "acVec : " << acVec << llendl;
// llinfos << "cgRot : " << cgRot << llendl;
LL_DEBUGS("JointSolver") << "bcVec : " << bcVec << LL_NEWLINE
<< "acVec : " << acVec << LL_NEWLINE
<< "cgRot : " << cgRot << LL_ENDL;
// update A->B and B->C with rotation from C to G
abVec = abVec * cgRot;
@ -353,18 +353,16 @@ void LLJointSolverRP3::solve()
pRot.shortestArc( abcNorm, apgNorm );
}
// llinfos << "abcNorm = " << abcNorm << llendl;
// llinfos << "apgNorm = " << apgNorm << llendl;
// llinfos << "pRot = " << pRot << llendl;
//-------------------------------------------------------------------------
// compute twist rotation
//-------------------------------------------------------------------------
LLQuaternion twistRot( mTwist, agVec );
// llinfos << "twist : " << mTwist*180.0/F_PI << llendl;
// llinfos << "agNormVec: " << agNormVec << llendl;
// llinfos << "twistRot : " << twistRot << llendl;
LL_DEBUGS("JointSolver") << "abcNorm = " << abcNorm << LL_NEWLINE
<< "apgNorm = " << apgNorm << LL_NEWLINE
<< "pRot = " << pRot << LL_NEWLINE
<< "twist : " << mTwist*180.0/F_PI << LL_NEWLINE
<< "twistRot : " << twistRot << LL_ENDL;
//-------------------------------------------------------------------------
// compute rotation of A

View File

@ -1263,7 +1263,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if (mJointMotionList->mBasePriority >= LLJoint::ADDITIVE_PRIORITY)
{
mJointMotionList->mBasePriority = (LLJoint::JointPriority)((int)LLJoint::ADDITIVE_PRIORITY-1);
mJointMotionList->mBasePriority = (LLJoint::JointPriority)((S32)LLJoint::ADDITIVE_PRIORITY-1);
mJointMotionList->mMaxPriority = mJointMotionList->mBasePriority;
}
else if (mJointMotionList->mBasePriority < LLJoint::USE_MOTION_PRIORITY)
@ -2288,8 +2288,7 @@ LLKeyframeMotion::JointConstraint::JointConstraint(JointConstraintSharedData* sh
mTargetVolume = NULL;
mFixupDistanceRMS = 0.f;
int i;
for (i=0; i<MAX_CHAIN_LENGTH; ++i)
for (S32 i=0; i<MAX_CHAIN_LENGTH; ++i)
{
mJointLengths[i] = 0.f;
mJointLengthFractions[i] = 0.f;

View File

@ -37,7 +37,6 @@
#include "lljointstate.h"
#include "v3math.h"
#include "llquaternion.h"
#include "linked_lists.h"
#include "llkeyframemotion.h"
//-----------------------------------------------------------------------------

View File

@ -54,7 +54,7 @@ LLMotion::LLMotion( const LLUUID &id ) :
mDeactivateCallback(NULL),
mDeactivateCallbackUserData(NULL)
{
for (int i=0; i<3; ++i)
for (S32 i=0; i<3; ++i)
memset(&mJointSignature[i][0], 0, sizeof(U8) * LL_CHARACTER_MAX_JOINTS);
}

View File

@ -33,7 +33,6 @@
#include "lljointstate.h"
#include "lljoint.h"
#include "llmap.h"
#include "llpointer.h"
#include <map>

View File

@ -26,22 +26,20 @@ include_directories(
# ${LLCOMMON_LIBRARIES})
set(llcommon_SOURCE_FILES
imageids.cpp
indra_constants.cpp
llallocator.cpp
llallocator_heap_profile.cpp
llapp.cpp
llapr.cpp
llassettype.cpp
llavatarname.cpp
llbase32.cpp
llbase64.cpp
llbitpack.cpp
llcommon.cpp
llcommonutils.cpp
llcoros.cpp
llcrc.cpp
llcriticaldamp.cpp
llcursortypes.cpp
lldate.cpp
lldependencies.cpp
lldictionary.cpp
@ -58,7 +56,6 @@ set(llcommon_SOURCE_FILES
llfile.cpp
llfindlocale.cpp
llfixedbuffer.cpp
llfoldertype.cpp
llformat.cpp
llframetimer.cpp
llheartbeat.cpp
@ -68,7 +65,6 @@ set(llcommon_SOURCE_FILES
llleaplistener.cpp
llliveappconfig.cpp
lllivefile.cpp
lllog.cpp
llmd5.cpp
llmemory.cpp
llmemorystream.cpp
@ -76,7 +72,6 @@ set(llcommon_SOURCE_FILES
llmetricperformancetester.cpp
llmortician.cpp
llmutex.cpp
lloptioninterface.cpp
llptrto.cpp
llpredicate.cpp
llprocess.cpp
@ -90,7 +85,6 @@ set(llcommon_SOURCE_FILES
llsdserialize.cpp
llsdserialize_xml.cpp
llsdutil.cpp
llsecondlifeurls.cpp
llsingleton.cpp
llstacktrace.cpp
llstreamqueue.cpp
@ -116,45 +110,33 @@ set(llcommon_SOURCE_FILES
set(llcommon_HEADER_FILES
CMakeLists.txt
bitpack.h
ctype_workaround.h
fix_macros.h
imageids.h
indra_constants.h
linden_common.h
linked_lists.h
llaccountingcost.h
llallocator.h
llallocator_heap_profile.h
llagentconstants.h
llavatarname.h
llapp.h
llapr.h
llassettype.h
llavatarconstants.h
llbase32.h
llbase64.h
llbitpack.h
llboost.h
llchat.h
llclickaction.h
llcommon.h
llcommonutils.h
llcoros.h
llcrc.h
llcriticaldamp.h
llcursortypes.h
lldarray.h
lldate.h
lldefs.h
lldependencies.h
lldeleteutils.h
lldepthstack.h
lldictionary.h
lldoubledispatch.h
llendianswizzle.h
llerror.h
llerrorcontrol.h
llerrorlegacy.h
llerrorthread.h
llevent.h
lleventapi.h
@ -163,30 +145,25 @@ set(llcommon_HEADER_FILES
lleventfilter.h
llevents.h
lleventemitter.h
llextendedstatus.h
llfasttimer.h
llfile.h
llfindlocale.h
llfixedbuffer.h
llfoldertype.h
llformat.h
llframetimer.h
llhandle.h
llhash.h
llheartbeat.h
llhttpstatuscodes.h
llindexedvector.h
llinitparam.h
llinstancetracker.h
llkeythrottle.h
llleap.h
llleaplistener.h
lllistenerwrapper.h
lllinkedqueue.h
llliveappconfig.h
lllivefile.h
lllog.h
lllslconstants.h
llmap.h
llmd5.h
llmemory.h
llmemorystream.h
@ -194,8 +171,6 @@ set(llcommon_HEADER_FILES
llmetricperformancetester.h
llmortician.h
llmutex.h
llnametable.h
lloptioninterface.h
llpointer.h
llpredicate.h
llpreprocessor.h
@ -215,11 +190,9 @@ set(llcommon_HEADER_FILES
llsdserialize.h
llsdserialize_xml.h
llsdutil.h
llsecondlifeurls.h
llsimplehash.h
llsingleton.h
llstacktrace.h
llstatenums.h
llstl.h
llstreamqueue.h
llstreamtools.h
@ -239,18 +212,12 @@ set(llcommon_HEADER_FILES
llunit.h
lluri.h
lluuid.h
llversionserver.h
llwin32headers.h
llwin32headerslean.h
llworkerthread.h
ll_template_cast.h
roles_constants.h
stdenums.h
stdtypes.h
string_table.h
stringize.h
timer.h
timing.h
u64.h
)

View File

@ -1,73 +0,0 @@
/**
* @file imageids.cpp
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "imageids.h"
#include "lluuid.h"
//
// USE OF THIS FILE IS DEPRECATED
//
// Please use viewerart.ini and the standard
// art import path. // indicates if file is only
// on dataserver, or also
// pre-cached on viewer
// Grass Images
const LLUUID IMG_SMOKE ("b4ba225c-373f-446d-9f7e-6cb7b5cf9b3d"); // VIEWER
const LLUUID IMG_DEFAULT ("d2114404-dd59-4a4d-8e6c-49359e91bbf0"); // VIEWER
const LLUUID IMG_SUN ("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver
const LLUUID IMG_MOON ("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver
const LLUUID IMG_CLOUD_POOF ("fc4b9f0b-d008-45c6-96a4-01dd947ac621"); // dataserver
const LLUUID IMG_SHOT ("35f217a3-f618-49cf-bbca-c86d486551a9"); // dataserver
const LLUUID IMG_SPARK ("d2e75ac1-d0fb-4532-820e-a20034ac814d"); // dataserver
const LLUUID IMG_FIRE ("aca40aa8-44cf-44ca-a0fa-93e1a2986f82"); // dataserver
const LLUUID IMG_FACE_SELECT ("a85ac674-cb75-4af6-9499-df7c5aaf7a28"); // face selector
const LLUUID IMG_DEFAULT_AVATAR ("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"); // dataserver
const LLUUID IMG_INVISIBLE ("3a367d1c-bef1-6d43-7595-e88c1e3aadb3"); // dataserver
const LLUUID IMG_EXPLOSION ("68edcf47-ccd7-45b8-9f90-1649d7f12806"); // On dataserver
const LLUUID IMG_EXPLOSION_2 ("21ce046c-83fe-430a-b629-c7660ac78d7c"); // On dataserver
const LLUUID IMG_EXPLOSION_3 ("fedea30a-1be8-47a6-bc06-337a04a39c4b"); // On dataserver
const LLUUID IMG_EXPLOSION_4 ("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); // On dataserver
const LLUUID IMG_SMOKE_POOF ("1e63e323-5fe0-452e-92f8-b98bd0f764e3"); // On dataserver
const LLUUID IMG_BIG_EXPLOSION_1 ("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); // On dataserver
const LLUUID IMG_BIG_EXPLOSION_2 ("9c8eca51-53d5-42a7-bb58-cef070395db8"); // On dataserver
const LLUUID IMG_BLOOM1 ("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); // VIEWER
const LLUUID TERRAIN_DIRT_DETAIL ("0bc58228-74a0-7e83-89bc-5c23464bcec5"); // VIEWER
const LLUUID TERRAIN_GRASS_DETAIL ("63338ede-0037-c4fd-855b-015d77112fc8"); // VIEWER
const LLUUID TERRAIN_MOUNTAIN_DETAIL ("303cd381-8560-7579-23f1-f0a880799740"); // VIEWER
const LLUUID TERRAIN_ROCK_DETAIL ("53a2f406-4895-1d13-d541-d2e3b86bc19c"); // VIEWER
const LLUUID DEFAULT_WATER_NORMAL ("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); // VIEWER
const LLUUID IMG_CHECKERBOARD_RGBA ("2585a0f3-4163-6dd1-0f34-ad48cb909e25"); // dataserver

View File

@ -1,70 +0,0 @@
/**
* @file imageids.h
* @brief Temporary holder for image IDs
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_IMAGEIDS_H
#define LL_IMAGEIDS_H
//
// USE OF THIS FILE IS DEPRECATED
//
// Please use viewerart.ini and the standard
// art import path.
class LLUUID;
LL_COMMON_API extern const LLUUID IMG_SMOKE;
LL_COMMON_API extern const LLUUID IMG_DEFAULT;
LL_COMMON_API extern const LLUUID IMG_SUN;
LL_COMMON_API extern const LLUUID IMG_MOON;
LL_COMMON_API extern const LLUUID IMG_CLOUD_POOF;
LL_COMMON_API extern const LLUUID IMG_SHOT;
LL_COMMON_API extern const LLUUID IMG_SPARK;
LL_COMMON_API extern const LLUUID IMG_FIRE;
LL_COMMON_API extern const LLUUID IMG_FACE_SELECT;
LL_COMMON_API extern const LLUUID IMG_DEFAULT_AVATAR;
LL_COMMON_API extern const LLUUID IMG_INVISIBLE;
LL_COMMON_API extern const LLUUID IMG_EXPLOSION;
LL_COMMON_API extern const LLUUID IMG_EXPLOSION_2;
LL_COMMON_API extern const LLUUID IMG_EXPLOSION_3;
LL_COMMON_API extern const LLUUID IMG_EXPLOSION_4;
LL_COMMON_API extern const LLUUID IMG_SMOKE_POOF;
LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_1;
LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_2;
LL_COMMON_API extern const LLUUID IMG_BLOOM1;
LL_COMMON_API extern const LLUUID TERRAIN_DIRT_DETAIL;
LL_COMMON_API extern const LLUUID TERRAIN_GRASS_DETAIL;
LL_COMMON_API extern const LLUUID TERRAIN_MOUNTAIN_DETAIL;
LL_COMMON_API extern const LLUUID TERRAIN_ROCK_DETAIL;
LL_COMMON_API extern const LLUUID DEFAULT_WATER_NORMAL;
LL_COMMON_API extern const LLUUID IMG_CHECKERBOARD_RGBA;
#endif

View File

@ -35,6 +35,35 @@ const LLUUID LL_UUID_ALL_AGENTS("44e87126-e794-4ded-05b3-7c42da3d5cdb");
// Governor Linden's agent id.
const LLUUID ALEXANDRIA_LINDEN_ID("ba2a564a-f0f1-4b82-9c61-b7520bfcd09f");
const LLUUID GOVERNOR_LINDEN_ID("3d6181b0-6a4b-97ef-18d8-722652995cf1");
const LLUUID REALESTATE_LINDEN_ID("3d6181b0-6a4b-97ef-18d8-722652995cf1");
// Maintenance's group id.
const LLUUID MAINTENANCE_GROUP_ID("dc7b21cd-3c89-fcaa-31c8-25f9ffd224cd");
// Grass Images
const LLUUID IMG_SMOKE ("b4ba225c-373f-446d-9f7e-6cb7b5cf9b3d"); // VIEWER
const LLUUID IMG_DEFAULT ("d2114404-dd59-4a4d-8e6c-49359e91bbf0"); // VIEWER
const LLUUID IMG_SUN ("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver
const LLUUID IMG_MOON ("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver
const LLUUID IMG_SHOT ("35f217a3-f618-49cf-bbca-c86d486551a9"); // dataserver
const LLUUID IMG_SPARK ("d2e75ac1-d0fb-4532-820e-a20034ac814d"); // dataserver
const LLUUID IMG_FIRE ("aca40aa8-44cf-44ca-a0fa-93e1a2986f82"); // dataserver
const LLUUID IMG_FACE_SELECT ("a85ac674-cb75-4af6-9499-df7c5aaf7a28"); // face selector
const LLUUID IMG_DEFAULT_AVATAR ("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"); // dataserver
const LLUUID IMG_INVISIBLE ("3a367d1c-bef1-6d43-7595-e88c1e3aadb3"); // dataserver
const LLUUID IMG_EXPLOSION ("68edcf47-ccd7-45b8-9f90-1649d7f12806"); // On dataserver
const LLUUID IMG_EXPLOSION_2 ("21ce046c-83fe-430a-b629-c7660ac78d7c"); // On dataserver
const LLUUID IMG_EXPLOSION_3 ("fedea30a-1be8-47a6-bc06-337a04a39c4b"); // On dataserver
const LLUUID IMG_EXPLOSION_4 ("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); // On dataserver
const LLUUID IMG_SMOKE_POOF ("1e63e323-5fe0-452e-92f8-b98bd0f764e3"); // On dataserver
const LLUUID IMG_BIG_EXPLOSION_1 ("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); // On dataserver
const LLUUID IMG_BIG_EXPLOSION_2 ("9c8eca51-53d5-42a7-bb58-cef070395db8"); // On dataserver
const LLUUID IMG_BLOOM1 ("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); // VIEWER
const LLUUID TERRAIN_DIRT_DETAIL ("0bc58228-74a0-7e83-89bc-5c23464bcec5"); // VIEWER
const LLUUID TERRAIN_GRASS_DETAIL ("63338ede-0037-c4fd-855b-015d77112fc8"); // VIEWER
const LLUUID TERRAIN_MOUNTAIN_DETAIL ("303cd381-8560-7579-23f1-f0a880799740"); // VIEWER
const LLUUID TERRAIN_ROCK_DETAIL ("53a2f406-4895-1d13-d541-d2e3b86bc19c"); // VIEWER
const LLUUID DEFAULT_WATER_NORMAL ("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); // VIEWER

View File

@ -31,122 +31,28 @@
class LLUUID;
// At 45 Hz collisions seem stable and objects seem
// to settle down at a reasonable rate.
// JC 3/18/2003
// const F32 PHYSICS_TIMESTEP = 1.f / 45.f;
// This must be a #define due to anal retentive restrictions on const expressions
// CG 2008-06-05
#define PHYSICS_TIMESTEP (1.f / 45.f)
const F32 COLLISION_TOLERANCE = 0.1f;
const F32 HALF_COLLISION_TOLERANCE = 0.05f;
// Time constants
const U32 HOURS_PER_LINDEN_DAY = 4;
const U32 DAYS_PER_LINDEN_YEAR = 11;
const U32 SEC_PER_LINDEN_DAY = HOURS_PER_LINDEN_DAY * 60 * 60;
const U32 SEC_PER_LINDEN_YEAR = DAYS_PER_LINDEN_YEAR * SEC_PER_LINDEN_DAY;
static const F32 REGION_WIDTH_METERS = 256.f;
static const S32 REGION_WIDTH_UNITS = 256;
static const U32 REGION_WIDTH_U32 = 256;
const F32 REGION_HEIGHT_METERS = 4096.f;
// Bits for simulator performance query flags
enum LAND_STAT_FLAGS
{
STAT_FILTER_BY_PARCEL = 0x00000001,
STAT_FILTER_BY_OWNER = 0x00000002,
STAT_FILTER_BY_OBJECT = 0x00000004,
STAT_FILTER_BY_PARCEL_NAME = 0x00000008,
STAT_REQUEST_LAST_ENTRY = 0x80000000,
};
enum LAND_STAT_REPORT_TYPE
{
STAT_REPORT_TOP_SCRIPTS = 0,
STAT_REPORT_TOP_COLLIDERS
};
const U32 STAT_FILTER_MASK = 0x1FFFFFFF;
// Region absolute limits
static const S32 REGION_AGENT_COUNT_MIN = 1;
static const S32 REGION_AGENT_COUNT_MAX = 200; // Must fit in U8 for the moment (RegionInfo msg)
static const S32 REGION_PRIM_COUNT_MIN = 0;
static const S32 REGION_PRIM_COUNT_MAX = 40000;
static const F32 REGION_PRIM_BONUS_MIN = 1.0;
static const F32 REGION_PRIM_BONUS_MAX = 10.0;
// Default maximum number of tasks/prims per region.
const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000;
const F32 MIN_AGENT_DEPTH = 0.30f;
const F32 DEFAULT_AGENT_DEPTH = 0.45f;
const F32 MAX_AGENT_DEPTH = 0.60f;
const F32 MIN_AGENT_WIDTH = 0.40f;
const F32 DEFAULT_AGENT_WIDTH = 0.60f;
const F32 MAX_AGENT_WIDTH = 0.80f;
const F32 MIN_AGENT_HEIGHT = 1.1f;
const F32 DEFAULT_AGENT_HEIGHT = 1.9f;
const F32 MAX_AGENT_HEIGHT = 2.45f;
// For linked sets
const S32 MAX_CHILDREN_PER_TASK = 255;
const S32 MAX_CHILDREN_PER_PHYSICAL_TASK = 32;
const S32 MAX_JOINTS_PER_OBJECT = 1; // limiting to 1 until Havok 2.x
const char* const DEFAULT_DMZ_SPACE_SERVER = "192.168.0.140";
const char* const DEFAULT_DMZ_USER_SERVER = "192.168.0.140";
const char* const DEFAULT_DMZ_DATA_SERVER = "192.168.0.140";
const char* const DEFAULT_DMZ_ASSET_SERVER = "http://asset.dmz.lindenlab.com:80";
const char* const DEFAULT_AGNI_SPACE_SERVER = "63.211.139.100";
const char* const DEFAULT_AGNI_USER_SERVER = "63.211.139.100";
const char* const DEFAULT_AGNI_DATA_SERVER = "63.211.139.100";
const char* const DEFAULT_AGNI_ASSET_SERVER = "http://asset.agni.lindenlab.com:80";
// Information about what ports are for what services is in the wiki Name Space Ports page
// https://wiki.lindenlab.com/wiki/Name_Space_Ports
const char* const DEFAULT_LOCAL_ASSET_SERVER = "http://localhost:12041/asset/tmp";
const char* const LOCAL_ASSET_URL_FORMAT = "http://%s:12041/asset";
const U32 DEFAULT_LAUNCHER_PORT = 12029;
//const U32 DEFAULT_BIGBOARD_PORT = 12030; // Deprecated
//const U32 DEFAULT_QUERYSIM_PORT = 12031; // Deprecated
const U32 DEFAULT_DATA_SERVER_PORT = 12032;
const U32 DEFAULT_SPACE_SERVER_PORT = 12033;
const U32 DEFAULT_VIEWER_PORT = 12034;
const U32 DEFAULT_SIMULATOR_PORT = 12035;
const U32 DEFAULT_USER_SERVER_PORT = 12036;
const U32 DEFAULT_RPC_SERVER_PORT = 12037;
const U32 DEFAULT_LOG_DATA_SERVER_PORT = 12039;
const U32 DEFAULT_BACKBONE_PORT = 12040;
const U32 DEFAULT_LOCAL_ASSET_PORT = 12041;
//const U32 DEFAULT_BACKBONE_CAP_PORT = 12042; // Deprecated
const U32 DEFAULT_CAP_PROXY_PORT = 12043;
const U32 DEFAULT_INV_DATA_SERVER_PORT = 12044;
const U32 DEFAULT_CGI_SERVICES_PORT = 12045;
// Mapserver uses ports 12124 - 12139 to allow multiple mapservers to run
// on a single host for map tile generation. JC
const U32 DEFAULT_MAPSERVER_PORT = 12124;
// For automatic port discovery when running multiple viewers on one host
const U32 PORT_DISCOVERY_RANGE_MIN = 13000;
const U32 PORT_DISCOVERY_RANGE_MAX = PORT_DISCOVERY_RANGE_MIN + 50;
const char LAND_LAYER_CODE = 'L';
const char WATER_LAYER_CODE = 'W';
const char WIND_LAYER_CODE = '7';
const char CLOUD_LAYER_CODE = '8';
enum ETerrainBrushType
{
// the valid brush numbers cannot be reordered, because they
// are used in the binary LSL format as arguments to llModifyLand()
E_LANDBRUSH_LEVEL = 0,
E_LANDBRUSH_RAISE = 1,
E_LANDBRUSH_LOWER = 2,
E_LANDBRUSH_SMOOTH = 3,
E_LANDBRUSH_NOISE = 4,
E_LANDBRUSH_REVERT = 5,
E_LANDBRUSH_INVALID = 6
};
// keys
// Bit masks for various keyboard modifier keys.
@ -265,89 +171,43 @@ LL_COMMON_API extern const LLUUID LL_UUID_ALL_AGENTS;
LL_COMMON_API extern const LLUUID ALEXANDRIA_LINDEN_ID;
LL_COMMON_API extern const LLUUID GOVERNOR_LINDEN_ID;
LL_COMMON_API extern const LLUUID REALESTATE_LINDEN_ID;
// Maintenance's group id.
LL_COMMON_API extern const LLUUID MAINTENANCE_GROUP_ID;
// Flags for kick message
const U32 KICK_FLAGS_DEFAULT = 0x0;
const U32 KICK_FLAGS_FREEZE = 1 << 0;
const U32 KICK_FLAGS_UNFREEZE = 1 << 1;
// image ids
LL_COMMON_API extern const LLUUID IMG_SMOKE;
const U8 UPD_NONE = 0x00;
const U8 UPD_POSITION = 0x01;
const U8 UPD_ROTATION = 0x02;
const U8 UPD_SCALE = 0x04;
const U8 UPD_LINKED_SETS = 0x08;
const U8 UPD_UNIFORM = 0x10; // used with UPD_SCALE
LL_COMMON_API extern const LLUUID IMG_DEFAULT;
// Agent Update Flags (U8)
const U8 AU_FLAGS_NONE = 0x00;
const U8 AU_FLAGS_HIDETITLE = 0x01;
const U8 AU_FLAGS_CLIENT_AUTOPILOT = 0x02;
LL_COMMON_API extern const LLUUID IMG_SUN;
LL_COMMON_API extern const LLUUID IMG_MOON;
LL_COMMON_API extern const LLUUID IMG_SHOT;
LL_COMMON_API extern const LLUUID IMG_SPARK;
LL_COMMON_API extern const LLUUID IMG_FIRE;
LL_COMMON_API extern const LLUUID IMG_FACE_SELECT;
LL_COMMON_API extern const LLUUID IMG_DEFAULT_AVATAR;
LL_COMMON_API extern const LLUUID IMG_INVISIBLE;
// start location constants
const U32 START_LOCATION_ID_LAST = 0;
const U32 START_LOCATION_ID_HOME = 1;
const U32 START_LOCATION_ID_DIRECT = 2; // for direct teleport
const U32 START_LOCATION_ID_PARCEL = 3; // for teleports to a parcel
const U32 START_LOCATION_ID_TELEHUB = 4; // for teleports to a spawnpoint
const U32 START_LOCATION_ID_URL = 5;
const U32 START_LOCATION_ID_COUNT = 6;
LL_COMMON_API extern const LLUUID IMG_EXPLOSION;
LL_COMMON_API extern const LLUUID IMG_EXPLOSION_2;
LL_COMMON_API extern const LLUUID IMG_EXPLOSION_3;
LL_COMMON_API extern const LLUUID IMG_EXPLOSION_4;
LL_COMMON_API extern const LLUUID IMG_SMOKE_POOF;
// group constants
const U32 GROUP_MIN_SIZE = 2;
LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_1;
LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_2;
LL_COMMON_API extern const LLUUID IMG_BLOOM1;
LL_COMMON_API extern const LLUUID TERRAIN_DIRT_DETAIL;
LL_COMMON_API extern const LLUUID TERRAIN_GRASS_DETAIL;
LL_COMMON_API extern const LLUUID TERRAIN_MOUNTAIN_DETAIL;
LL_COMMON_API extern const LLUUID TERRAIN_ROCK_DETAIL;
LL_COMMON_API extern const LLUUID DEFAULT_WATER_NORMAL;
// gMaxAgentGroups is now sent by login.cgi, which
// looks it up from globals.xml.
//
// For now we need an old default value however,
// so the viewer can be deployed ahead of login.cgi.
//
const S32 DEFAULT_MAX_AGENT_GROUPS = 25;
// radius within which a chat message is fully audible
const F32 CHAT_WHISPER_RADIUS = 10.f;
const F32 CHAT_NORMAL_RADIUS = 20.f;
const F32 CHAT_SHOUT_RADIUS = 100.f;
const F32 CHAT_MAX_RADIUS = CHAT_SHOUT_RADIUS;
const F32 CHAT_MAX_RADIUS_BY_TWO = CHAT_MAX_RADIUS / 2.f;
// squared editions of the above for distance checks
const F32 CHAT_WHISPER_RADIUS_SQUARED = CHAT_WHISPER_RADIUS * CHAT_WHISPER_RADIUS;
const F32 CHAT_NORMAL_RADIUS_SQUARED = CHAT_NORMAL_RADIUS * CHAT_NORMAL_RADIUS;
const F32 CHAT_SHOUT_RADIUS_SQUARED = CHAT_SHOUT_RADIUS * CHAT_SHOUT_RADIUS;
const F32 CHAT_MAX_RADIUS_SQUARED = CHAT_SHOUT_RADIUS_SQUARED;
const F32 CHAT_MAX_RADIUS_BY_TWO_SQUARED = CHAT_MAX_RADIUS_BY_TWO * CHAT_MAX_RADIUS_BY_TWO;
// this times above gives barely audible radius
const F32 CHAT_BARELY_AUDIBLE_FACTOR = 2.0f;
// distance in front of speaking agent the sphere is centered
const F32 CHAT_WHISPER_OFFSET = 5.f;
const F32 CHAT_NORMAL_OFFSET = 10.f;
const F32 CHAT_SHOUT_OFFSET = 50.f;
// first clean starts at 3 AM
const S32 SANDBOX_FIRST_CLEAN_HOUR = 3;
// clean every <n> hours
const S32 SANDBOX_CLEAN_FREQ = 12;
const F32 WIND_SCALE_HACK = 2.0f; // hack to make wind speeds more realistic
enum ETerrainBrushType
{
// the valid brush numbers cannot be reordered, because they
// are used in the binary LSL format as arguments to llModifyLand()
E_LANDBRUSH_LEVEL = 0,
E_LANDBRUSH_RAISE = 1,
E_LANDBRUSH_LOWER = 2,
E_LANDBRUSH_SMOOTH = 3,
E_LANDBRUSH_NOISE = 4,
E_LANDBRUSH_REVERT = 5,
E_LANDBRUSH_INVALID = 6
};
// media commands
const U32 PARCEL_MEDIA_COMMAND_STOP = 0;
@ -365,51 +225,101 @@ const U32 PARCEL_MEDIA_COMMAND_SIZE = 11;
const U32 PARCEL_MEDIA_COMMAND_DESC = 12;
const U32 PARCEL_MEDIA_COMMAND_LOOP_SET = 13;
// map item types
const U32 MAP_ITEM_TELEHUB = 0x01;
const U32 MAP_ITEM_PG_EVENT = 0x02;
const U32 MAP_ITEM_MATURE_EVENT = 0x03;
//const U32 MAP_ITEM_POPULAR = 0x04; // No longer supported, 2009-03-02 KLW
//const U32 MAP_ITEM_AGENT_COUNT = 0x05;
const U32 MAP_ITEM_AGENT_LOCATIONS = 0x06;
const U32 MAP_ITEM_LAND_FOR_SALE = 0x07;
const U32 MAP_ITEM_CLASSIFIED = 0x08;
const U32 MAP_ITEM_ADULT_EVENT = 0x09;
const U32 MAP_ITEM_LAND_FOR_SALE_ADULT = 0x0a;
// Region map layer numbers
const S32 MAP_SIM_OBJECTS = 0;
const S32 MAP_SIM_TERRAIN = 1;
const S32 MAP_SIM_LAND_FOR_SALE = 2; // Transparent alpha overlay of land for sale
const S32 MAP_SIM_IMAGE_TYPES = 3; // Number of map layers
const S32 MAP_SIM_INFO_MASK = 0x00FFFFFF; // Agent access may be stuffed into upper byte
const S32 MAP_SIM_LAYER_MASK = 0x0000FFFF; // Layer info is in lower 16 bits
const S32 MAP_SIM_RETURN_NULL_SIMS = 0x00010000;
const S32 MAP_SIM_PRELUDE = 0x00020000;
// Crash reporter behavior
const S32 CRASH_BEHAVIOR_ASK = 0;
const S32 CRASH_BEHAVIOR_ALWAYS_SEND = 1;
const S32 CRASH_BEHAVIOR_NEVER_SEND = 2;
// Export/Import return values
const S32 EXPORT_SUCCESS = 0;
const S32 EXPORT_ERROR_PERMISSIONS = -1;
const S32 EXPORT_ERROR_UNKNOWN = -2;
// This is how long the sim will try to teleport you before giving up.
const F32 TELEPORT_EXPIRY = 15.0f;
// Additional time (in seconds) to wait per attachment
const F32 TELEPORT_EXPIRY_PER_ATTACHMENT = 3.f;
// The maximum size of an object extra parameters binary (packed) block
#define MAX_OBJECT_PARAMS_SIZE 1024
const S32 CHAT_CHANNEL_DEBUG = S32_MAX;
// PLEASE don't add constants here. Every dev will have to do
// a complete rebuild. Try to find another shared header file,
// like llregionflags.h, lllslconstants.h, llagentconstants.h,
// or create a new one. JC
// agent constants
const U32 CONTROL_AT_POS_INDEX = 0;
const U32 CONTROL_AT_NEG_INDEX = 1;
const U32 CONTROL_LEFT_POS_INDEX = 2;
const U32 CONTROL_LEFT_NEG_INDEX = 3;
const U32 CONTROL_UP_POS_INDEX = 4;
const U32 CONTROL_UP_NEG_INDEX = 5;
const U32 CONTROL_PITCH_POS_INDEX = 6;
const U32 CONTROL_PITCH_NEG_INDEX = 7;
const U32 CONTROL_YAW_POS_INDEX = 8;
const U32 CONTROL_YAW_NEG_INDEX = 9;
const U32 CONTROL_FAST_AT_INDEX = 10;
const U32 CONTROL_FAST_LEFT_INDEX = 11;
const U32 CONTROL_FAST_UP_INDEX = 12;
const U32 CONTROL_FLY_INDEX = 13;
const U32 CONTROL_STOP_INDEX = 14;
const U32 CONTROL_FINISH_ANIM_INDEX = 15;
const U32 CONTROL_STAND_UP_INDEX = 16;
const U32 CONTROL_SIT_ON_GROUND_INDEX = 17;
const U32 CONTROL_MOUSELOOK_INDEX = 18;
const U32 CONTROL_NUDGE_AT_POS_INDEX = 19;
const U32 CONTROL_NUDGE_AT_NEG_INDEX = 20;
const U32 CONTROL_NUDGE_LEFT_POS_INDEX = 21;
const U32 CONTROL_NUDGE_LEFT_NEG_INDEX = 22;
const U32 CONTROL_NUDGE_UP_POS_INDEX = 23;
const U32 CONTROL_NUDGE_UP_NEG_INDEX = 24;
const U32 CONTROL_TURN_LEFT_INDEX = 25;
const U32 CONTROL_TURN_RIGHT_INDEX = 26;
const U32 CONTROL_AWAY_INDEX = 27;
const U32 CONTROL_LBUTTON_DOWN_INDEX = 28;
const U32 CONTROL_LBUTTON_UP_INDEX = 29;
const U32 CONTROL_ML_LBUTTON_DOWN_INDEX = 30;
const U32 CONTROL_ML_LBUTTON_UP_INDEX = 31;
const U32 TOTAL_CONTROLS = 32;
const U32 AGENT_CONTROL_AT_POS = 0x1 << CONTROL_AT_POS_INDEX; // 0x00000001
const U32 AGENT_CONTROL_AT_NEG = 0x1 << CONTROL_AT_NEG_INDEX; // 0x00000002
const U32 AGENT_CONTROL_LEFT_POS = 0x1 << CONTROL_LEFT_POS_INDEX; // 0x00000004
const U32 AGENT_CONTROL_LEFT_NEG = 0x1 << CONTROL_LEFT_NEG_INDEX; // 0x00000008
const U32 AGENT_CONTROL_UP_POS = 0x1 << CONTROL_UP_POS_INDEX; // 0x00000010
const U32 AGENT_CONTROL_UP_NEG = 0x1 << CONTROL_UP_NEG_INDEX; // 0x00000020
const U32 AGENT_CONTROL_PITCH_POS = 0x1 << CONTROL_PITCH_POS_INDEX; // 0x00000040
const U32 AGENT_CONTROL_PITCH_NEG = 0x1 << CONTROL_PITCH_NEG_INDEX; // 0x00000080
const U32 AGENT_CONTROL_YAW_POS = 0x1 << CONTROL_YAW_POS_INDEX; // 0x00000100
const U32 AGENT_CONTROL_YAW_NEG = 0x1 << CONTROL_YAW_NEG_INDEX; // 0x00000200
const U32 AGENT_CONTROL_FAST_AT = 0x1 << CONTROL_FAST_AT_INDEX; // 0x00000400
const U32 AGENT_CONTROL_FAST_LEFT = 0x1 << CONTROL_FAST_LEFT_INDEX; // 0x00000800
const U32 AGENT_CONTROL_FAST_UP = 0x1 << CONTROL_FAST_UP_INDEX; // 0x00001000
const U32 AGENT_CONTROL_FLY = 0x1 << CONTROL_FLY_INDEX; // 0x00002000
const U32 AGENT_CONTROL_STOP = 0x1 << CONTROL_STOP_INDEX; // 0x00004000
const U32 AGENT_CONTROL_FINISH_ANIM = 0x1 << CONTROL_FINISH_ANIM_INDEX; // 0x00008000
const U32 AGENT_CONTROL_STAND_UP = 0x1 << CONTROL_STAND_UP_INDEX; // 0x00010000
const U32 AGENT_CONTROL_SIT_ON_GROUND = 0x1 << CONTROL_SIT_ON_GROUND_INDEX; // 0x00020000
const U32 AGENT_CONTROL_MOUSELOOK = 0x1 << CONTROL_MOUSELOOK_INDEX; // 0x00040000
const U32 AGENT_CONTROL_NUDGE_AT_POS = 0x1 << CONTROL_NUDGE_AT_POS_INDEX; // 0x00080000
const U32 AGENT_CONTROL_NUDGE_AT_NEG = 0x1 << CONTROL_NUDGE_AT_NEG_INDEX; // 0x00100000
const U32 AGENT_CONTROL_NUDGE_LEFT_POS = 0x1 << CONTROL_NUDGE_LEFT_POS_INDEX; // 0x00200000
const U32 AGENT_CONTROL_NUDGE_LEFT_NEG = 0x1 << CONTROL_NUDGE_LEFT_NEG_INDEX; // 0x00400000
const U32 AGENT_CONTROL_NUDGE_UP_POS = 0x1 << CONTROL_NUDGE_UP_POS_INDEX; // 0x00800000
const U32 AGENT_CONTROL_NUDGE_UP_NEG = 0x1 << CONTROL_NUDGE_UP_NEG_INDEX; // 0x01000000
const U32 AGENT_CONTROL_TURN_LEFT = 0x1 << CONTROL_TURN_LEFT_INDEX; // 0x02000000
const U32 AGENT_CONTROL_TURN_RIGHT = 0x1 << CONTROL_TURN_RIGHT_INDEX; // 0x04000000
const U32 AGENT_CONTROL_AWAY = 0x1 << CONTROL_AWAY_INDEX; // 0x08000000
const U32 AGENT_CONTROL_LBUTTON_DOWN = 0x1 << CONTROL_LBUTTON_DOWN_INDEX; // 0x10000000
const U32 AGENT_CONTROL_LBUTTON_UP = 0x1 << CONTROL_LBUTTON_UP_INDEX; // 0x20000000
const U32 AGENT_CONTROL_ML_LBUTTON_DOWN = 0x1 << CONTROL_ML_LBUTTON_DOWN_INDEX; // 0x40000000
const U32 AGENT_CONTROL_ML_LBUTTON_UP = ((U32)0x1) << CONTROL_ML_LBUTTON_UP_INDEX; // 0x80000000
// move these up so that we can hide them in "State" for object updates
// (for now)
const U32 AGENT_ATTACH_OFFSET = 4;
const U32 AGENT_ATTACH_MASK = 0xf << AGENT_ATTACH_OFFSET;
// RN: this method swaps the upper and lower nibbles to maintain backward
// compatibility with old objects that only used the upper nibble
#define ATTACHMENT_ID_FROM_STATE(state) ((S32)((((U8)state & AGENT_ATTACH_MASK) >> 4) | (((U8)state & ~AGENT_ATTACH_MASK) << 4)))
// DO NOT CHANGE THE SEQUENCE OF THIS LIST!!
const U8 CLICK_ACTION_NONE = 0;
const U8 CLICK_ACTION_TOUCH = 0;
const U8 CLICK_ACTION_SIT = 1;
const U8 CLICK_ACTION_BUY = 2;
const U8 CLICK_ACTION_PAY = 3;
const U8 CLICK_ACTION_OPEN = 4;
const U8 CLICK_ACTION_PLAY = 5;
const U8 CLICK_ACTION_OPEN_MEDIA = 6;
const U8 CLICK_ACTION_ZOOM = 7;
// DO NOT CHANGE THE SEQUENCE OF THIS LIST!!
#endif

View File

@ -1,937 +0,0 @@
/**
* @file linked_lists.h
* @brief LLLinkedList class header amd implementation file.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LINKED_LISTS_H
#define LL_LINKED_LISTS_H
/**
* Provides a standard doubly linked list for fun and profit
* Utilizes a neat trick off of Flipcode where the back pointer is a
* pointer to a pointer, allowing easier transfer of nodes between lists, &c
* And a template class, of course
*/
#include "llerror.h"
template <class DATA_TYPE> class LLLinkedList
{
public:
friend class LLLinkNode;
// External interface
// basic constructor
LLLinkedList() : mHead(NULL), mCurrentp(NULL), mInsertBefore(NULL)
{
mCurrentp = mHead.mNextp;
mCurrentOperatingp = mHead.mNextp;
mCount = 0;
}
// basic constructor
LLLinkedList(BOOL (*insert_before)(DATA_TYPE *data_new, DATA_TYPE *data_tested)) : mHead(NULL), mCurrentp(NULL), mInsertBefore(insert_before)
{
mCurrentp = mHead.mNextp;
mCurrentOperatingp = mHead.mNextp;
mCount = 0;
}
// destructor destroys list and nodes, but not data in nodes
~LLLinkedList()
{
removeAllNodes();
}
// set mInsertBefore
void setInsertBefore(BOOL (*insert_before)(DATA_TYPE *data_new, DATA_TYPE *data_tested))
{
mInsertBefore = insert_before;
}
//
// WARNING!!!!!!!
// addData and addDataSorted are NOT O(1) operations, but O(n) because they check
// for existence of the data in the linked list first. Why, I don't know - djs
// If you don't care about dupes, use addDataNoCheck
//
// put data into a node and stick it at the front of the list
inline BOOL addData(DATA_TYPE *data);
// put data into a node and sort into list by mInsertBefore()
// calls normal add if mInsertBefore isn't set
inline BOOL addDataSorted(DATA_TYPE *data);
inline BOOL addDataNoCheck(DATA_TYPE *data);
// bubbleSortList
// does an improved bubble sort of the list . . . works best with almost sorted data
// does nothing if mInsertBefore isn't set
// Nota Bene: Swaps are accomplished by swapping data pointers
inline void bubbleSortList();
// put data into a node and stick it at the end of the list
inline BOOL addDataAtEnd(DATA_TYPE *data);
// returns number of items in the list
inline S32 getLength() const;
inline BOOL isEmpty();
// search the list starting at mHead.mNextp and remove the link with mDatap == data
// leave mCurrentp and mCurrentOperatingp on the next entry
// return TRUE if found, FALSE if not found
inline BOOL removeData(DATA_TYPE *data);
// search the list starting at mHead.mNextp and delete the link with mDatap == data
// leave mCurrentp and mCurrentOperatingp on the next entry
// return TRUE if found, FALSE if not found
inline BOOL deleteData(DATA_TYPE *data);
// remove all nodes from the list and delete the associated data
inline void deleteAllData();
// remove all nodes from the list but do not delete data
inline void removeAllNodes();
// check to see if data is in list
// if TRUE then mCurrentp and mCurrentOperatingp point to data
inline BOOL checkData(DATA_TYPE *data);
// place mCurrentp on first node
inline void resetList();
// return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp
inline DATA_TYPE *getCurrentData();
// same as getCurrentData() but a more intuitive name for the operation
inline DATA_TYPE *getNextData();
// reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp
inline DATA_TYPE *getFirstData();
// reset the list and return the data at position n, set mCurentOperatingp to that node and bump mCurrentp
// Note: n is zero-based
inline DATA_TYPE *getNthData( U32 n);
// reset the list and return the last data in it, set mCurentOperatingp to that node and bump mCurrentp
inline DATA_TYPE *getLastData();
// remove the Node at mCurentOperatingp
// leave mCurrentp and mCurentOperatingp on the next entry
inline void removeCurrentData();
// remove the Node at mCurentOperatingp and add it to newlist
// leave mCurrentp and mCurentOperatingp on the next entry
void moveCurrentData(LLLinkedList *newlist, BOOL b_sort);
BOOL moveData(DATA_TYPE *data, LLLinkedList *newlist, BOOL b_sort);
// delete the Node at mCurentOperatingp
// leave mCurrentp anf mCurentOperatingp on the next entry
void deleteCurrentData();
private:
// node that actually contains the data
class LLLinkNode
{
public:
// assign the mDatap pointer
LLLinkNode(DATA_TYPE *data) : mDatap(data), mNextp(NULL), mPrevpp(NULL)
{
}
// destructor does not, by default, destroy associated data
// however, the mDatap must be NULL to ensure that we aren't causing memory leaks
~LLLinkNode()
{
if (mDatap)
{
llerror("Attempting to call LLLinkNode destructor with a non-null mDatap!", 1);
}
}
// delete associated data and NULL out pointer
void deleteData()
{
delete mDatap;
mDatap = NULL;
}
// NULL out pointer
void removeData()
{
mDatap = NULL;
}
DATA_TYPE *mDatap;
LLLinkNode *mNextp;
LLLinkNode **mPrevpp;
};
// add a node at the front of the list
void addData(LLLinkNode *node)
{
// don't allow NULL to be passed to addData
if (!node)
{
llerror("NULL pointer passed to LLLinkedList::addData", 0);
}
// add the node to the front of the list
node->mPrevpp = &mHead.mNextp;
node->mNextp = mHead.mNextp;
// if there's something in the list, fix its back pointer
if (node->mNextp)
{
node->mNextp->mPrevpp = &node->mNextp;
}
mHead.mNextp = node;
}
LLLinkNode mHead; // fake head node. . . makes pointer operations faster and easier
LLLinkNode *mCurrentp; // mCurrentp is the Node that getCurrentData returns
LLLinkNode *mCurrentOperatingp; // this is the node that the various mumbleCurrentData functions act on
BOOL (*mInsertBefore)(DATA_TYPE *data_new, DATA_TYPE *data_tested); // user function set to allow sorted lists
U32 mCount;
};
template <class DATA_TYPE>
BOOL LLLinkedList<DATA_TYPE>::addData(DATA_TYPE *data)
{
// don't allow NULL to be passed to addData
if (!data)
{
llerror("NULL pointer passed to LLLinkedList::addData", 0);
}
LLLinkNode *tcurr = mCurrentp;
LLLinkNode *tcurrop = mCurrentOperatingp;
if ( checkData(data))
{
mCurrentp = tcurr;
mCurrentOperatingp = tcurrop;
return FALSE;
}
// make the new node
LLLinkNode *temp = new LLLinkNode(data);
// add the node to the front of the list
temp->mPrevpp = &mHead.mNextp;
temp->mNextp = mHead.mNextp;
// if there's something in the list, fix its back pointer
if (temp->mNextp)
{
temp->mNextp->mPrevpp = &temp->mNextp;
}
mHead.mNextp = temp;
mCurrentp = tcurr;
mCurrentOperatingp = tcurrop;
mCount++;
return TRUE;
}
template <class DATA_TYPE>
BOOL LLLinkedList<DATA_TYPE>::addDataNoCheck(DATA_TYPE *data)
{
// don't allow NULL to be passed to addData
if (!data)
{
llerror("NULL pointer passed to LLLinkedList::addData", 0);
}
LLLinkNode *tcurr = mCurrentp;
LLLinkNode *tcurrop = mCurrentOperatingp;
// make the new node
LLLinkNode *temp = new LLLinkNode(data);
// add the node to the front of the list
temp->mPrevpp = &mHead.mNextp;
temp->mNextp = mHead.mNextp;
// if there's something in the list, fix its back pointer
if (temp->mNextp)
{
temp->mNextp->mPrevpp = &temp->mNextp;
}
mHead.mNextp = temp;
mCurrentp = tcurr;
mCurrentOperatingp = tcurrop;
mCount++;
return TRUE;
}
template <class DATA_TYPE>
BOOL LLLinkedList<DATA_TYPE>::addDataSorted(DATA_TYPE *data)
{
LLLinkNode *tcurr = mCurrentp;
LLLinkNode *tcurrop = mCurrentOperatingp;
// don't allow NULL to be passed to addData
if (!data)
{
llerror("NULL pointer passed to LLLinkedList::addDataSorted", 0);
}
if (checkData(data))
{
// restore
mCurrentp = tcurr;
mCurrentOperatingp = tcurrop;
return FALSE;
}
// mInsertBefore not set?
if (!mInsertBefore)
{
addData(data);
// restore
mCurrentp = tcurr;
mCurrentOperatingp = tcurrop;
return FALSE;
}
// empty list?
if (!mHead.mNextp)
{
addData(data);
// restore
mCurrentp = tcurr;
mCurrentOperatingp = tcurrop;
return TRUE;
}
// make the new node
LLLinkNode *temp = new LLLinkNode(data);
// walk the list until mInsertBefore returns true
mCurrentp = mHead.mNextp;
while (mCurrentp->mNextp)
{
if (mInsertBefore(data, mCurrentp->mDatap))
{
// insert before the current one
temp->mPrevpp = mCurrentp->mPrevpp;
temp->mNextp = mCurrentp;
*(temp->mPrevpp) = temp;
mCurrentp->mPrevpp = &temp->mNextp;
// restore
mCurrentp = tcurr;
mCurrentOperatingp = tcurrop;
mCount++;
return TRUE;
}
else
{
mCurrentp = mCurrentp->mNextp;
}
}
// on the last element, add before?
if (mInsertBefore(data, mCurrentp->mDatap))
{
// insert before the current one
temp->mPrevpp = mCurrentp->mPrevpp;
temp->mNextp = mCurrentp;
*(temp->mPrevpp) = temp;
mCurrentp->mPrevpp = &temp->mNextp;
// restore
mCurrentp = tcurr;
mCurrentOperatingp = tcurrop;
}
else // insert after
{
temp->mPrevpp = &mCurrentp->mNextp;
temp->mNextp = NULL;
mCurrentp->mNextp = temp;
// restore
mCurrentp = tcurr;
mCurrentOperatingp = tcurrop;
}
mCount++;
return TRUE;
}
template <class DATA_TYPE>
void LLLinkedList<DATA_TYPE>::bubbleSortList()
{
// mInsertBefore not set
if (!mInsertBefore)
{
return;
}
LLLinkNode *tcurr = mCurrentp;
LLLinkNode *tcurrop = mCurrentOperatingp;
BOOL b_swapped = FALSE;
DATA_TYPE *temp;
// Nota Bene: This will break if more than 0x7FFFFFFF members in list!
S32 length = 0x7FFFFFFF;
S32 count = 0;
do
{
b_swapped = FALSE;
mCurrentp = mHead.mNextp;
count = 0;
while ( (count + 1 < length)
&&(mCurrentp))
{
if (mCurrentp->mNextp)
{
if (!mInsertBefore(mCurrentp->mDatap, mCurrentp->mNextp->mDatap))
{
// swap data pointers!
temp = mCurrentp->mDatap;
mCurrentp->mDatap = mCurrentp->mNextp->mDatap;
mCurrentp->mNextp->mDatap = temp;
b_swapped = TRUE;
}
}
else
{
break;
}
count++;
mCurrentp = mCurrentp->mNextp;
}
length = count;
} while (b_swapped);
// restore
mCurrentp = tcurr;
mCurrentOperatingp = tcurrop;
}
template <class DATA_TYPE>
BOOL LLLinkedList<DATA_TYPE>::addDataAtEnd(DATA_TYPE *data)
{
LLLinkNode *tcurr = mCurrentp;
LLLinkNode *tcurrop = mCurrentOperatingp;
// don't allow NULL to be passed to addData
if (!data)
{
llerror("NULL pointer passed to LLLinkedList::addData", 0);
}
if (checkData(data))
{
mCurrentp = tcurr;
mCurrentOperatingp = tcurrop;
return FALSE;
}
// make the new node
LLLinkNode *temp = new LLLinkNode(data);
// add the node to the end of the list
// if empty, add to the front and be done with it
if (!mHead.mNextp)
{
temp->mPrevpp = &mHead.mNextp;
temp->mNextp = NULL;
mHead.mNextp = temp;
}
else
{
// otherwise, walk to the end of the list
mCurrentp = mHead.mNextp;
while (mCurrentp->mNextp)
{
mCurrentp = mCurrentp->mNextp;
}
temp->mPrevpp = &mCurrentp->mNextp;
temp->mNextp = NULL;
mCurrentp->mNextp = temp;
}
// restore
mCurrentp = tcurr;
mCurrentOperatingp = tcurrop;
mCount++;
return TRUE;
}
// returns number of items in the list
template <class DATA_TYPE>
S32 LLLinkedList<DATA_TYPE>::getLength() const
{
// S32 length = 0;
// for (LLLinkNode* temp = mHead.mNextp; temp != NULL; temp = temp->mNextp)
// {
// length++;
// }
return mCount;
}
template <class DATA_TYPE>
BOOL LLLinkedList<DATA_TYPE>::isEmpty()
{
return (mCount == 0);
}
// search the list starting at mHead.mNextp and remove the link with mDatap == data
// leave mCurrentp and mCurrentOperatingp on the next entry
// return TRUE if found, FALSE if not found
template <class DATA_TYPE>
BOOL LLLinkedList<DATA_TYPE>::removeData(DATA_TYPE *data)
{
BOOL b_found = FALSE;
// don't allow NULL to be passed to addData
if (!data)
{
llerror("NULL pointer passed to LLLinkedList::removeData", 0);
}
LLLinkNode *tcurr = mCurrentp;
LLLinkNode *tcurrop = mCurrentOperatingp;
mCurrentp = mHead.mNextp;
mCurrentOperatingp = mHead.mNextp;
while (mCurrentOperatingp)
{
if (mCurrentOperatingp->mDatap == data)
{
b_found = TRUE;
// remove the node
// if there is a next one, fix it
if (mCurrentOperatingp->mNextp)
{
mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp;
}
*(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp;
// remove the LLLinkNode
// if we were on the one we want to delete, bump the cached copies
if (mCurrentOperatingp == tcurrop)
{
tcurrop = tcurr = mCurrentOperatingp->mNextp;
}
else if (mCurrentOperatingp == tcurr)
{
tcurrop = tcurr = mCurrentOperatingp->mNextp;
}
mCurrentp = mCurrentOperatingp->mNextp;
mCurrentOperatingp->removeData();
delete mCurrentOperatingp;
mCurrentOperatingp = mCurrentp;
mCount--;
break;
}
mCurrentOperatingp = mCurrentOperatingp->mNextp;
}
// restore
mCurrentp = tcurr;
mCurrentOperatingp = tcurrop;
return b_found;
}
// search the list starting at mHead.mNextp and delete the link with mDatap == data
// leave mCurrentp and mCurrentOperatingp on the next entry
// return TRUE if found, FALSE if not found
template <class DATA_TYPE>
BOOL LLLinkedList<DATA_TYPE>::deleteData(DATA_TYPE *data)
{
BOOL b_found = FALSE;
// don't allow NULL to be passed to addData
if (!data)
{
llerror("NULL pointer passed to LLLinkedList::removeData", 0);
}
LLLinkNode *tcurr = mCurrentp;
LLLinkNode *tcurrop = mCurrentOperatingp;
mCurrentp = mHead.mNextp;
mCurrentOperatingp = mHead.mNextp;
while (mCurrentOperatingp)
{
if (mCurrentOperatingp->mDatap == data)
{
b_found = TRUE;
// remove the node
// if there is a next one, fix it
if (mCurrentOperatingp->mNextp)
{
mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp;
}
*(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp;
// delete the LLLinkNode
// if we were on the one we want to delete, bump the cached copies
if (mCurrentOperatingp == tcurrop)
{
tcurrop = tcurr = mCurrentOperatingp->mNextp;
}
// and delete the associated data
llassert(mCurrentOperatingp);
mCurrentp = mCurrentOperatingp->mNextp;
mCurrentOperatingp->deleteData();
delete mCurrentOperatingp;
mCurrentOperatingp = mCurrentp;
mCount--;
break;
}
mCurrentOperatingp = mCurrentOperatingp->mNextp;
}
// restore
mCurrentp = tcurr;
mCurrentOperatingp = tcurrop;
return b_found;
}
// remove all nodes from the list and delete the associated data
template <class DATA_TYPE>
void LLLinkedList<DATA_TYPE>::deleteAllData()
{
LLLinkNode *temp;
// reset mCurrentp
mCurrentp = mHead.mNextp;
while (mCurrentp)
{
temp = mCurrentp->mNextp;
mCurrentp->deleteData();
delete mCurrentp;
mCurrentp = temp;
}
// reset mHead and mCurrentp
mHead.mNextp = NULL;
mCurrentp = mHead.mNextp;
mCurrentOperatingp = mHead.mNextp;
mCount = 0;
}
// remove all nodes from the list but do not delete data
template <class DATA_TYPE>
void LLLinkedList<DATA_TYPE>::removeAllNodes()
{
LLLinkNode *temp;
// reset mCurrentp
mCurrentp = mHead.mNextp;
while (mCurrentp)
{
temp = mCurrentp->mNextp;
mCurrentp->removeData();
delete mCurrentp;
mCurrentp = temp;
}
// reset mHead and mCurrentp
mHead.mNextp = NULL;
mCurrentp = mHead.mNextp;
mCurrentOperatingp = mHead.mNextp;
mCount = 0;
}
// check to see if data is in list
// if TRUE then mCurrentp and mCurrentOperatingp point to data
template <class DATA_TYPE>
BOOL LLLinkedList<DATA_TYPE>::checkData(DATA_TYPE *data)
{
// reset mCurrentp
mCurrentp = mHead.mNextp;
while (mCurrentp)
{
if (mCurrentp->mDatap == data)
{
mCurrentOperatingp = mCurrentp;
return TRUE;
}
mCurrentp = mCurrentp->mNextp;
}
mCurrentOperatingp = mCurrentp;
return FALSE;
}
// place mCurrentp on first node
template <class DATA_TYPE>
void LLLinkedList<DATA_TYPE>::resetList()
{
mCurrentp = mHead.mNextp;
mCurrentOperatingp = mHead.mNextp;
}
// return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp
template <class DATA_TYPE>
DATA_TYPE *LLLinkedList<DATA_TYPE>::getCurrentData()
{
if (mCurrentp)
{
mCurrentOperatingp = mCurrentp;
mCurrentp = mCurrentp->mNextp;
return mCurrentOperatingp->mDatap;
}
else
{
return NULL;
}
}
// same as getCurrentData() but a more intuitive name for the operation
template <class DATA_TYPE>
DATA_TYPE *LLLinkedList<DATA_TYPE>::getNextData()
{
if (mCurrentp)
{
mCurrentOperatingp = mCurrentp;
mCurrentp = mCurrentp->mNextp;
return mCurrentOperatingp->mDatap;
}
else
{
return NULL;
}
}
// reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp
template <class DATA_TYPE>
DATA_TYPE *LLLinkedList<DATA_TYPE>::getFirstData()
{
mCurrentp = mHead.mNextp;
mCurrentOperatingp = mHead.mNextp;
if (mCurrentp)
{
mCurrentOperatingp = mCurrentp;
mCurrentp = mCurrentp->mNextp;
return mCurrentOperatingp->mDatap;
}
else
{
return NULL;
}
}
// Note: n is zero-based
template <class DATA_TYPE>
DATA_TYPE *LLLinkedList<DATA_TYPE>::getNthData( U32 n )
{
mCurrentOperatingp = mHead.mNextp;
// if empty, return NULL
if (!mCurrentOperatingp)
{
return NULL;
}
for( U32 i = 0; i < n; i++ )
{
mCurrentOperatingp = mCurrentOperatingp->mNextp;
if( !mCurrentOperatingp )
{
return NULL;
}
}
mCurrentp = mCurrentOperatingp->mNextp;
return mCurrentOperatingp->mDatap;
}
// reset the list and return the last data in it, set mCurentOperatingp to that node and bump mCurrentp
template <class DATA_TYPE>
DATA_TYPE *LLLinkedList<DATA_TYPE>::getLastData()
{
mCurrentOperatingp = mHead.mNextp;
// if empty, return NULL
if (!mCurrentOperatingp)
return NULL;
// walk until we're pointing at the last entry
while (mCurrentOperatingp->mNextp)
{
mCurrentOperatingp = mCurrentOperatingp->mNextp;
}
mCurrentp = mCurrentOperatingp->mNextp;
return mCurrentOperatingp->mDatap;
}
// remove the Node at mCurentOperatingp
// leave mCurrentp and mCurentOperatingp on the next entry
// return TRUE if found, FALSE if not found
template <class DATA_TYPE>
void LLLinkedList<DATA_TYPE>::removeCurrentData()
{
if (mCurrentOperatingp)
{
// remove the node
// if there is a next one, fix it
if (mCurrentOperatingp->mNextp)
{
mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp;
}
*(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp;
// remove the LLLinkNode
mCurrentp = mCurrentOperatingp->mNextp;
mCurrentOperatingp->removeData();
delete mCurrentOperatingp;
mCount--;
mCurrentOperatingp = mCurrentp;
}
}
// remove the Node at mCurentOperatingp and add it to newlist
// leave mCurrentp and mCurentOperatingp on the next entry
// return TRUE if found, FALSE if not found
template <class DATA_TYPE>
void LLLinkedList<DATA_TYPE>::moveCurrentData(LLLinkedList *newlist, BOOL b_sort)
{
if (mCurrentOperatingp)
{
// remove the node
// if there is a next one, fix it
if (mCurrentOperatingp->mNextp)
{
mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp;
}
*(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp;
// remove the LLLinkNode
mCurrentp = mCurrentOperatingp->mNextp;
// move the node to the new list
newlist->addData(mCurrentOperatingp);
if (b_sort)
bubbleSortList();
mCurrentOperatingp = mCurrentp;
}
}
template <class DATA_TYPE>
BOOL LLLinkedList<DATA_TYPE>::moveData(DATA_TYPE *data, LLLinkedList *newlist, BOOL b_sort)
{
BOOL b_found = FALSE;
// don't allow NULL to be passed to addData
if (!data)
{
llerror("NULL pointer passed to LLLinkedList::removeData", 0);
}
LLLinkNode *tcurr = mCurrentp;
LLLinkNode *tcurrop = mCurrentOperatingp;
mCurrentp = mHead.mNextp;
mCurrentOperatingp = mHead.mNextp;
while (mCurrentOperatingp)
{
if (mCurrentOperatingp->mDatap == data)
{
b_found = TRUE;
// remove the node
// if there is a next one, fix it
if (mCurrentOperatingp->mNextp)
{
mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp;
}
*(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp;
// if we were on the one we want to delete, bump the cached copies
if ( (mCurrentOperatingp == tcurrop)
||(mCurrentOperatingp == tcurr))
{
tcurrop = tcurr = mCurrentOperatingp->mNextp;
}
// remove the LLLinkNode
mCurrentp = mCurrentOperatingp->mNextp;
// move the node to the new list
newlist->addData(mCurrentOperatingp);
if (b_sort)
newlist->bubbleSortList();
mCurrentOperatingp = mCurrentp;
break;
}
mCurrentOperatingp = mCurrentOperatingp->mNextp;
}
// restore
mCurrentp = tcurr;
mCurrentOperatingp = tcurrop;
return b_found;
}
// delete the Node at mCurentOperatingp
// leave mCurrentp anf mCurentOperatingp on the next entry
// return TRUE if found, FALSE if not found
template <class DATA_TYPE>
void LLLinkedList<DATA_TYPE>::deleteCurrentData()
{
if (mCurrentOperatingp)
{
// remove the node
// if there is a next one, fix it
if (mCurrentOperatingp->mNextp)
{
mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp;
}
*(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp;
// remove the LLLinkNode
mCurrentp = mCurrentOperatingp->mNextp;
mCurrentOperatingp->deleteData();
if (mCurrentOperatingp->mDatap)
llerror("This is impossible!", 0);
delete mCurrentOperatingp;
mCurrentOperatingp = mCurrentp;
mCount--;
}
}
#endif

View File

@ -1,177 +0,0 @@
/**
* @file ll_template_cast.h
* @author Nat Goodspeed
* @date 2009-11-21
* @brief Define ll_template_cast function
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#if ! defined(LL_LL_TEMPLATE_CAST_H)
#define LL_LL_TEMPLATE_CAST_H
/**
* Implementation for ll_template_cast() (q.v.).
*
* Default implementation: trying to cast two completely unrelated types
* returns 0. Typically you'd specify T and U as pointer types, but in fact T
* can be any type that can be initialized with 0.
*/
template <typename T, typename U>
struct ll_template_cast_impl
{
T operator()(U)
{
return 0;
}
};
/**
* ll_template_cast<T>(some_value) is for use in a template function when
* some_value might be of arbitrary type, but you want to recognize type T
* specially.
*
* It's designed for use with pointer types. Example:
* @code
* struct SpecialClass
* {
* void someMethod(const std::string&) const;
* };
*
* template <class REALCLASS>
* void somefunc(const REALCLASS& instance)
* {
* const SpecialClass* ptr = ll_template_cast<const SpecialClass*>(&instance);
* if (ptr)
* {
* ptr->someMethod("Call method only available on SpecialClass");
* }
* }
* @endcode
*
* Why is this better than dynamic_cast<>? Because unless OtherClass is
* polymorphic, the following won't even compile (gcc 4.0.1):
* @code
* OtherClass other;
* SpecialClass* ptr = dynamic_cast<SpecialClass*>(&other);
* @endcode
* to say nothing of this:
* @code
* void function(int);
* SpecialClass* ptr = dynamic_cast<SpecialClass*>(&function);
* @endcode
* ll_template_cast handles these kinds of cases by returning 0.
*/
template <typename T, typename U>
T ll_template_cast(U value)
{
return ll_template_cast_impl<T, U>()(value);
}
/**
* Implementation for ll_template_cast() (q.v.).
*
* Implementation for identical types: return same value.
*/
template <typename T>
struct ll_template_cast_impl<T, T>
{
T operator()(T value)
{
return value;
}
};
/**
* LL_TEMPLATE_CONVERTIBLE(dest, source) asserts that, for a value @c s of
* type @c source, <tt>ll_template_cast<dest>(s)</tt> will return @c s --
* presuming that @c source can be converted to @c dest by the normal rules of
* C++.
*
* By default, <tt>ll_template_cast<dest>(s)</tt> will return 0 unless @c s's
* type is literally identical to @c dest. (This is because of the
* straightforward application of template specialization rules.) That can
* lead to surprising results, e.g.:
*
* @code
* Foo myFoo;
* const Foo* fooptr = ll_template_cast<const Foo*>(&myFoo);
* @endcode
*
* Here @c fooptr will be 0 because <tt>&myFoo</tt> is of type <tt>Foo*</tt>
* -- @em not <tt>const Foo*</tt>. (Declaring <tt>const Foo myFoo;</tt> would
* force the compiler to do the right thing.)
*
* More disappointingly:
* @code
* struct Base {};
* struct Subclass: public Base {};
* Subclass object;
* Base* ptr = ll_template_cast<Base*>(&object);
* @endcode
*
* Here @c ptr will be 0 because <tt>&object</tt> is of type
* <tt>Subclass*</tt> rather than <tt>Base*</tt>. We @em want this cast to
* succeed, but without our help ll_template_cast can't recognize it.
*
* The following would suffice:
* @code
* LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*);
* ...
* Base* ptr = ll_template_cast<Base*>(&object);
* @endcode
*
* However, as noted earlier, this is easily fooled:
* @code
* const Base* ptr = ll_template_cast<const Base*>(&object);
* @endcode
* would still produce 0 because we haven't yet seen:
* @code
* LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*);
* @endcode
*
* @TODO
* This macro should use Boost type_traits facilities for stripping and
* re-adding @c const and @c volatile qualifiers so that invoking
* LL_TEMPLATE_CONVERTIBLE(dest, source) will automatically generate all
* permitted permutations. It's really not fair to the coder to require
* separate:
* @code
* LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*);
* LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*);
* LL_TEMPLATE_CONVERTIBLE(const Base*, const Subclass*);
* @endcode
*
* (Naturally we omit <tt>LL_TEMPLATE_CONVERTIBLE(Base*, const Subclass*)</tt>
* because that's not permitted by normal C++ assignment anyway.)
*/
#define LL_TEMPLATE_CONVERTIBLE(DEST, SOURCE) \
template <> \
struct ll_template_cast_impl<DEST, SOURCE> \
{ \
DEST operator()(SOURCE wrapper) \
{ \
return wrapper; \
} \
}
#endif /* ! defined(LL_LL_TEMPLATE_CAST_H) */

View File

@ -1,86 +0,0 @@
/**
* @file llaccountingcost.h
* @
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_ACCOUNTINGQUOTA_H
#define LL_ACCOUNTINGQUOTA_H
struct ParcelQuota
{
ParcelQuota( F32 ownerRenderCost, F32 ownerPhysicsCost, F32 ownerNetworkCost, F32 ownerSimulationCost,
F32 groupRenderCost, F32 groupPhysicsCost, F32 groupNetworkCost, F32 groupSimulationCost,
F32 otherRenderCost, F32 otherPhysicsCost, F32 otherNetworkCost, F32 otherSimulationCost,
F32 tempRenderCost, F32 tempPhysicsCost, F32 tempNetworkCost, F32 tempSimulationCost,
F32 selectedRenderCost, F32 selectedPhysicsCost, F32 selectedNetworkCost, F32 selectedSimulationCost,
F32 parcelCapacity )
: mOwnerRenderCost( ownerRenderCost ), mOwnerPhysicsCost( ownerPhysicsCost )
, mOwnerNetworkCost( ownerNetworkCost ), mOwnerSimulationCost( ownerSimulationCost )
, mGroupRenderCost( groupRenderCost ), mGroupPhysicsCost( groupPhysicsCost )
, mGroupNetworkCost( groupNetworkCost ), mGroupSimulationCost( groupSimulationCost )
, mOtherRenderCost( otherRenderCost ), mOtherPhysicsCost( otherPhysicsCost )
, mOtherNetworkCost( otherNetworkCost ), mOtherSimulationCost( otherSimulationCost )
, mTempRenderCost( tempRenderCost ), mTempPhysicsCost( tempPhysicsCost )
, mTempNetworkCost( tempNetworkCost ), mTempSimulationCost( tempSimulationCost )
, mSelectedRenderCost( tempRenderCost ), mSelectedPhysicsCost( tempPhysicsCost )
, mSelectedNetworkCost( tempNetworkCost ), mSelectedSimulationCost( selectedSimulationCost )
, mParcelCapacity( parcelCapacity )
{
}
ParcelQuota(){}
F32 mOwnerRenderCost, mOwnerPhysicsCost, mOwnerNetworkCost, mOwnerSimulationCost;
F32 mGroupRenderCost, mGroupPhysicsCost, mGroupNetworkCost, mGroupSimulationCost;
F32 mOtherRenderCost, mOtherPhysicsCost, mOtherNetworkCost, mOtherSimulationCost;
F32 mTempRenderCost, mTempPhysicsCost, mTempNetworkCost, mTempSimulationCost;
F32 mSelectedRenderCost, mSelectedPhysicsCost, mSelectedNetworkCost, mSelectedSimulationCost;
F32 mParcelCapacity;
};
//SelectionQuota atm does not require a id
struct SelectionCost
{
SelectionCost( /*LLTransactionID transactionId, */ F32 physicsCost, F32 networkCost, F32 simulationCost )
//: mTransactionId( transactionId)
: mPhysicsCost( physicsCost )
, mNetworkCost( networkCost )
, mSimulationCost( simulationCost )
{
}
SelectionCost()
: mPhysicsCost( 0.0f )
, mNetworkCost( 0.0f )
, mSimulationCost( 0.0f )
{}
F32 mPhysicsCost, mNetworkCost, mSimulationCost;
//LLTransactionID mTransactionId;
};
typedef enum { Roots = 0 , Prims } eSelectionType;
#endif

View File

@ -1,159 +0,0 @@
/**
* @file llagentconstants.h
* @author James Cook, Andrew Meadows, Richard Nelson
* @brief Shared constants through the system for agents.
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLAGENTCONSTANTS_H
#define LL_LLAGENTCONSTANTS_H
const U32 CONTROL_AT_POS_INDEX = 0;
const U32 CONTROL_AT_NEG_INDEX = 1;
const U32 CONTROL_LEFT_POS_INDEX = 2;
const U32 CONTROL_LEFT_NEG_INDEX = 3;
const U32 CONTROL_UP_POS_INDEX = 4;
const U32 CONTROL_UP_NEG_INDEX = 5;
const U32 CONTROL_PITCH_POS_INDEX = 6;
const U32 CONTROL_PITCH_NEG_INDEX = 7;
const U32 CONTROL_YAW_POS_INDEX = 8;
const U32 CONTROL_YAW_NEG_INDEX = 9;
const U32 CONTROL_FAST_AT_INDEX = 10;
const U32 CONTROL_FAST_LEFT_INDEX = 11;
const U32 CONTROL_FAST_UP_INDEX = 12;
const U32 CONTROL_FLY_INDEX = 13;
const U32 CONTROL_STOP_INDEX = 14;
const U32 CONTROL_FINISH_ANIM_INDEX = 15;
const U32 CONTROL_STAND_UP_INDEX = 16;
const U32 CONTROL_SIT_ON_GROUND_INDEX = 17;
const U32 CONTROL_MOUSELOOK_INDEX = 18;
const U32 CONTROL_NUDGE_AT_POS_INDEX = 19;
const U32 CONTROL_NUDGE_AT_NEG_INDEX = 20;
const U32 CONTROL_NUDGE_LEFT_POS_INDEX = 21;
const U32 CONTROL_NUDGE_LEFT_NEG_INDEX = 22;
const U32 CONTROL_NUDGE_UP_POS_INDEX = 23;
const U32 CONTROL_NUDGE_UP_NEG_INDEX = 24;
const U32 CONTROL_TURN_LEFT_INDEX = 25;
const U32 CONTROL_TURN_RIGHT_INDEX = 26;
const U32 CONTROL_AWAY_INDEX = 27;
const U32 CONTROL_LBUTTON_DOWN_INDEX = 28;
const U32 CONTROL_LBUTTON_UP_INDEX = 29;
const U32 CONTROL_ML_LBUTTON_DOWN_INDEX = 30;
const U32 CONTROL_ML_LBUTTON_UP_INDEX = 31;
const U32 TOTAL_CONTROLS = 32;
const U32 AGENT_CONTROL_AT_POS = 0x1 << CONTROL_AT_POS_INDEX; // 0x00000001
const U32 AGENT_CONTROL_AT_NEG = 0x1 << CONTROL_AT_NEG_INDEX; // 0x00000002
const U32 AGENT_CONTROL_LEFT_POS = 0x1 << CONTROL_LEFT_POS_INDEX; // 0x00000004
const U32 AGENT_CONTROL_LEFT_NEG = 0x1 << CONTROL_LEFT_NEG_INDEX; // 0x00000008
const U32 AGENT_CONTROL_UP_POS = 0x1 << CONTROL_UP_POS_INDEX; // 0x00000010
const U32 AGENT_CONTROL_UP_NEG = 0x1 << CONTROL_UP_NEG_INDEX; // 0x00000020
const U32 AGENT_CONTROL_PITCH_POS = 0x1 << CONTROL_PITCH_POS_INDEX; // 0x00000040
const U32 AGENT_CONTROL_PITCH_NEG = 0x1 << CONTROL_PITCH_NEG_INDEX; // 0x00000080
const U32 AGENT_CONTROL_YAW_POS = 0x1 << CONTROL_YAW_POS_INDEX; // 0x00000100
const U32 AGENT_CONTROL_YAW_NEG = 0x1 << CONTROL_YAW_NEG_INDEX; // 0x00000200
const U32 AGENT_CONTROL_FAST_AT = 0x1 << CONTROL_FAST_AT_INDEX; // 0x00000400
const U32 AGENT_CONTROL_FAST_LEFT = 0x1 << CONTROL_FAST_LEFT_INDEX; // 0x00000800
const U32 AGENT_CONTROL_FAST_UP = 0x1 << CONTROL_FAST_UP_INDEX; // 0x00001000
const U32 AGENT_CONTROL_FLY = 0x1 << CONTROL_FLY_INDEX; // 0x00002000
const U32 AGENT_CONTROL_STOP = 0x1 << CONTROL_STOP_INDEX; // 0x00004000
const U32 AGENT_CONTROL_FINISH_ANIM = 0x1 << CONTROL_FINISH_ANIM_INDEX; // 0x00008000
const U32 AGENT_CONTROL_STAND_UP = 0x1 << CONTROL_STAND_UP_INDEX; // 0x00010000
const U32 AGENT_CONTROL_SIT_ON_GROUND = 0x1 << CONTROL_SIT_ON_GROUND_INDEX; // 0x00020000
const U32 AGENT_CONTROL_MOUSELOOK = 0x1 << CONTROL_MOUSELOOK_INDEX; // 0x00040000
const U32 AGENT_CONTROL_NUDGE_AT_POS = 0x1 << CONTROL_NUDGE_AT_POS_INDEX; // 0x00080000
const U32 AGENT_CONTROL_NUDGE_AT_NEG = 0x1 << CONTROL_NUDGE_AT_NEG_INDEX; // 0x00100000
const U32 AGENT_CONTROL_NUDGE_LEFT_POS = 0x1 << CONTROL_NUDGE_LEFT_POS_INDEX; // 0x00200000
const U32 AGENT_CONTROL_NUDGE_LEFT_NEG = 0x1 << CONTROL_NUDGE_LEFT_NEG_INDEX; // 0x00400000
const U32 AGENT_CONTROL_NUDGE_UP_POS = 0x1 << CONTROL_NUDGE_UP_POS_INDEX; // 0x00800000
const U32 AGENT_CONTROL_NUDGE_UP_NEG = 0x1 << CONTROL_NUDGE_UP_NEG_INDEX; // 0x01000000
const U32 AGENT_CONTROL_TURN_LEFT = 0x1 << CONTROL_TURN_LEFT_INDEX; // 0x02000000
const U32 AGENT_CONTROL_TURN_RIGHT = 0x1 << CONTROL_TURN_RIGHT_INDEX; // 0x04000000
const U32 AGENT_CONTROL_AWAY = 0x1 << CONTROL_AWAY_INDEX; // 0x08000000
const U32 AGENT_CONTROL_LBUTTON_DOWN = 0x1 << CONTROL_LBUTTON_DOWN_INDEX; // 0x10000000
const U32 AGENT_CONTROL_LBUTTON_UP = 0x1 << CONTROL_LBUTTON_UP_INDEX; // 0x20000000
const U32 AGENT_CONTROL_ML_LBUTTON_DOWN = 0x1 << CONTROL_ML_LBUTTON_DOWN_INDEX; // 0x40000000
const U32 AGENT_CONTROL_ML_LBUTTON_UP = ((U32)0x1) << CONTROL_ML_LBUTTON_UP_INDEX; // 0x80000000
const U32 AGENT_CONTROL_AT = AGENT_CONTROL_AT_POS
| AGENT_CONTROL_AT_NEG
| AGENT_CONTROL_NUDGE_AT_POS
| AGENT_CONTROL_NUDGE_AT_NEG;
const U32 AGENT_CONTROL_LEFT = AGENT_CONTROL_LEFT_POS
| AGENT_CONTROL_LEFT_NEG
| AGENT_CONTROL_NUDGE_LEFT_POS
| AGENT_CONTROL_NUDGE_LEFT_NEG;
const U32 AGENT_CONTROL_UP = AGENT_CONTROL_UP_POS
| AGENT_CONTROL_UP_NEG
| AGENT_CONTROL_NUDGE_UP_POS
| AGENT_CONTROL_NUDGE_UP_NEG;
const U32 AGENT_CONTROL_HORIZONTAL = AGENT_CONTROL_AT
| AGENT_CONTROL_LEFT;
const U32 AGENT_CONTROL_NOT_USED_BY_LSL = AGENT_CONTROL_FLY
| AGENT_CONTROL_STOP
| AGENT_CONTROL_FINISH_ANIM
| AGENT_CONTROL_STAND_UP
| AGENT_CONTROL_SIT_ON_GROUND
| AGENT_CONTROL_MOUSELOOK
| AGENT_CONTROL_AWAY;
const U32 AGENT_CONTROL_MOVEMENT = AGENT_CONTROL_AT
| AGENT_CONTROL_LEFT
| AGENT_CONTROL_UP;
const U32 AGENT_CONTROL_ROTATION = AGENT_CONTROL_PITCH_POS
| AGENT_CONTROL_PITCH_NEG
| AGENT_CONTROL_YAW_POS
| AGENT_CONTROL_YAW_NEG;
const U32 AGENT_CONTROL_NUDGE = AGENT_CONTROL_NUDGE_AT_POS
| AGENT_CONTROL_NUDGE_AT_NEG
| AGENT_CONTROL_NUDGE_LEFT_POS
| AGENT_CONTROL_NUDGE_LEFT_NEG;
// move these up so that we can hide them in "State" for object updates
// (for now)
const U32 AGENT_ATTACH_OFFSET = 4;
const U32 AGENT_ATTACH_MASK = 0xf << AGENT_ATTACH_OFFSET;
const U32 AGENT_ATTACH_CLEAR = 0x00;
// RN: this method swaps the upper and lower nibbles to maintain backward
// compatibility with old objects that only used the upper nibble
#define ATTACHMENT_ID_FROM_STATE(state) ((S32)((((U8)state & AGENT_ATTACH_MASK) >> 4) | (((U8)state & ~AGENT_ATTACH_MASK) << 4)))
// test state for use in testing grabbing the camera
const U32 AGENT_CAMERA_OBJECT = 0x1 << 3;
const F32 MAX_ATTACHMENT_DIST = 3.5f; // meters?
#endif

View File

@ -30,7 +30,6 @@
#include <map>
#include "llrun.h"
#include "llsd.h"
#include "lloptioninterface.h"
// Forward declarations
template <typename Type> class LLAtomic32;
@ -64,7 +63,7 @@ namespace google_breakpad {
class ExceptionHandler; // See exception_handler.h
}
class LL_COMMON_API LLApp : public LLOptionInterface
class LL_COMMON_API LLApp
{
friend class LLErrorThread;
public:
@ -113,7 +112,7 @@ public:
* @param name The name of the option.
* @return Returns the option data.
*/
virtual LLSD getOption(const std::string& name) const;
LLSD getOption(const std::string& name) const;
/**
* @brief Parse command line options and insert them into

View File

@ -29,8 +29,6 @@
#include <string>
#include "stdenums.h" // for EDragAndDropType
class LL_COMMON_API LLAssetType
{
public:

View File

@ -1,55 +0,0 @@
/**
* @file llavatarconstants.h
* @brief some useful short term constants for Indra
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_AVATAR_CONSTANTS_H
#define LL_AVATAR_CONSTANTS_H
// If this string is passed to dataserver in AvatarPropertiesUpdate
// then no change is made to user.profile_web
const char* const BLACKLIST_PROFILE_WEB_STR = "featureWebProfilesDisabled";
// If profile web pages are feature blacklisted then this URL is
// shown in the profile instead of the user's set URL
const char* const BLACKLIST_PROFILE_WEB_URL = "http://secondlife.com/app/webdisabled";
// Maximum number of avatar picks
const S32 MAX_AVATAR_PICKS = 10;
// For Flags in AvatarPropertiesReply
const U32 AVATAR_ALLOW_PUBLISH = 0x1 << 0; // whether profile is externally visible or not
const U32 AVATAR_MATURE_PUBLISH = 0x1 << 1; // profile is "mature"
const U32 AVATAR_IDENTIFIED = 0x1 << 2; // whether avatar has provided payment info
const U32 AVATAR_TRANSACTED = 0x1 << 3; // whether avatar has actively used payment info
const U32 AVATAR_ONLINE = 0x1 << 4; // the online status of this avatar, if known.
const U32 AVATAR_AGEVERIFIED = 0x1 << 5; // whether avatar has been age-verified
char const* const VISIBILITY_DEFAULT = "default";
char const* const VISIBILITY_HIDDEN = "hidden";
char const* const VISIBILITY_VISIBLE = "visible";
char const* const VISIBILITY_INVISIBLE = "invisible";
#endif

View File

@ -27,4 +27,4 @@
#include "linden_common.h"
// implementation is all in the header, this include dep ensures the unit test is rerun if the implementation changes.
#include "bitpack.h"
#include "llbitpack.h"

View File

@ -1,5 +1,5 @@
/**
* @file bitpack.h
* @file llbitpack.h
* @brief Convert data to packed bit stream
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
@ -79,7 +79,7 @@ public:
*(mBuffer + mBufferSize++) = mLoad;
if (mBufferSize > mMaxSize)
{
llerror("mBufferSize exceeding mMaxSize!", 0);
LL_ERRS() << "mBufferSize exceeding mMaxSize!" << LL_ENDL;
}
mLoadSize = 0;
mLoad = 0x00;
@ -122,7 +122,7 @@ public:
*(mBuffer + mBufferSize++) = mLoad;
if (mBufferSize > mMaxSize)
{
llerror("mBufferSize exceeding mMaxSize!", 0);
LL_ERRS() << "mBufferSize exceeding mMaxSize!" << LL_ENDL;
}
mLoadSize = 0;
mLoad = 0x00;
@ -190,7 +190,7 @@ public:
*(mBuffer + mBufferSize++) = mLoad;
if (mBufferSize > mMaxSize)
{
llerror("mBufferSize exceeding mMaxSize!", 0);
LL_ERRS() << "mBufferSize exceeding mMaxSize!" << LL_ENDL;
}
mLoadSize = 0;
}

View File

@ -1,41 +0,0 @@
/**
* @file llclickaction.h
* @author James Cook
* @brief Constants for single-click actions on objects
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLCLICKACTION_H
#define LL_LLCLICKACTION_H
// DO NOT CHANGE THE SEQUENCE OF THIS LIST!!
const U8 CLICK_ACTION_NONE = 0;
const U8 CLICK_ACTION_TOUCH = 0;
const U8 CLICK_ACTION_SIT = 1;
const U8 CLICK_ACTION_BUY = 2;
const U8 CLICK_ACTION_PAY = 3;
const U8 CLICK_ACTION_OPEN = 4;
const U8 CLICK_ACTION_PLAY = 5;
const U8 CLICK_ACTION_OPEN_MEDIA = 6;
const U8 CLICK_ACTION_ZOOM = 7;
// DO NOT CHANGE THE SEQUENCE OF THIS LIST!!
#endif

View File

@ -1,223 +0,0 @@
/**
* @file lldarray.h
* @brief Wrapped std::vector for backward compatibility.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLDARRAY_H
#define LL_LLDARRAY_H
#include "llerror.h"
#include <vector>
#include <map>
// class LLDynamicArray<>; // = std::vector + reserves <BlockSize> elements
// class LLDynamicArrayIndexed<>; // = std::vector + std::map if indices, only supports operator[] and begin(),end()
//--------------------------------------------------------
// LLDynamicArray declaration
//--------------------------------------------------------
// NOTE: BlockSize is used to reserve a minimal initial amount
template <typename Type, int BlockSize = 32>
class LLDynamicArray : public std::vector<Type>
{
public:
enum
{
OKAY = 0,
FAIL = -1
};
LLDynamicArray(S32 size=0) : std::vector<Type>(size) { if (size < BlockSize) std::vector<Type>::reserve(BlockSize); }
void reset() { std::vector<Type>::clear(); }
// ACCESSORS
const Type& get(S32 index) const { return std::vector<Type>::operator[](index); }
Type& get(S32 index) { return std::vector<Type>::operator[](index); }
S32 find(const Type &obj) const;
S32 count() const { return std::vector<Type>::size(); }
S32 getLength() const { return std::vector<Type>::size(); }
S32 getMax() const { return std::vector<Type>::capacity(); }
// MANIPULATE
S32 put(const Type &obj); // add to end of array, returns index
// Type* reserve(S32 num); // reserve a block of indices in advance
Type* reserve_block(U32 num); // reserve a block of indices in advance
S32 remove(S32 index); // remove by index, no bounds checking
S32 removeObj(const Type &obj); // remove by object
S32 removeLast();
void operator+=(const LLDynamicArray<Type,BlockSize> &other);
};
//--------------------------------------------------------
// LLDynamicArray implementation
//--------------------------------------------------------
template <typename Type,int BlockSize>
inline S32 LLDynamicArray<Type,BlockSize>::find(const Type &obj) const
{
typename std::vector<Type>::const_iterator iter = std::find(this->begin(), this->end(), obj);
if (iter != this->end())
{
return iter - this->begin();
}
return FAIL;
}
template <typename Type,int BlockSize>
inline S32 LLDynamicArray<Type,BlockSize>::remove(S32 i)
{
// This is a fast removal by swapping with the last element
S32 sz = this->size();
if (i < 0 || i >= sz)
{
return FAIL;
}
if (i < sz-1)
{
this->operator[](i) = this->back();
}
this->pop_back();
return i;
}
template <typename Type,int BlockSize>
inline S32 LLDynamicArray<Type,BlockSize>::removeObj(const Type& obj)
{
typename std::vector<Type>::iterator iter = std::find(this->begin(), this->end(), obj);
if (iter != this->end())
{
S32 res = iter - this->begin();
typename std::vector<Type>::iterator last = this->end();
--last;
*iter = *last;
this->pop_back();
return res;
}
return FAIL;
}
template <typename Type,int BlockSize>
inline S32 LLDynamicArray<Type,BlockSize>::removeLast()
{
if (!this->empty())
{
this->pop_back();
return OKAY;
}
return FAIL;
}
template <typename Type,int BlockSize>
inline Type* LLDynamicArray<Type,BlockSize>::reserve_block(U32 num)
{
U32 sz = this->size();
this->resize(sz+num);
return &(this->operator[](sz));
}
template <typename Type,int BlockSize>
inline S32 LLDynamicArray<Type,BlockSize>::put(const Type &obj)
{
this->push_back(obj);
return this->size() - 1;
}
template <typename Type,int BlockSize>
inline void LLDynamicArray<Type,BlockSize>::operator+=(const LLDynamicArray<Type,BlockSize> &other)
{
insert(this->end(), other.begin(), other.end());
}
//--------------------------------------------------------
// LLDynamicArrayIndexed declaration
//--------------------------------------------------------
template <typename Type, typename Key, int BlockSize = 32>
class LLDynamicArrayIndexed
{
public:
typedef typename std::vector<Type>::iterator iterator;
typedef typename std::vector<Type>::const_iterator const_iterator;
typedef typename std::vector<Type>::reverse_iterator reverse_iterator;
typedef typename std::vector<Type>::const_reverse_iterator const_reverse_iterator;
typedef typename std::vector<Type>::size_type size_type;
protected:
std::vector<Type> mVector;
std::map<Key, U32> mIndexMap;
public:
LLDynamicArrayIndexed() { mVector.reserve(BlockSize); }
iterator begin() { return mVector.begin(); }
const_iterator begin() const { return mVector.begin(); }
iterator end() { return mVector.end(); }
const_iterator end() const { return mVector.end(); }
reverse_iterator rbegin() { return mVector.rbegin(); }
const_reverse_iterator rbegin() const { return mVector.rbegin(); }
reverse_iterator rend() { return mVector.rend(); }
const_reverse_iterator rend() const { return mVector.rend(); }
void reset() { mVector.resize(0); mIndexMap.resize(0); }
bool empty() const { return mVector.empty(); }
size_type size() const { return mVector.size(); }
Type& operator[](const Key& k)
{
typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k);
if (iter == mIndexMap.end())
{
U32 n = mVector.size();
mIndexMap[k] = n;
mVector.push_back(Type());
llassert(mVector.size() == mIndexMap.size());
return mVector[n];
}
else
{
return mVector[iter->second];
}
}
const_iterator find(const Key& k) const
{
typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k);
if(iter == mIndexMap.end())
{
return mVector.end();
}
else
{
return mVector.begin() + iter->second;
}
}
};
#endif

View File

@ -1,47 +0,0 @@
/**
* @file lldeleteutils.h
* @brief Utility functions to simplify some common pointer-munging idioms.
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_DELETE_UTILS_H
#define LL_DELETE_UTILS_H
// Simple utility functions to eventually replace the common 2-line
// idiom scattered throughout the viewer codebase. Note that where
// possible we would rather be using smart pointers of some sort.
template <class T>
inline void deleteAndClear(T*& ptr)
{
delete ptr;
ptr = NULL;
}
template <class T>
inline void deleteAndClearArray(T*& array_ptr)
{
delete[] array_ptr;
array_ptr = NULL;
}
#endif

View File

@ -41,8 +41,6 @@ public:
: mCurrentDepth(0), mMaxDepth(0)
{}
~LLDepthStack() {}
void setDepth(U32 depth)
{
mMaxDepth = depth;
@ -87,14 +85,7 @@ public:
{
return mStack.empty() ? NULL : mStack.back();
}
void deleteAllData()
{
mCurrentDepth = 0;
std::for_each(mStack.begin(), mStack.end(), DeletePointer());
mStack.clear();
}
void removeAllNodes()
{
mCurrentDepth = 0;

View File

@ -96,7 +96,7 @@ namespace {
mFile.open(filename, llofstream::out | llofstream::app);
if (!mFile)
{
llinfos << "Error setting log file to " << filename << llendl;
LL_INFOS() << "Error setting log file to " << filename << LL_ENDL;
}
}
@ -331,7 +331,7 @@ namespace
}
LLError::configure(configuration);
llinfos << "logging reconfigured from " << filename() << llendl;
LL_INFOS() << "logging reconfigured from " << filename() << LL_ENDL;
return true;
}
@ -495,14 +495,44 @@ namespace LLError
int line,
const std::type_info& class_info,
const char* function,
bool printOnce,
const char* broadTag,
const char* narrowTag,
bool printOnce)
: mLevel(level), mFile(file), mLine(line),
mClassInfo(class_info), mFunction(function),
mCached(false), mShouldLog(false),
mBroadTag(broadTag), mNarrowTag(narrowTag), mPrintOnce(printOnce)
{ }
const char* narrowTag)
: mLevel(level),
mFile(file),
mLine(line),
mClassInfo(class_info),
mFunction(function),
mCached(false),
mShouldLog(false),
mPrintOnce(printOnce),
mBroadTag(broadTag),
mNarrowTag(narrowTag)
{}
CallSite::CallSite(ELevel level,
const char* file,
int line,
const std::type_info& class_info,
const char* function,
bool printOnce,
const char* broadTag,
const char* narrowTag,
const char*,
...)
: mLevel(level),
mFile(file),
mLine(line),
mClassInfo(class_info),
mFunction(function),
mCached(false),
mShouldLog(false),
mPrintOnce(printOnce),
mBroadTag(broadTag),
mNarrowTag(narrowTag)
{
LL_ERRS() << "No support for more than 2 logging tags" << LL_ENDL;
}
void CallSite::invalidate()
@ -677,7 +707,7 @@ namespace LLError
LevelMap::const_iterator i = level_names.find(name);
if (i == level_names.end())
{
llwarns << "unrecognized logging level: '" << name << "'" << llendl;
LL_WARNS() << "unrecognized logging level: '" << name << "'" << LL_ENDL;
return LLError::LEVEL_INFO;
}
@ -741,6 +771,12 @@ namespace LLError
return false;
}
// virtual
bool Recorder::wantsTags()
{
return false;
}
void addRecorder(Recorder* recorder)
{
if (recorder == NULL)
@ -817,11 +853,14 @@ namespace LLError
namespace
{
void writeToRecorders(LLError::ELevel level, const std::string& message)
void writeToRecorders(const LLError::CallSite& site, const std::string& message)
{
LLError::ELevel level = site.mLevel;
LLError::Settings& s = LLError::Settings::get();
std::string messageWithTime;
std::string messageWithTags;
std::string messageWithTagsAndTime;
for (Recorders::const_iterator i = s.recorders.begin();
i != s.recorders.end();
@ -829,18 +868,47 @@ namespace
{
LLError::Recorder* r = *i;
if (r->wantsTime() && s.timeFunction != NULL)
if (r->wantsTime() && s.timeFunction != NULL)
{
if (messageWithTime.empty())
if (r->wantsTags())
{
messageWithTime = s.timeFunction() + " " + message;
if (messageWithTagsAndTime.empty())
{
messageWithTagsAndTime = s.timeFunction() + " "
+ (site.mBroadTag ? (std::string("#") + std::string(site.mBroadTag) + " ") : std::string())
+ (site.mNarrowTag ? (std::string("#") + std::string(site.mNarrowTag) + " ") : std::string())
+ message;
}
r->recordMessage(level, messageWithTagsAndTime);
}
else
{
if (messageWithTime.empty())
{
messageWithTime = s.timeFunction() + " " + message;
}
r->recordMessage(level, messageWithTime);
}
r->recordMessage(level, messageWithTime);
}
else
{
r->recordMessage(level, message);
if (r->wantsTags())
{
if (messageWithTags.empty())
{
messageWithTags = (site.mBroadTag ? (std::string("#") + std::string(site.mBroadTag) + " ") : std::string())
+ (site.mNarrowTag ? (std::string("#") + std::string(site.mNarrowTag) + " ") : std::string())
+ message;
}
r->recordMessage(level, messageWithTags);
}
else
{
r->recordMessage(level, message);
}
}
}
}
@ -1017,10 +1085,11 @@ namespace LLError
else
{
strncpy(message, out->str().c_str(), 127);
message[127] = '\0' ;
message[127] = '\0';
}
Globals& g = Globals::get();
if (out == &g.messageStream)
{
g.messageStream.clear();
@ -1031,7 +1100,7 @@ namespace LLError
{
delete out;
}
return ;
return;
}
void Log::flush(std::ostringstream* out, const CallSite& site)
@ -1063,7 +1132,7 @@ namespace LLError
fatalMessage << abbreviateFile(site.mFile)
<< "(" << site.mLine << ") : error";
writeToRecorders(site.mLevel, fatalMessage.str());
writeToRecorders(site, fatalMessage.str());
}
@ -1125,7 +1194,7 @@ namespace LLError
prefix << message;
message = prefix.str();
writeToRecorders(site.mLevel, message);
writeToRecorders(site, message);
if (site.mLevel == LEVEL_ERROR && s.crashFunction)
{
@ -1164,7 +1233,7 @@ namespace LLError
{
std::string::size_type i = 0;
std::string::size_type len = s.length();
for ( ; i < len; i++ )
for (; i < len; i++ )
{
if (s[i] == old)
{
@ -1235,8 +1304,8 @@ namespace LLError
namespace LLError
{
char** LLCallStacks::sBuffer = NULL ;
S32 LLCallStacks::sIndex = 0 ;
char** LLCallStacks::sBuffer = NULL;
S32 LLCallStacks::sIndex = 0;
#define SINGLE_THREADED 1
@ -1312,34 +1381,34 @@ namespace LLError
if(!sBuffer)
{
sBuffer = new char*[512] ;
sBuffer[0] = new char[512 * 128] ;
for(S32 i = 1 ; i < 512 ; i++)
sBuffer = new char*[512];
sBuffer[0] = new char[512 * 128];
for(S32 i = 1; i < 512; i++)
{
sBuffer[i] = sBuffer[i-1] + 128 ;
sBuffer[i] = sBuffer[i-1] + 128;
}
sIndex = 0 ;
sIndex = 0;
}
if(sIndex > 511)
{
clear() ;
clear();
}
strcpy(sBuffer[sIndex], function) ;
sprintf(sBuffer[sIndex] + strlen(function), " line: %d ", line) ;
sIndex++ ;
strcpy(sBuffer[sIndex], function);
sprintf(sBuffer[sIndex] + strlen(function), " line: %d ", line);
sIndex++;
return ;
return;
}
//static
std::ostringstream* LLCallStacks::insert(const char* function, const int line)
{
std::ostringstream* _out = LLError::Log::out();
*_out << function << " line " << line << " " ;
*_out << function << " line " << line << " ";
return _out ;
return _out;
}
//static
@ -1353,21 +1422,21 @@ namespace LLError
if(!sBuffer)
{
sBuffer = new char*[512] ;
sBuffer[0] = new char[512 * 128] ;
for(S32 i = 1 ; i < 512 ; i++)
sBuffer = new char*[512];
sBuffer[0] = new char[512 * 128];
for(S32 i = 1; i < 512; i++)
{
sBuffer[i] = sBuffer[i-1] + 128 ;
sBuffer[i] = sBuffer[i-1] + 128;
}
sIndex = 0 ;
sIndex = 0;
}
if(sIndex > 511)
{
clear() ;
clear();
}
LLError::Log::flush(_out, sBuffer[sIndex++]) ;
LLError::Log::flush(_out, sBuffer[sIndex++]);
}
//static
@ -1381,27 +1450,27 @@ namespace LLError
if(sIndex > 0)
{
llinfos << " ************* PRINT OUT LL CALL STACKS ************* " << llendl ;
LL_INFOS() << " ************* PRINT OUT LL CALL STACKS ************* " << LL_ENDL;
while(sIndex > 0)
{
sIndex-- ;
llinfos << sBuffer[sIndex] << llendl ;
sIndex--;
LL_INFOS() << sBuffer[sIndex] << LL_ENDL;
}
llinfos << " *************** END OF LL CALL STACKS *************** " << llendl ;
LL_INFOS() << " *************** END OF LL CALL STACKS *************** " << LL_ENDL;
}
if(sBuffer)
{
delete[] sBuffer[0] ;
delete[] sBuffer ;
sBuffer = NULL ;
delete[] sBuffer[0];
delete[] sBuffer;
sBuffer = NULL;
}
}
//static
void LLCallStacks::clear()
{
sIndex = 0 ;
sIndex = 0;
}
#if LL_WINDOWS

View File

@ -31,9 +31,66 @@
#include <sstream>
#include <typeinfo>
#include "llerrorlegacy.h"
#include "stdtypes.h"
#include "llpreprocessor.h"
#include <boost/static_assert.hpp>
const int LL_ERR_NOERR = 0;
// Define one of these for different error levels in release...
// #define RELEASE_SHOW_DEBUG // Define this if you want your release builds to show lldebug output.
#define RELEASE_SHOW_INFO // Define this if you want your release builds to show llinfo output
#define RELEASE_SHOW_WARN // Define this if you want your release builds to show llwarn output.
#ifdef _DEBUG
#define SHOW_DEBUG
#define SHOW_WARN
#define SHOW_INFO
#define SHOW_ASSERT
#else // _DEBUG
#ifdef LL_RELEASE_WITH_DEBUG_INFO
#define SHOW_ASSERT
#endif // LL_RELEASE_WITH_DEBUG_INFO
#ifdef RELEASE_SHOW_DEBUG
#define SHOW_DEBUG
#endif
#ifdef RELEASE_SHOW_WARN
#define SHOW_WARN
#endif
#ifdef RELEASE_SHOW_INFO
#define SHOW_INFO
#endif
#ifdef RELEASE_SHOW_ASSERT
#define SHOW_ASSERT
#endif
#endif // !_DEBUG
#define llassert_always(func) if (LL_UNLIKELY(!(func))) LL_ERRS() << "ASSERT (" << #func << ")" << LL_ENDL;
#ifdef SHOW_ASSERT
#define llassert(func) llassert_always(func)
#define llverify(func) llassert_always(func)
#else
#define llassert(func)
#define llverify(func) do {if (func) {}} while(0)
#endif
#ifdef LL_WINDOWS
#define LL_STATIC_ASSERT(func, msg) static_assert(func, msg)
#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) static_assert(false, msg)
#else
#define LL_STATIC_ASSERT(func, msg) BOOST_STATIC_ASSERT(func)
#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) BOOST_STATIC_ASSERT(sizeof(type) != 0 && false);
#endif
/** Error Logging Facility
Information for most users:
@ -121,26 +178,25 @@ namespace LLError
They are not intended for general use.
*/
class CallSite;
struct CallSite;
class LL_COMMON_API Log
{
public:
static bool shouldLog(CallSite&);
static std::ostringstream* out();
static void flush(std::ostringstream* out, char* message) ;
static void flush(std::ostringstream* out, char* message);
static void flush(std::ostringstream*, const CallSite&);
};
class LL_COMMON_API CallSite
struct LL_COMMON_API CallSite
{
// Represents a specific place in the code where a message is logged
// This is public because it is used by the macros below. It is not
// intended for public use.
public:
CallSite(ELevel, const char* file, int line,
const std::type_info& class_info, const char* function, const char* broadTag, const char* narrowTag, bool printOnce);
const std::type_info& class_info, const char* function, bool printOnce, const char* broadTag = NULL, const char* narrowTag = NULL );
#ifdef LL_LIBRARY_INCLUDE
bool shouldLog();
#else // LL_LIBRARY_INCLUDE
@ -151,7 +207,6 @@ namespace LLError
void invalidate();
private:
// these describe the call site and never change
const ELevel mLevel;
const char* const mFile;
@ -167,6 +222,11 @@ namespace LLError
bool mShouldLog;
friend class Log;
private:
// 3 or more tags not currently supported
CallSite(ELevel, const char* file, int line,
const std::type_info& class_info, const char* function, bool printOnce, const char* broadTag, const char* narrowTag, const char*, ...);
};
@ -237,78 +297,64 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
// Outside a class declaration, or in class without LOG_CLASS(), this
// typedef causes the messages to not be associated with any class.
/////////////////////////////////
// Error Logging Macros
// See top of file for common usage.
/////////////////////////////////
/*
Error Logging Macros
See top of file for common usage.
*/
#define lllog(level, broadTag, narrowTag, once) \
do { \
static LLError::CallSite _site( \
level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), __FUNCTION__, broadTag, narrowTag, once);\
if (LL_UNLIKELY(_site.shouldLog())) \
{ \
std::ostringstream* _out = LLError::Log::out(); \
#define lllog(level, once, ...) \
do { \
static LLError::CallSite _site( \
level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), __FUNCTION__, once, __VA_ARGS__ );\
if (LL_UNLIKELY(_site.shouldLog())) \
{ \
std::ostringstream* _out = LLError::Log::out(); \
(*_out)
// DEPRECATED: Don't call directly, use LL_ENDL instead, which actually looks like a macro
#define llendl \
LLError::End(); \
LLError::Log::flush(_out, _site); \
} \
} while(0)
//Use this construct if you need to do computation in the middle of a
//message:
//
// LL_INFOS("AgentGesture") << "the agent " << agend_id;
// switch (f)
// {
// case FOP_SHRUGS: LL_CONT << "shrugs"; break;
// case FOP_TAPS: LL_CONT << "points at " << who; break;
// case FOP_SAYS: LL_CONT << "says " << message; break;
// }
// LL_CONT << " for " << t << " seconds" << LL_ENDL;
//
//Such computation is done iff the message will be logged.
#define LL_CONT (*_out)
// DEPRECATED: Use the new macros that allow tags and *look* like macros.
#define lldebugs lllog(LLError::LEVEL_DEBUG, NULL, NULL, false)
#define llinfos lllog(LLError::LEVEL_INFO, NULL, NULL, false)
#define llwarns lllog(LLError::LEVEL_WARN, NULL, NULL, false)
#define llerrs lllog(LLError::LEVEL_ERROR, NULL, NULL, false)
#define llcont (*_out)
#define LL_NEWLINE '\n'
#define LL_ENDL \
LLError::End(); \
LLError::Log::flush(_out, _site); \
} \
} while(0)
// NEW Macros for debugging, allow the passing of a string tag
// One Tag
#define LL_DEBUGS(broadTag) lllog(LLError::LEVEL_DEBUG, broadTag, NULL, false)
#define LL_INFOS(broadTag) lllog(LLError::LEVEL_INFO, broadTag, NULL, false)
#define LL_WARNS(broadTag) lllog(LLError::LEVEL_WARN, broadTag, NULL, false)
#define LL_ERRS(broadTag) lllog(LLError::LEVEL_ERROR, broadTag, NULL, false)
// Two Tags
#define LL_DEBUGS2(broadTag, narrowTag) lllog(LLError::LEVEL_DEBUG, broadTag, narrowTag, false)
#define LL_INFOS2(broadTag, narrowTag) lllog(LLError::LEVEL_INFO, broadTag, narrowTag, false)
#define LL_WARNS2(broadTag, narrowTag) lllog(LLError::LEVEL_WARN, broadTag, narrowTag, false)
#define LL_ERRS2(broadTag, narrowTag) lllog(LLError::LEVEL_ERROR, broadTag, narrowTag, false)
// Pass comma separated list of tags (currently only supports up to 0, 1, or 2)
#define LL_DEBUGS(...) lllog(LLError::LEVEL_DEBUG, false, __VA_ARGS__)
#define LL_INFOS(...) lllog(LLError::LEVEL_INFO, false, __VA_ARGS__)
#define LL_WARNS(...) lllog(LLError::LEVEL_WARN, false, __VA_ARGS__)
#define LL_ERRS(...) lllog(LLError::LEVEL_ERROR, false, __VA_ARGS__)
// Only print the log message once (good for warnings or infos that would otherwise
// spam the log file over and over, such as tighter loops).
#define LL_DEBUGS_ONCE(broadTag) lllog(LLError::LEVEL_DEBUG, broadTag, NULL, true)
#define LL_INFOS_ONCE(broadTag) lllog(LLError::LEVEL_INFO, broadTag, NULL, true)
#define LL_WARNS_ONCE(broadTag) lllog(LLError::LEVEL_WARN, broadTag, NULL, true)
#define LL_DEBUGS2_ONCE(broadTag, narrowTag) lllog(LLError::LEVEL_DEBUG, broadTag, narrowTag, true)
#define LL_INFOS2_ONCE(broadTag, narrowTag) lllog(LLError::LEVEL_INFO, broadTag, narrowTag, true)
#define LL_WARNS2_ONCE(broadTag, narrowTag) lllog(LLError::LEVEL_WARN, broadTag, narrowTag, true)
#define LL_DEBUGS_ONCE(...) lllog(LLError::LEVEL_DEBUG, true, __VA_ARGS__)
#define LL_INFOS_ONCE(...) lllog(LLError::LEVEL_INFO, true, __VA_ARGS__)
#define LL_WARNS_ONCE(...) lllog(LLError::LEVEL_WARN, true, __VA_ARGS__)
#define LL_ENDL llendl
#define LL_CONT (*_out)
/*
Use this construct if you need to do computation in the middle of a
message:
LL_INFOS("AgentGesture") << "the agent " << agend_id;
switch (f)
{
case FOP_SHRUGS: LL_CONT << "shrugs"; break;
case FOP_TAPS: LL_CONT << "points at " << who; break;
case FOP_SAYS: LL_CONT << "says " << message; break;
}
LL_CONT << " for " << t << " seconds" << LL_ENDL;
Such computation is done iff the message will be logged.
*/
// DEPRECATED: Use the new macros that allow tags and *look* like macros.
#define lldebugs LL_DEBUGS()
#define llinfos LL_INFOS()
#define llwarns LL_WARNS()
#define llerrs LL_ERRS()
#define llcont LL_CONT
#define llendl LL_ENDL
#endif // LL_LLERROR_H

View File

@ -144,6 +144,10 @@ namespace LLError
virtual bool wantsTime(); // default returns false
// override and return true if the recorder wants the time string
// included in the text of the message
virtual bool wantsTags(); // default returns false
// override ands return true if the recorder wants the tags included
// in the text of the message
};
/**

View File

@ -28,100 +28,5 @@
#ifndef LL_LLERRORLEGACY_H
#define LL_LLERRORLEGACY_H
#include "llpreprocessor.h"
#include <boost/static_assert.hpp>
/*
LEGACY -- DO NOT USE THIS STUFF ANYMORE
*/
// Specific error codes
const int LL_ERR_NOERR = 0;
const int LL_ERR_ASSET_REQUEST_FAILED = -1;
//const int LL_ERR_ASSET_REQUEST_INVALID = -2;
const int LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE = -3;
const int LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE = -4;
const int LL_ERR_INSUFFICIENT_PERMISSIONS = -5;
const int LL_ERR_EOF = -39;
const int LL_ERR_CANNOT_OPEN_FILE = -42;
const int LL_ERR_FILE_NOT_FOUND = -43;
const int LL_ERR_FILE_EMPTY = -44;
const int LL_ERR_TCP_TIMEOUT = -23016;
const int LL_ERR_CIRCUIT_GONE = -23017;
const int LL_ERR_PRICE_MISMATCH = -23018;
// Define one of these for different error levels in release...
// #define RELEASE_SHOW_DEBUG // Define this if you want your release builds to show lldebug output.
#define RELEASE_SHOW_INFO // Define this if you want your release builds to show llinfo output
#define RELEASE_SHOW_WARN // Define this if you want your release builds to show llwarn output.
//////////////////////////////////////////
//
// Implementation - ignore
//
//
#ifdef _DEBUG
#define SHOW_DEBUG
#define SHOW_WARN
#define SHOW_INFO
#define SHOW_ASSERT
#else // _DEBUG
#ifdef LL_RELEASE_WITH_DEBUG_INFO
#define SHOW_ASSERT
#endif // LL_RELEASE_WITH_DEBUG_INFO
#ifdef RELEASE_SHOW_DEBUG
#define SHOW_DEBUG
#endif
#ifdef RELEASE_SHOW_WARN
#define SHOW_WARN
#endif
#ifdef RELEASE_SHOW_INFO
#define SHOW_INFO
#endif
#ifdef RELEASE_SHOW_ASSERT
#define SHOW_ASSERT
#endif
#endif // _DEBUG
#define lldebugst(type) lldebugs
#define llendflush llendl
#define llerror(msg, num) llerrs << "Error # " << num << ": " << msg << llendl;
#define llwarning(msg, num) llwarns << "Warning # " << num << ": " << msg << llendl;
#define llassert_always(func) if (LL_UNLIKELY(!(func))) llerrs << "ASSERT (" << #func << ")" << llendl;
#ifdef SHOW_ASSERT
#define llassert(func) llassert_always(func)
#define llverify(func) llassert_always(func)
#else
#define llassert(func)
#define llverify(func) do {if (func) {}} while(0)
#endif
#ifdef LL_WINDOWS
#define LL_STATIC_ASSERT(func, msg) static_assert(func, msg)
#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) static_assert(false, msg)
#else
#define LL_STATIC_ASSERT(func, msg) BOOST_STATIC_ASSERT(func)
#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) BOOST_STATIC_ASSERT(sizeof(type) != 0 && false);
#endif
// handy compile-time assert - enforce those template parameters!
#define cassert(expn) typedef char __C_ASSERT__[(expn)?1:-1] /* Flawfinder: ignore */
//XXX: used in two places in llcommon/llskipmap.h
#endif // LL_LLERRORLEGACY_H

View File

@ -61,7 +61,7 @@
#include "llsd.h"
#include "llsingleton.h"
#include "lldependencies.h"
#include "ll_template_cast.h"
#include "llstl.h"
/*==========================================================================*|
// override this to allow binding free functions with more parameters

View File

@ -35,7 +35,6 @@
*/
#include "lltimer.h"
#include "timing.h"
class LL_COMMON_API LLFrameTimer
{

100
indra/llcommon/llindexedvector.h Executable file
View File

@ -0,0 +1,100 @@
/**
* @file lldarray.h
* @brief Wrapped std::vector for backward compatibility.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLDARRAY_H
#define LL_LLDARRAY_H
#include "llerror.h"
#include <vector>
#include <map>
//--------------------------------------------------------
// LLIndexedVector
//--------------------------------------------------------
template <typename Type, typename Key, int BlockSize = 32>
class LLIndexedVector
{
public:
typedef typename std::vector<Type>::iterator iterator;
typedef typename std::vector<Type>::const_iterator const_iterator;
typedef typename std::vector<Type>::reverse_iterator reverse_iterator;
typedef typename std::vector<Type>::const_reverse_iterator const_reverse_iterator;
typedef typename std::vector<Type>::size_type size_type;
protected:
std::vector<Type> mVector;
std::map<Key, U32> mIndexMap;
public:
LLIndexedVector() { mVector.reserve(BlockSize); }
iterator begin() { return mVector.begin(); }
const_iterator begin() const { return mVector.begin(); }
iterator end() { return mVector.end(); }
const_iterator end() const { return mVector.end(); }
reverse_iterator rbegin() { return mVector.rbegin(); }
const_reverse_iterator rbegin() const { return mVector.rbegin(); }
reverse_iterator rend() { return mVector.rend(); }
const_reverse_iterator rend() const { return mVector.rend(); }
void reset() { mVector.resize(0); mIndexMap.resize(0); }
bool empty() const { return mVector.empty(); }
size_type size() const { return mVector.size(); }
Type& operator[](const Key& k)
{
typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k);
if (iter == mIndexMap.end())
{
U32 n = mVector.size();
mIndexMap[k] = n;
mVector.push_back(Type());
llassert(mVector.size() == mIndexMap.size());
return mVector[n];
}
else
{
return mVector[iter->second];
}
}
const_iterator find(const Key& k) const
{
typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k);
if(iter == mIndexMap.end())
{
return mVector.end();
}
else
{
return mVector.begin() + iter->second;
}
}
};
#endif

View File

@ -100,13 +100,13 @@ namespace LLInitParam
void Parser::parserWarning(const std::string& message)
{
if (mParseSilently) return;
llwarns << message << llendl;
LL_WARNS() << message << LL_ENDL;
}
void Parser::parserError(const std::string& message)
{
if (mParseSilently) return;
llerrs << message << llendl;
LL_ERRS() << message << LL_ENDL;
}
@ -131,7 +131,7 @@ namespace LLInitParam
std::string name(char_name);
if ((size_t)param->mParamHandle > mMaxParamOffset)
{
llerrs << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << llendl;
LL_ERRS() << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << LL_ENDL;
}
if (name.empty())
@ -214,7 +214,7 @@ namespace LLInitParam
{
if (emit_errors)
{
llwarns << "Invalid param \"" << getParamName(block_data, param) << "\"" << llendl;
LL_WARNS() << "Invalid param \"" << getParamName(block_data, param) << "\"" << LL_ENDL;
}
return false;
}
@ -417,7 +417,7 @@ namespace LLInitParam
// Block<T, Base_Class>
if ((size_t)handle > block_data.mMaxParamOffset)
{
llerrs << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << llendl;
LL_ERRS() << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << LL_ENDL;
}
ParamDescriptorPtr param_descriptor = findParamDescriptor(param);

View File

@ -31,7 +31,7 @@
#include <map>
#include <typeinfo>
#include "string_table.h"
#include "llstringtable.h"
#include <boost/iterator/transform_iterator.hpp>
#include <boost/iterator/indirect_iterator.hpp>

View File

@ -1,309 +0,0 @@
/**
* @file lllinkedqueue.h
* @brief Declaration of linked queue classes.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLLINKEDQUEUE_H
#define LL_LLLINKEDQUEUE_H
#include "llerror.h"
// node that actually contains the data
template <class DATA_TYPE> class LLLinkedQueueNode
{
public:
DATA_TYPE mData;
LLLinkedQueueNode *mNextp;
LLLinkedQueueNode *mPrevp;
public:
LLLinkedQueueNode();
LLLinkedQueueNode(const DATA_TYPE data);
// destructor does not, by default, destroy associated data
// however, the mDatap must be NULL to ensure that we aren't causing memory leaks
~LLLinkedQueueNode();
};
template <class DATA_TYPE> class LLLinkedQueue
{
public:
LLLinkedQueue();
// destructor destroys list and nodes, but not data in nodes
~LLLinkedQueue();
// Puts at end of FIFO
void push(const DATA_TYPE data);
// Takes off front of FIFO
BOOL pop(DATA_TYPE &data);
BOOL peek(DATA_TYPE &data);
void reset();
S32 getLength() const;
BOOL isEmpty() const;
BOOL remove(const DATA_TYPE data);
BOOL checkData(const DATA_TYPE data) const;
private:
// add node to end of list
// set mCurrentp to mQueuep
void addNodeAtEnd(LLLinkedQueueNode<DATA_TYPE> *nodep);
private:
LLLinkedQueueNode<DATA_TYPE> mHead; // head node
LLLinkedQueueNode<DATA_TYPE> mTail; // tail node
S32 mLength;
};
//
// Nodes
//
template <class DATA_TYPE>
LLLinkedQueueNode<DATA_TYPE>::LLLinkedQueueNode() :
mData(), mNextp(NULL), mPrevp(NULL)
{ }
template <class DATA_TYPE>
LLLinkedQueueNode<DATA_TYPE>::LLLinkedQueueNode(const DATA_TYPE data) :
mData(data), mNextp(NULL), mPrevp(NULL)
{ }
template <class DATA_TYPE>
LLLinkedQueueNode<DATA_TYPE>::~LLLinkedQueueNode()
{ }
//
// Queue itself
//
template <class DATA_TYPE>
LLLinkedQueue<DATA_TYPE>::LLLinkedQueue()
: mHead(),
mTail(),
mLength(0)
{ }
// destructor destroys list and nodes, but not data in nodes
template <class DATA_TYPE>
LLLinkedQueue<DATA_TYPE>::~LLLinkedQueue()
{
reset();
}
// put data into a node and stick it at the end of the list
template <class DATA_TYPE>
void LLLinkedQueue<DATA_TYPE>::push(const DATA_TYPE data)
{
// make the new node
LLLinkedQueueNode<DATA_TYPE> *nodep = new LLLinkedQueueNode<DATA_TYPE>(data);
addNodeAtEnd(nodep);
}
// search the list starting at mHead.mNextp and remove the link with mDatap == data
// set mCurrentp to mQueuep, or NULL if mQueuep points to node with mDatap == data
// return TRUE if found, FALSE if not found
template <class DATA_TYPE>
BOOL LLLinkedQueue<DATA_TYPE>::remove(const DATA_TYPE data)
{
BOOL b_found = FALSE;
LLLinkedQueueNode<DATA_TYPE> *currentp = mHead.mNextp;
while (currentp)
{
if (currentp->mData == data)
{
b_found = TRUE;
// if there is a next one, fix it
if (currentp->mNextp)
{
currentp->mNextp->mPrevp = currentp->mPrevp;
}
else // we are at end of list
{
mTail.mPrevp = currentp->mPrevp;
}
// if there is a previous one, fix it
if (currentp->mPrevp)
{
currentp->mPrevp->mNextp = currentp->mNextp;
}
else // we are at beginning of list
{
mHead.mNextp = currentp->mNextp;
}
// remove the node
delete currentp;
mLength--;
break;
}
currentp = currentp->mNextp;
}
return b_found;
}
// remove all nodes from the list but do not delete associated data
template <class DATA_TYPE>
void LLLinkedQueue<DATA_TYPE>::reset()
{
LLLinkedQueueNode<DATA_TYPE> *currentp;
LLLinkedQueueNode<DATA_TYPE> *nextp;
currentp = mHead.mNextp;
while (currentp)
{
nextp = currentp->mNextp;
delete currentp;
currentp = nextp;
}
// reset mHead and mCurrentp
mHead.mNextp = NULL;
mTail.mPrevp = NULL;
mLength = 0;
}
template <class DATA_TYPE>
S32 LLLinkedQueue<DATA_TYPE>::getLength() const
{
return mLength;
}
template <class DATA_TYPE>
BOOL LLLinkedQueue<DATA_TYPE>::isEmpty() const
{
return mLength <= 0;
}
// check to see if data is in list
// set mCurrentp and mQueuep to the target of search if found, otherwise set mCurrentp to mQueuep
// return TRUE if found, FALSE if not found
template <class DATA_TYPE>
BOOL LLLinkedQueue<DATA_TYPE>::checkData(const DATA_TYPE data) const
{
LLLinkedQueueNode<DATA_TYPE> *currentp = mHead.mNextp;
while (currentp)
{
if (currentp->mData == data)
{
return TRUE;
}
currentp = currentp->mNextp;
}
return FALSE;
}
template <class DATA_TYPE>
BOOL LLLinkedQueue<DATA_TYPE>::pop(DATA_TYPE &data)
{
LLLinkedQueueNode<DATA_TYPE> *currentp;
currentp = mHead.mNextp;
if (!currentp)
{
return FALSE;
}
mHead.mNextp = currentp->mNextp;
if (currentp->mNextp)
{
currentp->mNextp->mPrevp = currentp->mPrevp;
}
else
{
mTail.mPrevp = currentp->mPrevp;
}
data = currentp->mData;
delete currentp;
mLength--;
return TRUE;
}
template <class DATA_TYPE>
BOOL LLLinkedQueue<DATA_TYPE>::peek(DATA_TYPE &data)
{
LLLinkedQueueNode<DATA_TYPE> *currentp;
currentp = mHead.mNextp;
if (!currentp)
{
return FALSE;
}
data = currentp->mData;
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////
// private members
//////////////////////////////////////////////////////////////////////////////////////////
// add node to end of list
// set mCurrentp to mQueuep
template <class DATA_TYPE>
void LLLinkedQueue<DATA_TYPE>::addNodeAtEnd(LLLinkedQueueNode<DATA_TYPE> *nodep)
{
// add the node to the end of the list
nodep->mNextp = NULL;
nodep->mPrevp = mTail.mPrevp;
mTail.mPrevp = nodep;
// if there's something in the list, fix its back pointer
if (nodep->mPrevp)
{
nodep->mPrevp->mNextp = nodep;
}
else // otherwise fix the head node
{
mHead.mNextp = nodep;
}
mLength++;
}
#endif

View File

@ -1,111 +0,0 @@
/**
* @file lllog.cpp
* @author Don
* @date 2007-11-27
* @brief Class to log messages to syslog for streambase to process.
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "lllog.h"
#include "llapp.h"
#include "llsd.h"
#include "llsdserialize.h"
class LLLogImpl
{
public:
LLLogImpl(LLApp* app) : mApp(app) {}
~LLLogImpl() {}
void log(const std::string &message, LLSD& info);
bool useLegacyLogMessage(const std::string &message);
private:
LLApp* mApp;
};
//@brief Function to log a message to syslog for streambase to collect.
void LLLogImpl::log(const std::string &message, LLSD& info)
{
static S32 sequence = 0;
LLSD log_config = mApp->getOption("log-messages");
if (log_config.has(message))
{
LLSD message_config = log_config[message];
if (message_config.has("use-syslog"))
{
if (! message_config["use-syslog"].asBoolean())
{
return;
}
}
}
llinfos << "LLLOGMESSAGE (" << (sequence++) << ") " << message
<< " " << LLSDNotationStreamer(info) << llendl;
}
//@brief Function to check if specified legacy log message should be sent.
bool LLLogImpl::useLegacyLogMessage(const std::string &message)
{
LLSD log_config = mApp->getOption("log-messages");
if (log_config.has(message))
{
LLSD message_config = log_config[message];
if (message_config.has("use-legacy"))
{
return message_config["use-legacy"].asBoolean();
}
}
return true;
}
LLLog::LLLog(LLApp* app)
{
mImpl = new LLLogImpl(app);
}
LLLog::~LLLog()
{
delete mImpl;
mImpl = NULL;
}
void LLLog::log(const std::string &message, LLSD& info)
{
if (mImpl) mImpl->log(message, info);
}
bool LLLog::useLegacyLogMessage(const std::string &message)
{
if (mImpl)
{
return mImpl->useLegacyLogMessage(message);
}
return true;
}

View File

@ -1,52 +0,0 @@
/**
* @file lllog.h
* @author Don
* @date 2007-11-27
* @brief Class to log messages to syslog for streambase to process.
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLLOG_H
#define LL_LLLOG_H
#include <string>
class LLLogImpl;
class LLApp;
class LLSD;
class LL_COMMON_API LLLog
{
public:
LLLog(LLApp* app);
virtual ~LLLog();
virtual void log(const std::string &message, LLSD& info);
virtual bool useLegacyLogMessage(const std::string &message);
private:
LLLogImpl* mImpl;
};
#endif /* LL_LLLOG_H */

View File

@ -1,245 +0,0 @@
/**
* @file llmap.h
* @brief LLMap class header file
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLMAP_H
#define LL_LLMAP_H
// llmap uses the fast stl library code in a manner consistant with LLSkipMap, et. al.
template<class INDEX_TYPE, class MAPPED_TYPE> class LLMap
{
private:
typedef typename std::map<INDEX_TYPE, MAPPED_TYPE> stl_map_t;
typedef typename stl_map_t::iterator stl_iter_t;
typedef typename stl_map_t::value_type stl_value_t;
stl_map_t mStlMap;
stl_iter_t mCurIter; // *iterator = pair<const INDEX_TYPE, MAPPED_TYPE>
MAPPED_TYPE dummy_data;
INDEX_TYPE dummy_index;
public:
LLMap() : mStlMap()
{
memset((void*)(&dummy_data), 0x0, sizeof(MAPPED_TYPE));
memset((void*)(&dummy_index), 0x0, sizeof(INDEX_TYPE));
mCurIter = mStlMap.begin();
}
~LLMap()
{
mStlMap.clear();
}
// use these functions to itterate through a list
void resetMap()
{
mCurIter = mStlMap.begin();
}
// get the current data and bump mCurrentp
// This is kind of screwy since it returns a reference;
// We have to have a dummy value for when we reach the end
// or in case we have an empty list. Presumably, this value
// will initialize to some NULL value that will end the iterator.
// We really shouldn't be using getNextData() or getNextKey() anyway...
MAPPED_TYPE &getNextData()
{
if (mCurIter == mStlMap.end())
{
return dummy_data;
}
else
{
return (*mCurIter++).second;
}
}
const INDEX_TYPE &getNextKey()
{
if (mCurIter == mStlMap.end())
{
return dummy_index;
}
else
{
return (*mCurIter++).first;
}
}
MAPPED_TYPE &getFirstData()
{
resetMap();
return getNextData();
}
const INDEX_TYPE &getFirstKey()
{
resetMap();
return getNextKey();
}
S32 getLength()
{
return mStlMap.size();
}
void addData(const INDEX_TYPE &index, MAPPED_TYPE pointed_to)
{
mStlMap.insert(stl_value_t(index, pointed_to));
}
void addData(const INDEX_TYPE &index)
{
mStlMap.insert(stl_value_t(index, dummy_data));
}
// if index doesn't exist, then insert a new node and return it
MAPPED_TYPE &getData(const INDEX_TYPE &index)
{
std::pair<stl_iter_t, bool> res;
res = mStlMap.insert(stl_value_t(index, dummy_data));
return res.first->second;
}
// if index doesn't exist, then insert a new node, return it, and set b_new_entry to true
MAPPED_TYPE &getData(const INDEX_TYPE &index, BOOL &b_new_entry)
{
std::pair<stl_iter_t, bool> res;
res = mStlMap.insert(stl_value_t(index, dummy_data));
b_new_entry = res.second;
return res.first->second;
}
// If there, returns the data.
// If not, returns NULL.
// Never adds entries to the map.
MAPPED_TYPE getIfThere(const INDEX_TYPE &index)
{
stl_iter_t iter;
iter = mStlMap.find(index);
if (iter == mStlMap.end())
{
return (MAPPED_TYPE)0;
}
else
{
return (*iter).second;
}
}
// if index doesn't exist, then make a new node and return it
MAPPED_TYPE &operator[](const INDEX_TYPE &index)
{
return getData(index);
}
// do a reverse look-up, return NULL if failed
INDEX_TYPE reverseLookup(const MAPPED_TYPE data)
{
stl_iter_t iter;
stl_iter_t end_iter;
iter = mStlMap.begin();
end_iter = mStlMap.end();
while (iter != end_iter)
{
if ((*iter).second == data)
return (*iter).first;
iter++;
}
return (INDEX_TYPE)0;
}
BOOL removeData(const INDEX_TYPE &index)
{
mCurIter = mStlMap.find(index);
if (mCurIter == mStlMap.end())
{
return FALSE;
}
else
{
stl_iter_t iter = mCurIter++; // incrament mCurIter to the next element
mStlMap.erase(iter);
return TRUE;
}
}
// does this index exist?
BOOL checkData(const INDEX_TYPE &index)
{
stl_iter_t iter;
iter = mStlMap.find(index);
if (iter == mStlMap.end())
{
return FALSE;
}
else
{
mCurIter = iter;
return TRUE;
}
}
BOOL deleteData(const INDEX_TYPE &index)
{
mCurIter = mStlMap.find(index);
if (mCurIter == mStlMap.end())
{
return FALSE;
}
else
{
stl_iter_t iter = mCurIter++; // incrament mCurIter to the next element
delete (*iter).second;
mStlMap.erase(iter);
return TRUE;
}
}
void deleteAllData()
{
stl_iter_t iter;
stl_iter_t end_iter;
iter = mStlMap.begin();
end_iter = mStlMap.end();
while (iter != end_iter)
{
delete (*iter).second;
iter++;
}
mStlMap.clear();
mCurIter = mStlMap.end();
}
void removeAllData()
{
mStlMap.clear();
}
};
#endif

View File

@ -1,105 +0,0 @@
/**
* @file llnametable.h
* @brief LLNameTable class is a table to associate pointers with string names
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLNAMETABLE_H
#define LL_LLNAMETABLE_H
#include <map>
#include "string_table.h"
template <class DATA>
class LLNameTable
{
public:
LLNameTable()
: mNameMap()
{
}
~LLNameTable()
{
}
void addEntry(const std::string& name, DATA data)
{
addEntry(name.c_str(), data);
}
void addEntry(const char *name, DATA data)
{
char *tablename = gStringTable.addString(name);
mNameMap[tablename] = data;
}
BOOL checkName(const std::string& name) const
{
return checkName(name.c_str());
}
// "logically const" even though it modifies the global nametable
BOOL checkName(const char *name) const
{
char *tablename = gStringTable.addString(name);
return mNameMap.count(tablename) ? TRUE : FALSE;
}
DATA resolveName(const std::string& name) const
{
return resolveName(name.c_str());
}
// "logically const" even though it modifies the global nametable
DATA resolveName(const char *name) const
{
char *tablename = gStringTable.addString(name);
const_iter_t iter = mNameMap.find(tablename);
if (iter != mNameMap.end())
return iter->second;
else
return 0;
}
// O(N)! (currently only used in one place... (newsim/llstate.cpp))
const char *resolveData(const DATA &data) const
{
const_iter_t iter = mNameMap.begin();
const_iter_t end = mNameMap.end();
for (; iter != end; ++iter)
{
if (iter->second == data)
return iter->first;
}
return NULL;
}
typedef std::map<const char *, DATA> name_map_t;
typedef typename std::map<const char *,DATA>::iterator iter_t;
typedef typename std::map<const char *,DATA>::const_iterator const_iter_t;
name_map_t mNameMap;
};
#endif

View File

@ -1,33 +0,0 @@
/**
* @file lloptioninterface.cpp
* @brief
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "lloptioninterface.h"
LLOptionInterface::~LLOptionInterface()
{
}

View File

@ -1,40 +0,0 @@
/**
* @file lloptioninterface.h
* @brief
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLOPTIONINTERFACE_H
#define LL_LLOPTIONINTERFACE_H
#include "linden_common.h"
class LLSD;
class LLOptionInterface
{
public:
virtual ~LLOptionInterface() = 0;
virtual LLSD getOption(const std::string& name) const = 0;
};
#endif

View File

@ -1,84 +0,0 @@
/**
* @file llsecondlifeurls.cpp
* @brief Urls used in the product
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llsecondlifeurls.h"
/*
const std::string CREATE_ACCOUNT_URL (
"http://join.secondlife.com/");
const std::string MANAGE_ACCOUNT (
"http://secondlife.com/account/"); // *TODO: NOT USED
const std::string AUCTION_URL (
"http://secondlife.com/auctions/auction-detail.php?id=");
const std::string EVENTS_URL (
"http://secondlife.com/events/");
*/
const std::string TIER_UP_URL (
"http://secondlife.com/app/landtier"); // *TODO: Translate (simulator)
const std::string DIRECTX_9_URL (
"http://secondlife.com/support/"); // *TODO: NOT USED
/*
const std::string LAND_URL (
"http://secondlife.com/app/landtier"); // *TODO: NOT USED
const std::string UPGRADE_TO_PREMIUM_URL (
"http://secondlife.com/app/upgrade/"); // *TODO: NOT USED
const std::string AMD_AGP_URL (
"http://secondlife.com/support/"); // *TODO: NOT USED
const std::string VIA_URL (
"http://secondlife.com/support/"); // *TODO: NOT USED
const std::string SUPPORT_URL (
"http://secondlife.com/support/");
const std::string INTEL_CHIPSET_URL (
"http://secondlife.com/support/"); // *TODO: NOT USED
const std::string SIS_CHIPSET_URL (
"http://secondlife.com/support/"); // *TODO: NOT USED
const std::string BLOGS_URL (
"http://blog.secondlife.com/"); // *TODO: NOT USED
const std::string BUY_CURRENCY_URL (
"http://secondlife.com/app/currency/");
const std::string LSL_DOC_URL (
"http://secondlife.com/app/lsldoc/"); // *TODO: NOT USED
const std::string SL_KB_URL (
"http://secondlife.com/knowledgebase/"); // *TODO: NOT USED
const std::string RELEASE_NOTES_BASE_URL (
"http://secondlife.com/app/releasenotes/");
*/

View File

@ -1,76 +0,0 @@
/**
* @file llsecondlifeurls.h
* @brief Global URLs to pages on our web site
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLSECONDLIFEURLS_H
#define LL_LLSECONDLIFEURLS_H
/*
// Account registration web page
LL_COMMON_API extern const std::string CREATE_ACCOUNT_URL;
// Manage Account
LL_COMMON_API extern const std::string MANAGE_ACCOUNT;
LL_COMMON_API extern const std::string AUCTION_URL;
LL_COMMON_API extern const std::string EVENTS_URL;
*/
// Tier up to a new land level.
LL_COMMON_API extern const std::string TIER_UP_URL;
// Tier up to a new land level.
LL_COMMON_API extern const std::string LAND_URL;
// How to get DirectX 9
LL_COMMON_API extern const std::string DIRECTX_9_URL;
/*
// Upgrade from basic membership to premium membership
LL_COMMON_API extern const std::string UPGRADE_TO_PREMIUM_URL;
// Out of date VIA chipset
LL_COMMON_API extern const std::string VIA_URL;
// Support URL
LL_COMMON_API extern const std::string SUPPORT_URL;
// Linden Blogs page
LL_COMMON_API extern const std::string BLOGS_URL;
// Currency page
LL_COMMON_API extern const std::string BUY_CURRENCY_URL;
// LSL script wiki
LL_COMMON_API extern const std::string LSL_DOC_URL;
// SL KnowledgeBase page
LL_COMMON_API extern const std::string SL_KB_URL;
// Release Notes Redirect URL for Server and Viewer
LL_COMMON_API extern const std::string RELEASE_NOTES_BASE_URL;
*/
#endif

View File

@ -1,75 +0,0 @@
/**
* @file llstatenums.h
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLSTATENUMS_H
#define LL_LLSTATENUMS_H
enum ESimStatID
{
LL_SIM_STAT_TIME_DILATION = 0,
LL_SIM_STAT_FPS = 1,
LL_SIM_STAT_PHYSFPS = 2,
LL_SIM_STAT_AGENTUPS = 3,
LL_SIM_STAT_FRAMEMS = 4,
LL_SIM_STAT_NETMS = 5,
LL_SIM_STAT_SIMOTHERMS = 6,
LL_SIM_STAT_SIMPHYSICSMS = 7,
LL_SIM_STAT_AGENTMS = 8,
LL_SIM_STAT_IMAGESMS = 9,
LL_SIM_STAT_SCRIPTMS = 10,
LL_SIM_STAT_NUMTASKS = 11,
LL_SIM_STAT_NUMTASKSACTIVE = 12,
LL_SIM_STAT_NUMAGENTMAIN = 13,
LL_SIM_STAT_NUMAGENTCHILD = 14,
LL_SIM_STAT_NUMSCRIPTSACTIVE = 15,
LL_SIM_STAT_LSLIPS = 16,
LL_SIM_STAT_INPPS = 17,
LL_SIM_STAT_OUTPPS = 18,
LL_SIM_STAT_PENDING_DOWNLOADS = 19,
LL_SIM_STAT_PENDING_UPLOADS = 20,
LL_SIM_STAT_VIRTUAL_SIZE_KB = 21,
LL_SIM_STAT_RESIDENT_SIZE_KB = 22,
LL_SIM_STAT_PENDING_LOCAL_UPLOADS = 23,
LL_SIM_STAT_TOTAL_UNACKED_BYTES = 24,
LL_SIM_STAT_PHYSICS_PINNED_TASKS = 25,
LL_SIM_STAT_PHYSICS_LOD_TASKS = 26,
LL_SIM_STAT_SIMPHYSICSSTEPMS = 27,
LL_SIM_STAT_SIMPHYSICSSHAPEMS = 28,
LL_SIM_STAT_SIMPHYSICSOTHERMS = 29,
LL_SIM_STAT_SIMPHYSICSMEMORY = 30,
LL_SIM_STAT_SCRIPT_EPS = 31,
LL_SIM_STAT_SIMSPARETIME = 32,
LL_SIM_STAT_SIMSLEEPTIME = 33,
LL_SIM_STAT_IOPUMPTIME = 34,
LL_SIM_STAT_PCTSCRIPTSRUN = 35,
LL_SIM_STAT_REGION_IDLE = 36, // dataserver only
LL_SIM_STAT_REGION_IDLE_POSSIBLE = 37, // dataserver only
LL_SIM_STAT_SIMAISTEPTIMEMS = 38,
LL_SIM_STAT_SKIPPEDAISILSTEPS_PS = 39,
LL_SIM_STAT_PCTSTEPPEDCHARACTERS = 40
};
#endif

View File

@ -33,7 +33,6 @@
#include <vector>
#include <list>
#include <set>
#include <deque>
#include <typeinfo>
// Use to compare the first element only of a pair
@ -125,7 +124,7 @@ struct DeletePairedPointerArray
// compiler, the second unary_function template parameter can be set
// to void.
//
// Here's a snippit showing how you use this object:
// Here's a snippet showing how you use this object:
//
// typedef std::map<int, widget*> map_type;
// map_type widget_map;
@ -170,6 +169,49 @@ struct CopyNewPointer
}
};
template<typename T, typename ALLOC>
void delete_and_clear(std::list<T*, ALLOC>& list)
{
std::for_each(list.begin(), list.end(), DeletePointer());
list.clear();
}
template<typename T, typename ALLOC>
void delete_and_clear(std::vector<T*, ALLOC>& vector)
{
std::for_each(vector.begin(), vector.end(), DeletePointer());
vector.clear();
}
template<typename T, typename COMPARE, typename ALLOC>
void delete_and_clear(std::set<T*, COMPARE, ALLOC>& set)
{
std::for_each(set.begin(), set.end(), DeletePointer());
set.clear();
}
template<typename K, typename V, typename COMPARE, typename ALLOC>
void delete_and_clear(std::map<K, V*, COMPARE, ALLOC>& map)
{
std::for_each(map.begin(), map.end(), DeletePairedPointer());
map.clear();
}
template<typename T>
void delete_and_clear(T*& ptr)
{
delete ptr;
ptr = NULL;
}
template<typename T>
void delete_and_clear_array(T*& ptr)
{
delete[] ptr;
ptr = NULL;
}
// Simple function to help with finding pointers in maps.
// For example:
// typedef map_t;
@ -229,7 +271,6 @@ inline T get_if_there(const std::map<K,T>& inmap, const K& key, T default_value)
}
};
// Useful for replacing the removeObj() functionality of LLDynamicArray
// Example:
// for (std::vector<T>::iterator iter = mList.begin(); iter != mList.end(); )
// {
@ -238,8 +279,8 @@ inline T get_if_there(const std::map<K,T>& inmap, const K& key, T default_value)
// else
// ++iter;
// }
template <typename T, typename Iter>
inline Iter vector_replace_with_last(std::vector<T>& invec, Iter iter)
template <typename T>
inline typename std::vector<T>::iterator vector_replace_with_last(std::vector<T>& invec, typename std::vector<T>::iterator iter)
{
typename std::vector<T>::iterator last = invec.end(); --last;
if (iter == invec.end())
@ -259,7 +300,6 @@ inline Iter vector_replace_with_last(std::vector<T>& invec, Iter iter)
}
};
// Useful for replacing the removeObj() functionality of LLDynamicArray
// Example:
// vector_replace_with_last(mList, x);
template <typename T>
@ -522,4 +562,151 @@ namespace std
};
} // std
/**
* Implementation for ll_template_cast() (q.v.).
*
* Default implementation: trying to cast two completely unrelated types
* returns 0. Typically you'd specify T and U as pointer types, but in fact T
* can be any type that can be initialized with 0.
*/
template <typename T, typename U>
struct ll_template_cast_impl
{
T operator()(U)
{
return 0;
}
};
/**
* ll_template_cast<T>(some_value) is for use in a template function when
* some_value might be of arbitrary type, but you want to recognize type T
* specially.
*
* It's designed for use with pointer types. Example:
* @code
* struct SpecialClass
* {
* void someMethod(const std::string&) const;
* };
*
* template <class REALCLASS>
* void somefunc(const REALCLASS& instance)
* {
* const SpecialClass* ptr = ll_template_cast<const SpecialClass*>(&instance);
* if (ptr)
* {
* ptr->someMethod("Call method only available on SpecialClass");
* }
* }
* @endcode
*
* Why is this better than dynamic_cast<>? Because unless OtherClass is
* polymorphic, the following won't even compile (gcc 4.0.1):
* @code
* OtherClass other;
* SpecialClass* ptr = dynamic_cast<SpecialClass*>(&other);
* @endcode
* to say nothing of this:
* @code
* void function(int);
* SpecialClass* ptr = dynamic_cast<SpecialClass*>(&function);
* @endcode
* ll_template_cast handles these kinds of cases by returning 0.
*/
template <typename T, typename U>
T ll_template_cast(U value)
{
return ll_template_cast_impl<T, U>()(value);
}
/**
* Implementation for ll_template_cast() (q.v.).
*
* Implementation for identical types: return same value.
*/
template <typename T>
struct ll_template_cast_impl<T, T>
{
T operator()(T value)
{
return value;
}
};
/**
* LL_TEMPLATE_CONVERTIBLE(dest, source) asserts that, for a value @c s of
* type @c source, <tt>ll_template_cast<dest>(s)</tt> will return @c s --
* presuming that @c source can be converted to @c dest by the normal rules of
* C++.
*
* By default, <tt>ll_template_cast<dest>(s)</tt> will return 0 unless @c s's
* type is literally identical to @c dest. (This is because of the
* straightforward application of template specialization rules.) That can
* lead to surprising results, e.g.:
*
* @code
* Foo myFoo;
* const Foo* fooptr = ll_template_cast<const Foo*>(&myFoo);
* @endcode
*
* Here @c fooptr will be 0 because <tt>&myFoo</tt> is of type <tt>Foo*</tt>
* -- @em not <tt>const Foo*</tt>. (Declaring <tt>const Foo myFoo;</tt> would
* force the compiler to do the right thing.)
*
* More disappointingly:
* @code
* struct Base {};
* struct Subclass: public Base {};
* Subclass object;
* Base* ptr = ll_template_cast<Base*>(&object);
* @endcode
*
* Here @c ptr will be 0 because <tt>&object</tt> is of type
* <tt>Subclass*</tt> rather than <tt>Base*</tt>. We @em want this cast to
* succeed, but without our help ll_template_cast can't recognize it.
*
* The following would suffice:
* @code
* LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*);
* ...
* Base* ptr = ll_template_cast<Base*>(&object);
* @endcode
*
* However, as noted earlier, this is easily fooled:
* @code
* const Base* ptr = ll_template_cast<const Base*>(&object);
* @endcode
* would still produce 0 because we haven't yet seen:
* @code
* LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*);
* @endcode
*
* @TODO
* This macro should use Boost type_traits facilities for stripping and
* re-adding @c const and @c volatile qualifiers so that invoking
* LL_TEMPLATE_CONVERTIBLE(dest, source) will automatically generate all
* permitted permutations. It's really not fair to the coder to require
* separate:
* @code
* LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*);
* LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*);
* LL_TEMPLATE_CONVERTIBLE(const Base*, const Subclass*);
* @endcode
*
* (Naturally we omit <tt>LL_TEMPLATE_CONVERTIBLE(Base*, const Subclass*)</tt>
* because that's not permitted by normal C++ assignment anyway.)
*/
#define LL_TEMPLATE_CONVERTIBLE(DEST, SOURCE) \
template <> \
struct ll_template_cast_impl<DEST, SOURCE> \
{ \
DEST operator()(SOURCE wrapper) \
{ \
return wrapper; \
} \
}
#endif // LL_LLSTL_H

View File

@ -317,7 +317,7 @@ void LLStringTable::removeString(const char *str)
mUniqueEntries--;
if (mUniqueEntries < 0)
{
llerror("LLStringTable:removeString trying to remove too many strings!", 0);
LL_ERRS() << "LLStringTable:removeString trying to remove too many strings!" << LL_ENDL;
}
delete iter->second;
mStringHash.erase(iter);
@ -343,7 +343,7 @@ void LLStringTable::removeString(const char *str)
mUniqueEntries--;
if (mUniqueEntries < 0)
{
llerror("LLStringTable:removeString trying to remove too many strings!", 0);
LL_ERRS() << "LLStringTable:removeString trying to remove too many strings!" << LL_ENDL;
}
strlist->remove(entry);
delete entry;

View File

@ -43,7 +43,6 @@
//
// Locally used constants
//
const U32 SEC_PER_DAY = 86400;
const F64 SEC_TO_MICROSEC = 1000000.f;
const U64 SEC_TO_MICROSEC_U64 = 1000000;
const F64 USEC_TO_SEC_F64 = 0.000001;
@ -204,6 +203,8 @@ F64 calc_clock_frequency(unsigned int uiMeasureMSecs)
return 1000000.0; // microseconds, so 1 MHz.
}
const U64 SEC_TO_MICROSEC_U64 = 1000000;
U64 get_clock_count()
{
// Linux clocks are in microseconds
@ -226,7 +227,7 @@ void update_clock_frequencies()
// returns a U64 number that represents the number of
// microseconds since the unix epoch - Jan 1, 1970
U64 totalTime()
LLUnitImplicit<U64, LLUnits::Microseconds> totalTime()
{
U64 current_clock_count = get_clock_count();
if (!gTotalTimeClockCount)
@ -263,7 +264,7 @@ U64 totalTime()
}
// Return the total clock tick count in microseconds.
return (U64)(gTotalTimeClockCount*gClocksToMicroseconds);
return LLUnits::Microseconds::fromValue(gTotalTimeClockCount*gClocksToMicroseconds);
}
@ -375,7 +376,7 @@ LLUnitImplicit<F32, LLUnits::Seconds> LLTimer::getElapsedTimeAndResetF32()
///////////////////////////////////////////////////////////////////////////////
void LLTimer::setTimerExpirySec(F32 expiration)
void LLTimer::setTimerExpirySec(LLUnitImplicit<F32, LLUnits::Seconds> expiration)
{
mExpirationTicks = get_clock_count()
+ (U64)((F32)(expiration * gClockFrequency));

View File

@ -91,7 +91,7 @@ public:
void stop() { mStarted = FALSE; }
void reset(); // Resets the timer
void setLastClockCount(U64 current_count); // Sets the timer so that the next elapsed call will be relative to this time
void setTimerExpirySec(F32 expiration);
void setTimerExpirySec(LLUnitImplicit<F32, LLUnits::Seconds> expiration);
BOOL checkExpirationAndReset(F32 expiration);
BOOL hasExpired() const;
LLUnitImplicit<F32, LLUnits::Seconds> getElapsedTimeAndResetF32(); // Returns elapsed time in seconds with reset
@ -171,6 +171,6 @@ LL_COMMON_API struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_dayli
LL_COMMON_API void microsecondsToTimecodeString(U64 current_time, std::string& tcstring);
LL_COMMON_API void secondsToTimecodeString(F32 current_time, std::string& tcstring);
U64 LL_COMMON_API totalTime(); // Returns current system time in microseconds
LLUnitImplicit<U64, LLUnits::Microseconds> LL_COMMON_API totalTime(); // Returns current system time in microseconds
#endif

View File

@ -29,7 +29,7 @@
#include "stdtypes.h"
#include "llpreprocessor.h"
#include "llerrorlegacy.h"
#include "llerror.h"
template<typename STORAGE_TYPE, typename UNIT_TYPE>
struct LLUnit
@ -266,13 +266,29 @@ LLUnit<STORAGE_TYPE, UNIT_TYPE> operator + (SCALAR_TYPE first, LLUnit<STORAGE_TY
}
template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator + (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnit<STORAGE_TYPE2, UNIT_TYPE2> second)
LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator + (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnitImplicit<STORAGE_TYPE2, UNIT_TYPE2> second)
{
LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first);
result += second;
return result;
}
template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator + (LLUnit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnitImplicit<STORAGE_TYPE2, UNIT_TYPE2> second)
{
LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first);
result += second;
return result;
}
template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator + (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnit<STORAGE_TYPE2, UNIT_TYPE2> second)
{
LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first);
result += LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1>(second);
return result;
}
template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator + (LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second)
{
@ -281,10 +297,10 @@ LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator + (LLUnitImplicit<STORAGE_TYPE,
return result;
}
template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator + (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnitImplicit<STORAGE_TYPE2, UNIT_TYPE2> second)
template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator + (SCALAR_TYPE first, LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> second)
{
LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first);
LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> result(first);
result += second;
return result;
}
@ -324,6 +340,22 @@ LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator - (LLUnitImplicit<STORAGE_TYP
return result;
}
template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator - (LLUnit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnitImplicit<STORAGE_TYPE2, UNIT_TYPE2> second)
{
LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first);
result -= second;
return result;
}
template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator - (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnit<STORAGE_TYPE2, UNIT_TYPE2> second)
{
LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first);
result -= LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1>(second);
return result;
}
template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator - (LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second)
{
@ -343,18 +375,6 @@ LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator - (SCALAR_TYPE first, LLUnitImp
//
// operator *
//
template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
LLUnit<STORAGE_TYPE, UNIT_TYPE> operator * (SCALAR_TYPE first, LLUnit<STORAGE_TYPE, UNIT_TYPE> second)
{
return LLUnit<STORAGE_TYPE, UNIT_TYPE>((STORAGE_TYPE)(first * second.value()));
}
template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
LLUnit<STORAGE_TYPE, UNIT_TYPE> operator * (LLUnit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second)
{
return LLUnit<STORAGE_TYPE, UNIT_TYPE>((STORAGE_TYPE)(first.value() * second));
}
template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
LLUnit<STORAGE_TYPE1, UNIT_TYPE1> operator * (LLUnit<STORAGE_TYPE1, UNIT_TYPE1>, LLUnit<STORAGE_TYPE2, UNIT_TYPE2>)
{
@ -364,15 +384,15 @@ LLUnit<STORAGE_TYPE1, UNIT_TYPE1> operator * (LLUnit<STORAGE_TYPE1, UNIT_TYPE1>,
}
template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator * (SCALAR_TYPE first, LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> second)
LLUnit<STORAGE_TYPE, UNIT_TYPE> operator * (LLUnit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second)
{
return LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE>(first * second.value());
return LLUnit<STORAGE_TYPE, UNIT_TYPE>((STORAGE_TYPE)(first.value() * second));
}
template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator * (LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second)
LLUnit<STORAGE_TYPE, UNIT_TYPE> operator * (SCALAR_TYPE first, LLUnit<STORAGE_TYPE, UNIT_TYPE> second)
{
return LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE>(first.value() * second);
return LLUnit<STORAGE_TYPE, UNIT_TYPE>((STORAGE_TYPE)(first * second.value()));
}
template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
@ -383,6 +403,19 @@ LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator * (LLUnitImplicit<STORAGE_TYP
return LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1>();
}
template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator * (LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second)
{
return LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE>(first.value() * second);
}
template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE>
LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator * (SCALAR_TYPE first, LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> second)
{
return LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE>(first * second.value());
}
//
// operator /
//
@ -416,6 +449,18 @@ STORAGE_TYPE1 operator / (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUni
return STORAGE_TYPE1(first.value() / first.convert(second));
}
template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
STORAGE_TYPE1 operator / (LLUnit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnitImplicit<STORAGE_TYPE2, UNIT_TYPE2> second)
{
return STORAGE_TYPE1(first.value() / first.convert(second));
}
template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2>
STORAGE_TYPE1 operator / (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnit<STORAGE_TYPE2, UNIT_TYPE2> second)
{
return STORAGE_TYPE1(first.value() / first.convert(second));
}
#define COMPARISON_OPERATORS(op) \
template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE> \
bool operator op (SCALAR_TYPE first, LLUnit<STORAGE_TYPE, UNIT_TYPE> second) \
@ -591,6 +636,7 @@ LL_DECLARE_DERIVED_UNIT(Mibibits, * 1024, Gibibits, "Gib");
LL_DECLARE_BASE_UNIT(Seconds, "s");
LL_DECLARE_DERIVED_UNIT(Seconds, * 60, Minutes, "min");
LL_DECLARE_DERIVED_UNIT(Minutes, * 60, Hours, "h");
LL_DECLARE_DERIVED_UNIT(Hours, * 24, Days, "d");
LL_DECLARE_DERIVED_UNIT(Seconds, / 1000, Milliseconds, "ms");
LL_DECLARE_DERIVED_UNIT(Milliseconds, / 1000, Microseconds, "\x09\x3cs");
LL_DECLARE_DERIVED_UNIT(Microseconds, / 1000, Nanoseconds, "ns");

View File

@ -1,38 +0,0 @@
/**
* @file llversionserver.h
* @brief
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLVERSIONSERVER_H
#define LL_LLVERSIONSERVER_H
const S32 LL_VERSION_MAJOR = 2;
const S32 LL_VERSION_MINOR = 1;
const S32 LL_VERSION_PATCH = 0;
const S32 LL_VERSION_BUILD = 264760;
const char * const LL_CHANNEL = "Second Life Server";
#endif

View File

@ -1,137 +0,0 @@
/**
* @file stdenums.h
* @brief Enumerations for indra.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_STDENUMS_H
#define LL_STDENUMS_H
//----------------------------------------------------------------------------
// DEPRECATED - create new, more specific files for shared enums/constants
//----------------------------------------------------------------------------
// this enum is used by the llview.h (viewer) and the llassetstorage.h (viewer and sim)
enum EDragAndDropType
{
DAD_NONE = 0,
DAD_TEXTURE = 1,
DAD_SOUND = 2,
DAD_CALLINGCARD = 3,
DAD_LANDMARK = 4,
DAD_SCRIPT = 5,
DAD_CLOTHING = 6,
DAD_OBJECT = 7,
DAD_NOTECARD = 8,
DAD_CATEGORY = 9,
DAD_ROOT_CATEGORY = 10,
DAD_BODYPART = 11,
DAD_ANIMATION = 12,
DAD_GESTURE = 13,
DAD_LINK = 14,
DAD_MESH = 15,
DAD_WIDGET = 16,
DAD_PERSON = 17,
DAD_COUNT = 18, // number of types in this enum
};
// Reasons for drags to be denied.
// ordered by priority for multi-drag
enum EAcceptance
{
ACCEPT_POSTPONED, // we are asynchronously determining acceptance
ACCEPT_NO, // Uninformative, general purpose denial.
ACCEPT_NO_LOCKED, // Operation would be valid, but permissions are set to disallow it.
ACCEPT_YES_COPY_SINGLE, // We'll take a copy of a single item
ACCEPT_YES_SINGLE, // Accepted. OK to drag and drop single item here.
ACCEPT_YES_COPY_MULTI, // We'll take a copy of multiple items
ACCEPT_YES_MULTI // Accepted. OK to drag and drop multiple items here.
};
// This is used by the DeRezObject message to determine where to put
// derezed tasks.
enum EDeRezDestination
{
DRD_SAVE_INTO_AGENT_INVENTORY = 0,
DRD_ACQUIRE_TO_AGENT_INVENTORY = 1, // try to leave copy in world
DRD_SAVE_INTO_TASK_INVENTORY = 2,
DRD_ATTACHMENT = 3,
DRD_TAKE_INTO_AGENT_INVENTORY = 4, // delete from world
DRD_FORCE_TO_GOD_INVENTORY = 5, // force take copy
DRD_TRASH = 6,
DRD_ATTACHMENT_TO_INV = 7,
DRD_ATTACHMENT_EXISTS = 8,
DRD_RETURN_TO_OWNER = 9, // back to owner's inventory
DRD_RETURN_TO_LAST_OWNER = 10, // deeded object back to last owner's inventory
DRD_COUNT = 11
};
// This is used by the return to owner code to determine the reason
// that this object is being returned.
enum EReturnReason
{
RR_GENERIC = 0,
RR_SANDBOX = 1,
RR_PARCEL_OWNER = 2,
RR_PARCEL_AUTO = 3,
RR_PARCEL_FULL = 4,
RR_OFF_WORLD = 5,
RR_COUNT = 6
};
// This is used for filling in the first byte of the ExtraID field of
// the ObjectProperties message.
enum EObjectPropertiesExtraID
{
OPEID_NONE = 0,
OPEID_ASSET_ID = 1,
OPEID_FROM_TASK_ID = 2,
OPEID_COUNT = 3
};
enum EAddPosition
{
ADD_TOP,
ADD_BOTTOM,
ADD_DEFAULT
};
enum LLGroupChange
{
GC_PROPERTIES,
GC_MEMBER_DATA,
GC_ROLE_DATA,
GC_ROLE_MEMBER_DATA,
GC_TITLES,
GC_ALL
};
//----------------------------------------------------------------------------
// DEPRECATED - create new, more specific files for shared enums/constants
//----------------------------------------------------------------------------
#endif

View File

@ -1,26 +0,0 @@
/**
* @file string_table.h
* @brief Legacy wrapper header.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llstringtable.h"

View File

@ -28,7 +28,7 @@
#include "linden_common.h"
#include "../bitpack.h"
#include "../llbitpack.h"
#include "../test/lltut.h"

View File

@ -1,42 +0,0 @@
/**
* @file timing.h
* @brief Cross-platform routines for doing timing.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_TIMING_H
#define LL_TIMING_H
#if LL_LINUX || LL_DARWIN || LL_SOLARIS
#include <sys/time.h>
#endif
const F32 SEC_TO_MICROSEC = 1000000.f;
const U64 SEC_TO_MICROSEC_U64 = 1000000;
const U32 SEC_PER_DAY = 86400;
// functionality has been moved lltimer.{cpp,h}. This file will be deprecated in the future.
#endif

View File

@ -34,6 +34,11 @@
#include "llsd.h"
#include "llcontrol.h"
// Crash reporter behavior
const S32 CRASH_BEHAVIOR_ASK = 0;
const S32 CRASH_BEHAVIOR_ALWAYS_SEND = 1;
const S32 CRASH_BEHAVIOR_NEVER_SEND = 2;
class LLCrashLogger : public LLApp
{
public:

View File

@ -19,6 +19,7 @@ include_directories(
set(llinventory_SOURCE_FILES
llcategory.cpp
lleconomy.cpp
llfoldertype.cpp
llinventory.cpp
llinventorydefines.cpp
llinventorytype.cpp
@ -36,6 +37,7 @@ set(llinventory_HEADER_FILES
llcategory.h
lleconomy.h
llfoldertype.h
llinventory.h
llinventorydefines.h
llinventorytype.h

View File

@ -27,7 +27,6 @@
#ifndef LL_LLINVENTORY_H
#define LL_LLINVENTORY_H
#include "lldarray.h"
#include "llfoldertype.h"
#include "llinventorytype.h"
#include "llpermissions.h"
@ -124,7 +123,7 @@ protected:
class LLInventoryItem : public LLInventoryObject
{
public:
typedef LLDynamicArray<LLPointer<LLInventoryItem> > item_array_t;
typedef std::vector<LLPointer<LLInventoryItem> > item_array_t;
//--------------------------------------------------------------------
// Initialization
@ -235,7 +234,7 @@ protected:
class LLInventoryCategory : public LLInventoryObject
{
public:
typedef LLDynamicArray<LLPointer<LLInventoryCategory> > cat_array_t;
typedef std::vector<LLPointer<LLInventoryCategory> > cat_array_t;
//--------------------------------------------------------------------
// Initialization

View File

@ -136,7 +136,7 @@ LLParcel::LLParcel(const LLUUID &owner_id,
// virtual
LLParcel::~LLParcel()
{
// user list cleaned up by LLDynamicArray destructor.
// user list cleaned up by std::vector destructor.
}
void LLParcel::init(const LLUUID &owner_id,
@ -1082,7 +1082,7 @@ void LLParcel::startSale(const LLUUID& buyer_id, BOOL is_buyer_group)
mGroupID.setNull();
}
mSaleTimerExpires.start();
mSaleTimerExpires.setTimerExpirySec(DEFAULT_USEC_SALE_TIMEOUT / SEC_TO_MICROSEC);
mSaleTimerExpires.setTimerExpirySec(LLUnits::Microseconds::fromValue(DEFAULT_USEC_SALE_TIMEOUT));
mStatus = OS_LEASE_PENDING;
mClaimDate = time(NULL);
setAuctionID(0);

View File

@ -44,7 +44,6 @@
#include "m3math.h"
#include "llmatrix3a.h"
#include "lloctree.h"
#include "lldarray.h"
#include "llvolume.h"
#include "llvolumeoctree.h"
#include "llstl.h"

View File

@ -42,7 +42,6 @@ class LLVolumeFace;
class LLVolume;
class LLVolumeTriangle;
#include "lldarray.h"
#include "lluuid.h"
#include "v4color.h"
//#include "vmath.h"

View File

@ -27,6 +27,7 @@ set(llmessage_SOURCE_FILES
llares.cpp
llareslistener.cpp
llassetstorage.cpp
llavatarname.cpp
llavatarnamecache.cpp
llblowfishcipher.cpp
llbuffer.cpp
@ -114,6 +115,7 @@ set(llmessage_HEADER_FILES
llares.h
llareslistener.h
llassetstorage.h
llavatarname.h
llavatarnamecache.h
llblowfishcipher.h
llbuffer.h
@ -128,6 +130,7 @@ set(llmessage_HEADER_FILES
lldbstrings.h
lldispatcher.h
lleventflags.h
llextendedstatus.h
llfiltersd2xmlrpc.h
llfollowcamparams.h
llhost.h

View File

@ -34,11 +34,11 @@
#include "lltimer.h"
#include "llnamevalue.h"
#include "llhost.h"
#include "stdenums.h" // for EDragAndDropType
#include "lltransfermanager.h" // For LLTSCode enum
#include "llassettype.h"
#include "llstring.h"
#include "llextendedstatus.h"
#include "llxfer.h"
// Forward declarations
class LLMessageSystem;
@ -51,6 +51,15 @@ class LLSD;
// HTTP Uploads also timeout if they take longer than this.
const F32 LL_ASSET_STORAGE_TIMEOUT = 5 * 60.0f;
// Specific error codes
const int LL_ERR_ASSET_REQUEST_FAILED = -1;
//const int LL_ERR_ASSET_REQUEST_INVALID = -2;
const int LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE = -3;
const int LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE = -4;
const int LL_ERR_INSUFFICIENT_PERMISSIONS = -5;
const int LL_ERR_PRICE_MISMATCH = -23018;
class LLAssetInfo
{
protected:

View File

@ -34,7 +34,6 @@
#include "llerror.h"
#include "lltimer.h"
#include "timing.h"
#include "net.h"
#include "llhost.h"
#include "llpacketack.h"
@ -51,6 +50,8 @@ const F32 LL_AVERAGED_PING_MIN = 100; // msec // IW: increased to avoid ret
const U32 INITIAL_PING_VALUE_MSEC = 1000; // initial value for the ping delay, or for ping delay for an unknown circuit
const TPACKETID LL_MAX_OUT_PACKET_ID = 0x01000000;
const int LL_ERR_CIRCUIT_GONE = -23017;
const int LL_ERR_TCP_TIMEOUT = -23016;
// 0 - flags
// [1,4] - packetid

View File

@ -36,6 +36,7 @@
#include "llproxy.h"
#include "llvfile.h"
#include "llvfs.h"
#include "llxfer.h"
#ifdef LL_STANDALONE
# include <zlib.h>
@ -43,6 +44,8 @@
# include "zlib/zlib.h"
#endif
const char* const LOCAL_ASSET_URL_FORMAT = "http://%s:12041/asset";
const U32 MAX_RUNNING_REQUESTS = 1;
const F32 MAX_PROCESSING_TIME = 0.005f;
const S32 CURL_XFER_BUFFER_SIZE = 65536;

View File

@ -27,9 +27,9 @@
#ifndef LL_LLMESSAGETEMPLATE_H
#define LL_LLMESSAGETEMPLATE_H
#include "lldarray.h"
#include "message.h" // TODO: babbage: Remove...
#include "llstl.h"
#include "llindexedvector.h"
class LLMsgVarData
{
@ -102,7 +102,7 @@ public:
}
S32 mBlockNumber;
typedef LLDynamicArrayIndexed<LLMsgVarData, const char *, 8> msg_var_data_map_t;
typedef LLIndexedVector<LLMsgVarData, const char *, 8> msg_var_data_map_t;
msg_var_data_map_t mMemberVarData;
char *mName;
S32 mTotalSize;
@ -225,7 +225,7 @@ public:
friend std::ostream& operator<<(std::ostream& s, LLMessageBlock &msg);
typedef LLDynamicArrayIndexed<LLMessageVariable*, const char *, 8> message_variable_map_t;
typedef LLIndexedVector<LLMessageVariable*, const char *, 8> message_variable_map_t;
message_variable_map_t mMemberVariables;
char *mName;
EMsgBlockType mType;
@ -391,7 +391,7 @@ public:
}
public:
typedef LLDynamicArrayIndexed<LLMessageBlock*, char*, 8> message_block_map_t;
typedef LLIndexedVector<LLMessageBlock*, char*, 8> message_block_map_t;
message_block_map_t mMemberBlocks;
char *mName;
EMsgFrequency mFrequency;

View File

@ -33,7 +33,7 @@
#include "u64.h"
#include "llstring.h"
#include "string_table.h"
#include "llstringtable.h"
// Anonymous enumeration to provide constants in this file.
// *NOTE: These values may be used in sscanf statements below as their

View File

@ -41,7 +41,7 @@
// SitObject STRING
// SitPosition VEC3
#include "string_table.h"
#include "llstringtable.h"
#include "llmath.h"
#include "v3math.h"
#include "lldbstrings.h"

View File

@ -29,7 +29,7 @@
#include "llpacketbuffer.h"
#include "net.h"
#include "timing.h"
#include "lltimer.h"
#include "llhost.h"
///////////////////////////////////////////////////////////

View File

@ -41,7 +41,6 @@
#include "llproxy.h"
#include "llrand.h"
#include "message.h"
#include "timing.h"
#include "u64.h"
///////////////////////////////////////////////////////////

View File

@ -32,6 +32,10 @@
#include "llextendedstatus.h"
const S32 LL_XFER_LARGE_PAYLOAD = 7680;
const S32 LL_ERR_FILE_EMPTY = -44;
const int LL_ERR_FILE_NOT_FOUND = -43;
const int LL_ERR_CANNOT_OPEN_FILE = -42;
const int LL_ERR_EOF = -39;
typedef enum ELLXferStatus {
e_LL_XFER_UNINITIALIZED,

View File

@ -677,7 +677,7 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user
ack_info.mID = id;
ack_info.mPacketNum = decodePacketNum(packetnum);
ack_info.mRemoteHost = mesgsys->getSender();
mXferAckQueue.push(ack_info);
mXferAckQueue.push_back(ack_info);
}
if (isLastPacket(packetnum))
@ -1088,15 +1088,15 @@ void LLXferManager::retransmitUnackedPackets ()
// so we don't blow through bandwidth.
//
while (mXferAckQueue.getLength())
while (mXferAckQueue.size())
{
if (mAckThrottle.checkOverflow(1000.0f*8.0f))
{
break;
}
//llinfos << "Confirm packet queue length:" << mXferAckQueue.getLength() << llendl;
LLXferAckInfo ack_info;
mXferAckQueue.pop(ack_info);
//llinfos << "Confirm packet queue length:" << mXferAckQueue.size() << llendl;
LLXferAckInfo ack_info = mXferAckQueue.front();
mXferAckQueue.pop_front();
//llinfos << "Sending confirm packet" << llendl;
sendConfirmPacket(gMessageSystem, ack_info.mID, ack_info.mPacketNum, ack_info.mRemoteHost);
mAckThrottle.throttleOverflow(1000.f*8.f); // Assume 1000 bytes/packet

View File

@ -41,7 +41,7 @@ class LLVFS;
#include "message.h"
#include "llassetstorage.h"
#include "lldir.h"
#include "lllinkedqueue.h"
#include <deque>
#include "llthrottle.h"
class LLHostStatus
@ -80,7 +80,7 @@ class LLXferManager
S32 mMaxIncomingXfers;
BOOL mUseAckThrottling; // Use ack throttling to cap file xfer bandwidth
LLLinkedQueue<LLXferAckInfo> mXferAckQueue;
std::deque<LLXferAckInfo> mXferAckQueue;
LLThrottle mAckThrottle;
public:

View File

@ -47,10 +47,8 @@
// linden library headers
#include "indra_constants.h"
#include "lldarray.h"
#include "lldir.h"
#include "llerror.h"
#include "llerrorlegacy.h"
#include "llfasttimer.h"
#include "llhttpclient.h"
#include "llhttpnodeadapter.h"
@ -73,7 +71,6 @@
#include "lltransfermanager.h"
#include "lluuid.h"
#include "llxfermanager.h"
#include "timing.h"
#include "llquaternion.h"
#include "u64.h"
#include "v3dmath.h"
@ -120,7 +117,7 @@ namespace
{
LL_WARNS("Messaging") << "error status " << status
<< " for message " << mMessageName
<< " reason " << reason << llendl;
<< " reason " << reason << LL_ENDL;
}
// TODO: Map status in to useful error code.
if(NULL != mCallback) mCallback(mCallbackData, LL_ERR_TCP_TIMEOUT);
@ -155,7 +152,7 @@ void LLMessageHandlerBridge::post(LLHTTPNode::ResponsePtr response,
std::string name = context["request"]["wildcard"]["message-name"];
char* namePtr = LLMessageStringTable::getInstance()->getString(name.c_str());
lldebugs << "Setting mLastSender " << input["sender"].asString() << llendl;
lldebugs << "Setting mLastSender " << input["sender"].asString() << LL_ENDL;
gMessageSystem->mLastSender = LLHost(input["sender"].asString());
gMessageSystem->mPacketsIn += 1;
gMessageSystem->mLLSDMessageReader->setMessage(namePtr, input["body"]);
@ -284,14 +281,14 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
mbError = TRUE;
mErrorCode = error;
}
// LL_DEBUGS("Messaging") << << "*** port: " << mPort << llendl;
// LL_DEBUGS("Messaging") << << "*** port: " << mPort << LL_ENDL;
//
// Create the data structure that we can poll on
//
if (!gAPRPoolp)
{
LL_ERRS("Messaging") << "No APR pool before message system initialization!" << llendl;
LL_ERRS("Messaging") << "No APR pool before message system initialization!" << LL_ENDL;
ll_init_apr();
}
apr_socket_t *aprSocketp = NULL;
@ -329,7 +326,7 @@ void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure
{
if(filename.empty())
{
LL_ERRS("Messaging") << "No template filename specified" << llendl;
LL_ERRS("Messaging") << "No template filename specified" << LL_ENDL;
mbError = TRUE;
return;
}
@ -338,9 +335,9 @@ void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure
if(!_read_file_into_string(template_body, filename))
{
if (failure_is_fatal) {
LL_ERRS("Messaging") << "Failed to open template: " << filename << llendl;
LL_ERRS("Messaging") << "Failed to open template: " << filename << LL_ENDL;
} else {
LL_WARNS("Messaging") << "Failed to open template: " << filename << llendl;
LL_WARNS("Messaging") << "Failed to open template: " << filename << LL_ENDL;
}
mbError = TRUE;
return;
@ -566,7 +563,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
// Ones that are non-zero but below the minimum packet size are worrisome.
if (receive_size > 0)
{
LL_WARNS("Messaging") << "Invalid (too short) packet discarded " << receive_size << llendl;
LL_WARNS("Messaging") << "Invalid (too short) packet discarded " << receive_size << LL_ENDL;
callExceptionFunc(MX_PACKET_TOO_SHORT);
}
// no data in packet receive buffer
@ -592,7 +589,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
// the next one
LL_WARNS("Messaging") << "Malformed packet received. Packet size "
<< receive_size << " with invalid no. of acks " << acks
<< llendl;
<< LL_ENDL;
valid_packet = FALSE;
continue;
}
@ -620,7 +617,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
memcpy(&mem_id, &mTrueReceiveBuffer[true_rcv_size], /* Flawfinder: ignore*/
sizeof(TPACKETID));
packet_id = ntohl(mem_id);
//LL_INFOS("Messaging") << "got ack: " << packet_id << llendl;
//LL_INFOS("Messaging") << "got ack: " << packet_id << LL_ENDL;
cdp->ackReliablePacket(packet_id);
}
if (!cdp->getUnackedPacketCount())
@ -652,14 +649,14 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
// LL_WARNS("Messaging") << "DISCARDED PACKET HOST MISMATCH! HOST: "
// << host << " CIRCUIT: "
// << mCircuitInfo.mCurrentCircuit->mHost
// << llendl;
// << LL_ENDL;
//}
// ***************************************
//mCircuitInfo.mCurrentCircuit->mAcks.put(mCurrentRecvPacketID);
cdp->collectRAck(mCurrentRecvPacketID);
}
LL_DEBUGS("Messaging") << "Discarding duplicate resend from " << host << llendl;
LL_DEBUGS("Messaging") << "Discarding duplicate resend from " << host << LL_ENDL;
if(mVerboseLog)
{
std::ostringstream str;
@ -671,7 +668,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
<< " resent "
<< ((acks > 0) ? "acks" : "")
<< " DISCARD DUPLICATE";
LL_INFOS("Messaging") << str.str() << llendl;
LL_INFOS("Messaging") << str.str() << LL_ENDL;
}
mPacketsIn++;
valid_packet = FALSE;
@ -750,7 +747,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
{
if (mbProtected && (!cdp))
{
LL_WARNS("Messaging") << "Invalid Packet from invalid circuit " << host << llendl;
LL_WARNS("Messaging") << "Invalid Packet from invalid circuit " << host << LL_ENDL;
mOffCircuitPackets++;
}
else
@ -820,7 +817,7 @@ void LLMessageSystem::processAcks()
if (!mDenyTrustedCircuitSet.empty())
{
LL_INFOS("Messaging") << "Sending queued DenyTrustedCircuit messages." << llendl;
LL_INFOS("Messaging") << "Sending queued DenyTrustedCircuit messages." << LL_ENDL;
for (host_set_t::iterator hostit = mDenyTrustedCircuitSet.begin(); hostit != mDenyTrustedCircuitSet.end(); ++hostit)
{
reallySendDenyTrustedCircuit(*hostit);
@ -894,7 +891,7 @@ LLSD LLMessageSystem::getBuiltMessageLLSD() const
else
{
// TODO: implement as below?
llerrs << "Message not built as LLSD." << llendl;
llerrs << "Message not built as LLSD." << LL_ENDL;
}
return result;
}
@ -1147,7 +1144,7 @@ LLHTTPClient::ResponderPtr LLMessageSystem::createResponder(const std::string& n
// explicitly sent as reliable, so they don't have a callback
// LL_WARNS("Messaging") << "LLMessageSystem::sendMessage: Sending unreliable "
// << mMessageBuilder->getMessageName() << " message via HTTP"
// << llendl;
// << LL_ENDL;
return new LLFnPtrResponder(
NULL,
NULL,
@ -1183,11 +1180,11 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
if(mVerboseLog)
{
LL_INFOS_ONCE("Messaging") << "MSG: -> " << host << "\tUNKNOWN CIRCUIT:\t"
<< mMessageBuilder->getMessageName() << llendl;
<< mMessageBuilder->getMessageName() << LL_ENDL;
}
LL_WARNS_ONCE("Messaging") << "sendMessage - Trying to send "
<< mMessageBuilder->getMessageName() << " on unknown circuit "
<< host << llendl;
<< host << LL_ENDL;
return 0;
}
else
@ -1206,11 +1203,11 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
if(mVerboseLog)
{
LL_INFOS("Messaging") << "MSG: -> " << host << "\tDEAD CIRCUIT\t\t"
<< mMessageBuilder->getMessageName() << llendl;
<< mMessageBuilder->getMessageName() << LL_ENDL;
}
LL_WARNS("Messaging") << "sendMessage - Trying to send message "
<< mMessageBuilder->getMessageName() << " to dead circuit "
<< host << llendl;
<< host << LL_ENDL;
return 0;
}
}
@ -1255,7 +1252,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
LL_WARNS("Messaging") << "sendMessage - Trying to send "
<< ((buffer_length > 4000) ? "EXTRA " : "")
<< "BIG message " << mMessageBuilder->getMessageName() << " - "
<< buffer_length << llendl;
<< buffer_length << LL_ENDL;
}
}
if (mSendReliable)
@ -1317,7 +1314,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
// append_acout_count is incorrect or that
// MAX_BUFFER_SIZE has fallen below MTU which is bad
// and probably programmer error.
LL_ERRS("Messaging") << "Buffer packing failed due to size.." << llendl;
LL_ERRS("Messaging") << "Buffer packing failed due to size.." << LL_ENDL;
}
}
@ -1358,7 +1355,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
std::ostream_iterator<TPACKETID> append(str, " ");
std::copy(acks.begin(), acks.end(), append);
}
LL_INFOS("Messaging") << str.str() << llendl;
LL_INFOS("Messaging") << str.str() << LL_ENDL;
}
@ -1382,7 +1379,7 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re
<< nullToEmpty(mMessageReader->getMessageName())
<< (recv_reliable ? " reliable" : "")
<< " REJECTED";
LL_INFOS("Messaging") << str.str() << llendl;
LL_INFOS("Messaging") << str.str() << LL_ENDL;
}
// nope!
// cout << "Rejecting unexpected message " << mCurrentMessageTemplate->mName << " from " << hex << ip << " , " << dec << port << endl;
@ -1390,7 +1387,7 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re
// Keep track of rejected messages as well
if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM)
{
LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl;
LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << LL_ENDL;
}
else
{
@ -1409,7 +1406,7 @@ S32 LLMessageSystem::sendMessage(
{
if (!(host.isOk()))
{
LL_WARNS("Messaging") << "trying to send message to invalid host" << llendl;
LL_WARNS("Messaging") << "trying to send message to invalid host" << LL_ENDL;
return 0;
}
@ -1427,14 +1424,14 @@ void LLMessageSystem::logTrustedMsgFromUntrustedCircuit( const LLHost& host )
LL_WARNS("Messaging") << "Received trusted message on untrusted circuit. "
<< "Will reply with deny. "
<< "Message: " << nullToEmpty(mMessageReader->getMessageName())
<< " Host: " << host << llendl;
<< " Host: " << host << LL_ENDL;
}
if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM)
{
LL_WARNS("Messaging") << "got more than " << MAX_MESSAGE_COUNT_NUM
<< " packets without clearing counts"
<< llendl;
<< LL_ENDL;
}
else
{
@ -1452,7 +1449,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r
{
if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM)
{
LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl;
LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << LL_ENDL;
}
else
{
@ -1481,7 +1478,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r
<< (recv_reliable ? " reliable" : "")
<< (recv_resent ? " resent" : "")
<< (recv_acks ? " acks" : "");
LL_INFOS("Messaging") << str.str() << llendl;
LL_INFOS("Messaging") << str.str() << LL_ENDL;
}
}
@ -1491,54 +1488,54 @@ void LLMessageSystem::sanityCheck()
// if (!mCurrentRMessageData)
// {
// LL_ERRS("Messaging") << "mCurrentRMessageData is NULL" << llendl;
// LL_ERRS("Messaging") << "mCurrentRMessageData is NULL" << LL_ENDL;
// }
// if (!mCurrentRMessageTemplate)
// {
// LL_ERRS("Messaging") << "mCurrentRMessageTemplate is NULL" << llendl;
// LL_ERRS("Messaging") << "mCurrentRMessageTemplate is NULL" << LL_ENDL;
// }
// if (!mCurrentRTemplateBlock)
// {
// LL_ERRS("Messaging") << "mCurrentRTemplateBlock is NULL" << llendl;
// LL_ERRS("Messaging") << "mCurrentRTemplateBlock is NULL" << LL_ENDL;
// }
// if (!mCurrentRDataBlock)
// {
// LL_ERRS("Messaging") << "mCurrentRDataBlock is NULL" << llendl;
// LL_ERRS("Messaging") << "mCurrentRDataBlock is NULL" << LL_ENDL;
// }
// if (!mCurrentSMessageData)
// {
// LL_ERRS("Messaging") << "mCurrentSMessageData is NULL" << llendl;
// LL_ERRS("Messaging") << "mCurrentSMessageData is NULL" << LL_ENDL;
// }
// if (!mCurrentSMessageTemplate)
// {
// LL_ERRS("Messaging") << "mCurrentSMessageTemplate is NULL" << llendl;
// LL_ERRS("Messaging") << "mCurrentSMessageTemplate is NULL" << LL_ENDL;
// }
// if (!mCurrentSTemplateBlock)
// {
// LL_ERRS("Messaging") << "mCurrentSTemplateBlock is NULL" << llendl;
// LL_ERRS("Messaging") << "mCurrentSTemplateBlock is NULL" << LL_ENDL;
// }
// if (!mCurrentSDataBlock)
// {
// LL_ERRS("Messaging") << "mCurrentSDataBlock is NULL" << llendl;
// LL_ERRS("Messaging") << "mCurrentSDataBlock is NULL" << LL_ENDL;
// }
}
void LLMessageSystem::showCircuitInfo()
{
LL_INFOS("Messaging") << mCircuitInfo << llendl;
LL_INFOS("Messaging") << mCircuitInfo << LL_ENDL;
}
void LLMessageSystem::dumpCircuitInfo()
{
lldebugst(LLERR_CIRCUIT_INFO) << mCircuitInfo << llendl;
LL_DEBUGS("Messaging") << mCircuitInfo << LL_ENDL;
}
/* virtual */
@ -1582,7 +1579,7 @@ void LLMessageSystem::enableCircuit(const LLHost &host, BOOL trusted)
void LLMessageSystem::disableCircuit(const LLHost &host)
{
LL_INFOS("Messaging") << "LLMessageSystem::disableCircuit for " << host << llendl;
LL_INFOS("Messaging") << "LLMessageSystem::disableCircuit for " << host << LL_ENDL;
U32 code = gMessageSystem->findCircuitCode( host );
// Don't need to do this, as we're removing the circuit info anyway - djs 01/28/03
@ -1595,7 +1592,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host)
code_session_map_t::iterator it = mCircuitCodes.find(code);
if(it != mCircuitCodes.end())
{
LL_INFOS("Messaging") << "Circuit " << code << " removed from list" << llendl;
LL_INFOS("Messaging") << "Circuit " << code << " removed from list" << LL_ENDL;
//mCircuitCodes.removeData(code);
mCircuitCodes.erase(it);
}
@ -1611,7 +1608,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host)
U32 old_port = (U32)(ip_port & (U64)0xFFFFFFFF);
U32 old_ip = (U32)(ip_port >> 32);
LL_INFOS("Messaging") << "Host " << LLHost(old_ip, old_port) << " circuit " << code << " removed from lookup table" << llendl;
LL_INFOS("Messaging") << "Host " << LLHost(old_ip, old_port) << " circuit " << code << " removed from lookup table" << LL_ENDL;
gMessageSystem->mIPPortToCircuitCode.erase(ip_port);
}
mCircuitInfo.removeCircuitData(host);
@ -1621,7 +1618,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host)
// Sigh, since we can open circuits which don't have circuit
// codes, it's possible for this to happen...
LL_WARNS("Messaging") << "Couldn't find circuit code for " << host << llendl;
LL_WARNS("Messaging") << "Couldn't find circuit code for " << host << LL_ENDL;
}
}
@ -1652,7 +1649,7 @@ BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit)
if (!host.isOk())
{
LL_DEBUGS("Messaging") << "checkCircuitBlocked: Unknown circuit " << circuit << llendl;
LL_DEBUGS("Messaging") << "checkCircuitBlocked: Unknown circuit " << circuit << LL_ENDL;
return TRUE;
}
@ -1663,7 +1660,7 @@ BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit)
}
else
{
LL_INFOS("Messaging") << "checkCircuitBlocked(circuit): Unknown host - " << host << llendl;
LL_INFOS("Messaging") << "checkCircuitBlocked(circuit): Unknown host - " << host << LL_ENDL;
return FALSE;
}
}
@ -1674,7 +1671,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit)
if (!host.isOk())
{
LL_DEBUGS("Messaging") << "checkCircuitAlive: Unknown circuit " << circuit << llendl;
LL_DEBUGS("Messaging") << "checkCircuitAlive: Unknown circuit " << circuit << LL_ENDL;
return FALSE;
}
@ -1685,7 +1682,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit)
}
else
{
LL_INFOS("Messaging") << "checkCircuitAlive(circuit): Unknown host - " << host << llendl;
LL_INFOS("Messaging") << "checkCircuitAlive(circuit): Unknown host - " << host << LL_ENDL;
return FALSE;
}
}
@ -1699,7 +1696,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const LLHost &host)
}
else
{
LL_DEBUGS("Messaging") << "checkCircuitAlive(host): Unknown host - " << host << llendl;
LL_DEBUGS("Messaging") << "checkCircuitAlive(host): Unknown host - " << host << LL_ENDL;
return FALSE;
}
}
@ -1851,18 +1848,18 @@ void LLMessageSystem::processAssignCircuitCode(LLMessageSystem* msg, void**)
{
LL_WARNS("Messaging") << "AssignCircuitCode, bad session id. Expecting "
<< msg->getMySessionID() << " but got " << session_id
<< llendl;
<< LL_ENDL;
return;
}
U32 code;
msg->getU32Fast(_PREHASH_CircuitCode, _PREHASH_Code, code);
if (!code)
{
LL_ERRS("Messaging") << "Assigning circuit code of zero!" << llendl;
LL_ERRS("Messaging") << "Assigning circuit code of zero!" << LL_ENDL;
}
msg->mOurCircuitCode = code;
LL_INFOS("Messaging") << "Circuit code " << code << " assigned." << llendl;
LL_INFOS("Messaging") << "Circuit code " << code << " assigned." << LL_ENDL;
}
*/
@ -1886,20 +1883,20 @@ bool LLMessageSystem::addCircuitCode(U32 code, const LLUUID& session_id)
{
if(!code)
{
LL_WARNS("Messaging") << "addCircuitCode: zero circuit code" << llendl;
LL_WARNS("Messaging") << "addCircuitCode: zero circuit code" << LL_ENDL;
return false;
}
code_session_map_t::iterator it = mCircuitCodes.find(code);
if(it == mCircuitCodes.end())
{
LL_INFOS("Messaging") << "New circuit code " << code << " added" << llendl;
LL_INFOS("Messaging") << "New circuit code " << code << " added" << LL_ENDL;
//msg->mCircuitCodes[circuit_code] = circuit_code;
mCircuitCodes.insert(code_session_map_t::value_type(code, session_id));
}
else
{
LL_INFOS("Messaging") << "Duplicate circuit code " << code << " added" << llendl;
LL_INFOS("Messaging") << "Duplicate circuit code " << code << " added" << LL_ENDL;
}
return true;
}
@ -1933,7 +1930,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
// Whoah, abort! We don't know anything about this circuit code.
LL_WARNS("Messaging") << "UseCircuitCode for " << circuit_code_in
<< " received without AddCircuitCode message - aborting"
<< llendl;
<< LL_ENDL;
return;
}
@ -1945,7 +1942,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
{
LL_WARNS("Messaging") << "UseCircuitCode unmatched session id. Got "
<< session_id << " but expected " << (*it).second
<< llendl;
<< LL_ENDL;
return;
}
@ -1958,7 +1955,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
if ((ip_port_old == ip_port_in) && (circuit_code_old == circuit_code_in))
{
// Current information is the same as incoming info, ignore
LL_INFOS("Messaging") << "Got duplicate UseCircuitCode for circuit " << circuit_code_in << " to " << msg->getSender() << llendl;
LL_INFOS("Messaging") << "Got duplicate UseCircuitCode for circuit " << circuit_code_in << " to " << msg->getSender() << LL_ENDL;
return;
}
@ -1968,27 +1965,27 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
msg->mIPPortToCircuitCode.erase(ip_port_old);
U32 old_port = (U32)(ip_port_old & (U64)0xFFFFFFFF);
U32 old_ip = (U32)(ip_port_old >> 32);
LL_INFOS("Messaging") << "Removing derelict lookup entry for circuit " << circuit_code_old << " to " << LLHost(old_ip, old_port) << llendl;
LL_INFOS("Messaging") << "Removing derelict lookup entry for circuit " << circuit_code_old << " to " << LLHost(old_ip, old_port) << LL_ENDL;
}
if (circuit_code_old)
{
LLHost cur_host(ip, port);
LL_WARNS("Messaging") << "Disabling existing circuit for " << cur_host << llendl;
LL_WARNS("Messaging") << "Disabling existing circuit for " << cur_host << LL_ENDL;
msg->disableCircuit(cur_host);
if (circuit_code_old == circuit_code_in)
{
LL_WARNS("Messaging") << "Asymmetrical circuit to ip/port lookup!" << llendl;
LL_WARNS("Messaging") << "Multiple circuit codes for " << cur_host << " probably!" << llendl;
LL_WARNS("Messaging") << "Permanently disabling circuit" << llendl;
LL_WARNS("Messaging") << "Asymmetrical circuit to ip/port lookup!" << LL_ENDL;
LL_WARNS("Messaging") << "Multiple circuit codes for " << cur_host << " probably!" << LL_ENDL;
LL_WARNS("Messaging") << "Permanently disabling circuit" << LL_ENDL;
return;
}
else
{
LL_WARNS("Messaging") << "Circuit code changed for " << msg->getSender()
<< " from " << circuit_code_old << " to "
<< circuit_code_in << llendl;
<< circuit_code_in << LL_ENDL;
}
}
@ -2030,7 +2027,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
LL_INFOS("Messaging") << "Circuit code " << circuit_code_in << " from "
<< msg->getSender() << " for agent " << id << " in session "
<< session_id << llendl;
<< session_id << LL_ENDL;
const LLUseCircuitCodeResponder* responder =
(const LLUseCircuitCodeResponder*) user;
@ -2041,7 +2038,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg,
}
else
{
LL_WARNS("Messaging") << "Got zero circuit code in use_circuit_code" << llendl;
LL_WARNS("Messaging") << "Got zero circuit code in use_circuit_code" << LL_ENDL;
}
}
@ -2063,7 +2060,7 @@ void LLMessageSystem::processError(LLMessageSystem* msg, void**)
LL_WARNS("Messaging") << "Message error from " << msg->getSender() << " - "
<< error_code << " " << error_token << " " << error_id << " \""
<< error_system << "\" \"" << error_message << "\"" << llendl;
<< error_system << "\" \"" << error_message << "\"" << LL_ENDL;
}
@ -2099,7 +2096,7 @@ void LLMessageSystem::dispatch(
gMessageSystem->mMessageTemplates.end()) &&
!LLMessageConfig::isValidMessage(msg_name))
{
LL_WARNS("Messaging") << "Ignoring unknown message " << msg_name << llendl;
LL_WARNS("Messaging") << "Ignoring unknown message " << msg_name << LL_ENDL;
responsep->notFound("Invalid message name");
return;
}
@ -2110,12 +2107,12 @@ void LLMessageSystem::dispatch(
if (!handler)
{
LL_WARNS("Messaging") << "LLMessageService::dispatch > no handler for "
<< path << llendl;
<< path << LL_ENDL;
return;
}
// enable this for output of message names
//LL_INFOS("Messaging") << "< \"" << msg_name << "\"" << llendl;
//lldebugs << "data: " << LLSDNotationStreamer(message) << llendl;
//LL_INFOS("Messaging") << "< \"" << msg_name << "\"" << LL_ENDL;
//LL_DEBUGS() << "data: " << LLSDNotationStreamer(message) << LL_ENDL;
handler->post(responsep, context, message);
}
@ -2233,7 +2230,7 @@ S32 LLMessageSystem::sendError(
else
{
LL_WARNS("Messaging") << "Data and message were too large -- data removed."
<< llendl;
<< LL_ENDL;
addBinaryData("Data", NULL, 0);
}
return sendReliable(host);
@ -2253,7 +2250,7 @@ void process_packet_ack(LLMessageSystem *msgsystem, void** /*user_data*/)
for (S32 i = 0; i < ack_count; i++)
{
msgsystem->getU32Fast(_PREHASH_Packets, _PREHASH_ID, packet_id, i);
// LL_DEBUGS("Messaging") << "ack recvd' from " << host << " for packet " << (TPACKETID)packet_id << llendl;
// LL_DEBUGS("Messaging") << "ack recvd' from " << host << " for packet " << (TPACKETID)packet_id << LL_ENDL;
cdp->ackReliablePacket(packet_id);
}
if (!cdp->getUnackedPacketCount())
@ -2274,12 +2271,12 @@ void process_log_messages(LLMessageSystem* msg, void**)
if (log_message)
{
LL_INFOS("Messaging") << "Starting logging via message" << llendl;
LL_INFOS("Messaging") << "Starting logging via message" << LL_ENDL;
msg->startLogging();
}
else
{
LL_INFOS("Messaging") << "Stopping logging via message" << llendl;
LL_INFOS("Messaging") << "Stopping logging via message" << LL_ENDL;
msg->stopLogging();
}
}*/
@ -2299,7 +2296,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
if (!cdp)
{
LL_WARNS("Messaging") << "Attempt to create trusted circuit without circuit data: "
<< msg->getSender() << llendl;
<< msg->getSender() << LL_ENDL;
return;
}
@ -2318,13 +2315,13 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
if( msg->getBlockUntrustedInterface() )
{
LL_WARNS("Messaging") << "Ignoring CreateTrustedCircuit on public interface from host: "
<< msg->getSender() << llendl;
<< msg->getSender() << LL_ENDL;
return;
}
else
{
LL_WARNS("Messaging") << "Processing CreateTrustedCircuit on public interface from host: "
<< msg->getSender() << llendl;
<< msg->getSender() << LL_ENDL;
}
}
@ -2340,7 +2337,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
if(msg->isMatchingDigestForWindowAndUUIDs(their_digest, TRUST_TIME_WINDOW, local_id, remote_id))
{
cdp->setTrusted(TRUE);
LL_INFOS("Messaging") << "Trusted digest from " << msg->getSender() << llendl;
LL_INFOS("Messaging") << "Trusted digest from " << msg->getSender() << LL_ENDL;
return;
}
else if (cdp->getTrusted())
@ -2350,13 +2347,13 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **)
// the message system is being slow. Don't bother sending the deny, as it may continually
// ping-pong back and forth on a very hosed circuit.
LL_WARNS("Messaging") << "Ignoring bad digest from known trusted circuit: " << their_digest
<< " host: " << msg->getSender() << llendl;
<< " host: " << msg->getSender() << LL_ENDL;
return;
}
else
{
LL_WARNS("Messaging") << "Bad digest from known circuit: " << their_digest
<< " host: " << msg->getSender() << llendl;
<< " host: " << msg->getSender() << LL_ENDL;
msg->sendDenyTrustedCircuit(msg->getSender());
return;
}
@ -2392,13 +2389,13 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **)
if( msg->getBlockUntrustedInterface() )
{
LL_WARNS("Messaging") << "Ignoring DenyTrustedCircuit on public interface from host: "
<< msg->getSender() << llendl;
<< msg->getSender() << LL_ENDL;
return;
}
else
{
LL_WARNS("Messaging") << "Processing DenyTrustedCircuit on public interface from host: "
<< msg->getSender() << llendl;
<< msg->getSender() << LL_ENDL;
}
}
@ -2411,7 +2408,7 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **)
// *TODO: probably should keep a count of number of resends
// per circuit, and stop resending after a while.
LL_INFOS("Messaging") << "Got DenyTrustedCircuit. Sending CreateTrustedCircuit to "
<< msg->getSender() << llendl;
<< msg->getSender() << LL_ENDL;
msg->sendCreateTrustedCircuit(msg->getSender(), local_id, remote_id);
}
@ -2527,11 +2524,11 @@ bool start_messaging_system(
if (gMessageSystem->mMessageFileVersionNumber != gPrehashVersionNumber)
{
LL_INFOS("AppInit") << "Message template version does not match prehash version number" << LL_ENDL;
LL_INFOS("AppInit") << "Run simulator with -prehash command line option to rebuild prehash data" << llendl;
LL_INFOS("AppInit") << "Run simulator with -prehash command line option to rebuild prehash data" << LL_ENDL;
}
else
{
LL_DEBUGS("AppInit") << "Message template version matches prehash version number" << llendl;
LL_DEBUGS("AppInit") << "Message template version matches prehash version number" << LL_ENDL;
}
}
@ -2577,7 +2574,7 @@ void LLMessageSystem::startLogging()
str << "\t<-\tincoming message" <<std::endl;
str << "\t->\toutgoing message" << std::endl;
str << " <> host size zero id name";
LL_INFOS("Messaging") << str.str() << llendl;
LL_INFOS("Messaging") << str.str() << LL_ENDL;
}
void LLMessageSystem::stopLogging()
@ -2585,7 +2582,7 @@ void LLMessageSystem::stopLogging()
if(mVerboseLog)
{
mVerboseLog = FALSE;
LL_INFOS("Messaging") << "END MESSAGE LOG" << llendl;
LL_INFOS("Messaging") << "END MESSAGE LOG" << LL_ENDL;
}
}
@ -2693,7 +2690,7 @@ void end_messaging_system(bool print_summary)
{
std::ostringstream str;
gMessageSystem->summarizeLogs(str);
LL_INFOS("Messaging") << str.str().c_str() << llendl;
LL_INFOS("Messaging") << str.str().c_str() << LL_ENDL;
}
delete gMessageSystem;
@ -2746,7 +2743,7 @@ void LLMessageSystem::dumpReceiveCounts()
if(mNumMessageCounts > 0)
{
LL_DEBUGS("Messaging") << "Dump: " << mNumMessageCounts << " messages processed in " << mReceiveTime << " seconds" << llendl;
LL_DEBUGS("Messaging") << "Dump: " << mNumMessageCounts << " messages processed in " << mReceiveTime << " seconds" << LL_ENDL;
for (message_template_name_map_t::const_iterator iter = mMessageTemplates.begin(),
end = mMessageTemplates.end();
iter != end; iter++)
@ -2755,7 +2752,7 @@ void LLMessageSystem::dumpReceiveCounts()
if (mt->mReceiveCount > 0)
{
LL_INFOS("Messaging") << "Num: " << std::setw(3) << mt->mReceiveCount << " Bytes: " << std::setw(6) << mt->mReceiveBytes
<< " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << llround(100 * mt->mDecodeTimeThisFrame / mReceiveTime) << "%" << llendl;
<< " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << llround(100 * mt->mDecodeTimeThisFrame / mReceiveTime) << "%" << LL_ENDL;
}
}
}
@ -2872,7 +2869,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
if ((*data_size ) < LL_MINIMUM_VALID_PACKET_SIZE)
{
LL_WARNS("Messaging") << "zeroCodeExpand() called with data_size of " << *data_size
<< llendl;
<< LL_ENDL;
}
mTotalBytesIn += *data_size;
@ -2911,7 +2908,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
{
if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-1]))
{
LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 1" << llendl;
LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 1" << LL_ENDL;
callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE);
outptr = mEncodedRecvBuffer;
break;
@ -2923,7 +2920,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
*outptr++ = *inptr++;
if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-256]))
{
LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 2" << llendl;
LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 2" << LL_ENDL;
callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE);
outptr = mEncodedRecvBuffer;
count = -1;
@ -2942,7 +2939,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size)
{
if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-(*inptr)]))
{
LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 3" << llendl;
LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 3" << LL_ENDL;
callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE);
outptr = mEncodedRecvBuffer;
}
@ -2966,7 +2963,7 @@ void LLMessageSystem::addTemplate(LLMessageTemplate *templatep)
if (mMessageTemplates.count(templatep->mName) > 0)
{
LL_ERRS("Messaging") << templatep->mName << " already used as a template name!"
<< llendl;
<< LL_ENDL;
}
mMessageTemplates[templatep->mName] = templatep;
mMessageNumbers[templatep->mMessageNumber] = templatep;
@ -2982,7 +2979,7 @@ void LLMessageSystem::setHandlerFuncFast(const char *name, void (*handler_func)(
}
else
{
LL_ERRS("Messaging") << name << " is not a known message name!" << llendl;
LL_ERRS("Messaging") << name << " is not a known message name!" << LL_ENDL;
}
}
@ -2995,7 +2992,7 @@ bool LLMessageSystem::callHandler(const char *name,
if(iter == mMessageTemplates.end())
{
LL_WARNS("Messaging") << "LLMessageSystem::callHandler: unknown message "
<< name << llendl;
<< name << LL_ENDL;
return false;
}
@ -3006,7 +3003,7 @@ bool LLMessageSystem::callHandler(const char *name,
<< name
<< " from "
<< (trustedSource ? "trusted " : "untrusted ")
<< "source" << llendl;
<< "source" << LL_ENDL;
return false;
}
@ -3142,7 +3139,7 @@ bool LLMessageSystem::generateDigestForWindowAndUUIDs(char* digest, const S32 wi
std::string shared_secret = get_shared_secret();
if(shared_secret.empty())
{
LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << llendl;
LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << LL_ENDL;
}
U32 now = (U32)time(NULL);
@ -3161,7 +3158,7 @@ bool LLMessageSystem::isMatchingDigestForWindowAndUUIDs(const char* digest, cons
std::string shared_secret = get_shared_secret();
if(shared_secret.empty())
{
LL_ERRS("Messaging") << "Trying to compare complex digests on a machine without a shared secret!" << llendl;
LL_ERRS("Messaging") << "Trying to compare complex digests on a machine without a shared secret!" << LL_ENDL;
}
char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */
@ -3208,7 +3205,7 @@ bool LLMessageSystem::generateDigestForWindow(char* digest, const S32 window) co
std::string shared_secret = get_shared_secret();
if(shared_secret.empty())
{
LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << llendl;
LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << LL_ENDL;
}
U32 now = (U32)time(NULL);
@ -3227,7 +3224,7 @@ bool LLMessageSystem::isMatchingDigestForWindow(const char* digest, S32 const wi
std::string shared_secret = get_shared_secret();
if(shared_secret.empty())
{
LL_ERRS("Messaging") << "Trying to compare simple digests on a machine without a shared secret!" << llendl;
LL_ERRS("Messaging") << "Trying to compare simple digests on a machine without a shared secret!" << LL_ENDL;
}
char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */
@ -3261,12 +3258,12 @@ void LLMessageSystem::sendCreateTrustedCircuit(const LLHost &host, const LLUUID
char digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */
if (id1.isNull())
{
LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the local end point ID" << llendl;
LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the local end point ID" << LL_ENDL;
return;
}
if (id2.isNull())
{
LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the remote end point ID" << llendl;
LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the remote end point ID" << LL_ENDL;
return;
}
generateDigestForWindowAndUUIDs(digest, TRUST_TIME_WINDOW, id1, id2);
@ -3274,7 +3271,7 @@ void LLMessageSystem::sendCreateTrustedCircuit(const LLHost &host, const LLUUID
nextBlockFast(_PREHASH_DataBlock);
addUUIDFast(_PREHASH_EndPointID, id1);
addBinaryDataFast(_PREHASH_Digest, digest, MD5HEX_STR_BYTES);
LL_INFOS("Messaging") << "xmitting digest: " << digest << " Host: " << host << llendl;
LL_INFOS("Messaging") << "xmitting digest: " << digest << " Host: " << host << LL_ENDL;
sendMessage(host);
}
@ -3288,10 +3285,10 @@ void LLMessageSystem::reallySendDenyTrustedCircuit(const LLHost &host)
LLCircuitData *cdp = mCircuitInfo.findCircuit(host);
if (!cdp)
{
LL_WARNS("Messaging") << "Not sending DenyTrustedCircuit to host without a circuit." << llendl;
LL_WARNS("Messaging") << "Not sending DenyTrustedCircuit to host without a circuit." << LL_ENDL;
return;
}
LL_INFOS("Messaging") << "Sending DenyTrustedCircuit to " << host << llendl;
LL_INFOS("Messaging") << "Sending DenyTrustedCircuit to " << host << LL_ENDL;
newMessageFast(_PREHASH_DenyTrustedCircuit);
nextBlockFast(_PREHASH_DataBlock);
addUUIDFast(_PREHASH_EndPointID, cdp->getLocalEndPointID());
@ -3312,7 +3309,7 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_
std::string shared_secret = get_shared_secret();
if(shared_secret.empty())
{
LL_ERRS("Messaging") << "Trying to establish bidirectional trust on a machine without a shared secret!" << llendl;
LL_ERRS("Messaging") << "Trying to establish bidirectional trust on a machine without a shared secret!" << LL_ENDL;
}
LLTimer timeout;
@ -3364,8 +3361,8 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_
void LLMessageSystem::dumpPacketToLog()
{
LL_WARNS("Messaging") << "Packet Dump from:" << mPacketRing.getLastSender() << llendl;
LL_WARNS("Messaging") << "Packet Size:" << mTrueReceiveSize << llendl;
LL_WARNS("Messaging") << "Packet Dump from:" << mPacketRing.getLastSender() << LL_ENDL;
LL_WARNS("Messaging") << "Packet Size:" << mTrueReceiveSize << LL_ENDL;
char line_buffer[256]; /* Flawfinder: ignore */
S32 i;
S32 cur_line_pos = 0;
@ -3380,13 +3377,13 @@ void LLMessageSystem::dumpPacketToLog()
if (cur_line_pos >= 16)
{
cur_line_pos = 0;
LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << llendl;
LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << LL_ENDL;
cur_line++;
}
}
if (cur_line_pos)
{
LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << llendl;
LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << LL_ENDL;
}
}
@ -3930,7 +3927,7 @@ void LLMessageSystem::getStringFast(const char *block, const char *var,
{
if(buffer_size <= 0)
{
LL_WARNS("Messaging") << "buffer_size <= 0" << llendl;
LL_WARNS("Messaging") << "buffer_size <= 0" << LL_ENDL;
}
mMessageReader->getString(block, var, buffer_size, s, blocknum);
}
@ -4039,7 +4036,7 @@ void LLMessageSystem::banUdpMessage(const std::string& name)
}
else
{
llwarns << "Attempted to ban an unknown message: " << name << "." << llendl;
LL_WARNS() << "Attempted to ban an unknown message: " << name << "." << LL_ENDL;
}
}
const LLHost& LLMessageSystem::getSender() const

View File

@ -45,7 +45,7 @@
#include "llerror.h"
#include "net.h"
#include "string_table.h"
#include "llstringtable.h"
#include "llcircuit.h"
#include "lltimer.h"
#include "llpacketring.h"

View File

@ -67,5 +67,8 @@ const S32 ETHERNET_MTU_BYTES = 1500;
const S32 MTUBITS = MTUBYTES*8;
const S32 MTUU32S = MTUBITS/32;
// For automatic port discovery when running multiple viewers on one host
const U32 PORT_DISCOVERY_RANGE_MIN = 13000;
const U32 PORT_DISCOVERY_RANGE_MAX = PORT_DISCOVERY_RANGE_MIN + 50;
#endif

View File

@ -28,7 +28,7 @@
#include "linden_common.h"
#include "partsyspacket.h"
#include "imageids.h"
#include "indra_constants.h"
// this function is global
void gSetInitDataDefaults(LLPartInitData *setMe)

View File

@ -31,7 +31,7 @@
#include "v3math.h"
#include "patch_dct.h"
#include "patch_code.h"
#include "bitpack.h"
#include "llbitpack.h"
U32 gPatchSize, gWordBits;

Some files were not shown because too many files have changed in this diff Show More