Alchemy llcharacter and llcommon merge pass.

This commit is contained in:
Shyotl
2017-03-31 02:08:03 -05:00
parent f95be54bd5
commit 1230748ef5
61 changed files with 301 additions and 304 deletions

View File

@@ -46,7 +46,7 @@ LLUUID const ANIM_AGENT_BLOW_KISS ("db84829b-462c-ee83-1e27-9bbee66b
LLUUID const ANIM_AGENT_BORED ("b906c4ba-703b-1940-32a3-0c7f7d791510"); LLUUID const ANIM_AGENT_BORED ("b906c4ba-703b-1940-32a3-0c7f7d791510");
LLUUID const ANIM_AGENT_BOW ("82e99230-c906-1403-4d9c-3889dd98daba"); LLUUID const ANIM_AGENT_BOW ("82e99230-c906-1403-4d9c-3889dd98daba");
LLUUID const ANIM_AGENT_BRUSH ("349a3801-54f9-bf2c-3bd0-1ac89772af01"); LLUUID const ANIM_AGENT_BRUSH ("349a3801-54f9-bf2c-3bd0-1ac89772af01");
LLUUID const ANIM_AGENT_BUSY ("efcf670c-2d18-8128-973a-034ebc806b67"); LLUUID const ANIM_AGENT_DO_NOT_DISTURB ("efcf670c-2d18-8128-973a-034ebc806b67");
LLUUID const ANIM_AGENT_CLAP ("9b0c1c4e-8ac7-7969-1494-28c874c4f668"); LLUUID const ANIM_AGENT_CLAP ("9b0c1c4e-8ac7-7969-1494-28c874c4f668");
LLUUID const ANIM_AGENT_COURTBOW ("9ba1c942-08be-e43a-fb29-16ad440efc50"); LLUUID const ANIM_AGENT_COURTBOW ("9ba1c942-08be-e43a-fb29-16ad440efc50");
LLUUID const ANIM_AGENT_CROUCH ("201f3fdf-cb1f-dbec-201f-7333e328ae7c"); LLUUID const ANIM_AGENT_CROUCH ("201f3fdf-cb1f-dbec-201f-7333e328ae7c");
@@ -211,7 +211,7 @@ LLAnimationLibrary::LLAnimationLibrary() :
mAnimMap[ANIM_AGENT_BORED]= mAnimStringTable.addString("express_bored"); mAnimMap[ANIM_AGENT_BORED]= mAnimStringTable.addString("express_bored");
mAnimMap[ANIM_AGENT_BOW]= mAnimStringTable.addString("bow"); mAnimMap[ANIM_AGENT_BOW]= mAnimStringTable.addString("bow");
mAnimMap[ANIM_AGENT_BRUSH]= mAnimStringTable.addString("brush"); mAnimMap[ANIM_AGENT_BRUSH]= mAnimStringTable.addString("brush");
mAnimMap[ANIM_AGENT_BUSY]= mAnimStringTable.addString("busy"); mAnimMap[ANIM_AGENT_DO_NOT_DISTURB]= mAnimStringTable.addString("busy");
mAnimMap[ANIM_AGENT_CLAP]= mAnimStringTable.addString("clap"); mAnimMap[ANIM_AGENT_CLAP]= mAnimStringTable.addString("clap");
mAnimMap[ANIM_AGENT_COURTBOW]= mAnimStringTable.addString("courtbow"); mAnimMap[ANIM_AGENT_COURTBOW]= mAnimStringTable.addString("courtbow");
mAnimMap[ANIM_AGENT_CROUCH]= mAnimStringTable.addString("crouch"); mAnimMap[ANIM_AGENT_CROUCH]= mAnimStringTable.addString("crouch");

View File

@@ -56,7 +56,7 @@ extern const LLUUID ANIM_AGENT_BLOW_KISS;
extern const LLUUID ANIM_AGENT_BORED; extern const LLUUID ANIM_AGENT_BORED;
extern const LLUUID ANIM_AGENT_BOW; extern const LLUUID ANIM_AGENT_BOW;
extern const LLUUID ANIM_AGENT_BRUSH; extern const LLUUID ANIM_AGENT_BRUSH;
extern const LLUUID ANIM_AGENT_BUSY; extern const LLUUID ANIM_AGENT_DO_NOT_DISTURB;
extern const LLUUID ANIM_AGENT_CLAP; extern const LLUUID ANIM_AGENT_CLAP;
extern const LLUUID ANIM_AGENT_COURTBOW; extern const LLUUID ANIM_AGENT_COURTBOW;
extern const LLUUID ANIM_AGENT_CROUCH; extern const LLUUID ANIM_AGENT_CROUCH;

View File

@@ -80,13 +80,14 @@ LLHeadRotMotion::LLHeadRotMotion(LLUUID const& id, LLMotionController* controlle
AIMaskedMotion(id, controller, ANIM_AGENT_HEAD_ROT), AIMaskedMotion(id, controller, ANIM_AGENT_HEAD_ROT),
mCharacter(NULL), mCharacter(NULL),
mTorsoJoint(NULL), mTorsoJoint(NULL),
mHeadJoint(NULL) mHeadJoint(NULL),
mRootJoint(NULL),
mPelvisJoint(NULL),
mHeadState(new LLJointState),
mTorsoState(new LLJointState),
mNeckState(new LLJointState)
{ {
mName = "head_rot"; mName = "head_rot";
mTorsoState = new LLJointState;
mNeckState = new LLJointState;
mHeadState = new LLJointState;
} }
@@ -388,7 +389,7 @@ void LLEyeMotion::adjustEyeTarget(LLVector3* targetPos, LLJointState& left_eye_s
// calculate vergence // calculate vergence
F32 interocular_dist = (left_eye_state.getJoint()->getWorldPosition() - right_eye_state.getJoint()->getWorldPosition()).magVec(); F32 interocular_dist = (left_eye_state.getJoint()->getWorldPosition() - right_eye_state.getJoint()->getWorldPosition()).magVec();
vergence = -atan2((interocular_dist / 2.f), lookAtDistance); vergence = -atan2((interocular_dist / 2.f), lookAtDistance);
llclamp(vergence, -F_PI_BY_TWO, 0.f); vergence = llclamp(vergence, -F_PI_BY_TWO, 0.f);
} }
else else
{ {

View File

@@ -70,15 +70,15 @@ protected:
public: public:
// Constructor // Constructor
LLJointState() LLJointState()
: mUsage(0) : mJoint(NULL)
, mJoint(NULL) , mUsage(0)
, mWeight(0.f) , mWeight(0.f)
, mPriority(LLJoint::USE_MOTION_PRIORITY) , mPriority(LLJoint::USE_MOTION_PRIORITY)
{} {}
LLJointState(LLJoint* joint) LLJointState(LLJoint* joint)
: mUsage(0) : mJoint(joint)
, mJoint(joint) , mUsage(0)
, mWeight(0.f) , mWeight(0.f)
, mPriority(LLJoint::USE_MOTION_PRIORITY) , mPriority(LLJoint::USE_MOTION_PRIORITY)
{} {}

View File

@@ -447,7 +447,9 @@ void LLKeyframeMotion::JointMotion::update(LLJointState* joint_state, F32 time,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLKeyframeMotion::LLKeyframeMotion(const LLUUID &id, LLMotionController* controller) LLKeyframeMotion::LLKeyframeMotion(const LLUUID &id, LLMotionController* controller)
: LLMotion(id, controller), : LLMotion(id, controller),
mJointMotionList(NULL),
mPelvisp(NULL), mPelvisp(NULL),
mCharacter(NULL),
mLastSkeletonSerialNum(0), mLastSkeletonSerialNum(0),
mLastUpdateTime(0.f), mLastUpdateTime(0.f),
mLastLoopedTime(0.f), mLastLoopedTime(0.f),
@@ -1101,11 +1103,11 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
if (constraint->mSharedData->mChainLength != 0 && if (constraint->mSharedData->mChainLength != 0 &&
dist_vec_squared(root_pos, target_pos) * 0.95f > constraint->mTotalLength * constraint->mTotalLength) dist_vec_squared(root_pos, target_pos) * 0.95f > constraint->mTotalLength * constraint->mTotalLength)
{ {
constraint->mWeight = lerp(constraint->mWeight, 0.f, LLSmoothInterpolation::getInterpolant(0.1f)); constraint->mWeight = LLSmoothInterpolation::lerp(constraint->mWeight, 0.f, 0.1f);
} }
else else
{ {
constraint->mWeight = lerp(constraint->mWeight, 1.f, LLSmoothInterpolation::getInterpolant(0.3f)); constraint->mWeight = LLSmoothInterpolation::lerp(constraint->mWeight, 1.f, 0.3f);
} }
F32 weight = constraint->mWeight * ((shared_data->mEaseOutStopTime == 0.f) ? 1.f : F32 weight = constraint->mWeight * ((shared_data->mEaseOutStopTime == 0.f) ? 1.f :
@@ -1783,14 +1785,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
for(S32 i = 0; i < num_constraints; ++i) for(S32 i = 0; i < num_constraints; ++i)
{ {
// read in constraint data // read in constraint data
JointConstraintSharedData* constraintp = new JointConstraintSharedData; auto constraintp = new JointConstraintSharedData;
std::unique_ptr<JointConstraintSharedData> watcher(constraintp); std::unique_ptr<JointConstraintSharedData> watcher(constraintp);
U8 byte = 0; U8 byte = 0;
if (!dp.unpackU8(byte, "chain_length")) if (!dp.unpackU8(byte, "chain_length"))
{ {
LL_WARNS() << "can't read constraint chain length" << LL_ENDL; LL_WARNS() << "can't read constraint chain length" << LL_ENDL;
delete constraintp;
return FALSE; return FALSE;
} }
constraintp->mChainLength = (S32) byte; constraintp->mChainLength = (S32) byte;
@@ -1798,21 +1799,18 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if((U32)constraintp->mChainLength > mJointMotionList->getNumJointMotions()) if((U32)constraintp->mChainLength > mJointMotionList->getNumJointMotions())
{ {
LL_WARNS() << "invalid constraint chain length" << LL_ENDL; LL_WARNS() << "invalid constraint chain length" << LL_ENDL;
delete constraintp;
return FALSE; return FALSE;
} }
if (!dp.unpackU8(byte, "constraint_type")) if (!dp.unpackU8(byte, "constraint_type"))
{ {
LL_WARNS() << "can't read constraint type" << LL_ENDL; LL_WARNS() << "can't read constraint type" << LL_ENDL;
delete constraintp;
return FALSE; return FALSE;
} }
if( byte >= NUM_CONSTRAINT_TYPES ) if( byte >= NUM_CONSTRAINT_TYPES )
{ {
LL_WARNS() << "invalid constraint type" << LL_ENDL; LL_WARNS() << "invalid constraint type" << LL_ENDL;
delete constraintp;
return FALSE; return FALSE;
} }
constraintp->mConstraintType = (EConstraintType)byte; constraintp->mConstraintType = (EConstraintType)byte;
@@ -1822,7 +1820,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "source_volume")) if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "source_volume"))
{ {
LL_WARNS() << "can't read source volume name" << LL_ENDL; LL_WARNS() << "can't read source volume name" << LL_ENDL;
delete constraintp;
return FALSE; return FALSE;
} }
@@ -1834,7 +1831,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if(constraintp->mSourceConstraintVolume == -1) if(constraintp->mSourceConstraintVolume == -1)
{ {
LL_WARNS() << "can't get source constraint volume" << LL_ENDL; LL_WARNS() << "can't get source constraint volume" << LL_ENDL;
delete constraintp;
return FALSE; return FALSE;
} }
// </edit> // </edit>
@@ -1924,12 +1920,12 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
return FALSE; return FALSE;
} }
constraintp->mJointStateIndices = new S32[constraintp->mChainLength + 1]; // note: mChainLength is size-limited - comes from a byte
if (singu_new_joint_motion_list) if (singu_new_joint_motion_list)
{ {
mJointMotionList->mConstraints.push_front(watcher.release()); mJointMotionList->mConstraints.push_front(watcher.release());
} }
constraintp->mJointStateIndices = new S32[constraintp->mChainLength + 1]; // note: mChainLength is size-limited - comes from a byte
LLJoint* joint = mCharacter->findCollisionVolume(constraintp->mSourceConstraintVolume); LLJoint* joint = mCharacter->findCollisionVolume(constraintp->mSourceConstraintVolume);
// get joint to which this collision volume is attached // get joint to which this collision volume is attached
@@ -2168,7 +2164,7 @@ void LLKeyframeMotion::setEmote(const LLUUID& emote_id)
} }
else else
{ {
mJointMotionList->mEmoteName = ""; mJointMotionList->mEmoteName.clear();
} }
} }

View File

@@ -140,14 +140,18 @@ BOOL LLKeyframeWalkMotion::onUpdate(F32 time, U8* joint_mask)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLWalkAdjustMotion::LLWalkAdjustMotion(LLUUID const& id, LLMotionController* controller) : LLWalkAdjustMotion::LLWalkAdjustMotion(LLUUID const& id, LLMotionController* controller) :
AIMaskedMotion(id, controller, ANIM_AGENT_WALK_ADJUST), AIMaskedMotion(id, controller, ANIM_AGENT_WALK_ADJUST),
mCharacter(NULL),
mLastTime(0.f), mLastTime(0.f),
mAnimSpeed(0.f), mAnimSpeed(0.f),
mAdjustedSpeed(0.f), mAdjustedSpeed(0.f),
mRelativeDir(0.f), mRelativeDir(0.f),
mAnkleOffset(0.f) mAnkleOffset(0.f),
mLeftAnkleJoint(NULL),
mRightAnkleJoint(NULL),
mPelvisJoint(NULL),
mPelvisState(new LLJointState)
{ {
mName = "walk_adjust"; mName = "walk_adjust";
mPelvisState = new LLJointState;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -287,7 +291,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
F32 desired_speed_multiplier = llclamp(speed / foot_speed, min_speed_multiplier, ANIM_SPEED_MAX); F32 desired_speed_multiplier = llclamp(speed / foot_speed, min_speed_multiplier, ANIM_SPEED_MAX);
// blend towards new speed adjustment value // blend towards new speed adjustment value
F32 new_speed_adjust = lerp(mAdjustedSpeed, desired_speed_multiplier, LLSmoothInterpolation::getInterpolant(SPEED_ADJUST_TIME_CONSTANT)); F32 new_speed_adjust = LLSmoothInterpolation::lerp(mAdjustedSpeed, desired_speed_multiplier, SPEED_ADJUST_TIME_CONSTANT);
// limit that rate at which the speed adjustment changes // limit that rate at which the speed adjustment changes
F32 speedDelta = llclamp(new_speed_adjust - mAdjustedSpeed, -SPEED_ADJUST_MAX_SEC * delta_time, SPEED_ADJUST_MAX_SEC * delta_time); F32 speedDelta = llclamp(new_speed_adjust - mAdjustedSpeed, -SPEED_ADJUST_MAX_SEC * delta_time, SPEED_ADJUST_MAX_SEC * delta_time);
@@ -305,7 +309,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
{ // standing/turning { // standing/turning
// damp out speed adjustment to 0 // damp out speed adjustment to 0
mAnimSpeed = lerp(mAnimSpeed, 1.f, LLSmoothInterpolation::getInterpolant(0.2f)); mAnimSpeed = LLSmoothInterpolation::lerp(mAnimSpeed, 1.f, 0.2f);
//mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.2f)); //mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.2f));
} }
@@ -333,6 +337,7 @@ void LLWalkAdjustMotion::onDeactivate()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLFlyAdjustMotion::LLFlyAdjustMotion(LLUUID const& id, LLMotionController* controller) LLFlyAdjustMotion::LLFlyAdjustMotion(LLUUID const& id, LLMotionController* controller)
: AIMaskedMotion(id, controller, ANIM_AGENT_FLY_ADJUST), : AIMaskedMotion(id, controller, ANIM_AGENT_FLY_ADJUST),
mCharacter(NULL),
mRoll(0.f) mRoll(0.f)
{ {
mName = "fly_adjust"; mName = "fly_adjust";
@@ -384,7 +389,7 @@ BOOL LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask)
F32 target_roll = llclamp(ang_vel.mV[VZ], -4.f, 4.f) * roll_factor; F32 target_roll = llclamp(ang_vel.mV[VZ], -4.f, 4.f) * roll_factor;
// roll is critically damped interpolation between current roll and angular velocity-derived target roll // roll is critically damped interpolation between current roll and angular velocity-derived target roll
mRoll = lerp(mRoll, target_roll, LLSmoothInterpolation::getInterpolant(0.1f)); mRoll = LLSmoothInterpolation::lerp(mRoll, target_roll, U32Milliseconds(100));
LLQuaternion roll(mRoll, LLVector3(0.f, 0.f, 1.f)); LLQuaternion roll(mRoll, LLVector3(0.f, 0.f, 1.f));
mPelvisState->setRotation(roll); mPelvisState->setRotation(roll);

View File

@@ -83,7 +83,7 @@ LLMotionRegistry::~LLMotionRegistry()
BOOL LLMotionRegistry::registerMotion( const LLUUID& id, LLMotionConstructor constructor ) BOOL LLMotionRegistry::registerMotion( const LLUUID& id, LLMotionConstructor constructor )
{ {
// LL_INFOS() << "Registering motion: " << name << LL_ENDL; // LL_INFOS() << "Registering motion: " << name << LL_ENDL;
return mMotionTable.insert(std::make_pair(id,constructor)).second; return mMotionTable.emplace(id, constructor).second;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -582,9 +582,7 @@ static LLTrace::BlockTimerStatHandle FTM_MOTION_ON_UPDATE("Motion onUpdate");
void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_type) void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_type)
{ {
BOOL update_result = TRUE; BOOL update_result = TRUE;
U8 last_joint_signature[LL_CHARACTER_MAX_ANIMATED_JOINTS]; U8 last_joint_signature[LL_CHARACTER_MAX_ANIMATED_JOINTS] = {0};
memset(&last_joint_signature, 0, sizeof(U8) * LL_CHARACTER_MAX_ANIMATED_JOINTS);
// iterate through active motions in chronological order // iterate through active motions in chronological order
for (motion_list_t::iterator iter = mActiveMotions.begin(); for (motion_list_t::iterator iter = mActiveMotions.begin();

View File

@@ -180,34 +180,34 @@ BOOL LLMultiGesture::deserialize(LLDataPacker& dp)
{ {
case STEP_ANIMATION: case STEP_ANIMATION:
{ {
LLGestureStepAnimation* step = new LLGestureStepAnimation(); std::unique_ptr<LLGestureStep> step(new LLGestureStepAnimation());
BOOL ok = step->deserialize(dp); BOOL ok = step->deserialize(dp);
if (!ok) return FALSE; if (!ok) return FALSE;
mSteps.push_back(step); mSteps.push_back(step.release());
break; break;
} }
case STEP_SOUND: case STEP_SOUND:
{ {
LLGestureStepSound* step = new LLGestureStepSound(); std::unique_ptr<LLGestureStep> step(new LLGestureStepSound());
BOOL ok = step->deserialize(dp); BOOL ok = step->deserialize(dp);
if (!ok) return FALSE; if (!ok) return FALSE;
mSteps.push_back(step); mSteps.push_back(step.release());
break; break;
} }
case STEP_CHAT: case STEP_CHAT:
{ {
LLGestureStepChat* step = new LLGestureStepChat(); std::unique_ptr<LLGestureStep> step(new LLGestureStepChat());
BOOL ok = step->deserialize(dp); BOOL ok = step->deserialize(dp);
if (!ok) return FALSE; if (!ok) return FALSE;
mSteps.push_back(step); mSteps.push_back(step.release());
break; break;
} }
case STEP_WAIT: case STEP_WAIT:
{ {
LLGestureStepWait* step = new LLGestureStepWait(); std::unique_ptr<LLGestureStep> step(new LLGestureStepWait());
BOOL ok = step->deserialize(dp); BOOL ok = step->deserialize(dp);
if (!ok) return FALSE; if (!ok) return FALSE;
mSteps.push_back(step); mSteps.push_back(step.release());
break; break;
} }
default: default:

View File

@@ -8,6 +8,7 @@ include(LLCommon)
include(APR) include(APR)
include(Linking) include(Linking)
include(Boost) include(Boost)
include(OpenSSL)
include(LLSharedLibs) include(LLSharedLibs)
include(GoogleBreakpad) include(GoogleBreakpad)
include(Copy3rdPartyLibs) include(Copy3rdPartyLibs)
@@ -16,6 +17,7 @@ include(ZLIB)
include_directories( include_directories(
${EXPAT_INCLUDE_DIRS} ${EXPAT_INCLUDE_DIRS}
${LLCOMMON_INCLUDE_DIRS} ${LLCOMMON_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}
${BREAKPAD_INCLUDE_DIRECTORIES} ${BREAKPAD_INCLUDE_DIRECTORIES}
) )
@@ -284,6 +286,7 @@ target_link_libraries(
${APRUTIL_LIBRARIES} ${APRUTIL_LIBRARIES}
${APR_LIBRARIES} ${APR_LIBRARIES}
${EXPAT_LIBRARIES} ${EXPAT_LIBRARIES}
${OPENSSL_LIBRARIES}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${WINDOWS_LIBRARIES} ${WINDOWS_LIBRARIES}
${Boost_CONTEXT_LIBRARY} ${Boost_CONTEXT_LIBRARY}

View File

@@ -49,9 +49,8 @@
* signatures. * signatures.
*/ */
template <typename FTYPE> template <typename FTYPE>
inline BOOL is_approx_equal_fraction_impl(FTYPE x, FTYPE y, U32 frac_bits) inline bool is_approx_equal_fraction_impl(FTYPE x, FTYPE y, U32 frac_bits)
{ {
BOOL ret = TRUE;
FTYPE diff = (FTYPE) fabs(x - y); FTYPE diff = (FTYPE) fabs(x - y);
S32 diffInt = (S32) diff; S32 diffInt = (S32) diff;
@@ -64,20 +63,20 @@ inline BOOL is_approx_equal_fraction_impl(FTYPE x, FTYPE y, U32 frac_bits)
// based on the number of bits used for packing decimal portion. // based on the number of bits used for packing decimal portion.
if (diffInt != 0 || diffFracTolerance > 1) if (diffInt != 0 || diffFracTolerance > 1)
{ {
ret = FALSE; return false;
} }
return ret; return true;
} }
/// F32 flavor /// F32 flavor
inline BOOL is_approx_equal_fraction(F32 x, F32 y, U32 frac_bits) inline bool is_approx_equal_fraction(F32 x, F32 y, U32 frac_bits)
{ {
return is_approx_equal_fraction_impl<F32>(x, y, frac_bits); return is_approx_equal_fraction_impl<F32>(x, y, frac_bits);
} }
/// F64 flavor /// F64 flavor
inline BOOL is_approx_equal_fraction(F64 x, F64 y, U32 frac_bits) inline bool is_approx_equal_fraction(F64 x, F64 y, U32 frac_bits)
{ {
return is_approx_equal_fraction_impl<F64>(x, y, frac_bits); return is_approx_equal_fraction_impl<F64>(x, y, frac_bits);
} }

View File

@@ -43,11 +43,9 @@
#endif #endif
#if defined(LL_WINDOWS) && defined(_DEBUG) #if defined(LL_WINDOWS) && defined(_DEBUG)
# if _MSC_VER >= 1400 // Visual C++ 2005 or later
# define _CRTDBG_MAP_ALLOC # define _CRTDBG_MAP_ALLOC
# include <stdlib.h> # include <stdlib.h>
# include <crtdbg.h> # include <crtdbg.h>
# endif
#endif #endif
#include "llpreprocessor.h" #include "llpreprocessor.h"

View File

@@ -40,7 +40,7 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/range/iterator_range.hpp> #include <boost/range/iterator_range.hpp>
static const std::string HEAP_PROFILE_MAGIC_STR = "heap profile:"; static const std::string HEAP_PROFILE_MAGIC_STR("heap profile:");
static bool is_separator(char c) static bool is_separator(char c)
{ {
@@ -70,7 +70,7 @@ void LLAllocatorHeapProfile::parse(std::string const & prof_text)
range_t prof_range(prof_begin, prof_text.end()); range_t prof_range(prof_begin, prof_text.end());
boost::algorithm::split(prof_lines, boost::algorithm::split(prof_lines,
prof_range, prof_range,
boost::bind(std::equal_to<llwchar>(), '\n', _1)); std::bind(std::equal_to<llwchar>(), '\n', std::placeholders::_1));
std::vector< range_t >::const_iterator i; std::vector< range_t >::const_iterator i;
for(i = prof_lines.begin(); i != prof_lines.end() && !i->empty(); ++i) for(i = prof_lines.begin(); i != prof_lines.end() && !i->empty(); ++i)

View File

@@ -28,38 +28,31 @@
#include "linden_common.h" #include "linden_common.h"
#include "llbase64.h" #include "llbase64.h"
#include <openssl/evp.h>
#include <string>
#include "apr_base64.h"
// static // static
std::string LLBase64::encode(const U8* input, size_t input_size) std::string LLBase64::encode(const U8* input, size_t input_size)
{ {
std::string output; if (!(input && input_size > 0)) return LLStringUtil::null;
if (input
&& input_size > 0) BIO *b64 = BIO_new(BIO_f_base64());
{ BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
// Yes, it returns int.
int b64_buffer_length = apr_base64_encode_len(input_size); BIO *bio = BIO_new(BIO_s_mem());
char* b64_buffer = new char[b64_buffer_length]; BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL);
bio = BIO_push(b64, bio);
// This is faster than apr_base64_encode() if you know BIO_write(bio, input, input_size);
// you're not on an EBCDIC machine. Also, the output is
// null terminated, even though the documentation doesn't (void)BIO_flush(bio);
// specify. See apr_base64.c for details. JC
b64_buffer_length = apr_base64_encode_binary( char *new_data;
b64_buffer, size_t bytes_written = BIO_get_mem_data(bio, &new_data);
input, std::string result(new_data, bytes_written);
input_size); BIO_free_all(bio);
output.assign(b64_buffer);
delete[] b64_buffer; return result;
}
return output;
} }
// static // static
std::string LLBase64::encode(const std::string& in_str) std::string LLBase64::encode(const std::string& in_str)
{ {
@@ -74,9 +67,16 @@ std::string LLBase64::encode(const std::string& in_str)
size_t LLBase64::decode(const std::string& input, U8 * buffer, size_t buffer_size) size_t LLBase64::decode(const std::string& input, U8 * buffer, size_t buffer_size)
{ {
if (input.empty()) return 0; if (input.empty()) return 0;
size_t bytes_written = apr_base64_decode_binary(buffer, input.data()); BIO *b64 = BIO_new(BIO_f_base64());
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
// BIO_new_mem_buf is not const aware, but it doesn't modify the buffer
BIO *bio = BIO_new_mem_buf(const_cast<char*>(input.c_str()), input.length());
bio = BIO_push(b64, bio);
size_t bytes_written = BIO_read(bio, buffer, buffer_size);
BIO_free_all(bio);
return bytes_written; return bytes_written;
} }

View File

@@ -66,7 +66,6 @@ void LLCallbackList::addFunction( callback_t func, void *data)
bool LLCallbackList::containsFunction( callback_t func, void *data) bool LLCallbackList::containsFunction( callback_t func, void *data)
{ {
callback_pair_t t(func, data);
callback_list_t::iterator iter = find(func,data); callback_list_t::iterator iter = find(func,data);
if (iter != mCallbackList.end()) if (iter != mCallbackList.end())
{ {

View File

@@ -88,7 +88,7 @@ std::string LLDate::asRFC1123() const
LLTrace::BlockTimerStatHandle FT_DATE_FORMAT("Date Format"); LLTrace::BlockTimerStatHandle FT_DATE_FORMAT("Date Format");
std::string LLDate::toHTTPDateString(std::string fmt) const std::string LLDate::toHTTPDateString(const std::string& fmt) const
{ {
LL_RECORD_BLOCK_TIME(FT_DATE_FORMAT); LL_RECORD_BLOCK_TIME(FT_DATE_FORMAT);
@@ -102,7 +102,7 @@ std::string LLDate::toHTTPDateString(std::string fmt) const
return toHTTPDateString(gmt, fmt); return toHTTPDateString(gmt, fmt);
} }
std::string LLDate::toHTTPDateString(tm * gmt, std::string fmt) std::string LLDate::toHTTPDateString(tm * gmt, const std::string& fmt)
{ {
LL_RECORD_BLOCK_TIME(FT_DATE_FORMAT); LL_RECORD_BLOCK_TIME(FT_DATE_FORMAT);
@@ -115,8 +115,8 @@ std::string LLDate::toHTTPDateString(tm * gmt, std::string fmt)
} }
// use strftime() as it appears to be faster than std::time_put // use strftime() as it appears to be faster than std::time_put
char buffer[128]; char buffer[128] = {};
if (std::strftime(buffer, 128, fmt.c_str(), gmt) == 0) if (std::strftime(buffer, sizeof(buffer), fmt.c_str(), gmt) == 0)
return LLStringExplicit(EPOCH_STR); return LLStringExplicit(EPOCH_STR);
std::string res(buffer); std::string res(buffer);

View File

@@ -86,8 +86,8 @@ public:
std::string asRFC1123() const; std::string asRFC1123() const;
void toStream(std::ostream&) const; void toStream(std::ostream&) const;
bool split(S32 *year, S32 *month = NULL, S32 *day = NULL, S32 *hour = NULL, S32 *min = NULL, S32 *sec = NULL) const; bool split(S32 *year, S32 *month = NULL, S32 *day = NULL, S32 *hour = NULL, S32 *min = NULL, S32 *sec = NULL) const;
std::string toHTTPDateString (std::string fmt) const; std::string toHTTPDateString (const std::string& fmt) const;
static std::string toHTTPDateString (tm * gmt, std::string fmt); static std::string toHTTPDateString (tm * gmt, const std::string& fmt);
/** /**
* @brief Set the date from an ISO-8601 string. * @brief Set the date from an ISO-8601 string.
* *

View File

@@ -41,7 +41,7 @@
#include <boost/graph/exception.hpp> #include <boost/graph/exception.hpp>
// other Linden headers // other Linden headers
LLDependenciesBase::VertexList LLDependenciesBase::topo_sort(int vertices, const EdgeList& edges) const LLDependenciesBase::VertexList LLDependenciesBase::topo_sort(std::size_t vertices, const EdgeList& edges) const
{ {
// Construct a Boost Graph Library graph according to the constraints // Construct a Boost Graph Library graph according to the constraints
// we've collected. It seems as though we ought to be able to capture // we've collected. It seems as though we ought to be able to capture

View File

@@ -127,9 +127,9 @@ public:
virtual std::string describe(bool full=true) const; virtual std::string describe(bool full=true) const;
protected: protected:
typedef std::vector< std::pair<int, int> > EdgeList; typedef std::vector< std::pair<std::size_t, std::size_t> > EdgeList;
typedef std::vector<int> VertexList; typedef std::vector<std::size_t> VertexList;
VertexList topo_sort(int vertices, const EdgeList& edges) const; VertexList topo_sort(std::size_t vertices, const EdgeList& edges) const;
/** /**
* refpair is specifically intended to capture a pair of references. This * refpair is specifically intended to capture a pair of references. This
@@ -511,7 +511,7 @@ public:
// been explicitly added. Rely on std::map rejecting a second attempt // been explicitly added. Rely on std::map rejecting a second attempt
// to insert the same key. Use the map's size() as the vertex number // to insert the same key. Use the map's size() as the vertex number
// to get a distinct value for each successful insertion. // to get a distinct value for each successful insertion.
typedef std::map<KEY, int> VertexMap; typedef std::map<KEY, std::size_t> VertexMap;
VertexMap vmap; VertexMap vmap;
// Nest each of these loops because !@#$%? MSVC warns us that its // Nest each of these loops because !@#$%? MSVC warns us that its
// former broken behavior has finally been fixed -- and our builds // former broken behavior has finally been fixed -- and our builds
@@ -542,7 +542,7 @@ public:
for (typename DepNodeMap::const_iterator nmi = mNodes.begin(), nmend = mNodes.end(); for (typename DepNodeMap::const_iterator nmi = mNodes.begin(), nmend = mNodes.end();
nmi != nmend; ++nmi) nmi != nmend; ++nmi)
{ {
int thisnode = vmap[nmi->first]; std::size_t thisnode = vmap[nmi->first];
// after dependencies: build edges from the named node to this one // after dependencies: build edges from the named node to this one
for (typename DepNode::dep_set::const_iterator ai = nmi->second.after.begin(), for (typename DepNode::dep_set::const_iterator ai = nmi->second.after.begin(),
aend = nmi->second.after.end(); aend = nmi->second.after.end();

View File

@@ -65,7 +65,7 @@ public:
{ {
for (const_iterator_t dictionary_iter = map_t::begin(); for (const_iterator_t dictionary_iter = map_t::begin();
dictionary_iter != map_t::end(); dictionary_iter != map_t::end();
dictionary_iter++) ++dictionary_iter)
{ {
const Entry *entry = dictionary_iter->second; const Entry *entry = dictionary_iter->second;
if (entry->mName == name) if (entry->mName == name)

View File

@@ -226,7 +226,7 @@ bool LLSimpleDispatcher::fireEvent(LLPointer<LLEvent> event, LLSD filter)
for (itor=mListeners.begin(); itor!=mListeners.end(); ++itor) for (itor=mListeners.begin(); itor!=mListeners.end(); ++itor)
{ {
LLListenerEntry& entry = *itor; LLListenerEntry& entry = *itor;
if (filter_string == "" || entry.filter.asString() == filter_string) if (filter_string.empty() || entry.filter.asString() == filter_string)
{ {
(entry.listener)->handleEvent(event, (*itor).userdata); (entry.listener)->handleEvent(event, (*itor).userdata);
} }

View File

@@ -449,7 +449,7 @@ struct LLEventDispatcher::ParamsDispatchEntry: public LLEventDispatcher::Dispatc
virtual void call(const std::string& desc, const LLSD& event) const virtual void call(const std::string& desc, const LLSD& event) const
{ {
LLSDArgsSource src(desc, event); LLSDArgsSource src(desc, event);
mInvoker(boost::bind(&LLSDArgsSource::next, boost::ref(src))); mInvoker(std::bind(&LLSDArgsSource::next, std::ref(src)));
} }
}; };

View File

@@ -57,19 +57,12 @@ static const int& nil(nil_);
#endif #endif
#include <string> #include <string>
#include <boost/shared_ptr.hpp>
#ifndef BOOST_FUNCTION_HPP_INCLUDED
#include <boost/function.hpp> #include <boost/function.hpp>
#define BOOST_FUNCTION_HPP_INCLUDED
#endif
#include <boost/bind.hpp>
#include <boost/iterator/transform_iterator.hpp> #include <boost/iterator/transform_iterator.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/function_types/is_nonmember_callable_builtin.hpp> #include <boost/function_types/is_nonmember_callable_builtin.hpp>
#include <boost/function_types/parameter_types.hpp> #include <boost/function_types/parameter_types.hpp>
#include <boost/function_types/function_arity.hpp> #include <boost/function_types/function_arity.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/fusion/include/push_back.hpp> #include <boost/fusion/include/push_back.hpp>
#include <boost/fusion/include/cons.hpp> #include <boost/fusion/include/cons.hpp>
#include <boost/fusion/include/invoke.hpp> #include <boost/fusion/include/invoke.hpp>
@@ -303,7 +296,7 @@ private:
// subclass object. However, I definitely want DispatchMap to destroy // subclass object. However, I definitely want DispatchMap to destroy
// DispatchEntry if no references are outstanding at the time an entry is // DispatchEntry if no references are outstanding at the time an entry is
// removed. This looks like a job for boost::shared_ptr. // removed. This looks like a job for boost::shared_ptr.
typedef std::map<std::string, boost::shared_ptr<DispatchEntry> > DispatchMap; typedef std::map<std::string, std::shared_ptr<DispatchEntry> > DispatchMap;
public: public:
/// We want the flexibility to redefine what data we store per name, /// We want the flexibility to redefine what data we store per name,
@@ -430,7 +423,7 @@ struct LLEventDispatcher::invoker
// Instead of grabbing the first item from argsrc and making an // Instead of grabbing the first item from argsrc and making an
// LLSDParam of it, call getter() and pass that as the instance param. // LLSDParam of it, call getter() and pass that as the instance param.
invoker<Function, next_iter_type, To>::apply invoker<Function, next_iter_type, To>::apply
( func, argsrc, boost::fusion::push_back(boost::fusion::nil(), boost::ref(getter()))); ( func, argsrc, boost::fusion::push_back(boost::fusion::nil(), std::ref(getter())));
} }
}; };

View File

@@ -33,15 +33,14 @@
// STL headers // STL headers
// std headers // std headers
// external library headers // external library headers
#include <boost/bind.hpp>
// other Linden headers // other Linden headers
#include "llerror.h" // LL_ERRS #include "llerror.h" // LL_ERRS
#include "llsdutil.h" // llsd_matches() #include "llsdutil.h" // llsd_matches()
LLEventFilter::LLEventFilter(LLEventPump& source, const std::string& name, bool tweak): LLEventFilter::LLEventFilter(LLEventPump& source, const std::string& name, bool tweak):
LLEventStream(name, tweak) LLEventStream(name, tweak),
mSource(source.listen(getName(), boost::bind(&LLEventFilter::post, this, _1)))
{ {
source.listen(getName(), boost::bind(&LLEventFilter::post, this, _1));
} }
LLEventMatching::LLEventMatching(const LLSD& pattern): LLEventMatching::LLEventMatching(const LLSD& pattern):

View File

@@ -32,10 +32,6 @@
#include "llevents.h" #include "llevents.h"
#include "stdtypes.h" #include "stdtypes.h"
#include "lltimer.h" #include "lltimer.h"
#ifndef BOOST_FUNCTION_HPP_INCLUDED
#include <boost/function.hpp>
#define BOOST_FUNCTION_HPP_INCLUDED
#endif
/** /**
* Generic base class * Generic base class
@@ -52,6 +48,9 @@ public:
/// Post an event to all listeners /// Post an event to all listeners
virtual bool post(const LLSD& event) = 0; virtual bool post(const LLSD& event) = 0;
private:
LLTempBoundListener mSource;
}; };
/** /**
@@ -89,7 +88,7 @@ public:
LLEventTimeoutBase(LLEventPump& source); LLEventTimeoutBase(LLEventPump& source);
/// Callable, can be constructed with boost::bind() /// Callable, can be constructed with boost::bind()
typedef boost::function<void()> Action; typedef std::function<void()> Action;
/** /**
* Start countdown timer for the specified number of @a seconds. Forward * Start countdown timer for the specified number of @a seconds. Forward

View File

@@ -28,8 +28,7 @@
#define LLHANDLE_H #define LLHANDLE_H
#include "llpointer.h" #include "llpointer.h"
#include <boost/type_traits/is_convertible.hpp> #include <boost/throw_exception.hpp>
#include <boost/utility/enable_if.hpp>
/** /**
* Helper object for LLHandle. Don't instantiate these directly, used * Helper object for LLHandle. Don't instantiate these directly, used
@@ -86,7 +85,7 @@ public:
LLHandle() : mTombStone(getDefaultTombStone()) {} LLHandle() : mTombStone(getDefaultTombStone()) {}
template<typename U> template<typename U>
LLHandle(const LLHandle<U>& other, typename boost::enable_if< typename boost::is_convertible<U*, T*> >::type* dummy = 0) LLHandle(const LLHandle<U>& other, typename std::enable_if<std::is_convertible<U*, T*>::value>::type* dummy = nullptr)
: mTombStone(other.mTombStone) : mTombStone(other.mTombStone)
{} {}
@@ -195,7 +194,7 @@ public:
} }
template <typename U> template <typename U>
LLHandle<U> getDerivedHandle(typename boost::enable_if< typename boost::is_convertible<U*, T*> >::type* dummy = 0) const LLHandle<U> getDerivedHandle(typename std::enable_if<std::is_convertible<U*, T*>::value>::type* dummy = nullptr) const
{ {
LLHandle<U> downcast_handle; LLHandle<U> downcast_handle;
downcast_handle.mTombStone = getHandle().mTombStone; downcast_handle.mTombStone = getHandle().mTombStone;

View File

@@ -67,8 +67,8 @@ namespace LLInitParam
mMergeFunc(merge_func), mMergeFunc(merge_func),
mDeserializeFunc(deserialize_func), mDeserializeFunc(deserialize_func),
mSerializeFunc(serialize_func), mSerializeFunc(serialize_func),
mInspectFunc(inspect_func),
mValidationFunc(validation_func), mValidationFunc(validation_func),
mInspectFunc(inspect_func),
mMinCount(min_count), mMinCount(min_count),
mMaxCount(max_count), mMaxCount(max_count),
mUserData(NULL) mUserData(NULL)
@@ -79,8 +79,8 @@ namespace LLInitParam
mMergeFunc(NULL), mMergeFunc(NULL),
mDeserializeFunc(NULL), mDeserializeFunc(NULL),
mSerializeFunc(NULL), mSerializeFunc(NULL),
mInspectFunc(NULL),
mValidationFunc(NULL), mValidationFunc(NULL),
mInspectFunc(NULL),
mMinCount(0), mMinCount(0),
mMaxCount(0), mMaxCount(0),
mUserData(NULL) mUserData(NULL)
@@ -193,7 +193,12 @@ namespace LLInitParam
{ {
if (!silent) if (!silent)
{ {
p.parserWarning(llformat("Failed to parse parameter \"%s\"", p.getCurrentElementName().c_str())); std::string file_name = p.getCurrentFileName();
if(!file_name.empty())
{
file_name = "in file: " + file_name;
}
p.parserWarning(llformat("Failed to parse parameter \"%s\" %s", p.getCurrentElementName().c_str(), file_name.c_str()));
} }
return false; return false;
} }

View File

@@ -30,13 +30,7 @@
#include <vector> #include <vector>
#include <list> #include <list>
#ifndef BOOST_FUNCTION_HPP_INCLUDED
#include <boost/function.hpp> #include <boost/function.hpp>
#define BOOST_FUNCTION_HPP_INCLUDED
#endif
#include <boost/shared_ptr.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_enum.hpp>
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
#include "llerror.h" #include "llerror.h"
@@ -118,7 +112,7 @@ namespace LLInitParam
// wraps comparison operator between any 2 values of the same type // wraps comparison operator between any 2 values of the same type
// specialize to handle cases where equality isn't defined well, or at all // specialize to handle cases where equality isn't defined well, or at all
template <typename T, bool IS_BOOST_FUNCTION = boost::is_convertible<T, boost::function_base>::value > template <typename T, bool IS_BOOST_FUNCTION = std::is_convertible<T, boost::function_base>::value >
struct ParamCompare struct ParamCompare
{ {
static bool equals(const T &a, const T &b) static bool equals(const T &a, const T &b)
@@ -499,7 +493,7 @@ namespace LLInitParam
virtual ~Parser(); virtual ~Parser();
template <typename T> bool readValue(T& param, typename boost::disable_if<boost::is_enum<T> >::type* dummy = 0) template <typename T> bool readValue(T& param, typename std::enable_if<!std::is_enum<T>::value>::type* dummy = 0)
{ {
parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T)); parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T));
if (found_it != mParserReadFuncs->end()) if (found_it != mParserReadFuncs->end())
@@ -509,8 +503,8 @@ namespace LLInitParam
return false; return false;
} }
template <typename T> bool readValue(T& param, typename boost::enable_if<boost::is_enum<T> >::type* dummy = 0) template <typename T> bool readValue(T& param, typename std::enable_if<std::is_enum<T>::value>::type* dummy = nullptr)
{ {
parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T)); parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T));
if (found_it != mParserReadFuncs->end()) if (found_it != mParserReadFuncs->end())
@@ -554,6 +548,7 @@ namespace LLInitParam
} }
virtual std::string getCurrentElementName() = 0; virtual std::string getCurrentElementName() = 0;
virtual std::string getCurrentFileName() = 0;
virtual void parserWarning(const std::string& message); virtual void parserWarning(const std::string& message);
virtual void parserError(const std::string& message); virtual void parserError(const std::string& message);
void setParseSilently(bool silent) { mParseSilently = silent; } void setParseSilently(bool silent) { mParseSilently = silent; }
@@ -633,7 +628,7 @@ namespace LLInitParam
UserData* mUserData; UserData* mUserData;
}; };
typedef boost::shared_ptr<ParamDescriptor> ParamDescriptorPtr; typedef std::shared_ptr<ParamDescriptor> ParamDescriptorPtr;
// each derived Block class keeps a static data structure maintaining offsets to various params // each derived Block class keeps a static data structure maintaining offsets to various params
class LL_COMMON_API BlockDescriptor class LL_COMMON_API BlockDescriptor
@@ -1449,7 +1444,7 @@ namespace LLInitParam
++it) ++it)
{ {
std::string key = it->getValueName(); std::string key = it->getValueName();
name_stack.push_back(std::make_pair(std::string(), true)); name_stack.emplace_back(std::string(), true);
if(key.empty()) if(key.empty())
// not parsed via name values, write out value directly // not parsed via name values, write out value directly
@@ -1501,7 +1496,7 @@ namespace LLInitParam
param_value_t& add() param_value_t& add()
{ {
mValues.push_back(value_t()); mValues.emplace_back(value_t());
Param::setProvided(); Param::setProvided();
return mValues.back(); return mValues.back();
} }

View File

@@ -102,19 +102,19 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) {
uint4 input_index, buffer_index; uint4 input_index, buffer_index;
uint4 buffer_space; // how much space is left in buffer uint4 buffer_space; // how much space is left in buffer
if (finalized){ // so we can't update! if (mFinalized){ // so we can't update!
std::cerr << "LLMD5::update: Can't update a finalized digest!" << std::endl; std::cerr << "LLMD5::update: Can't update a finalized digest!" << std::endl;
return; return;
} }
// Compute number of bytes mod 64 // Compute number of bytes mod 64
buffer_index = (unsigned int)((count[0] >> 3) & 0x3F); buffer_index = (unsigned int)((mCount[0] >> 3) & 0x3F);
// Update number of bits // Update number of bits
if ( (count[0] += ((uint4) input_length << 3))<((uint4) input_length << 3) ) if ( (mCount[0] += ((uint4) input_length << 3))<((uint4) input_length << 3) )
count[1]++; mCount[1]++;
count[1] += ((uint4)input_length >> 29); mCount[1] += ((uint4)input_length >> 29);
buffer_space = 64 - buffer_index; // how much space is left in buffer buffer_space = 64 - buffer_index; // how much space is left in buffer
@@ -129,10 +129,10 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) {
if (input_length >= buffer_space) { // ie. we have enough to fill the buffer if (input_length >= buffer_space) { // ie. we have enough to fill the buffer
// fill the rest of the buffer and transform // fill the rest of the buffer and transform
memcpy( /* Flawfinder: ignore */ memcpy( /* Flawfinder: ignore */
buffer + buffer_index, mBuffer + buffer_index,
input, input,
buffer_space); buffer_space);
transform (buffer); transform (mBuffer);
for (input_index = buffer_space; input_index + 63 < input_length; for (input_index = buffer_space; input_index + 63 < input_length;
input_index += 64) input_index += 64)
@@ -145,7 +145,7 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) {
// and here we do the buffering: // and here we do the buffering:
memcpy(buffer+buffer_index, input+input_index, input_length-input_index); /* Flawfinder: ignore */ memcpy(mBuffer+buffer_index, input+input_index, input_length-input_index); /* Flawfinder: ignore */
} }
@@ -200,16 +200,16 @@ void LLMD5::finalize (){
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}; };
if (finalized){ if (mFinalized){
std::cerr << "LLMD5::finalize: Already finalized this digest!" << std::endl; std::cerr << "LLMD5::finalize: Already finalized this digest!" << std::endl;
return; return;
} }
// Save number of bits // Save number of bits
encode (bits, count, 8); encode (bits, mCount, 8);
// Pad out to 56 mod 64. // Pad out to 56 mod 64.
index = (uint4) ((count[0] >> 3) & 0x3f); index = (uint4) ((mCount[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index); padLen = (index < 56) ? (56 - index) : (120 - index);
update (PADDING, padLen); update (PADDING, padLen);
@@ -217,12 +217,12 @@ void LLMD5::finalize (){
update (bits, 8); update (bits, 8);
// Store state in digest // Store state in digest
encode (digest, state, 16); encode (mDigest, mState, 16);
// Zeroize sensitive information // Zeroize sensitive information
memset (buffer, 0, sizeof(*buffer)); memset (mBuffer, 0, sizeof(mBuffer));
finalized=1; mFinalized=true;
} }
@@ -269,7 +269,7 @@ LLMD5::LLMD5(const unsigned char *s)
void LLMD5::raw_digest(unsigned char *s) const void LLMD5::raw_digest(unsigned char *s) const
{ {
if (!finalized) if (!mFinalized)
{ {
std::cerr << "LLMD5::raw_digest: Can't get digest if you haven't "<< std::cerr << "LLMD5::raw_digest: Can't get digest if you haven't "<<
"finalized the digest!" << std::endl; "finalized the digest!" << std::endl;
@@ -277,22 +277,22 @@ void LLMD5::raw_digest(unsigned char *s) const
return; return;
} }
memcpy(s, digest, 16); /* Flawfinder: ignore */ memcpy(s, mDigest, 16); /* Flawfinder: ignore */
return; return;
} }
//Singu extension: the inverse of LLMD5::raw_digest. //Singu extension: the inverse of LLMD5::raw_digest.
void LLMD5::clone(unsigned char const* s) void LLMD5::clone(unsigned char const* s)
{ {
memcpy(digest, s, 16); memcpy(mDigest, s, 16);
finalized = 1; mFinalized = true;
} }
void LLMD5::hex_digest(char *s) const void LLMD5::hex_digest(char *s) const
{ {
int i; int i;
if (!finalized) if (!mFinalized)
{ {
std::cerr << "LLMD5::hex_digest: Can't get digest if you haven't "<< std::cerr << "LLMD5::hex_digest: Can't get digest if you haven't "<<
"finalized the digest!" <<std::endl; "finalized the digest!" <<std::endl;
@@ -302,7 +302,7 @@ void LLMD5::hex_digest(char *s) const
for (i=0; i<16; i++) for (i=0; i<16; i++)
{ {
sprintf(s+i*2, "%02x", digest[i]); /* Flawfinder: ignore */ sprintf(s+i*2, "%02x", mDigest[i]); /* Flawfinder: ignore */
} }
s[32]='\0'; s[32]='\0';
@@ -322,9 +322,9 @@ void LLMD5::clone(std::string const& hash_str)
unsigned char nibble = (c >= '0' && c <= '9') ? c - '0' : c - 'a' + 10; unsigned char nibble = (c >= '0' && c <= '9') ? c - '0' : c - 'a' + 10;
byte += nibble << ((1 - j) << 2); byte += nibble << ((1 - j) << 2);
} }
digest[i] = byte; mDigest[i] = byte;
} }
finalized = 1; mFinalized = 1;
} }
@@ -340,17 +340,17 @@ std::ostream& operator<<(std::ostream &stream, LLMD5 const& context)
// PRIVATE METHODS: // PRIVATE METHODS:
void LLMD5::init(){ void LLMD5::init(){
finalized=0; // we just started! mFinalized=false; // we just started!
// Nothing counted, so count=0 // Nothing counted, so count=0
count[0] = 0; mCount[0] = 0;
count[1] = 0; mCount[1] = 0;
// Load magic initialization constants. // Load magic initialization constants.
state[0] = 0x67452301; mState[0] = 0x67452301;
state[1] = 0xefcdab89; mState[1] = 0xefcdab89;
state[2] = 0x98badcfe; mState[2] = 0x98badcfe;
state[3] = 0x10325476; mState[3] = 0x10325476;
} }
@@ -419,11 +419,11 @@ Rotation is separate from addition to prevent recomputation.
// LLMD5 basic transformation. Transforms state based on block. // LLMD5 basic transformation. Transforms state based on block.
void LLMD5::transform (const U8 block[64]){ void LLMD5::transform (const U8 block[64]){
uint4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; uint4 a = mState[0], b = mState[1], c = mState[2], d = mState[3], x[16];
decode (x, block, 64); decode (x, block, 64);
assert(!finalized); // not just a user error, since the method is private assert(!mFinalized); // not just a user error, since the method is private
/* Round 1 */ /* Round 1 */
FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
@@ -497,10 +497,10 @@ void LLMD5::transform (const U8 block[64]){
II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
state[0] += a; mState[0] += a;
state[1] += b; mState[1] += b;
state[2] += c; mState[2] += c;
state[3] += d; mState[3] += d;
// Zeroize sensitive information. // Zeroize sensitive information.
memset ( (uint1 *) x, 0, sizeof(x)); memset ( (uint1 *) x, 0, sizeof(x));

View File

@@ -102,7 +102,7 @@ public:
void update (const std::string& str); void update (const std::string& str);
void finalize (); void finalize ();
bool isFinalized() const { return finalized; } bool isFinalized() const { return mFinalized; }
// constructors for special circumstances. All these constructors finalize // constructors for special circumstances. All these constructors finalize
// the MD5 context. // the MD5 context.
@@ -120,19 +120,19 @@ public:
void hex_digest(char *string) const; // provide 33-byte array for ascii-hex string void hex_digest(char *string) const; // provide 33-byte array for ascii-hex string
friend LL_COMMON_API std::ostream& operator<< (std::ostream&, LLMD5 const& context); friend LL_COMMON_API std::ostream& operator<< (std::ostream&, LLMD5 const& context);
friend LL_COMMON_API bool operator==(const LLMD5& a, const LLMD5& b) { return std::memcmp(a.digest ,b.digest, 16) == 0; } friend LL_COMMON_API bool operator==(const LLMD5& a, const LLMD5& b) { return std::memcmp(a.mDigest ,b.mDigest, 16) == 0; }
friend LL_COMMON_API bool operator!=(const LLMD5& a, const LLMD5& b) { return std::memcmp(a.digest ,b.digest, 16) != 0; } friend LL_COMMON_API bool operator!=(const LLMD5& a, const LLMD5& b) { return std::memcmp(a.mDigest,b.mDigest, 16) != 0; }
friend LL_COMMON_API bool operator<(const LLMD5& a, const LLMD5& b) { return std::memcmp(a.digest ,b.digest, 16) < 0; } friend LL_COMMON_API bool operator<(const LLMD5& a, const LLMD5& b) { return std::memcmp(a.mDigest,b.mDigest, 16) < 0; }
private: private:
// next, the private data: // next, the private data:
uint4 state[4]; uint4 mState[4];
uint4 count[2]; // number of *bits*, mod 2^64 uint4 mCount[2]; // number of *bits*, mod 2^64
uint1 buffer[64]; // input buffer uint1 mBuffer[64]; // input buffer
uint1 digest[16]; uint1 mDigest[16];
uint1 finalized; bool mFinalized;
// last, the private methods, mostly static: // last, the private methods, mostly static:
void init (); // called by all constructors void init (); // called by all constructors

View File

@@ -489,8 +489,7 @@ private:
unsigned int ids = (unsigned int)cpu_info[0]; unsigned int ids = (unsigned int)cpu_info[0];
setConfig(eMaxID, (S32)ids); setConfig(eMaxID, (S32)ids);
char cpu_vendor[0x20]; char cpu_vendor[0x20] = {0};
memset(cpu_vendor, 0, sizeof(cpu_vendor));
*((int*)cpu_vendor) = cpu_info[1]; *((int*)cpu_vendor) = cpu_info[1];
*((int*)(cpu_vendor+4)) = cpu_info[3]; *((int*)(cpu_vendor+4)) = cpu_info[3];
*((int*)(cpu_vendor+8)) = cpu_info[2]; *((int*)(cpu_vendor+8)) = cpu_info[2];
@@ -556,8 +555,7 @@ private:
unsigned int ext_ids = cpu_info[0]; unsigned int ext_ids = cpu_info[0];
setConfig(eMaxExtID, 0); setConfig(eMaxExtID, 0);
char cpu_brand_string[0x40]; char cpu_brand_string[0x40] = {0};
memset(cpu_brand_string, 0, sizeof(cpu_brand_string));
// Get the information associated with each extended ID. // Get the information associated with each extended ID.
for(unsigned int i=0x80000000; i<=ext_ids; ++i) for(unsigned int i=0x80000000; i<=ext_ids; ++i)
@@ -638,16 +636,14 @@ private:
{ {
size_t len = 0; size_t len = 0;
char cpu_brand_string[0x40]; char cpu_brand_string[0x40] = {0};
len = sizeof(cpu_brand_string); len = sizeof(cpu_brand_string);
memset(cpu_brand_string, 0, len);
sysctlbyname("machdep.cpu.brand_string", (void*)cpu_brand_string, &len, NULL, 0); sysctlbyname("machdep.cpu.brand_string", (void*)cpu_brand_string, &len, NULL, 0);
cpu_brand_string[0x3f] = 0; cpu_brand_string[0x3f] = 0;
setInfo(eBrandName, cpu_brand_string); setInfo(eBrandName, cpu_brand_string);
char cpu_vendor[0x20]; char cpu_vendor[0x20] = {0};
len = sizeof(cpu_vendor); len = sizeof(cpu_vendor);
memset(cpu_vendor, 0, len);
sysctlbyname("machdep.cpu.vendor", (void*)cpu_vendor, &len, NULL, 0); sysctlbyname("machdep.cpu.vendor", (void*)cpu_vendor, &len, NULL, 0);
cpu_vendor[0x1f] = 0; cpu_vendor[0x1f] = 0;
setInfo(eVendor, cpu_vendor); setInfo(eVendor, cpu_vendor);
@@ -735,8 +731,7 @@ private:
LLFILE* cpuinfo_fp = LLFile::fopen(CPUINFO_FILE, "rb"); LLFILE* cpuinfo_fp = LLFile::fopen(CPUINFO_FILE, "rb");
if(cpuinfo_fp) if(cpuinfo_fp)
{ {
char line[MAX_STRING]; char line[MAX_STRING] = {0};
memset(line, 0, MAX_STRING);
while(fgets(line, MAX_STRING, cpuinfo_fp)) while(fgets(line, MAX_STRING, cpuinfo_fp))
{ {
// /proc/cpuinfo on Linux looks like: // /proc/cpuinfo on Linux looks like:
@@ -834,8 +829,7 @@ private:
LLFILE* cpuinfo = LLFile::fopen(CPUINFO_FILE, "rb"); LLFILE* cpuinfo = LLFile::fopen(CPUINFO_FILE, "rb");
if(cpuinfo) if(cpuinfo)
{ {
char line[MAX_STRING]; char line[MAX_STRING] = {0};
memset(line, 0, MAX_STRING);
while(fgets(line, MAX_STRING, cpuinfo)) while(fgets(line, MAX_STRING, cpuinfo))
{ {
line[strlen(line)-1] = ' '; line[strlen(line)-1] = ' ';

View File

@@ -31,12 +31,10 @@
#if ! defined(LL_LLPTRTO_H) #if ! defined(LL_LLPTRTO_H)
#define LL_LLPTRTO_H #define LL_LLPTRTO_H
#include <type_traits>
#include "llpointer.h" #include "llpointer.h"
#include "llrefcount.h" // LLRefCount #include "llrefcount.h" // LLRefCount
#include "llthread.h" // LLThreadSafeRefCount #include "llthread.h" // LLThreadSafeRefCount
#include <boost/type_traits/is_base_of.hpp>
#include <boost/type_traits/remove_pointer.hpp>
#include <boost/utility/enable_if.hpp>
/** /**
* LLPtrTo<TARGET>::type is either of two things: * LLPtrTo<TARGET>::type is either of two things:
@@ -56,14 +54,14 @@ struct LLPtrTo
/// specialize for subclasses of LLRefCount /// specialize for subclasses of LLRefCount
template <class T> template <class T>
struct LLPtrTo<T, typename boost::enable_if< boost::is_base_of<LLRefCount, T> >::type> struct LLPtrTo<T, typename std::enable_if< std::is_base_of<LLRefCount, T>::value>::type>
{ {
typedef LLPointer<T> type; typedef LLPointer<T> type;
}; };
/// specialize for subclasses of LLThreadSafeRefCount /// specialize for subclasses of LLThreadSafeRefCount
template <class T> template <class T>
struct LLPtrTo<T, typename boost::enable_if< boost::is_base_of<LLThreadSafeRefCount, T> >::type> struct LLPtrTo<T, typename std::enable_if< std::is_base_of<LLThreadSafeRefCount, T>::value>::type>
{ {
typedef LLPointer<T> type; typedef LLPointer<T> type;
}; };
@@ -74,7 +72,7 @@ struct LLPtrTo<T, typename boost::enable_if< boost::is_base_of<LLThreadSafeRefCo
template <typename PTRTYPE> template <typename PTRTYPE>
struct LLRemovePointer struct LLRemovePointer
{ {
typedef typename boost::remove_pointer<PTRTYPE>::type type; typedef typename std::remove_pointer<PTRTYPE>::type type;
}; };
/// specialize for LLPointer<SOMECLASS> /// specialize for LLPointer<SOMECLASS>

View File

@@ -53,7 +53,7 @@ LLRunner::~LLRunner()
mRunEvery.clear(); mRunEvery.clear();
} }
S32 LLRunner::run() size_t LLRunner::run()
{ {
// We collect all of the runnables which should be run. Since the // We collect all of the runnables which should be run. Since the
// runnables are allowed to adjust the run list, we need to copy // runnables are allowed to adjust the run list, we need to copy

View File

@@ -56,7 +56,7 @@ public:
/** /**
* @brief The pointer to a runnable. * @brief The pointer to a runnable.
*/ */
typedef boost::shared_ptr<LLRunnable> run_ptr_t; typedef std::shared_ptr<LLRunnable> run_ptr_t;
/** /**
* @brief The handle for use in the API. * @brief The handle for use in the API.
@@ -93,7 +93,7 @@ public:
* *
* @return Returns the number of runnables run. * @return Returns the number of runnables run.
*/ */
S32 run(); size_t run();
/** /**
* @brief Add a runnable to the run list. * @brief Add a runnable to the run list.

View File

@@ -740,11 +740,9 @@ const LLSD& LLSD::Impl::undef()
void LLSD::Impl::dumpStats() const void LLSD::Impl::dumpStats() const
{ {
S32 type_counts[LLSD::TypeLLSDNumTypes + 1]; S32 type_counts[LLSD::TypeLLSDNumTypes + 1] = {0};
memset(&type_counts, 0, sizeof(type_counts));
S32 share_counts[LLSD::TypeLLSDNumTypes + 1]; S32 share_counts[LLSD::TypeLLSDNumTypes + 1] = {0};
memset(&share_counts, 0, sizeof(share_counts));
// Add info from all the values this object has // Add info from all the values this object has
calcStats(type_counts, share_counts); calcStats(type_counts, share_counts);

View File

@@ -30,7 +30,6 @@
// Project includes // Project includes
#include "llsdparam.h" #include "llsdparam.h"
#include "llsdutil.h" #include "llsdutil.h"
#include "boost/bind.hpp"
static LLInitParam::Parser::parser_read_func_map_t sReadFuncs; static LLInitParam::Parser::parser_read_func_map_t sReadFuncs;
static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs; static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs;
@@ -44,10 +43,8 @@ LLTrace::BlockTimerStatHandle FTM_SD_PARAM_ADAPTOR("LLSD to LLInitParam conversi
// //
LLParamSDParser::LLParamSDParser() LLParamSDParser::LLParamSDParser()
: Parser(sReadFuncs, sWriteFuncs, sInspectFuncs), : Parser(sReadFuncs, sWriteFuncs, sInspectFuncs),
mCurReadSD(NULL), mCurWriteSD(NULL), mWriteRootSD(NULL) mCurReadSD(NULL), mWriteRootSD(NULL)
{ {
using boost::bind;
if (sReadFuncs.empty()) if (sReadFuncs.empty())
{ {
registerParserFuncs<LLInitParam::Flag>(readFlag, &LLParamSDParser::writeFlag); registerParserFuncs<LLInitParam::Flag>(readFlag, &LLParamSDParser::writeFlag);
@@ -100,7 +97,7 @@ void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool
mNameStack.clear(); mNameStack.clear();
setParseSilently(silent); setParseSilently(silent);
LLParamSDParserUtilities::readSDValues(boost::bind(&LLParamSDParser::submit, this, boost::ref(block), _1, _2), sd, mNameStack); LLParamSDParserUtilities::readSDValues(std::bind(&LLParamSDParser::submit, this, std::ref(block), std::placeholders::_1, std::placeholders::_2), sd, mNameStack);
//readSDValues(sd, block); //readSDValues(sd, block);
} }
@@ -281,14 +278,14 @@ void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLI
} }
else if (sd.isUndefined()) else if (sd.isUndefined())
{ {
if (!cb.empty()) if (cb)
{ {
cb(NO_VALUE_MARKER, stack); cb(NO_VALUE_MARKER, stack);
} }
} }
else else
{ {
if (!cb.empty()) if (cb)
{ {
cb(sd, stack); cb(sd, stack);
} }
@@ -337,7 +334,7 @@ namespace LLInitParam
if (!p.writeValue<LLSD>(mValue, name_stack_range)) if (!p.writeValue<LLSD>(mValue, name_stack_range))
{ {
// otherwise read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc) // otherwise read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc)
LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, name_stack_range); LLParamSDParserUtilities::readSDValues(std::bind(&serializeElement, std::ref(p), std::placeholders::_1, std::placeholders::_2), mValue, name_stack_range);
} }
return true; return true;
} }

View File

@@ -29,14 +29,13 @@
#define LL_LLSDPARAM_H #define LL_LLSDPARAM_H
#include "llinitparam.h" #include "llinitparam.h"
#include "boost/function.hpp"
#include "llfasttimer.h" #include "llfasttimer.h"
struct LL_COMMON_API LLParamSDParserUtilities struct LL_COMMON_API LLParamSDParserUtilities
{ {
static LLSD& getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range); static LLSD& getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range);
typedef boost::function<void (const LLSD&, LLInitParam::Parser::name_stack_t&)> read_sd_cb_t; typedef std::function<void (const LLSD&, LLInitParam::Parser::name_stack_t&)> read_sd_cb_t;
static void readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack); static void readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack);
static void readSDValues(read_sd_cb_t cb, const LLSD& sd); static void readSDValues(read_sd_cb_t cb, const LLSD& sd);
}; };
@@ -66,6 +65,7 @@ public:
} }
/*virtual*/ std::string getCurrentElementName(); /*virtual*/ std::string getCurrentElementName();
/*virtual*/ std::string getCurrentFileName(){ return LLStringUtil::null; }
private: private:
void writeSDImpl(LLSD& sd, void writeSDImpl(LLSD& sd,
@@ -106,7 +106,6 @@ private:
Parser::name_stack_t mNameStack; Parser::name_stack_t mNameStack;
const LLSD* mCurReadSD; const LLSD* mCurReadSD;
LLSD* mWriteRootSD; LLSD* mWriteRootSD;
LLSD* mCurWriteSD;
}; };

View File

@@ -45,7 +45,6 @@
#include <map> #include <map>
#include <set> #include <set>
#include <boost/range.hpp>
// U32 // U32
LLSD ll_sd_from_U32(const U32 val) LLSD ll_sd_from_U32(const U32 val)
@@ -347,7 +346,7 @@ class TypeLookup
public: public:
TypeLookup() TypeLookup()
{ {
for (const Data *di(boost::begin(typedata)), *dend(boost::end(typedata)); di != dend; ++di) for (const Data *di(std::begin(typedata)), *dend(std::end(typedata)); di != dend; ++di)
{ {
mMap[di->type] = di->name; mMap[di->type] = di->name;
} }
@@ -527,7 +526,7 @@ std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::str
LLSD::TypeURI LLSD::TypeURI
}; };
return match_types(prototype.type(), return match_types(prototype.type(),
TypeVector(boost::begin(accept), boost::end(accept)), TypeVector(std::begin(accept), std::end(accept)),
data.type(), data.type(),
pfx); pfx);
} }
@@ -544,7 +543,7 @@ std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::str
}; };
// Funny business: shuffle the set of acceptable types to include all // Funny business: shuffle the set of acceptable types to include all
// but the prototype's type. Get the acceptable types in a set. // but the prototype's type. Get the acceptable types in a set.
std::set<LLSD::Type> rest(boost::begin(all), boost::end(all)); std::set<LLSD::Type> rest(std::begin(all), std::end(all));
// Remove the prototype's type because we pass that separately. // Remove the prototype's type because we pass that separately.
rest.erase(prototype.type()); rest.erase(prototype.type());
return match_types(prototype.type(), return match_types(prototype.type(),
@@ -560,7 +559,7 @@ std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::str
LLSD::TypeString LLSD::TypeString
}; };
return match_types(prototype.type(), return match_types(prototype.type(),
TypeVector(boost::begin(accept), boost::end(accept)), TypeVector(std::begin(accept), std::end(accept)),
data.type(), data.type(),
pfx); pfx);
} }

View File

@@ -73,8 +73,7 @@ bool ll_get_stack_trace(std::vector<std::string>& lines)
if(symbolsLoaded) if(symbolsLoaded)
{ {
// create the frames to hold the addresses // create the frames to hold the addresses
void* frames[MAX_STACK_DEPTH]; void* frames[MAX_STACK_DEPTH] = {0};
memset(frames, 0, sizeof(void*)*MAX_STACK_DEPTH);
S32 depth = 0; S32 depth = 0;
// get the addresses // get the addresses
@@ -110,7 +109,7 @@ bool ll_get_stack_trace(std::vector<std::string>& lines)
if(ret) if(ret)
{ {
std::string file_name = line.FileName; std::string file_name = line.FileName;
std::string::size_type index = file_name.rfind("\\"); std::string::size_type index = file_name.rfind('\\');
stack_line << file_name.substr(index + 1, file_name.size()) << ":" << line.LineNumber; stack_line << file_name.substr(index + 1, file_name.size()) << ":" << line.LineNumber;
} }

View File

@@ -45,7 +45,7 @@ public:
const std::string& String() const { return string; } const std::string& String() const { return string; }
size_t Hash() const { return string_hash; } size_t Hash() const { return string_hash; }
bool operator==(const LLStaticHashedString& b) const { return String() == b.String(); } bool operator==(const LLStaticHashedString& b) const { return Hash() == b.Hash(); }
protected: protected:

View File

@@ -318,9 +318,9 @@ inline bool vector_replace_with_last(T& invec, typename T::value_type const& val
// Append N elements to the vector and return a pointer to the first new element. // Append N elements to the vector and return a pointer to the first new element.
template <typename T> template <typename T>
inline T* vector_append(std::vector<T>& invec, S32 N) inline T* vector_append(std::vector<T>& invec, size_t N)
{ {
U32 sz = invec.size(); size_t sz = invec.size();
invec.resize(sz+N); invec.resize(sz+N);
return &(invec[sz]); return &(invec[sz]);
} }
@@ -512,6 +512,17 @@ llbind2nd(const _Operation& __oper, const _Tp& __x)
return llbinder2nd<_Operation>(__oper, _Arg2_type(__x)); return llbinder2nd<_Operation>(__oper, _Arg2_type(__x));
} }
/**
* Compare std::type_info* pointers a la std::less. We break this out as a
* separate function for use in two different std::less specializations.
*/
inline
bool before(const std::type_info* lhs, const std::type_info* rhs)
{
// Just use before(), as we normally would
return lhs->before(*rhs) ? true : false;
}
/** /**
* Specialize std::less<std::type_info*> to use std::type_info::before(). * Specialize std::less<std::type_info*> to use std::type_info::before().
* See MAINT-1175. It is NEVER a good idea to directly compare std::type_info* * See MAINT-1175. It is NEVER a good idea to directly compare std::type_info*
@@ -526,7 +537,7 @@ namespace std
{ {
bool operator()(const std::type_info* lhs, const std::type_info* rhs) const bool operator()(const std::type_info* lhs, const std::type_info* rhs) const
{ {
return lhs->before(*rhs); return before(lhs, rhs);
} }
}; };
@@ -536,7 +547,7 @@ namespace std
{ {
bool operator()(std::type_info* lhs, std::type_info* rhs) const bool operator()(std::type_info* lhs, std::type_info* rhs) const
{ {
return lhs->before(*rhs); return before(lhs, rhs);
} }
}; };
} // std } // std

View File

@@ -124,7 +124,7 @@ bool skip_to_next_word(std::istream& input_stream)
bool skip_to_end_of_next_keyword(const char* keyword, std::istream& input_stream) bool skip_to_end_of_next_keyword(const char* keyword, std::istream& input_stream)
{ {
int key_length = strlen(keyword); /*Flawfinder: ignore*/ size_t key_length = strlen(keyword); /*Flawfinder: ignore*/
if (0 == key_length) if (0 == key_length)
{ {
return false; return false;
@@ -321,7 +321,7 @@ bool unget_line(const std::string& line, std::istream& input_stream)
// returns true if removed last char // returns true if removed last char
bool remove_last_char(char c, std::string& line) bool remove_last_char(char c, std::string& line)
{ {
int line_size = line.size(); size_t line_size = line.size();
if (line_size > 1 if (line_size > 1
&& c == line[line_size - 1]) && c == line[line_size - 1])
{ {

View File

@@ -68,7 +68,7 @@ public:
Object* operator ++(int) { Object* old = mObjectp; mBytep += mSkip; return old; } Object* operator ++(int) { Object* old = mObjectp; mBytep += mSkip; return old; }
Object* operator +=(int i) { mBytep += mSkip*i; return mObjectp; } Object* operator +=(int i) { mBytep += mSkip*i; return mObjectp; }
Object& operator[](U32 index) { return *(Object*)(mBytep + (mSkip * index)); } Object& operator[](size_t index) { return *(Object*)(mBytep + (mSkip * index)); }
}; };

View File

@@ -372,12 +372,12 @@ S32 wstring_utf8_length(const LLWString& wstr)
LLWString utf8str_to_wstring(const std::string& utf8str, S32 len) LLWString utf8str_to_wstring(const std::string& utf8str, S32 len)
{ {
llwchar unichar;
LLWString wout; LLWString wout;
wout.reserve(len);
S32 i = 0; for (S32 i = 0; i < len; i++)
while (i < len)
{ {
llwchar unichar;
U8 cur_char = utf8str[i]; U8 cur_char = utf8str[i];
if (cur_char < 0x80) if (cur_char < 0x80)
@@ -453,7 +453,6 @@ LLWString utf8str_to_wstring(const std::string& utf8str, S32 len)
} }
wout += unichar; wout += unichar;
++i;
} }
return wout; return wout;
} }
@@ -466,16 +465,15 @@ LLWString utf8str_to_wstring(const std::string& utf8str)
std::string wstring_to_utf8str(const LLWString& utf32str, S32 len) std::string wstring_to_utf8str(const LLWString& utf32str, S32 len)
{ {
char tchars[8]; /* Flawfinder: ignore */
std::string out; std::string out;
out.reserve(len);
S32 i = 0; for (S32 i = 0; i < len; i++)
while (i < len)
{ {
char tchars[8]; /* Flawfinder: ignore */
S32 n = wchar_to_utf8chars(utf32str[i], tchars); S32 n = wchar_to_utf8chars(utf32str[i], tchars);
tchars[n] = 0; tchars[n] = 0;
out += tchars; out += tchars;
i++;
} }
return out; return out;
} }
@@ -812,7 +810,7 @@ std::string LLStringOps::getDatetimeCode (std::string key)
} }
else else
{ {
return std::string(""); return std::string();
} }
} }
@@ -1083,7 +1081,7 @@ bool LLStringUtil::formatDatetime(std::string& replacement, std::string token,
} }
else if (param == "local") else if (param == "local")
{ {
replacement = ""; // user knows their own timezone replacement.clear(); // user knows their own timezone
} }
else else
{ {

View File

@@ -1384,8 +1384,12 @@ void LLStringUtilBase<T>::stripNonprintable(string_type& string)
return; return;
} }
size_t src_size = string.size(); size_t src_size = string.size();
char* c_string = new char[src_size + 1]; char* c_string = nullptr;
if(c_string == NULL) try
{
c_string = new char[src_size + 1];
}
catch (const std::bad_alloc&)
{ {
return; return;
} }

View File

@@ -264,7 +264,7 @@ LLStringTableEntry* LLStringTable::addStringEntry(const char *str)
if (strlist) if (strlist)
{ {
string_list_t::iterator iter; string_list_t::iterator iter;
for (iter = strlist->begin(); iter != strlist->end(); iter++) for (iter = strlist->begin(); iter != strlist->end(); ++iter)
{ {
entry = *iter; entry = *iter;
ret_val = entry->mString; ret_val = entry->mString;
@@ -338,7 +338,7 @@ void LLStringTable::removeString(const char *str)
if (strlist) if (strlist)
{ {
string_list_t::iterator iter; string_list_t::iterator iter;
for (iter = strlist->begin(); iter != strlist->end(); iter++) for (iter = strlist->begin(); iter != strlist->end(); ++iter)
{ {
entry = *iter; entry = *iter;
ret_val = entry->mString; ret_val = entry->mString;

View File

@@ -150,7 +150,7 @@ public:
for (S32 i = 0; i<mTableSize; i++) for (S32 i = 0; i<mTableSize; i++)
{ {
string_set_t& stringset = mStringList[i]; string_set_t& stringset = mStringList[i];
for (string_set_t::iterator iter = stringset.begin(); iter != stringset.end(); iter++) for (string_set_t::iterator iter = stringset.begin(); iter != stringset.end(); ++iter)
{ {
delete *iter; delete *iter;
} }

View File

@@ -1311,7 +1311,11 @@ BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile)
LLFILE *dst = NULL; LLFILE *dst = NULL;
S32 bytes = 0; S32 bytes = 0;
tmpfile = dstfile + ".t"; tmpfile = dstfile + ".t";
#if LL_WINDOWS
src = gzopen_w(utf8str_to_utf16str(srcfile).c_str(), "rb");
#else
src = gzopen(srcfile.c_str(), "rb"); src = gzopen(srcfile.c_str(), "rb");
#endif
if (! src) goto err; if (! src) goto err;
dst = LLFile::fopen(tmpfile, "wb"); /* Flawfinder: ignore */ dst = LLFile::fopen(tmpfile, "wb"); /* Flawfinder: ignore */
if (! dst) goto err; if (! dst) goto err;
@@ -1345,7 +1349,11 @@ BOOL gzip_file(const std::string& srcfile, const std::string& dstfile)
LLFILE *src = NULL; LLFILE *src = NULL;
S32 bytes = 0; S32 bytes = 0;
tmpfile = dstfile + ".t"; tmpfile = dstfile + ".t";
#if LL_WINDOWS
dst = gzopen_w(utf8str_to_utf16str(tmpfile).c_str(), "wb");
#else
dst = gzopen(tmpfile.c_str(), "wb"); /* Flawfinder: ignore */ dst = gzopen(tmpfile.c_str(), "wb"); /* Flawfinder: ignore */
#endif
if (! dst) goto err; if (! dst) goto err;
src = LLFile::fopen(srcfile, "rb"); /* Flawfinder: ignore */ src = LLFile::fopen(srcfile, "rb"); /* Flawfinder: ignore */
if (! src) goto err; if (! src) goto err;

View File

@@ -63,10 +63,6 @@
#include <vector> #include <vector>
#include <deque> #include <deque>
#include <boost/iterator/iterator_facade.hpp> #include <boost/iterator/iterator_facade.hpp>
#ifndef BOOST_FUNCTION_HPP_INCLUDED
#include <boost/function.hpp>
#define BOOST_FUNCTION_HPP_INCLUDED
#endif
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
namespace LLTreeIter namespace LLTreeIter
@@ -96,7 +92,7 @@ protected:
typedef typename LLPtrTo<NODE>::type ptr_type; typedef typename LLPtrTo<NODE>::type ptr_type;
/// function that advances from this node to next accepts a node pointer /// function that advances from this node to next accepts a node pointer
/// and returns another /// and returns another
typedef boost::function<ptr_type(const ptr_type&)> func_type; typedef std::function<ptr_type(const ptr_type&)> func_type;
typedef SELFTYPE self_type; typedef SELFTYPE self_type;
}; };
@@ -333,7 +329,7 @@ protected:
typedef typename super::ptr_type ptr_type; typedef typename super::ptr_type ptr_type;
// The func_type is different for this: from a NODE pointer, we must // The func_type is different for this: from a NODE pointer, we must
// obtain a CHILDITER. // obtain a CHILDITER.
typedef boost::function<CHILDITER(const ptr_type&)> func_type; typedef std::function<CHILDITER(const ptr_type&)> func_type;
private: private:
typedef std::vector<ptr_type> list_type; typedef std::vector<ptr_type> list_type;
public: public:
@@ -438,7 +434,7 @@ protected:
typedef typename super::ptr_type ptr_type; typedef typename super::ptr_type ptr_type;
// The func_type is different for this: from a NODE pointer, we must // The func_type is different for this: from a NODE pointer, we must
// obtain a CHILDITER. // obtain a CHILDITER.
typedef boost::function<CHILDITER(const ptr_type&)> func_type; typedef std::function<CHILDITER(const ptr_type&)> func_type;
private: private:
// Upon reaching a given node in our pending list, we need to know whether // Upon reaching a given node in our pending list, we need to know whether
// we've already pushed that node's children, so we must associate a bool // we've already pushed that node's children, so we must associate a bool
@@ -503,14 +499,17 @@ private:
// Once we've popped the last node, this becomes a no-op. // Once we've popped the last node, this becomes a no-op.
if (mPending.empty()) if (mPending.empty())
return; return;
auto& pending = mPending.back();
// Here mPending.back() holds the node pointer we're proposing to // Here mPending.back() holds the node pointer we're proposing to
// dereference next. Have we pushed that node's children yet? // dereference next. Have we pushed that node's children yet?
if (mPending.back().second) if (pending.second)
return; // if so, it's okay to visit this node now return; // if so, it's okay to visit this node now
// We haven't yet pushed this node's children. Do so now. Remember // We haven't yet pushed this node's children. Do so now. Remember
// that we did -- while the node in question is still back(). // that we did -- while the node in question is still back().
mPending.back().second = true; pending.second = true;
addChildren(mPending.back().first); addChildren(pending.first);
// Now, because we've just changed mPending.back(), make that new node // Now, because we've just changed mPending.back(), make that new node
// current. // current.
makeCurrent(); makeCurrent();
@@ -577,7 +576,7 @@ protected:
typedef typename super::ptr_type ptr_type; typedef typename super::ptr_type ptr_type;
// The func_type is different for this: from a NODE pointer, we must // The func_type is different for this: from a NODE pointer, we must
// obtain a CHILDITER. // obtain a CHILDITER.
typedef boost::function<CHILDITER(const ptr_type&)> func_type; typedef std::function<CHILDITER(const ptr_type&)> func_type;
private: private:
// We need a FIFO queue rather than a LIFO stack. Use a deque rather than // We need a FIFO queue rather than a LIFO stack. Use a deque rather than
// a vector, since vector can't implement pop_front() efficiently. // a vector, since vector can't implement pop_front() efficiently.

View File

@@ -191,10 +191,9 @@ LLURI::LLURI(const std::string& escaped_str)
{ {
std::string::size_type delim_pos; std::string::size_type delim_pos;
delim_pos = escaped_str.find(':'); delim_pos = escaped_str.find(':');
std::string temp;
if (delim_pos == std::string::npos) if (delim_pos == std::string::npos)
{ {
mScheme = ""; mScheme.clear();
mEscapedOpaque = escaped_str; mEscapedOpaque = escaped_str;
} }
else else
@@ -244,7 +243,7 @@ void LLURI::parseAuthorityAndPathUsingOpaque()
delim_pos2 == std::string::npos) delim_pos2 == std::string::npos)
{ {
mEscapedAuthority = mEscapedOpaque.substr(2); mEscapedAuthority = mEscapedOpaque.substr(2);
mEscapedPath = ""; mEscapedPath.clear();
} }
// path exist, no query // path exist, no query
else if (delim_pos2 == std::string::npos) else if (delim_pos2 == std::string::npos)
@@ -456,7 +455,7 @@ namespace {
std::string::size_type start_pos = authority.find('@'); std::string::size_type start_pos = authority.find('@');
if (start_pos == std::string::npos) if (start_pos == std::string::npos)
{ {
user = ""; user.clear();
start_pos = 0; start_pos = 0;
} }
else else
@@ -469,7 +468,7 @@ namespace {
if (end_pos == std::string::npos) if (end_pos == std::string::npos)
{ {
host = authority.substr(start_pos); host = authority.substr(start_pos);
port = ""; port.clear();
} }
else else
{ {
@@ -529,7 +528,7 @@ U16 LLURI::hostPort() const
return 21; return 21;
return 0; return 0;
} }
return atoi(port.c_str()); return static_cast<U16>(std::stoi(port));
} }
std::string LLURI::path() const std::string LLURI::path() const
@@ -582,7 +581,7 @@ LLSD LLURI::queryMap(std::string escaped_query_string)
else else
{ {
tuple = escaped_query_string; tuple = escaped_query_string;
escaped_query_string = ""; escaped_query_string .clear();
} }
if (tuple.empty()) continue; if (tuple.empty()) continue;

View File

@@ -103,7 +103,7 @@ LLFolderDictionary::LLFolderDictionary()
addEntry(LLFolderType::FT_OUTBOX, new FolderEntry("outbox", TRUE)); addEntry(LLFolderType::FT_OUTBOX, new FolderEntry("outbox", TRUE));
addEntry(LLFolderType::FT_BASIC_ROOT, new FolderEntry("basic_rt", TRUE)); addEntry(LLFolderType::FT_BASIC_ROOT, new FolderEntry("basic_rt", TRUE));
addEntry(LLFolderType::FT_SUITCASE, new FolderEntry("suitcase", FALSE)); addEntry(LLFolderType::FT_SUITCASE, new FolderEntry("suitcase", TRUE));
addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE)); addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE));
}; };

View File

@@ -1314,11 +1314,11 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
setUUID(item_id); setUUID(item_id);
LLAssetType::EType type; LLAssetType::EType type;
type = (LLAssetType::EType)(atoi((*(iter++)).c_str())); type = static_cast<LLAssetType::EType>(std::stoi((*(iter++))));
setType( type ); setType( type );
LLInventoryType::EType inv_type; LLInventoryType::EType inv_type;
inv_type = (LLInventoryType::EType)(atoi((*(iter++)).c_str())); inv_type = static_cast<LLInventoryType::EType>(std::stoi((*(iter++))));
setInventoryType( inv_type ); setInventoryType( inv_type );
std::string name((*(iter++)).c_str()); std::string name((*(iter++)).c_str());
@@ -1346,8 +1346,8 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
setDescription(desc); setDescription(desc);
LLSaleInfo::EForSale sale_type; LLSaleInfo::EForSale sale_type;
sale_type = (LLSaleInfo::EForSale)(atoi((*(iter++)).c_str())); sale_type = static_cast<LLSaleInfo::EForSale>(std::stoi((*(iter++))));
S32 price = atoi((*(iter++)).c_str()); S32 price = std::stoi(*(iter++));
LLSaleInfo sale_info(sale_type, price); LLSaleInfo sale_info(sale_type, price);
setSaleInfo(sale_info); setSaleInfo(sale_info);
@@ -1416,6 +1416,10 @@ LLSD LLInventoryCategory::asLLSD() const
return sd; return sd;
} }
bool LLInventoryCategory::isPreferredTypeRoot() const
{
return (mPreferredType == LLFolderType::FT_ROOT_INVENTORY || mPreferredType == 9);
}
// virtual // virtual
void LLInventoryCategory::packMessage(LLMessageSystem* msg) const void LLInventoryCategory::packMessage(LLMessageSystem* msg) const

View File

@@ -90,16 +90,12 @@ public:
// in place correction for inventory name string // in place correction for inventory name string
static void correctInventoryName(std::string& name); static void correctInventoryName(std::string& name);
// [/RLVa:KB] // [/RLVa:KB]
private:
// // in place correction for inventory name string
// void correctInventoryName(std::string& name);
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// File Support // File Support
// Implemented here so that a minimal information set can be transmitted // Implemented here so that a minimal information set can be transmitted
// between simulator and viewer. // between simulator and viewer.
//-------------------------------------------------------------------- //--------------------------------------------------------------------
public:
// virtual BOOL importFile(LLFILE* fp); // virtual BOOL importFile(LLFILE* fp);
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const; virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
virtual BOOL importLegacyStream(std::istream& input_stream); virtual BOOL importLegacyStream(std::istream& input_stream);
@@ -262,6 +258,7 @@ public:
void setPreferredType(LLFolderType::EType type); void setPreferredType(LLFolderType::EType type);
LLSD asLLSD() const; LLSD asLLSD() const;
bool fromLLSD(const LLSD& sd); bool fromLLSD(const LLSD& sd);
bool isPreferredTypeRoot() const;
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// Messaging // Messaging

View File

@@ -1518,7 +1518,7 @@ BOOL LLAgent::getAFK() const
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLAgent::setDoNotDisturb(bool pIsDoNotDisturb) void LLAgent::setDoNotDisturb(bool pIsDoNotDisturb)
{ {
sendAnimationRequest(ANIM_AGENT_BUSY, pIsDoNotDisturb ? ANIM_REQUEST_START : ANIM_REQUEST_STOP); sendAnimationRequest(ANIM_AGENT_DO_NOT_DISTURB, pIsDoNotDisturb ? ANIM_REQUEST_START : ANIM_REQUEST_STOP);
mIsDoNotDisturb = pIsDoNotDisturb; mIsDoNotDisturb = pIsDoNotDisturb;
if (gBusyMenu) if (gBusyMenu)
{ {

View File

@@ -75,7 +75,7 @@ public:
virtual void move( LLFolderViewEventListener* parent_listener ) = 0; virtual void move( LLFolderViewEventListener* parent_listener ) = 0;
virtual BOOL isItemCopyable() const = 0; virtual BOOL isItemCopyable() const = 0;
virtual BOOL copyToClipboard() const = 0; virtual BOOL copyToClipboard() const = 0;
virtual void cutToClipboard() = 0; virtual BOOL cutToClipboard() = 0;
virtual BOOL isClipboardPasteable() const = 0; virtual BOOL isClipboardPasteable() const = 0;
virtual void pasteFromClipboard(bool only_copies = false) = 0; virtual void pasteFromClipboard(bool only_copies = false) = 0;
virtual void pasteLinkFromClipboard() = 0; virtual void pasteLinkFromClipboard() = 0;

View File

@@ -55,7 +55,7 @@
// MAX ITEMS is based on (sizeof(uuid)+2) * count must be < MTUBYTES // MAX ITEMS is based on (sizeof(uuid)+2) * count must be < MTUBYTES
// or 18 * count < 1200 => count < 1200/18 => 66. I've cut it down a // or 18 * count < 1200 => count < 1200/18 => 66. I've cut it down a
// bit from there to give some pad. // bit from there to give some pad.
const size_t MAX_ITEMS = 42; const size_t MAX_ITEMS = 50;
class LLGiveable : public LLInventoryCollectFunctor class LLGiveable : public LLInventoryCollectFunctor
{ {

View File

@@ -275,12 +275,14 @@ BOOL LLInvFVBridge::isLibraryItem() const
/** /**
* @brief Adds this item into clipboard storage * @brief Adds this item into clipboard storage
*/ */
void LLInvFVBridge::cutToClipboard() BOOL LLInvFVBridge::cutToClipboard()
{ {
if(isItemMovable()) if(isItemMovable())
{ {
LLInventoryClipboard::instance().cut(mUUID); LLInventoryClipboard::instance().cut(mUUID);
return true;
} }
return false;
} }
BOOL LLInvFVBridge::copyToClipboard() const BOOL LLInvFVBridge::copyToClipboard() const
@@ -1450,7 +1452,7 @@ bool LLInvFVBridge::canListOnMarketplaceNow() const
// +=================================================+ // +=================================================+
// | InventoryFVBridgeBuilder | // | InventoryFVBridgeBuilder |
// +=================================================+ // +=================================================+
LLInvFVBridge* LLInventoryFVBridgeBuilder::createBridge(LLAssetType::EType asset_type, LLInvFVBridge* LLInventoryFolderViewModelBuilder::createBridge(LLAssetType::EType asset_type,
LLAssetType::EType actual_asset_type, LLAssetType::EType actual_asset_type,
LLInventoryType::EType inv_type, LLInventoryType::EType inv_type,
LLInventoryPanel* inventory, LLInventoryPanel* inventory,
@@ -2490,6 +2492,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
} }
} }
} }
// if target is an outfit or current outfit folder we use link // if target is an outfit or current outfit folder we use link
if (move_is_into_current_outfit || move_is_into_outfit) if (move_is_into_current_outfit || move_is_into_outfit)
{ {
@@ -3278,18 +3281,18 @@ void LLFolderBridge::pasteFromClipboard(bool only_copies)
NULL); NULL);
} }
// [/SL:KB] // [/SL:KB]
else else
{ {
copy_inventory_item( copy_inventory_item(
gAgent.getID(), gAgent.getID(),
item->getPermissions().getOwner(), item->getPermissions().getOwner(),
item->getUUID(), item->getUUID(),
parent_id, parent_id,
std::string(), std::string(),
LLPointer<LLInventoryCallback>(NULL)); LLPointer<LLInventoryCallback>(NULL));
}
}
} }
}
}
} }
// Change mode to copy for next paste // Change mode to copy for next paste
LLInventoryClipboard::instance().setCutMode(false); LLInventoryClipboard::instance().setCutMode(false);
@@ -6796,7 +6799,7 @@ LLInvFVBridge* LLRecentInventoryBridgeBuilder::createBridge(
} }
else else
{ {
new_listener = LLInventoryFVBridgeBuilder::createBridge(asset_type, new_listener = LLInventoryFolderViewModelBuilder::createBridge(asset_type,
actual_asset_type, actual_asset_type,
inv_type, inv_type,
inventory, inventory,

View File

@@ -111,7 +111,7 @@ public:
virtual void move(LLFolderViewEventListener* new_parent_bridge) {} virtual void move(LLFolderViewEventListener* new_parent_bridge) {}
virtual BOOL isItemCopyable() const { return FALSE; } virtual BOOL isItemCopyable() const { return FALSE; }
virtual BOOL copyToClipboard() const; virtual BOOL copyToClipboard() const;
virtual void cutToClipboard(); virtual BOOL cutToClipboard();
virtual BOOL isClipboardPasteable() const; virtual BOOL isClipboardPasteable() const;
bool isClipboardPasteableAsCopy() const; bool isClipboardPasteableAsCopy() const;
virtual BOOL isClipboardPasteableAsLink() const; virtual BOOL isClipboardPasteableAsLink() const;
@@ -187,11 +187,11 @@ class AIFilePicker;
// This class intended to build Folder View Bridge via LLInvFVBridge::createBridge. // This class intended to build Folder View Bridge via LLInvFVBridge::createBridge.
// It can be overridden with another way of creation necessary Inventory-Folder-View-Bridge. // It can be overridden with another way of creation necessary Inventory-Folder-View-Bridge.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLInventoryFVBridgeBuilder class LLInventoryFolderViewModelBuilder
{ {
public: public:
LLInventoryFVBridgeBuilder() {} LLInventoryFolderViewModelBuilder() {}
virtual ~LLInventoryFVBridgeBuilder() {} virtual ~LLInventoryFolderViewModelBuilder() {}
virtual LLInvFVBridge* createBridge(LLAssetType::EType asset_type, virtual LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
LLAssetType::EType actual_asset_type, LLAssetType::EType actual_asset_type,
LLInventoryType::EType inv_type, LLInventoryType::EType inv_type,
@@ -631,7 +631,7 @@ public:
}; };
// Bridge builder to create Inventory-Folder-View-Bridge for Recent Inventory Panel // Bridge builder to create Inventory-Folder-View-Bridge for Recent Inventory Panel
class LLRecentInventoryBridgeBuilder : public LLInventoryFVBridgeBuilder class LLRecentInventoryBridgeBuilder : public LLInventoryFolderViewModelBuilder
{ {
public: public:
LLRecentInventoryBridgeBuilder() {} LLRecentInventoryBridgeBuilder() {}

View File

@@ -58,7 +58,7 @@ const std::string LLInventoryPanel::DEFAULT_SORT_ORDER = std::string("InventoryS
const std::string LLInventoryPanel::RECENTITEMS_SORT_ORDER = std::string("RecentItemsSortOrder"); const std::string LLInventoryPanel::RECENTITEMS_SORT_ORDER = std::string("RecentItemsSortOrder");
const std::string LLInventoryPanel::WORNITEMS_SORT_ORDER = std::string("WornItemsSortOrder"); const std::string LLInventoryPanel::WORNITEMS_SORT_ORDER = std::string("WornItemsSortOrder");
const std::string LLInventoryPanel::INHERIT_SORT_ORDER = std::string(""); const std::string LLInventoryPanel::INHERIT_SORT_ORDER = std::string("");
static const LLInventoryFVBridgeBuilder INVENTORY_BRIDGE_BUILDER; static const LLInventoryFolderViewModelBuilder INVENTORY_BRIDGE_BUILDER;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -52,7 +52,7 @@ class LLFolderViewItem;
class LLInventoryFilter; class LLInventoryFilter;
class LLInventoryModel; class LLInventoryModel;
class LLInvFVBridge; class LLInvFVBridge;
class LLInventoryFVBridgeBuilder; class LLInventoryFolderViewModelBuilder;
class LLMenuBarGL; class LLMenuBarGL;
class LLCheckBoxCtrl; class LLCheckBoxCtrl;
class LLSpinCtrl; class LLSpinCtrl;
@@ -172,13 +172,13 @@ protected:
LLPointer<LLFolderViewGroupedItemBridge> mGroupedItemBridge; LLPointer<LLFolderViewGroupedItemBridge> mGroupedItemBridge;
/** /**
* Pointer to LLInventoryFVBridgeBuilder. * Pointer to LLInventoryFolderViewModelBuilder.
* *
* It is set in LLInventoryPanel's constructor and can be overridden in derived classes with * It is set in LLInventoryPanel's constructor and can be overridden in derived classes with
* another implementation. * another implementation.
* Take into account it will not be deleted by LLInventoryPanel itself. * Take into account it will not be deleted by LLInventoryPanel itself.
*/ */
const LLInventoryFVBridgeBuilder* mInvFVBridgeBuilder; const LLInventoryFolderViewModelBuilder* mInvFVBridgeBuilder;
//-------------------------------------------------------------------- //--------------------------------------------------------------------

View File

@@ -130,7 +130,7 @@ public:
virtual void move(LLFolderViewEventListener* parent_listener); virtual void move(LLFolderViewEventListener* parent_listener);
virtual BOOL isItemCopyable() const; virtual BOOL isItemCopyable() const;
virtual BOOL copyToClipboard() const; virtual BOOL copyToClipboard() const;
virtual void cutToClipboard(); virtual BOOL cutToClipboard();
virtual BOOL isClipboardPasteable() const; virtual BOOL isClipboardPasteable() const;
virtual void pasteFromClipboard(bool only_copies = false); virtual void pasteFromClipboard(bool only_copies = false);
virtual void pasteLinkFromClipboard(); virtual void pasteLinkFromClipboard();
@@ -596,8 +596,9 @@ BOOL LLTaskInvFVBridge::copyToClipboard() const
return FALSE; return FALSE;
} }
void LLTaskInvFVBridge::cutToClipboard() BOOL LLTaskInvFVBridge::cutToClipboard()
{ {
return FALSE;
} }
BOOL LLTaskInvFVBridge::isClipboardPasteable() const BOOL LLTaskInvFVBridge::isClipboardPasteable() const

View File

@@ -1577,7 +1577,7 @@ void LLVOAvatar::initInstance(void)
if (LLCharacter::sInstances.size() == 1) if (LLCharacter::sInstances.size() == 1)
{ {
LLKeyframeMotion::setVFS(gStaticVFS); LLKeyframeMotion::setVFS(gStaticVFS);
registerMotion( ANIM_AGENT_BUSY, LLNullMotion::create ); registerMotion(ANIM_AGENT_DO_NOT_DISTURB, LLNullMotion::create );
registerMotion( ANIM_AGENT_CROUCH, LLKeyframeStandMotion::create ); registerMotion( ANIM_AGENT_CROUCH, LLKeyframeStandMotion::create );
registerMotion( ANIM_AGENT_CROUCHWALK, LLKeyframeWalkMotion::create ); registerMotion( ANIM_AGENT_CROUCHWALK, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_EXPRESS_AFRAID, LLEmote::create ); registerMotion( ANIM_AGENT_EXPRESS_AFRAID, LLEmote::create );
@@ -3583,7 +3583,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name)
bool fRlvShowNames = gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES); bool fRlvShowNames = gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES);
// [/RLVa:KB] // [/RLVa:KB]
bool is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY) != mSignaledAnimations.end(); bool is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY) != mSignaledAnimations.end();
bool is_busy = mSignaledAnimations.find(ANIM_AGENT_BUSY) != mSignaledAnimations.end(); bool is_busy = mSignaledAnimations.find(ANIM_AGENT_DO_NOT_DISTURB) != mSignaledAnimations.end();
bool is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end(); bool is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end();
bool is_muted; bool is_muted;
if (isSelf()) if (isSelf())
@@ -6030,10 +6030,10 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL
{ {
sitDown(FALSE); sitDown(FALSE);
} }
if ((anim_id == ANIM_AGENT_BUSY) && gAgent.isDoNotDisturb()) if ((anim_id == ANIM_AGENT_DO_NOT_DISTURB) && gAgent.isDoNotDisturb())
{ {
// re-assert DND tag animation // re-assert DND tag animation
gAgent.sendAnimationRequest(ANIM_AGENT_BUSY, ANIM_REQUEST_START); gAgent.sendAnimationRequest(ANIM_AGENT_DO_NOT_DISTURB, ANIM_REQUEST_START);
return result; return result;
} }
stopMotion(anim_id); stopMotion(anim_id);