diff options
author | Steven Bennetts <steve@lindenlab.com> | 2007-01-18 00:36:25 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2007-01-18 00:36:25 +0000 |
commit | 73f0b5029aa247a563862fc39152ce58baa407aa (patch) | |
tree | 656b4b9d02c3c81d184ebf2915fe8c073e9335e2 /indra/llcharacter | |
parent | 71d28bdbf0baab9302c8f458e3bdbcfc60d656d4 (diff) |
merge -r 56738:56842 maintenance.
Diffstat (limited to 'indra/llcharacter')
-rw-r--r-- | indra/llcharacter/llkeyframemotion.cpp | 44 | ||||
-rw-r--r-- | indra/llcharacter/llmultigesture.cpp | 20 |
2 files changed, 31 insertions, 33 deletions
diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index 930deb227c..dae85d3154 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -1169,14 +1169,11 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) //------------------------------------------------------------------------- // get emote (optional) //------------------------------------------------------------------------- - char read_string[128]; - if (!dp.unpackString(read_string, "emote_name")) + if (!dp.unpackString(mEmoteName, "emote_name")) { llwarns << "can't read optional_emote_animation" << llendl; return FALSE; } - - mEmoteName.assign( read_string ); //------------------------------------------------------------------------- // get loop @@ -1262,7 +1259,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) S32 k; for(U32 i=0; i<mJointMotionList->mNumJointMotions; ++i) { - if (!dp.unpackString(read_string, "joint_name")) + std::string joint_name; + if (!dp.unpackString(joint_name, "joint_name")) { llwarns << "can't read joint name" << llendl; return FALSE; @@ -1271,18 +1269,18 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) //--------------------------------------------------------------------- // find the corresponding joint //--------------------------------------------------------------------- - LLJoint *joint = mCharacter->getJoint( read_string ); + LLJoint *joint = mCharacter->getJoint( joint_name ); if (joint) { -// llinfos << " joint: " << read_string << llendl; +// llinfos << " joint: " << joint_name << llendl; } else { - llwarns << "joint not found: " << read_string << llendl; + llwarns << "joint not found: " << joint_name << llendl; //return FALSE; } - mJointMotionList->mJointMotionArray[i].mJointName = read_string; + mJointMotionList->mJointMotionArray[i].mJointName = joint_name; mJointStates[i].setJoint( joint ); mJointStates[i].setUsage( 0 ); @@ -1509,13 +1507,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) } constraintp->mConstraintType = (EConstraintType)byte; - if (!dp.unpackBinaryDataFixed((unsigned char*)read_string, 16, "source_volume")) + const S32 BIN_DATA_LENGTH = 16; + U8 bin_data[BIN_DATA_LENGTH]; + if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "source_volume")) { llwarns << "can't read source volume name" << llendl; return FALSE; } - - str.assign(read_string); + + bin_data[BIN_DATA_LENGTH-1] = 0; // Ensure null termination + str = (char*)bin_data; constraintp->mSourceConstraintVolume = mCharacter->getCollisionVolumeID(str); if (!dp.unpackVector3(constraintp->mSourceConstraintOffset, "source_offset")) @@ -1524,13 +1525,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) return FALSE; } - if (!dp.unpackBinaryDataFixed((unsigned char*)read_string, 16, "target_volume")) + if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "target_volume")) { llwarns << "can't read target volume name" << llendl; return FALSE; } - str.assign(read_string); + bin_data[BIN_DATA_LENGTH-1] = 0; // Ensure null termination + str = (char*)bin_data; if (str == "GROUND") { // constrain to ground @@ -1589,16 +1591,21 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) constraintp->mJointStateIndices = new S32[constraintp->mChainLength + 1]; LLJoint* joint = mCharacter->findCollisionVolume(constraintp->mSourceConstraintVolume); + // get joint to which this collision volume is attached if (!joint) { return FALSE; } - - // get joint to which this collision volume is attached - joint = joint->getParent(); - for (S32 i = 0; i < constraintp->mChainLength + 1; i++) { + LLJoint* parent = joint->getParent(); + if (!parent) + { + llwarns << "Joint with no parent: " << joint->getName() + << " Emote: " << mEmoteName << llendl; + return FALSE; + } + joint = parent; constraintp->mJointStateIndices[i] = -1; for (U32 j = 0; j < mJointMotionList->mNumJointMotions; j++) { @@ -1608,7 +1615,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) break; } } - joint = joint->getParent(); } } diff --git a/indra/llcharacter/llmultigesture.cpp b/indra/llcharacter/llmultigesture.cpp index 1e42352d74..accb4ae909 100644 --- a/indra/llcharacter/llmultigesture.cpp +++ b/indra/llcharacter/llmultigesture.cpp @@ -136,12 +136,10 @@ BOOL LLMultiGesture::deserialize(LLDataPacker& dp) dp.unpackU8(mKey, "key"); dp.unpackU32(mMask, "mask"); - char buffer[256]; /* Flawfinder: ignore */ - dp.unpackString(buffer, "trigger"); - mTrigger = buffer; + + dp.unpackString(mTrigger, "trigger"); - dp.unpackString(buffer, "replace"); - mReplaceText = buffer; + dp.unpackString(mReplaceText, "replace"); S32 count; dp.unpackS32(count, "step_count"); @@ -256,9 +254,7 @@ BOOL LLGestureStepAnimation::serialize(LLDataPacker& dp) const BOOL LLGestureStepAnimation::deserialize(LLDataPacker& dp) { - char buffer[256]; /* Flawfinder: ignore */ - dp.unpackString(buffer, "anim_name"); - mAnimName = buffer; + dp.unpackString(mAnimName, "anim_name"); // Apparently an earlier version of the gesture code added \r to the end // of the animation names. Get rid of it. JC @@ -333,9 +329,7 @@ BOOL LLGestureStepSound::serialize(LLDataPacker& dp) const BOOL LLGestureStepSound::deserialize(LLDataPacker& dp) { - char buffer[256]; /* Flawfinder: ignore */ - dp.unpackString(buffer, "sound_name"); - mSoundName = buffer; + dp.unpackString(mSoundName, "sound_name"); dp.unpackUUID(mSoundAssetID, "asset_id"); dp.unpackU32(mFlags, "flags"); @@ -391,9 +385,7 @@ BOOL LLGestureStepChat::serialize(LLDataPacker& dp) const BOOL LLGestureStepChat::deserialize(LLDataPacker& dp) { - char buffer[256]; /* Flawfinder: ignore */ - dp.unpackString(buffer, "chat_text"); - mChatText = buffer; + dp.unpackString(mChatText, "chat_text"); dp.unpackU32(mFlags, "flags"); return TRUE; |