From cb3bd8865aa0f9fb8a247ea595cf1973057ba91f Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 30 May 2024 15:41:36 +0200 Subject: Fix a bunch of uninitialized variable warnings that showed up in Visual Studio --- indra/llappearance/llavatarappearance.cpp | 14 +----- indra/llappearance/llavatarappearance.h | 72 +++++++++++++++---------------- indra/llappearance/lldriverparam.h | 6 +-- 3 files changed, 40 insertions(+), 52 deletions(-) (limited to 'indra/llappearance') diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index f06845f084..743c1745d0 100644 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -164,19 +164,7 @@ LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary* LLAvatarAppearance::sAv LLAvatarAppearance::LLAvatarAppearance(LLWearableData* wearable_data) : LLCharacter(), - mIsDummy(false), - mTexSkinColor( NULL ), - mTexHairColor( NULL ), - mTexEyeColor( NULL ), - mPelvisToFoot(0.f), - mHeadOffset(), - mRoot(NULL), - mWearableData(wearable_data), - mNumBones(0), - mNumCollisionVolumes(0), - mCollisionVolumes(NULL), - mIsBuilt(false), - mInitFlags(0) + mWearableData(wearable_data) { llassert_always(mWearableData); mBakedTextureDatas.resize(LLAvatarAppearanceDefines::BAKED_NUM_INDICES); diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h index c2188d8ac9..1f33ae290e 100644 --- a/indra/llappearance/llavatarappearance.h +++ b/indra/llappearance/llavatarappearance.h @@ -70,7 +70,7 @@ public: static void initClass(); static void cleanupClass(); // Cleanup data that's only init'd once per class. virtual void initInstance(); // Called after construction to initialize the instance. - S32 mInitFlags; + S32 mInitFlags{ 0 }; virtual bool loadSkeletonNode(); bool loadMeshNodes(); bool loadLayersets(); @@ -135,8 +135,8 @@ public: F32 getPelvisToFoot() const { return mPelvisToFoot; } /*virtual*/ LLJoint* getRootJoint() { return mRoot; } - LLVector3 mHeadOffset; // current head position - LLAvatarJoint *mRoot; + LLVector3 mHeadOffset{}; // current head position + LLAvatarJoint* mRoot{ nullptr }; typedef std::map joint_map_t; joint_map_t mJointMap; @@ -167,7 +167,7 @@ protected: bool buildSkeleton(const LLAvatarSkeletonInfo *info); void clearSkeleton(); - bool mIsBuilt; // state of deferred character building + bool mIsBuilt{ false }; // state of deferred character building avatar_joint_list_t mSkeleton; LLVector3OverrideMap mPelvisFixups; joint_alias_map_t mJointAliasMap; @@ -184,30 +184,30 @@ public: LLVector3 mBodySize; LLVector3 mAvatarOffset; protected: - F32 mPelvisToFoot; + F32 mPelvisToFoot{ 0.f }; //-------------------------------------------------------------------- // Cached pointers to well known joints //-------------------------------------------------------------------- public: - LLJoint* mPelvisp; - LLJoint* mTorsop; - LLJoint* mChestp; - LLJoint* mNeckp; - LLJoint* mHeadp; - LLJoint* mSkullp; - LLJoint* mEyeLeftp; - LLJoint* mEyeRightp; - LLJoint* mHipLeftp; - LLJoint* mHipRightp; - LLJoint* mKneeLeftp; - LLJoint* mKneeRightp; - LLJoint* mAnkleLeftp; - LLJoint* mAnkleRightp; - LLJoint* mFootLeftp; - LLJoint* mFootRightp; - LLJoint* mWristLeftp; - LLJoint* mWristRightp; + LLJoint* mPelvisp{nullptr}; + LLJoint* mTorsop{ nullptr }; + LLJoint* mChestp{ nullptr }; + LLJoint* mNeckp{ nullptr }; + LLJoint* mHeadp{ nullptr }; + LLJoint* mSkullp{ nullptr }; + LLJoint* mEyeLeftp{ nullptr }; + LLJoint* mEyeRightp{ nullptr }; + LLJoint* mHipLeftp{ nullptr }; + LLJoint* mHipRightp{ nullptr }; + LLJoint* mKneeLeftp{ nullptr }; + LLJoint* mKneeRightp{ nullptr }; + LLJoint* mAnkleLeftp{ nullptr }; + LLJoint* mAnkleRightp{ nullptr }; + LLJoint* mFootLeftp{ nullptr }; + LLJoint* mFootRightp{ nullptr }; + LLJoint* mWristLeftp{ nullptr }; + LLJoint* mWristRightp{ nullptr }; //-------------------------------------------------------------------- // XML parse tree @@ -227,7 +227,7 @@ protected: ** RENDERING **/ public: - bool mIsDummy; // for special views and animated object controllers; local to viewer + bool mIsDummy{ false }; // for special views and animated object controllers; local to viewer //-------------------------------------------------------------------- // Morph masks @@ -290,9 +290,9 @@ public: LLColor4 getGlobalColor(const std::string& color_name ) const; virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color) = 0; protected: - LLTexGlobalColor* mTexSkinColor; - LLTexGlobalColor* mTexHairColor; - LLTexGlobalColor* mTexEyeColor; + LLTexGlobalColor* mTexSkinColor{ nullptr }; + LLTexGlobalColor* mTexHairColor{ nullptr }; + LLTexGlobalColor* mTexEyeColor{ nullptr }; //-------------------------------------------------------------------- // Visibility @@ -315,7 +315,7 @@ public: virtual bool isWearingWearableType(LLWearableType::EType type ) const; private: - LLWearableData* mWearableData; + LLWearableData* mWearableData{ nullptr }; /******************************************************************************** ** ** @@ -333,11 +333,11 @@ protected: struct BakedTextureData { LLUUID mLastTextureID; - LLTexLayerSet* mTexLayerSet; // Only exists for self - bool mIsLoaded; - bool mIsUsed; - LLAvatarAppearanceDefines::ETextureIndex mTextureIndex; - U32 mMaskTexName; + LLTexLayerSet* mTexLayerSet{ nullptr }; // Only exists for self + bool mIsLoaded{ false }; + bool mIsUsed{ false }; + LLAvatarAppearanceDefines::ETextureIndex mTextureIndex{ LLAvatarAppearanceDefines::ETextureIndex::TEX_INVALID }; + U32 mMaskTexName{ 0 }; // Stores pointers to the joint meshes that this baked texture deals with avatar_joint_mesh_list_t mJointMeshes; morph_list_t mMaskedMorphs; @@ -354,9 +354,9 @@ protected: // Collision volumes //-------------------------------------------------------------------- public: - S32 mNumBones; - S32 mNumCollisionVolumes; - LLAvatarJointCollisionVolume* mCollisionVolumes; + S32 mNumBones{ 0 }; + S32 mNumCollisionVolumes{ 0 }; + LLAvatarJointCollisionVolume* mCollisionVolumes{ nullptr }; protected: bool allocateCollisionVolumes(U32 num); diff --git a/indra/llappearance/lldriverparam.h b/indra/llappearance/lldriverparam.h index b7eac80603..59092988dd 100644 --- a/indra/llappearance/lldriverparam.h +++ b/indra/llappearance/lldriverparam.h @@ -130,10 +130,10 @@ protected: LL_ALIGN_16(LLVector4a mDefaultVec); // temp holder entry_list_t mDriven; - LLViewerVisualParam* mCurrentDistortionParam; + LLViewerVisualParam* mCurrentDistortionParam{ nullptr }; // Backlink only; don't make this an LLPointer. - LLAvatarAppearance* mAvatarAppearance; - LLWearable* mWearablep; + LLAvatarAppearance* mAvatarAppearance{ nullptr }; + LLWearable* mWearablep{ nullptr }; }; #endif // LL_LLDRIVERPARAM_H -- cgit v1.2.3 From b42f9d836b4c0f7fbd4bdae1734021e2a09fdbe8 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 1 Jun 2024 15:49:26 +0200 Subject: Re-enable a lot of compiler warnings for MSVC and address the C4267 "possible loss of precision" warnings --- indra/llappearance/lldriverparam.cpp | 2 +- indra/llappearance/lllocaltextureobject.cpp | 2 +- indra/llappearance/llpolymorph.cpp | 4 ++-- indra/llappearance/llwearable.cpp | 2 +- indra/llappearance/llwearabledata.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/llappearance') diff --git a/indra/llappearance/lldriverparam.cpp b/indra/llappearance/lldriverparam.cpp index 29815d22f7..2e933f9357 100644 --- a/indra/llappearance/lldriverparam.cpp +++ b/indra/llappearance/lldriverparam.cpp @@ -422,7 +422,7 @@ const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **po S32 LLDriverParam::getDrivenParamsCount() const { - return mDriven.size(); + return static_cast(mDriven.size()); } const LLViewerVisualParam* LLDriverParam::getDrivenParam(S32 index) const diff --git a/indra/llappearance/lllocaltextureobject.cpp b/indra/llappearance/lllocaltextureobject.cpp index 9707f002ee..f743f7b517 100644 --- a/indra/llappearance/lllocaltextureobject.cpp +++ b/indra/llappearance/lllocaltextureobject.cpp @@ -109,7 +109,7 @@ LLTexLayer* LLLocalTextureObject::getTexLayer(const std::string &name) U32 LLLocalTextureObject::getNumTexLayers() const { - return mTexLayers.size(); + return static_cast(mTexLayers.size()); } LLUUID LLLocalTextureObject::getID() const diff --git a/indra/llappearance/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp index d8109d79c2..068be84441 100644 --- a/indra/llappearance/llpolymorph.cpp +++ b/indra/llappearance/llpolymorph.cpp @@ -107,7 +107,7 @@ LLPolyMorphData::~LLPolyMorphData() bool LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) { S32 numVertices; - S32 numRead; + size_t numRead; numRead = fread(&numVertices, sizeof(S32), 1, fp); llendianswizzle(&numVertices, sizeof(S32), 1); @@ -384,7 +384,7 @@ bool LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info) if (!mMorphData) { const std::string driven_tag = "_Driven"; - U32 pos = morph_param_name.find(driven_tag); + auto pos = morph_param_name.find(driven_tag); if (pos > 0) { morph_param_name = morph_param_name.substr(0,pos); diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index 9c41e3c256..a7e5292fed 100644 --- a/indra/llappearance/llwearable.cpp +++ b/indra/llappearance/llwearable.cpp @@ -744,7 +744,7 @@ void LLWearable::writeToAvatar(LLAvatarAppearance* avatarp) std::string terse_F32_to_string(F32 f) { std::string r = llformat("%.2f", f); - S32 len = r.length(); + auto len = r.length(); // "1.20" -> "1.2" // "24.00" -> "24." diff --git a/indra/llappearance/llwearabledata.cpp b/indra/llappearance/llwearabledata.cpp index a58138c434..7598ed67f3 100644 --- a/indra/llappearance/llwearabledata.cpp +++ b/indra/llappearance/llwearabledata.cpp @@ -334,7 +334,7 @@ U32 LLWearableData::getWearableCount(const LLWearableType::EType type) const return 0; } const wearableentry_vec_t& wearable_vec = wearable_iter->second; - return wearable_vec.size(); + return static_cast(wearable_vec.size()); } U32 LLWearableData::getWearableCount(const U32 tex_index) const -- cgit v1.2.3