diff --git a/autobuild.xml b/autobuild.xml index 58263ed6aa..359fe19af1 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1678,6 +1678,14 @@ llphysicsextensions_source + copyright + Copyright (c) 2010, Linden Research, Inc. + license + internal + license_file + LICENSES/llphysicsextensions.txt + name + llphysicsextensions_source platforms darwin64 @@ -1687,11 +1695,11 @@ creds github hash - b037cc0b29ea70ee834cfae6dda5b7a25cd57174 + 24256fab0ccf6c0f70dcb536240e7e556f592ebe hash_algorithm sha1 url - https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/144851460 + https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/171617692 name darwin64 @@ -1703,11 +1711,11 @@ creds github hash - bdea1fd5c4da9da5afde088d16188b45d0853e04 + 7d218e641c66a63bb6722b4605d6bcbf78c51c85 hash_algorithm sha1 url - https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/144851461 + https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/171617691 name linux64 @@ -1719,26 +1727,18 @@ creds github hash - f652ce0d6aef864689f0ed44255da4d9cd65a43f + 56b94c0d0f0b2f221fd13648e99e9569b0490d76 hash_algorithm sha1 url - https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/144851463 + https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/171617694 name windows64 - license - internal - license_file - LICENSES/llphysicsextensions.txt - copyright - Copyright (c) 2010, Linden Research, Inc. version - 1.0.479d20a - name - llphysicsextensions_source + 1.0.b6dc588 llphysicsextensions_stub diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index ea5124b3f3..c400faa293 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 431950c25a..434b9a4c2e 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(); @@ -137,8 +137,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 }; // This map gets queried a huge amount of time. // typedef std::map joint_map_t; @@ -178,7 +178,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; @@ -195,30 +195,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 @@ -242,7 +242,7 @@ public: ** 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 @@ -313,9 +313,9 @@ public: virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color, bool upload_bake) = 0; // [Legacy Bake] protected: - LLTexGlobalColor* mTexSkinColor; - LLTexGlobalColor* mTexHairColor; - LLTexGlobalColor* mTexEyeColor; + LLTexGlobalColor* mTexSkinColor{ nullptr }; + LLTexGlobalColor* mTexHairColor{ nullptr }; + LLTexGlobalColor* mTexEyeColor{ nullptr }; //-------------------------------------------------------------------- // Visibility @@ -338,7 +338,7 @@ public: virtual bool isWearingWearableType(LLWearableType::EType type ) const; private: - LLWearableData* mWearableData; + LLWearableData* mWearableData{ nullptr }; /******************************************************************************** ** ** @@ -356,11 +356,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; @@ -377,9 +377,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.cpp b/indra/llappearance/lldriverparam.cpp index 01e0dbbdd0..2c21b9ee4b 100644 --- a/indra/llappearance/lldriverparam.cpp +++ b/indra/llappearance/lldriverparam.cpp @@ -435,7 +435,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/lldriverparam.h b/indra/llappearance/lldriverparam.h index af3169ae3d..7b0061cb0d 100644 --- a/indra/llappearance/lldriverparam.h +++ b/indra/llappearance/lldriverparam.h @@ -138,10 +138,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 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 77d3575f55..71469689e1 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); @@ -386,8 +386,8 @@ bool LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info) if (!mMorphData) { const std::string driven_tag = "_Driven"; - U32 pos = morph_param_name.find(driven_tag); - if (pos > 0) + auto pos = morph_param_name.find(driven_tag); + if (pos != std::string::npos) { morph_param_name = morph_param_name.substr(0,pos); mMorphData = mMesh->getMorphData(morph_param_name); diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index 472e14133f..13bfee31c2 100644 --- a/indra/llappearance/llwearable.cpp +++ b/indra/llappearance/llwearable.cpp @@ -763,7 +763,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 2ac5c87c0e..1aca01ae3c 100644 --- a/indra/llappearance/llwearabledata.cpp +++ b/indra/llappearance/llwearabledata.cpp @@ -346,7 +346,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 diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index fc1ae2a7f0..2b003b6aa8 100644 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -422,7 +422,7 @@ bool LLVorbisDecodeState::finishDecode() ov_clear(&mVF); // write "data" chunk length, in little-endian format - S32 data_length = mWAVBuffer.size() - WAV_HEADER_SIZE; + S32 data_length = static_cast(mWAVBuffer.size()) - WAV_HEADER_SIZE; mWAVBuffer[40] = (data_length) & 0x000000FF; mWAVBuffer[41] = (data_length >> 8) & 0x000000FF; mWAVBuffer[42] = (data_length >> 16) & 0x000000FF; @@ -463,7 +463,7 @@ bool LLVorbisDecodeState::finishDecode() { memcpy(&mWAVBuffer[WAV_HEADER_SIZE], pcmout, (2 * fade_length)); /*Flawfinder: ignore*/ } - S32 near_end = mWAVBuffer.size() - (2 * fade_length); + S32 near_end = static_cast(mWAVBuffer.size()) - (2 * fade_length); if ((S32)mWAVBuffer.size() >= ( near_end + 2* fade_length)) { memcpy(pcmout, &mWAVBuffer[near_end], (2 * fade_length)); /*Flawfinder: ignore*/ @@ -491,7 +491,7 @@ bool LLVorbisDecodeState::finishDecode() return true; // we've finished } mBytesRead = -1; - mFileHandle = LLLFSThread::sLocal->write(mOutFilename, &mWAVBuffer[0], 0, mWAVBuffer.size(), + mFileHandle = LLLFSThread::sLocal->write(mOutFilename, &mWAVBuffer[0], 0, static_cast(mWAVBuffer.size()), new WriteResponder(this)); } diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 350d74dc6a..bc27a1e5f1 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -73,8 +73,8 @@ LLCharacter::~LLCharacter() delete param; } - U32 i ; - U32 size = sInstances.size() ; + size_t i ; + size_t size = sInstances.size() ; for(i = 0 ; i < size ; i++) { if(sInstances[i] == this) diff --git a/indra/llcharacter/llgesture.cpp b/indra/llcharacter/llgesture.cpp index 151bac7920..b69462ce28 100644 --- a/indra/llcharacter/llgesture.cpp +++ b/indra/llcharacter/llgesture.cpp @@ -282,7 +282,7 @@ bool LLGestureList::trigger(KEY key, MASK mask) U8 *LLGestureList::serialize(U8 *buffer) const { // a single S32 serves as the header that tells us how many to read - U32 count = mList.size(); + auto count = mList.size(); htolememcpy(buffer, &count, MVT_S32, 4); buffer += sizeof(count); diff --git a/indra/llcharacter/llgesture.h b/indra/llcharacter/llgesture.h index f1b83a4b50..f8504d06d2 100644 --- a/indra/llcharacter/llgesture.h +++ b/indra/llcharacter/llgesture.h @@ -90,7 +90,7 @@ public: bool triggerAndReviseString(const std::string &string, std::string* revised_string); // Used for construction from UI - S32 count() const { return mList.size(); } + S32 count() const { return static_cast(mList.size()); } virtual LLGesture* get(S32 i) const { return mList.at(i); } virtual void put(LLGesture* gesture) { mList.push_back( gesture ); } void deleteAll(); diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index a94406696a..b63101aa07 100644 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -47,7 +47,7 @@ JointKey JointKey::construct(const std::string& aName) return { aName, itr->second }; } - U32 size = mpStringToKeys.size() + 1; + U32 size = static_cast(mpStringToKeys.size()) + 1; mpStringToKeys.try_emplace(aName, size); return { aName, size }; } @@ -94,7 +94,7 @@ void LLVector3OverrideMap::showJointVector3Overrides( std::ostringstream& os ) c U32 LLVector3OverrideMap::count() const { - return m_map.size(); + return static_cast(m_map.size()); } void LLVector3OverrideMap::add(const LLUUID& mesh_id, const LLVector3& pos) @@ -104,7 +104,7 @@ void LLVector3OverrideMap::add(const LLUUID& mesh_id, const LLVector3& pos) bool LLVector3OverrideMap::remove(const LLUUID& mesh_id) { - U32 remove_count = m_map.erase(mesh_id); + auto remove_count = m_map.erase(mesh_id); return (remove_count > 0); } diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index 53ab3968ee..e0f436a6cd 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -432,9 +432,9 @@ void LLKeyframeMotion::JointMotion::update(LLJointState* joint_state, F32 time, //----------------------------------------------------------------------------- LLKeyframeMotion::LLKeyframeMotion(const LLUUID &id) : LLMotion(id), - mJointMotionList(NULL), - mPelvisp(NULL), - mCharacter(NULL), // Uninitialized pointer fix by Drake Arconis + mJointMotionList(nullptr), + mPelvisp(nullptr), + mCharacter(nullptr), mLastSkeletonSerialNum(0), mLastUpdateTime(0.f), mLastLoopedTime(0.f), @@ -2082,7 +2082,7 @@ bool LLKeyframeMotion::serialize(LLDataPacker& dp) const JointMotion* joint_motionp = mJointMotionList->getJointMotion(i); success &= dp.packString(joint_motionp->mJointName, "joint_name"); success &= dp.packS32(joint_motionp->mPriority, "joint_priority"); - success &= dp.packS32(joint_motionp->mRotationCurve.mKeys.size(), "num_rot_keys"); + success &= dp.packS32(static_cast(joint_motionp->mRotationCurve.mKeys.size()), "num_rot_keys"); LL_DEBUGS("BVH") << "Joint " << i << " name: " << joint_motionp->mJointName @@ -2108,7 +2108,7 @@ bool LLKeyframeMotion::serialize(LLDataPacker& dp) const LL_DEBUGS("BVH") << " rot: t " << rot_key.mTime << " angles " << rot_angles.mV[VX] <<","<< rot_angles.mV[VY] <<","<< rot_angles.mV[VZ] << LL_ENDL; } - success &= dp.packS32(joint_motionp->mPositionCurve.mKeys.size(), "num_pos_keys"); + success &= dp.packS32(static_cast(joint_motionp->mPositionCurve.mKeys.size()), "num_pos_keys"); for (PositionCurve::key_map_t::value_type& pos_pair : joint_motionp->mPositionCurve.mKeys) { PositionKey& pos_key = pos_pair.second; @@ -2128,7 +2128,7 @@ bool LLKeyframeMotion::serialize(LLDataPacker& dp) const } } - success &= dp.packS32(mJointMotionList->mConstraints.size(), "num_constraints"); + success &= dp.packS32(static_cast(mJointMotionList->mConstraints.size()), "num_constraints"); LL_DEBUGS("BVH") << "num_constraints " << mJointMotionList->mConstraints.size() << LL_ENDL; for (JointConstraintSharedData* shared_constraintp : mJointMotionList->mConstraints) { diff --git a/indra/llcharacter/llkeyframemotion.h b/indra/llcharacter/llkeyframemotion.h index edf2308050..d5b27c8102 100644 --- a/indra/llcharacter/llkeyframemotion.h +++ b/indra/llcharacter/llkeyframemotion.h @@ -420,7 +420,7 @@ public: ~JointMotionList(); U32 dumpDiagInfo(); JointMotion* getJointMotion(U32 index) const { llassert(index < mJointMotionArray.size()); return mJointMotionArray[index]; } - U32 getNumJointMotions() const { return mJointMotionArray.size(); } + U32 getNumJointMotions() const { return static_cast(mJointMotionArray.size()); } }; protected: diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index 98e0f70fb2..7b1e8384ce 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -157,11 +157,11 @@ LLMotionController::~LLMotionController() void LLMotionController::incMotionCounts(S32& num_motions, S32& num_loading_motions, S32& num_loaded_motions, S32& num_active_motions, S32& num_deprecated_motions) { - num_motions += mAllMotions.size(); - num_loading_motions += mLoadingMotions.size(); - num_loaded_motions += mLoadedMotions.size(); - num_active_motions += mActiveMotions.size(); - num_deprecated_motions += mDeprecatedMotions.size(); + num_motions += static_cast(mAllMotions.size()); + num_loading_motions += static_cast(mLoadingMotions.size()); + num_loaded_motions += static_cast(mLoadedMotions.size()); + num_active_motions += static_cast(mActiveMotions.size()); + num_deprecated_motions += static_cast(mDeprecatedMotions.size()); } //----------------------------------------------------------------------------- @@ -223,7 +223,7 @@ void LLMotionController::purgeExcessMotions() } // clean up all inactive, loaded motions - for (LLUUID motion_id : motions_to_kill) + for (const LLUUID& motion_id : motions_to_kill) { // look up the motion again by ID to get canonical instance // and kill it only if that one is inactive @@ -234,7 +234,7 @@ void LLMotionController::purgeExcessMotions() } } - U32 loaded_count = mLoadedMotions.size(); + U32 loaded_count = static_cast(mLoadedMotions.size()); // Can't do anything about it anyway - stop spamming the log //if (loaded_count > (2 * MAX_MOTION_INSTANCES) && loaded_count > mLastCountAfterPurge) //{ diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index 64f9b1629f..bd17b12bd2 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -199,9 +199,9 @@ bool LLApp::parseCommandOptions(int argc, char** argv) #if LL_WINDOWS //Windows changed command line parsing. Deal with it. - S32 slen = value.length() - 1; - S32 start = 0; - S32 end = slen; + size_t slen = value.length() - 1; + size_t start = 0; + size_t end = slen; if (argv[ii][start]=='"')start++; if (argv[ii][end]=='"')end--; if (start!=0 || end!=slen) @@ -264,9 +264,9 @@ bool LLApp::parseCommandOptions(int argc, wchar_t** wargv) #if LL_WINDOWS //Windows changed command line parsing. Deal with it. - S32 slen = value.length() - 1; - S32 start = 0; - S32 end = slen; + size_t slen = value.length() - 1; + size_t start = 0; + size_t end = slen; if (wargv[ii][start]=='"')start++; if (wargv[ii][end]=='"')end--; if (start!=0 || end!=slen) diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 729d4aca28..827331e328 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -221,7 +221,7 @@ private: private: U64 mStartTime; - BlockTimerStackRecord mParentTimerData; + BlockTimerStackRecord mParentTimerData{}; public: // statics diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 510746bfe9..2baf806048 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -389,7 +389,7 @@ const char *LLFile::tmpdir() sep = '\\'; std::vector utf16path(MAX_PATH + 1); - GetTempPathW(utf16path.size(), &utf16path[0]); + GetTempPathW(static_cast(utf16path.size()), &utf16path[0]); utf8path = ll_convert_wide_to_string(&utf16path[0]); #else sep = '/'; diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index 08a008c19a..2564671b13 100644 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -97,7 +97,7 @@ public: // no copy LLUniqueFile(const LLUniqueFile&) = delete; // move construction - LLUniqueFile(LLUniqueFile&& other) + LLUniqueFile(LLUniqueFile&& other) noexcept { mFileHandle = other.mFileHandle; other.mFileHandle = nullptr; @@ -118,7 +118,7 @@ public: // copy assignment deleted LLUniqueFile& operator=(const LLUniqueFile&) = delete; // move assignment - LLUniqueFile& operator=(LLUniqueFile&& other) + LLUniqueFile& operator=(LLUniqueFile&& other) noexcept { close(); std::swap(mFileHandle, other.mFileHandle); diff --git a/indra/llcommon/llindexedvector.h b/indra/llcommon/llindexedvector.h index de3ae0dcc4..0b2e9c76ca 100644 --- a/indra/llcommon/llindexedvector.h +++ b/indra/llcommon/llindexedvector.h @@ -47,7 +47,7 @@ public: typedef typename std::vector::size_type size_type; protected: std::vector mVector; - std::map mIndexMap; + std::map mIndexMap; public: LLIndexedVector() { mVector.reserve(BlockSize); } @@ -68,10 +68,10 @@ public: Type& operator[](const Key& k) { - typename std::map::const_iterator iter = mIndexMap.find(k); + typename std::map::const_iterator iter = mIndexMap.find(k); if (iter == mIndexMap.end()) { - U32 n = mVector.size(); + auto n = mVector.size(); mIndexMap[k] = n; mVector.push_back(Type()); llassert(mVector.size() == mIndexMap.size()); @@ -85,7 +85,7 @@ public: const_iterator find(const Key& k) const { - typename std::map::const_iterator iter = mIndexMap.find(k); + typename std::map::const_iterator iter = mIndexMap.find(k); if(iter == mIndexMap.end()) { return mVector.end(); diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index d71a5cac14..16ca7c3689 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -138,24 +138,6 @@ // Deal with VC6 problems #if LL_MSVC -#pragma warning( 3 : 4701 ) // "local variable used without being initialized" Treat this as level 3, not level 4. -#pragma warning( 3 : 4702 ) // "unreachable code" Treat this as level 3, not level 4. -#pragma warning( 3 : 4189 ) // "local variable initialized but not referenced" Treat this as level 3, not level 4. -//#pragma warning( 3 : 4018 ) // "signed/unsigned mismatch" Treat this as level 3, not level 4. -#pragma warning( 3 : 4263 ) // 'function' : member function does not override any base class virtual member function -#pragma warning( 3 : 4264 ) // "'virtual_function' : no override available for virtual member function from base 'class'; function is hidden" -#pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual" -#pragma warning( 3 : 4266 ) // 'function' : no override available for virtual member function from base 'type'; function is hidden -#pragma warning (disable : 4180) // qualifier applied to function type has no meaning; ignored -//#pragma warning( disable : 4284 ) // silly MS warning deep inside their include file - -#if ADDRESS_SIZE == 64 -// That one is all over the place for x64 builds. -#pragma warning( disable : 4267 ) // 'var' : conversion from 'size_t' to 'type', possible loss of data) -#endif - -#pragma warning( disable : 4503 ) // 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation. -#pragma warning( disable : 4800 ) // 'BOOL' : forcing value to bool 'true' or 'false' (performance warning) #pragma warning( disable : 4996 ) // warning: deprecated // Linker optimization with "extern template" generates these warnings diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index 39e8113587..7d77f6f6a9 100644 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -210,7 +210,7 @@ void LLQueuedThread::waitOnPending() // MAIN thread void LLQueuedThread::printQueueStats() { - U32 size = mRequestQueue.size(); + auto size = mRequestQueue.size(); if (size > 0) { LL_INFOS() << llformat("Pending Requests:%d ", mRequestQueue.size()) << LL_ENDL; diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 64a0c76bf9..af688c26fa 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -1547,7 +1547,7 @@ S32 LLSDBinaryFormatter::format_impl(const LLSD& data, std::ostream& ostr, case LLSD::TypeMap: { ostr.put('{'); - U32 size_nbo = htonl(data.size()); + U32 size_nbo = htonl(static_cast(data.size())); ostr.write((const char*)(&size_nbo), sizeof(U32)); LLSD::map_const_iterator iter = data.beginMap(); LLSD::map_const_iterator end = data.endMap(); @@ -1564,7 +1564,7 @@ S32 LLSDBinaryFormatter::format_impl(const LLSD& data, std::ostream& ostr, case LLSD::TypeArray: { ostr.put('['); - U32 size_nbo = htonl(data.size()); + U32 size_nbo = htonl(static_cast(data.size())); ostr.write((const char*)(&size_nbo), sizeof(U32)); LLSD::array_const_iterator iter = data.beginArray(); LLSD::array_const_iterator end = data.endArray(); @@ -1631,7 +1631,7 @@ S32 LLSDBinaryFormatter::format_impl(const LLSD& data, std::ostream& ostr, { ostr.put('b'); const std::vector& buffer = data.asBinary(); - U32 size_nbo = htonl(buffer.size()); + U32 size_nbo = htonl(static_cast(buffer.size())); ostr.write((const char*)(&size_nbo), sizeof(U32)); if(buffer.size()) ostr.write((const char*)&buffer[0], buffer.size()); break; @@ -1649,7 +1649,7 @@ void LLSDBinaryFormatter::formatString( const std::string& string, std::ostream& ostr) const { - U32 size_nbo = htonl(string.size()); + U32 size_nbo = htonl(static_cast(string.size())); ostr.write((const char*)(&size_nbo), sizeof(U32)); ostr.write(string.c_str(), string.size()); } diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 22fa2a6f4b..3810b49b08 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -569,6 +569,7 @@ public: classname(), " -- creating new instance"}); // fall through + [[fallthrough]]; case UNINITIALIZED: case QUEUED: // QUEUED means some secondary thread has already requested an diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h index 52bebf82e3..5730ce6ff2 100644 --- a/indra/llcommon/llstl.h +++ b/indra/llcommon/llstl.h @@ -301,7 +301,7 @@ inline bool vector_replace_with_last(std::vector& invec, const T& val) template inline T* vector_append(std::vector& invec, S32 N) { - U32 sz = invec.size(); + auto sz = invec.size(); invec.resize(sz+N); return &(invec[sz]); } diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 4841174b10..1200da23e5 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -565,7 +565,7 @@ std::string utf8str_truncate(const std::string& utf8str, const S32 max_len) } // [RLVa:KB] - Checked: RLVa-2.1.0 -std::string utf8str_substr(const std::string& utf8str, const S32 index, const S32 max_len) +std::string utf8str_substr(const std::string& utf8str, const size_t index, const size_t max_len) { if (0 == max_len) { @@ -577,7 +577,7 @@ std::string utf8str_substr(const std::string& utf8str, const S32 index, const S3 } else { - S32 cur_char = max_len; + size_t cur_char = max_len; // If we're ASCII, we don't need to do anything if ((U8)utf8str[index + cur_char] > 0x7f) @@ -881,7 +881,7 @@ std::string ll_convert_wide_to_string(const wchar_t* in, size_t len_in, unsigned code_page, 0, in, - len_in, + static_cast(len_in), NULL, 0, 0, @@ -896,7 +896,7 @@ std::string ll_convert_wide_to_string(const wchar_t* in, size_t len_in, unsigned code_page, 0, in, - len_in, + static_cast(len_in), pout, len_out, 0, @@ -923,8 +923,8 @@ std::wstring ll_convert_string_to_wide(const char* in, size_t len, unsigned int std::vector w_out(len + 1); memset(&w_out[0], 0, w_out.size()); - int real_output_str_len = MultiByteToWideChar(code_page, 0, in, len, - &w_out[0], w_out.size() - 1); + int real_output_str_len = MultiByteToWideChar(code_page, 0, in, static_cast(len), + &w_out[0], static_cast(w_out.size() - 1)); //looks like MultiByteToWideChar didn't add null terminator to converted string, see EXT-4858. w_out[real_output_str_len] = 0; @@ -1015,7 +1015,7 @@ std::optional llstring_getoptenv(const std::string& key) auto wkey = ll_convert_string_to_wide(key); // Take a wild guess as to how big the buffer should be. std::vector buffer(1024); - auto n = GetEnvironmentVariableW(wkey.c_str(), &buffer[0], buffer.size()); + auto n = GetEnvironmentVariableW(wkey.c_str(), &buffer[0], static_cast(buffer.size())); // If our initial guess was too short, n will indicate the size (in // wchar_t's) that buffer should have been, including the terminating nul. if (n > (buffer.size() - 1)) @@ -1023,7 +1023,7 @@ std::optional llstring_getoptenv(const std::string& key) // make it big enough buffer.resize(n); // and try again - n = GetEnvironmentVariableW(wkey.c_str(), &buffer[0], buffer.size()); + n = GetEnvironmentVariableW(wkey.c_str(), &buffer[0], static_cast(buffer.size())); } // did that (ultimately) succeed? if (n) diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 0e70bf94d5..42bbb565a1 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -719,7 +719,7 @@ LL_COMMON_API S32 wstring_wstring_length_from_utf16_length(const LLWString & wst LL_COMMON_API std::string utf8str_truncate(const std::string& utf8str, const S32 max_len); // [RLVa:KB] - Checked: RLVa-2.1.0 -LL_COMMON_API std::string utf8str_substr(const std::string& utf8str, const S32 index, const S32 max_len); +LL_COMMON_API std::string utf8str_substr(const std::string& utf8str, const size_t index, const size_t max_len); LL_COMMON_API void utf8str_split(std::list& split_list, const std::string& utf8str, size_t maxlen, char split_token); // [/RLVa:KB] diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 692bbe5acf..ba7acf9547 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -522,9 +522,9 @@ namespace LLTrace struct BlockTimerStackRecord { - class BlockTimer* mActiveTimer; - class BlockTimerStatHandle* mTimeBlock; - U64 mChildTime; + class BlockTimer* mActiveTimer{ nullptr }; + class BlockTimerStatHandle* mTimeBlock{ nullptr }; + U64 mChildTime{ 0 }; }; struct AccumulatorBufferGroup : public LLRefCount diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index 2bf11fdd34..a64be01c7e 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -82,8 +82,6 @@ public: // to integers, among other things. Use isNull() or notNull(). // operator bool() const; - // JC: These must return real bool's (not BOOLs) or else use of the STL - // will generate bool-to-int performance warnings. bool operator==(const LLUUID &rhs) const; bool operator!=(const LLUUID &rhs) const; bool operator<(const LLUUID &rhs) const; diff --git a/indra/llcommon/tests/commonmisc_test.cpp b/indra/llcommon/tests/commonmisc_test.cpp index 3deb864c0c..0057a1f639 100644 --- a/indra/llcommon/tests/commonmisc_test.cpp +++ b/indra/llcommon/tests/commonmisc_test.cpp @@ -67,7 +67,7 @@ namespace tut std::ostringstream resp; resp << "{'connect':true, 'position':[r128,r128,r128], 'look_at':[r0,r1,r0], 'agent_access':'M', 'region_x':i8192, 'region_y':i8192}"; std::string str = resp.str(); - LLMemoryStream mstr((U8*)str.c_str(), str.size()); + LLMemoryStream mstr((U8*)str.c_str(), static_cast(str.size())); LLSD response; S32 count = LLSDSerialize::fromNotation(response, mstr, str.size()); ensure("stream parsed", response.isDefined()); @@ -252,7 +252,7 @@ namespace tut resp << "{'label':'short binary test', 'singlebinary':b(1)\"A\", 'singlerawstring':s(1)\"A\", 'endoftest':'end' }"; std::string str = resp.str(); LLSD sd; - LLMemoryStream mstr((U8*)str.c_str(), str.size()); + LLMemoryStream mstr((U8*)str.c_str(), static_cast(str.size())); S32 count = LLSDSerialize::fromNotation(sd, mstr, str.size()); ensure_equals("parse count", count, 5); ensure("sd created", sd.isDefined()); @@ -456,7 +456,7 @@ namespace tut void mem_object::test<1>() { const char HELLO_WORLD[] = "hello world"; - LLMemoryStream mem((U8*)&HELLO_WORLD[0], strlen(HELLO_WORLD)); /* Flawfinder: ignore */ + LLMemoryStream mem((U8*)&HELLO_WORLD[0], static_cast(strlen(HELLO_WORLD))); /* Flawfinder: ignore */ std::string hello; std::string world; mem >> hello >> world; diff --git a/indra/llcommon/tests/lleventdispatcher_test.cpp b/indra/llcommon/tests/lleventdispatcher_test.cpp index a99acba848..44f772e322 100644 --- a/indra/llcommon/tests/lleventdispatcher_test.cpp +++ b/indra/llcommon/tests/lleventdispatcher_test.cpp @@ -491,7 +491,7 @@ namespace tut // Partial defaults arrays. for (LLSD::String a: ab) { - LLSD::Integer partition(std::min(partial_offset, dft_array_full[a].size())); + LLSD::Integer partition(static_cast(std::min(partial_offset, dft_array_full[a].size()))); dft_array_partial[a] = llsd_copy_array(dft_array_full[a].beginArray() + partition, dft_array_full[a].endArray()); @@ -508,7 +508,7 @@ namespace tut // (params, dft_array_full). Part of the point of using map-style // defaults is to allow any subset of the target function's // parameters to be optional, not just the rightmost. - for (LLSD::Integer ix = 0, ixend = params[a].size(); ix < ixend; ix += 2) + for (LLSD::Integer ix = 0, ixend = static_cast(params[a].size()); ix < ixend; ix += 2) { dft_map_partial[a][params[a][ix].asString()] = dft_array_full[a][ix]; } @@ -696,7 +696,7 @@ namespace tut LLSD zipmap(const LLSD& keys, const LLSD& values) { LLSD map; - for (LLSD::Integer i = 0, iend = keys.size(); i < iend; ++i) + for (LLSD::Integer i = 0, iend = static_cast(keys.size()); i < iend; ++i) { // Have to select asString() since you can index an LLSD // object with either String or Integer. @@ -955,7 +955,7 @@ namespace tut allreq[a] = zipmap(params[a], LLSD::emptyArray()); // Same for leftreq, save that we use the subset of the params not // supplied by dft_array_partial[a]. - LLSD::Integer partition(params[a].size() - dft_array_partial[a].size()); + LLSD::Integer partition(static_cast(params[a].size() - dft_array_partial[a].size())); leftreq[a] = zipmap(llsd_copy_array(params[a].beginArray(), params[a].beginArray() + partition), LLSD::emptyArray()); diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index 56fdc51e82..fb2af1d2db 100644 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -701,7 +701,7 @@ namespace tut "cam1.23" "", v, - v.size() + 1); + static_cast(v.size()) + 1); } template<> template<> @@ -721,7 +721,7 @@ namespace tut "cam1.23" "", v, - v.size() + 1); + static_cast(v.size()) + 1); v.clear(); v["amy"] = 23; @@ -734,7 +734,7 @@ namespace tut "cam1.23" "", v, - v.size() + 1); + static_cast(v.size()) + 1); v.clear(); v["amy"] = 23; @@ -751,7 +751,7 @@ namespace tut "cam1.23" "", v, - v.size() + 1); + static_cast(v.size()) + 1); v.clear(); v[0] = 23; @@ -766,7 +766,7 @@ namespace tut "1.23" "", v, - v.size() + 1); + static_cast(v.size()) + 1); v.clear(); v[0] = 23; @@ -782,7 +782,7 @@ namespace tut "1.23" "", v, - v.size() + 1); + static_cast(v.size()) + 1); } template<> template<> @@ -1405,13 +1405,13 @@ namespace tut uint32_t size = htonl(1); memcpy(&vec[1], &size, sizeof(uint32_t)); vec.push_back('k'); - int key_size_loc = vec.size(); + auto key_size_loc = vec.size(); size = htonl(1); // 1 too short vec.resize(vec.size() + 4); memcpy(&vec[key_size_loc], &size, sizeof(uint32_t)); vec.push_back('a'); vec.push_back('m'); vec.push_back('y'); vec.push_back('i'); - int integer_loc = vec.size(); + auto integer_loc = vec.size(); vec.resize(vec.size() + 4); uint32_t val_int = htonl(23); memcpy(&vec[integer_loc], &val_int, sizeof(uint32_t)); @@ -1473,7 +1473,7 @@ namespace tut memcpy(&vec[1], &size, sizeof(uint32_t)); vec.push_back('"'); vec.push_back('a'); vec.push_back('m'); vec.push_back('y'); vec.push_back('"'); vec.push_back('i'); - int integer_loc = vec.size(); + auto integer_loc = vec.size(); vec.resize(vec.size() + 4); uint32_t val_int = htonl(23); memcpy(&vec[integer_loc], &val_int, sizeof(uint32_t)); diff --git a/indra/llcorehttp/_httplibcurl.cpp b/indra/llcorehttp/_httplibcurl.cpp index a8e750e391..8d821d0771 100644 --- a/indra/llcorehttp/_httplibcurl.cpp +++ b/indra/llcorehttp/_httplibcurl.cpp @@ -413,30 +413,30 @@ bool HttpLibcurl::completeRequest(CURLM * multi_handle, CURL * handle, CURLcode // If not, we assume http pipelining havng gone out of sync. If yes, yield a 503 status and switch // pipelining off. bool bFailed = false; - if( op->mXLLURL.size() ) + if (op->mXLLURL.size()) { std::string strURI = op->mReqURL; - int i = strURI.find( "://" ); - if( i > 0 ) - i = strURI.find( "/", i+3 ); + size_t i = strURI.find("://"); + if (i != std::string::npos) + i = strURI.find("/", i + 3); - if( i > 0 ) - strURI = strURI.substr( i ); + if (i != std::string::npos) + strURI = strURI.substr(i); - if( strURI != op->mXLLURL ) + if (strURI != op->mXLLURL) { LL_WARNS() << "HTTP pipelining out of sync! Asked for: " << strURI << " got " << op->mXLLURL << LL_ENDL; op->mStatus = HttpStatus(HTTP_SERVICE_UNAVAILABLE); bFailed = true; } } - if ( !bFailed && (op->mReqOffset || op->mReqLength) ) + if (!bFailed && (op->mReqOffset || op->mReqLength)) { - if( op->mReqOffset != op->mReplyOffset || ( op->mReqLength && op->mReqLength < op->mReplyLength ) ) + if (op->mReqOffset != op->mReplyOffset || (op->mReqLength && op->mReqLength < op->mReplyLength)) { std::stringstream strm; strm << "HTTP pipelining possibly out of sync, request wanted: " << op->mReqOffset << "-"; - if( op->mReqLength ) + if (op->mReqLength) strm << op->mReqLength + op->mReqLength -1; strm << " got: " << op->mReplyOffset << "-" << op->mReplyOffset+op->mReplyLength-1; strm << " url: " << op->mReqURL; @@ -445,19 +445,19 @@ bool HttpLibcurl::completeRequest(CURLM * multi_handle, CURL * handle, CURLcode bFailed = true; } } - if( bFailed ) + if (bFailed) { HttpPolicy & policy(mService->getPolicy()); - for( int i = 0; i < mPolicyCount; ++ i ) + for (int i = 0; i < mPolicyCount; ++ i) { HttpPolicyClass & options(policy.getClassOptions(i)); long lVal; - if( options.get( LLCore::HttpRequest::PO_PIPELINING_DEPTH, &lVal ) && lVal ) + if (options.get(LLCore::HttpRequest::PO_PIPELINING_DEPTH, &lVal) && lVal) { - options.set( LLCore::HttpRequest::PO_PIPELINING_DEPTH, 0 ); - mDirtyPolicy[ i ] = true; - policyUpdated( i ); + options.set(LLCore::HttpRequest::PO_PIPELINING_DEPTH, 0); + mDirtyPolicy[i] = true; + policyUpdated(i); } } } @@ -496,7 +496,7 @@ bool HttpLibcurl::completeRequest(CURLM * multi_handle, CURL * handle, CURLcode int HttpLibcurl::getActiveCount() const { - return mActiveOps.size(); + return static_cast(mActiveOps.size()); } diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp index 69bdfa5b11..d7205db8ec 100644 --- a/indra/llcorehttp/_httpoprequest.cpp +++ b/indra/llcorehttp/_httpoprequest.cpp @@ -269,7 +269,7 @@ void HttpOpRequest::visitNotifier(HttpRequest * request) if (mReplyOffset || mReplyLength) { // Got an explicit offset/length in response - response->setRange(mReplyOffset, mReplyLength, mReplyFullLength); + response->setRange(mReplyOffset, static_cast(mReplyLength), static_cast(mReplyFullLength)); } response->setContentType(mReplyConType); response->setRetries(mPolicyRetries, mPolicy503Retries); @@ -330,7 +330,7 @@ HttpStatus HttpOpRequest::setupGetByteRange(HttpRequest::policy_t policy_id, LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; setupCommon(policy_id, url, NULL, options, headers); mReqMethod = HOR_GET; - mReqOffset = offset; + mReqOffset = static_cast(offset); mReqLength = len; if (offset || len) { @@ -625,7 +625,7 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service) long data_size(0); if (mReqBody) { - data_size = mReqBody->size(); + data_size = static_cast(mReqBody->size()); } check_curl_easy_setopt(mCurlHandle, CURLOPT_POSTFIELDS, static_cast(NULL)); check_curl_easy_setopt(mCurlHandle, CURLOPT_POSTFIELDSIZE, data_size); @@ -636,13 +636,14 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service) case HOR_PATCH: check_curl_easy_setopt(mCurlHandle, CURLOPT_CUSTOMREQUEST, "PATCH"); // fall through. The rest is the same as PUT + [[fallthrough]]; case HOR_PUT: { check_curl_easy_setopt(mCurlHandle, CURLOPT_UPLOAD, 1); long data_size(0); if (mReqBody) { - data_size = mReqBody->size(); + data_size = static_cast(mReqBody->size()); } check_curl_easy_setopt(mCurlHandle, CURLOPT_INFILESIZE, data_size); mCurlHeaders = curl_slist_append(mCurlHeaders, "Expect:"); diff --git a/indra/llcorehttp/_httppolicy.cpp b/indra/llcorehttp/_httppolicy.cpp index 03ac521b87..58d0e64e2f 100644 --- a/indra/llcorehttp/_httppolicy.cpp +++ b/indra/llcorehttp/_httppolicy.cpp @@ -98,7 +98,7 @@ HttpPolicy::~HttpPolicy() HttpRequest::policy_t HttpPolicy::createPolicyClass() { - const HttpRequest::policy_t policy_class(mClasses.size()); + const HttpRequest::policy_t policy_class(static_cast(mClasses.size())); if (policy_class >= HTTP_POLICY_CLASS_LIMIT) { return HttpRequest::INVALID_POLICY_ID; @@ -433,8 +433,8 @@ int HttpPolicy::getReadyCount(HttpRequest::policy_t policy_class) const { if (policy_class < mClasses.size()) { - return (mClasses[policy_class]->mReadyQueue.size() - + mClasses[policy_class]->mRetryQueue.size()); + return static_cast((mClasses[policy_class]->mReadyQueue.size() + + mClasses[policy_class]->mRetryQueue.size())); } return 0; } diff --git a/indra/llcorehttp/examples/http_texture_load.cpp b/indra/llcorehttp/examples/http_texture_load.cpp index 4d1e52b766..3c7c8ed634 100644 --- a/indra/llcorehttp/examples/http_texture_load.cpp +++ b/indra/llcorehttp/examples/http_texture_load.cpp @@ -519,7 +519,7 @@ void WorkingSet::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * r { // More success LLCore::BufferArray * data(response->getBody()); - mByteCount += data ? data->size() : 0; + mByteCount += data ? static_cast(data->size()) : 0L; ++mSuccesses; } else @@ -602,7 +602,7 @@ void WorkingSet::loadAssetUuids(FILE * in) mAssets.push_back(asset); } } - mRemaining = mLimit = mAssets.size(); + mRemaining = mLimit = static_cast(mAssets.size()); } diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index e70d7d632c..3921f44f0f 100644 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -146,7 +146,7 @@ std::string getStartupStateFromLog(std::string& sllog) std::string startup_state = "STATE_FIRST"; std::string startup_token = "Startup state changing from "; - size_t index = sllog.rfind(startup_token); + auto index = sllog.rfind(startup_token); if (index != std::string::npos || index + startup_token.length() > sllog.length()) { return startup_state; } diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp index c0c9e94876..ca69088095 100644 --- a/indra/llfilesystem/lldir.cpp +++ b/indra/llfilesystem/lldir.cpp @@ -693,7 +693,7 @@ std::string LLDir::getBaseFileName(const std::string& filepath, bool strip_exten std::string LLDir::getDirName(const std::string& filepath) const { std::size_t offset = filepath.find_last_of(getDirDelimiter()); - S32 len = (offset == std::string::npos) ? 0 : offset; + auto len = (offset == std::string::npos) ? 0 : offset; std::string dirname = filepath.substr(0, len); return dirname; } @@ -948,8 +948,8 @@ std::string LLDir::getScrubbedFileName(const std::string uncleanFileName) // replace any illegal file chars with and underscore '_' for( unsigned int i = 0; i < illegalChars.length(); i++ ) { - int j = -1; - while((j = name.find(illegalChars[i])) > -1) + std::string::size_type j = -1; + while((j = name.find(illegalChars[i])) > std::string::npos) { name[j] = '_'; } diff --git a/indra/llfilesystem/lldir_win32.cpp b/indra/llfilesystem/lldir_win32.cpp index 8606a97582..cc7c50a0f2 100644 --- a/indra/llfilesystem/lldir_win32.cpp +++ b/indra/llfilesystem/lldir_win32.cpp @@ -232,7 +232,7 @@ LLDir_Win32::LLDir_Win32() { w_str[size] = '\0'; mExecutablePathAndName = utf16str_to_utf8str(llutf16string(w_str)); - S32 path_end = mExecutablePathAndName.find_last_of('\\'); + auto path_end = mExecutablePathAndName.find_last_of('\\'); if (path_end != std::string::npos) { mExecutableDir = mExecutablePathAndName.substr(0, path_end); diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp index e76f48b0dc..910b92bb8f 100644 --- a/indra/llfilesystem/llfilesystem.cpp +++ b/indra/llfilesystem/llfilesystem.cpp @@ -212,7 +212,7 @@ bool LLFileSystem::read(U8* buffer, S32 bytes) { if (fseek(file, mPosition, SEEK_SET) == 0) { - mBytesRead = fread(buffer, 1, bytes, file); + mBytesRead = static_cast(fread(buffer, 1, bytes, file)); fclose(file); mPosition += mBytesRead; @@ -306,7 +306,7 @@ bool LLFileSystem::write(const U8* buffer, S32 bytes) LLFILE* ofs = LLFile::fopen(filename, "a+b"); if (ofs) { - S32 bytes_written = fwrite(buffer, 1, bytes, ofs); + S32 bytes_written = static_cast(fwrite(buffer, 1, bytes, ofs)); mPosition = ftell(ofs); fclose(ofs); success = (bytes_written == bytes); @@ -319,7 +319,7 @@ bool LLFileSystem::write(const U8* buffer, S32 bytes) { if (fseek(ofs, mPosition, SEEK_SET) == 0) { - S32 bytes_written = fwrite(buffer, 1, bytes, ofs); + S32 bytes_written = static_cast(fwrite(buffer, 1, bytes, ofs)); mPosition = ftell(ofs); fclose(ofs); success = (bytes_written == bytes); @@ -330,7 +330,7 @@ bool LLFileSystem::write(const U8* buffer, S32 bytes) ofs = LLFile::fopen(filename, "wb"); if (ofs) { - S32 bytes_written = fwrite(buffer, 1, bytes, ofs); + S32 bytes_written = static_cast(fwrite(buffer, 1, bytes, ofs)); mPosition = ftell(ofs); fclose(ofs); success = (bytes_written == bytes); @@ -342,7 +342,7 @@ bool LLFileSystem::write(const U8* buffer, S32 bytes) LLFILE* ofs = LLFile::fopen(filename, "wb"); if (ofs) { - S32 bytes_written = fwrite(buffer, 1, bytes, ofs); + S32 bytes_written = static_cast(fwrite(buffer, 1, bytes, ofs)); mPosition = ftell(ofs); fclose(ofs); success = (bytes_written == bytes); diff --git a/indra/llfilesystem/lllfsthread.cpp b/indra/llfilesystem/lllfsthread.cpp index 7d135b4472..6a882f64a8 100644 --- a/indra/llfilesystem/lllfsthread.cpp +++ b/indra/llfilesystem/lllfsthread.cpp @@ -45,7 +45,7 @@ void LLLFSThread::initClass(bool local_is_threaded) //static S32 LLLFSThread::updateClass(U32 ms_elapsed) { - return sLocal->update((F32)ms_elapsed); + return static_cast(sLocal->update((F32)ms_elapsed)); } //static diff --git a/indra/llimage/llimagedxt.cpp b/indra/llimage/llimagedxt.cpp index 89299258a6..6b960f9077 100644 --- a/indra/llimage/llimagedxt.cpp +++ b/indra/llimage/llimagedxt.cpp @@ -476,7 +476,7 @@ bool LLImageDXT::convertToDXR() // virtual S32 LLImageDXT::calcHeaderSize() { - return llmax(sizeof(dxtfile_header_old_t), sizeof(dxtfile_header_t)); + return static_cast(llmax(sizeof(dxtfile_header_old_t), sizeof(dxtfile_header_t))); } // virtual diff --git a/indra/llimage/llimagetga.cpp b/indra/llimage/llimagetga.cpp index bbf1ea579d..cd1d668dc9 100644 --- a/indra/llimage/llimagetga.cpp +++ b/indra/llimage/llimagetga.cpp @@ -1195,7 +1195,7 @@ bool LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight // Reads a .tga file and creates an LLImageTGA with its data. bool LLImageTGA::loadFile( const std::string& path ) { - S32 len = path.size(); + auto len = path.size(); if( len < 5 ) { return false; @@ -1238,7 +1238,7 @@ bool LLImageTGA::loadFile( const std::string& path ) return false; } - S32 bytes_read = fread(buffer, 1, file_size, file); + S32 bytes_read = static_cast(fread(buffer, 1, file_size, file)); if( bytes_read != file_size ) { deleteData(); diff --git a/indra/llimage/llpngwrapper.cpp b/indra/llimage/llpngwrapper.cpp index a5fb7a3167..79c201b1f4 100644 --- a/indra/llimage/llpngwrapper.cpp +++ b/indra/llimage/llpngwrapper.cpp @@ -328,10 +328,10 @@ bool LLPngWrapper::writePng(const LLImageRaw* rawImage, U8* dest, size_t destSiz mWriteInfoPtr = png_create_info_struct(mWritePngPtr); // Setup write function - PngDataInfo dataPtr; + PngDataInfo dataPtr{}; dataPtr.mData = dest; dataPtr.mOffset = 0; - dataPtr.mDataSize = destSize; + dataPtr.mDataSize = static_cast(destSize); png_set_write_fn(mWritePngPtr, &dataPtr, &writeDataCallback, &writeFlush); // Setup image params diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 101509122e..7251d2fee6 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -463,7 +463,7 @@ namespace // Trim extra tracks. while (value.size() > LLSettingsDay::TRACK_MAX) { - value.erase(value.size() - 1); + value.erase(static_cast(value.size()) - 1); } S32 framecount(0); @@ -512,7 +512,7 @@ namespace } - int waterTracks = value[0].size(); + int waterTracks = static_cast(value[0].size()); int skyTracks = framecount - waterTracks; if (waterTracks < 1) diff --git a/indra/llmath/llsimdtypes.h b/indra/llmath/llsimdtypes.h index 9db152adf8..11462170fb 100644 --- a/indra/llmath/llsimdtypes.h +++ b/indra/llmath/llsimdtypes.h @@ -60,7 +60,7 @@ public: inline operator bool() const { return static_cast(m_bool); } private: - int m_bool; + int m_bool{ 0 }; }; #if LL_WINDOWS @@ -118,7 +118,7 @@ public: } private: - LLQuad mQ; + LLQuad mQ{}; }; #endif //LL_SIMD_TYPES_H diff --git a/indra/llmath/llsphere.cpp b/indra/llmath/llsphere.cpp index 89349af6c8..5f48764455 100644 --- a/indra/llmath/llsphere.cpp +++ b/indra/llmath/llsphere.cpp @@ -185,7 +185,7 @@ LLSphere LLSphere::getBoundingSphere(const std::vector& sphere_list) // TODO -- improve the accuracy for small collections of spheres LLSphere bounding_sphere( LLVector3(0.f, 0.f, 0.f), 0.f ); - S32 sphere_count = sphere_list.size(); + auto sphere_count = sphere_list.size(); if (1 == sphere_count) { // trivial case -- single sphere diff --git a/indra/llmath/lltreenode.h b/indra/llmath/lltreenode.h index f648a114ca..e3d30206b7 100644 --- a/indra/llmath/lltreenode.h +++ b/indra/llmath/lltreenode.h @@ -57,7 +57,7 @@ public: virtual bool remove(T* data); virtual void notifyRemoval(T* data); virtual U32 hasListeners() const { return !mListeners.empty(); } - virtual U32 getListenerCount() const { return mListeners.size(); } + virtual U32 getListenerCount() const { return static_cast(mListeners.size()); } virtual LLTreeListener* getListener(U32 index) const { if (index < mListeners.size()) diff --git a/indra/llmath/llvector4a.h b/indra/llmath/llvector4a.h index 8f0ee4b739..ea80b33e2d 100644 --- a/indra/llmath/llvector4a.h +++ b/indra/llmath/llvector4a.h @@ -322,7 +322,7 @@ public: inline operator LLQuad() const; private: - LLQuad mQ; + LLQuad mQ{}; }; inline void update_min_max(LLVector4a& min, LLVector4a& max, const LLVector4a& p) diff --git a/indra/llmath/llvector4logical.h b/indra/llmath/llvector4logical.h index d08b5513d9..70759eef5c 100644 --- a/indra/llmath/llvector4logical.h +++ b/indra/llmath/llvector4logical.h @@ -120,7 +120,7 @@ public: private: - LLQuad mQ; + LLQuad mQ{}; }; #endif //LL_VECTOR4ALOGICAL_H diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index e621bb6b78..4eab69b041 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2412,7 +2412,7 @@ bool LLVolume::unpackVolumeFaces(U8* in_data, S32 size) bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl) { { - U32 face_count = mdl.size(); + auto face_count = mdl.size(); if (face_count == 0) { //no faces unpacked, treat as failed decode @@ -2444,7 +2444,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl) LLSD::Binary idx = mdl[i]["TriangleList"]; //copy out indices - S32 num_indices = idx.size() / 2; + auto num_indices = idx.size() / 2; const S32 indices_to_discard = num_indices % 3; if (indices_to_discard > 0) { @@ -2452,7 +2452,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl) LL_WARNS() << "Incomplete triangle discarded from face! Indices count " << num_indices << " was not divisible by 3. face index: " << i << " Total: " << face_count << LL_ENDL; num_indices -= indices_to_discard; } - face.resizeIndices(num_indices); + face.resizeIndices(static_cast(num_indices)); if (num_indices > 2 && !face.mIndices) { @@ -2473,7 +2473,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl) } //copy out vertices - U32 num_verts = pos.size()/(3*2); + U32 num_verts = static_cast(pos.size())/(3*2); face.resizeVertices(num_verts); if (num_verts > 0 && !face.mPositions) @@ -5064,13 +5064,13 @@ void LLVolumeFace::remap() { // Generate a remap buffer std::vector remap(mNumVertices); - S32 remap_vertices_count = LLMeshOptimizer::generateRemapMultiU16(&remap[0], + S32 remap_vertices_count = static_cast(LLMeshOptimizer::generateRemapMultiU16(&remap[0], mIndices, mNumIndices, mPositions, mNormals, mTexCoords, - mNumVertices); + mNumVertices)); // Allocate new buffers S32 size = ((mNumIndices * sizeof(U16)) + 0xF) & ~0xF; @@ -5603,7 +5603,7 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents) U32 stream_count = data.w.empty() ? 4 : 5; - size_t vert_count = meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count); + S32 vert_count = static_cast(meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count)); if (vert_count < 65535 && vert_count != 0) { @@ -6695,8 +6695,8 @@ void LLVolumeFace::pushIndex(const U16& idx) void LLVolumeFace::fillFromLegacyData(std::vector& v, std::vector& idx) { - resizeVertices(v.size()); - resizeIndices(idx.size()); + resizeVertices(static_cast(v.size())); + resizeIndices(static_cast(idx.size())); for (U32 i = 0; i < v.size(); ++i) { diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index 122ba23145..b1766159b7 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -1022,7 +1022,7 @@ public: U8 getProfileType() const { return mParams.getProfileParams().getCurveType(); } U8 getPathType() const { return mParams.getPathParams().getCurveType(); } S32 getNumFaces() const; - S32 getNumVolumeFaces() const { return mVolumeFaces.size(); } + S32 getNumVolumeFaces() const { return static_cast(mVolumeFaces.size()); } F32 getDetail() const { return mDetail; } F32 getSurfaceArea() const { return mSurfaceArea; } const LLVolumeParams& getParams() const { return mParams; } diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 13fda24e62..b3390451a2 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -1125,7 +1125,7 @@ S32 LLAssetStorage::getNumPending(LLAssetStorage::ERequestType rt) const S32 num_pending = -1; if (requests) { - num_pending = requests->size(); + num_pending = static_cast(requests->size()); } return num_pending; } diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 31441bf305..82cc6eb1f8 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -255,7 +255,7 @@ void LLAvatarNameCache::handleAvNameCacheSuccess(const LLSD &data, const LLSD &h // Same logic as error response case const LLSD& unresolved_agents = data["bad_ids"]; - S32 num_unresolved = unresolved_agents.size(); + auto num_unresolved = unresolved_agents.size(); if (num_unresolved > 0) { LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result " << num_unresolved << " unresolved ids; " diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 2c720f595c..8eb2ad458e 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -616,13 +616,13 @@ std::string LLCacheName::buildLegacyName(const std::string& complete_name) { //boost::regexp was showing up in the crashreporter, so doing //painfully manual parsing using substr. LF - S32 open_paren = complete_name.rfind(" ("); - S32 close_paren = complete_name.rfind(')'); + auto open_paren = complete_name.rfind(" ("); + auto close_paren = complete_name.rfind(')'); if (open_paren != std::string::npos && close_paren == complete_name.length()-1) { - S32 length = close_paren - open_paren - 2; + auto length = close_paren - open_paren - 2; std::string legacy_name = complete_name.substr(open_paren+2, length); if (legacy_name.length() > 0) @@ -631,7 +631,7 @@ std::string LLCacheName::buildLegacyName(const std::string& complete_name) LLStringUtil::toUpper(cap_letter); legacy_name = cap_letter + legacy_name.substr(1); - S32 separator = legacy_name.find('.'); + auto separator = legacy_name.find('.'); if (separator != std::string::npos) { diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp index 68af5503db..5ffe7bbf32 100644 --- a/indra/llmessage/llcircuit.cpp +++ b/indra/llmessage/llcircuit.cpp @@ -801,8 +801,8 @@ void LLCircuitData::checkPacketInID(TPACKETID id, bool receive_resent) void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys) { F64Seconds cur_time = LLMessageSystem::getMessageTimeSeconds(); - S32 count = mPingSet.size(); - S32 cur = 0; + size_t count = mPingSet.size(); + size_t cur = 0; // Only process each circuit once at most, stop processing if no circuits while((cur < count) && !mPingSet.empty()) diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp index eb2fe1d93b..6d7dabc7e0 100644 --- a/indra/llmessage/llcoproceduremanager.cpp +++ b/indra/llmessage/llcoproceduremanager.cpp @@ -87,7 +87,7 @@ public: /// inline S32 count() const { - return countPending() + countActive(); + return static_cast(countPending() + countActive()); } void close(); diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index 134f34aafa..e911150787 100644 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -237,7 +237,7 @@ bool LLDataPacker::unpackUUIDs(LLUUID *values, S32 count, const char *name) bool LLDataPackerBinaryBuffer::packString(const std::string& value, const char *name) { - S32 length = value.length()+1; + S32 length = static_cast(value.length()) + 1; if (!verifyLength(length, name)) { @@ -740,7 +740,7 @@ bool LLDataPackerAsciiBuffer::packString(const std::string& value, const char *n } else { - numCopied = value.length() + 1; /*Flawfinder: ignore*/ + numCopied = static_cast(value.length()) + 1; /*Flawfinder: ignore*/ } // snprintf returns number of bytes that would have been written diff --git a/indra/llmessage/llfiltersd2xmlrpc.cpp b/indra/llmessage/llfiltersd2xmlrpc.cpp index 44dbe1e71d..b31c3e7c57 100644 --- a/indra/llmessage/llfiltersd2xmlrpc.cpp +++ b/indra/llmessage/llfiltersd2xmlrpc.cpp @@ -283,12 +283,12 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd) if(!buffer.empty()) { // *TODO: convert to LLBase64 - int b64_buffer_length = apr_base64_encode_len(buffer.size()); + int b64_buffer_length = apr_base64_encode_len(static_cast(buffer.size())); char* b64_buffer = new char[b64_buffer_length]; b64_buffer_length = apr_base64_encode_binary( b64_buffer, &buffer[0], - buffer.size()); + static_cast(buffer.size())); ostr.write(b64_buffer, b64_buffer_length - 1); delete[] b64_buffer; } diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index 9791a20743..e562f09844 100644 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -494,7 +494,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl( LLChangeChannel change(channels.in(), channels.out()); std::for_each(buffer->beginSegment(), buffer->endSegment(), change); std::string header = ostr.str(); - buffer->prepend(channels.out(), (U8*)header.c_str(), header.size()); + buffer->prepend(channels.out(), (U8*)header.c_str(), static_cast(header.size())); PUMP_DEBUG; return STATUS_DONE; } diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index b7b747a28c..a4a85c59b4 100644 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -352,7 +352,7 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl( PUMP_DEBUG; len = READ_BUFFER_SIZE; status = apr_socket_recv(mSource->getSocket(), read_buf, &len); - buffer->append(channels.out(), (U8*)read_buf, len); + buffer->append(channels.out(), (U8*)read_buf, static_cast(len)); } while((APR_SUCCESS == status) && (READ_BUFFER_SIZE == len)); LL_DEBUGS() << "socket read status: " << status << LL_ENDL; LLIOPipe::EStatus rv = STATUS_OK; diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp index ca027d7675..9e10a356db 100644 --- a/indra/llmessage/llmail.cpp +++ b/indra/llmessage/llmail.cpp @@ -273,7 +273,7 @@ bool LLMail::send( std::string good_string = "\n..\n"; while (1) { - int index = message.find(bad_string); + auto index = message.find(bad_string); if (index == std::string::npos) break; message.replace(index, bad_string.size(), good_string); } diff --git a/indra/llmessage/llproxy.cpp b/indra/llmessage/llproxy.cpp index 3599cb7776..c4370303ac 100644 --- a/indra/llmessage/llproxy.cpp +++ b/indra/llmessage/llproxy.cpp @@ -123,7 +123,7 @@ S32 LLProxy::proxyHandshake(LLHost proxy) // The server has requested a username/password combination std::string socks_username(getSocksUser()); std::string socks_password(getSocksPwd()); - U32 request_size = socks_username.size() + socks_password.size() + 3; + U32 request_size = static_cast(socks_username.size() + socks_password.size() + 3); char * password_auth = new char[request_size]; password_auth[0] = 0x01; password_auth[1] = (char)(socks_username.size()); diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp index d3b75cf86b..e1cd70b216 100644 --- a/indra/llmessage/llpumpio.cpp +++ b/indra/llmessage/llpumpio.cpp @@ -818,7 +818,7 @@ void LLPumpIO::rebuildPollset() running_chains_t::iterator run_end = mRunningChains.end(); for(; run_it != run_end; ++run_it) { - size += (*run_it).mDescriptors.size(); + size += static_cast((*run_it).mDescriptors.size()); } //LL_DEBUGS() << "found " << size << " descriptors." << LL_ENDL; if(size) diff --git a/indra/llmessage/llregionflags.h b/indra/llmessage/llregionflags.h index b8a0e91ae3..106b433839 100644 --- a/indra/llmessage/llregionflags.h +++ b/indra/llmessage/llregionflags.h @@ -28,83 +28,83 @@ #define LL_LLREGIONFLAGS_H // Can you be hurt here? Should health be on? -const U64 REGION_FLAGS_ALLOW_DAMAGE = (1 << 0); +constexpr U64 REGION_FLAGS_ALLOW_DAMAGE = (1ULL << 0); // Can you make landmarks here? -const U64 REGION_FLAGS_ALLOW_LANDMARK = (1 << 1); +constexpr U64 REGION_FLAGS_ALLOW_LANDMARK = (1ULL << 1); // Do we reset the home position when someone teleports away from here? -const U64 REGION_FLAGS_ALLOW_SET_HOME = (1 << 2); +constexpr U64 REGION_FLAGS_ALLOW_SET_HOME = (1ULL << 2); // Do we reset the home position when someone teleports away from here? -const U64 REGION_FLAGS_RESET_HOME_ON_TELEPORT = (1 << 3); +constexpr U64 REGION_FLAGS_RESET_HOME_ON_TELEPORT = (1ULL << 3); // Does the sun move? -const U64 REGION_FLAGS_SUN_FIXED = (1 << 4); +constexpr U64 REGION_FLAGS_SUN_FIXED = (1ULL << 4); // Does the estate owner allow private parcels? -const U64 REGION_FLAGS_ALLOW_ACCESS_OVERRIDE = (1 << 5); +constexpr U64 REGION_FLAGS_ALLOW_ACCESS_OVERRIDE = (1ULL << 5); // Can't change the terrain heightfield, even on owned parcels, // but can plant trees and grass. -const U64 REGION_FLAGS_BLOCK_TERRAFORM = (1 << 6); +constexpr U64 REGION_FLAGS_BLOCK_TERRAFORM = (1ULL << 6); // Can't release, sell, or buy land. -const U64 REGION_FLAGS_BLOCK_LAND_RESELL = (1 << 7); +constexpr U64 REGION_FLAGS_BLOCK_LAND_RESELL = (1ULL << 7); // All content wiped once per night -const U64 REGION_FLAGS_SANDBOX = (1 << 8); +constexpr U64 REGION_FLAGS_SANDBOX = (1ULL << 8); -const U64 REGION_FLAGS_ALLOW_ENVIRONMENT_OVERRIDE = (1 << 9); +constexpr U64 REGION_FLAGS_ALLOW_ENVIRONMENT_OVERRIDE = (1ULL << 9); -const U64 REGION_FLAGS_SKIP_COLLISIONS = (1 << 12); // Pin all non agent rigid bodies -const U64 REGION_FLAGS_SKIP_SCRIPTS = (1 << 13); -const U64 REGION_FLAGS_SKIP_PHYSICS = (1 << 14); // Skip all physics -const U64 REGION_FLAGS_EXTERNALLY_VISIBLE = (1 << 15); -const U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT = (1 << 16); -const U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT = (1 << 17); -const U64 REGION_FLAGS_BLOCK_DWELL = (1 << 18); +constexpr U64 REGION_FLAGS_SKIP_COLLISIONS = (1ULL << 12); // Pin all non agent rigid bodies +constexpr U64 REGION_FLAGS_SKIP_SCRIPTS = (1ULL << 13); +constexpr U64 REGION_FLAGS_SKIP_PHYSICS = (1ULL << 14); // Skip all physics +constexpr U64 REGION_FLAGS_EXTERNALLY_VISIBLE = (1ULL << 15); +constexpr U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT = (1ULL << 16); +constexpr U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT = (1ULL << 17); +constexpr U64 REGION_FLAGS_BLOCK_DWELL = (1ULL << 18); // Is flight allowed? -const U64 REGION_FLAGS_BLOCK_FLY = (1 << 19); +constexpr U64 REGION_FLAGS_BLOCK_FLY = (1ULL << 19); // Is direct teleport (p2p) allowed? -const U64 REGION_FLAGS_ALLOW_DIRECT_TELEPORT = (1 << 20); +constexpr U64 REGION_FLAGS_ALLOW_DIRECT_TELEPORT = (1ULL << 20); // Is there an administrative override on scripts in the region at the // moment. This is the similar skip scripts, except this flag is // presisted in the database on an estate level. -const U64 REGION_FLAGS_ESTATE_SKIP_SCRIPTS = (1 << 21); +constexpr U64 REGION_FLAGS_ESTATE_SKIP_SCRIPTS = (1ULL << 21); -const U64 REGION_FLAGS_RESTRICT_PUSHOBJECT = (1 << 22); +constexpr U64 REGION_FLAGS_RESTRICT_PUSHOBJECT = (1ULL << 22); -const U64 REGION_FLAGS_DENY_ANONYMOUS = (1 << 23); +constexpr U64 REGION_FLAGS_DENY_ANONYMOUS = (1ULL << 23); -const U64 REGION_FLAGS_ALLOW_PARCEL_CHANGES = (1 << 26); +constexpr U64 REGION_FLAGS_ALLOW_PARCEL_CHANGES = (1ULL << 26); -const U64 REGION_FLAGS_BLOCK_FLYOVER = (1 << 27); +constexpr U64 REGION_FLAGS_BLOCK_FLYOVER = (1ULL << 27); -const U64 REGION_FLAGS_ALLOW_VOICE = (1 << 28); +constexpr U64 REGION_FLAGS_ALLOW_VOICE = (1ULL << 28); -const U64 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29); -const U64 REGION_FLAGS_DENY_AGEUNVERIFIED = (1 << 30); +constexpr U64 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1ULL << 29); +constexpr U64 REGION_FLAGS_DENY_AGEUNVERIFIED = (1ULL << 30); -const U64 REGION_FLAGS_DENY_BOTS = (1 << 31); +constexpr U64 REGION_FLAGS_DENY_BOTS = (1ULL << 31); -const U64 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK | - REGION_FLAGS_ALLOW_SET_HOME | - REGION_FLAGS_ALLOW_PARCEL_CHANGES | - REGION_FLAGS_ALLOW_VOICE; +constexpr U64 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK | + REGION_FLAGS_ALLOW_SET_HOME | + REGION_FLAGS_ALLOW_PARCEL_CHANGES | + REGION_FLAGS_ALLOW_VOICE; -const U64 REGION_FLAGS_PRELUDE_SET = REGION_FLAGS_RESET_HOME_ON_TELEPORT; -const U64 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK - | REGION_FLAGS_ALLOW_SET_HOME; +constexpr U64 REGION_FLAGS_PRELUDE_SET = REGION_FLAGS_RESET_HOME_ON_TELEPORT; +constexpr U64 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK | + REGION_FLAGS_ALLOW_SET_HOME; -const U64 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE - | REGION_FLAGS_SUN_FIXED - | REGION_FLAGS_DENY_ANONYMOUS - | REGION_FLAGS_DENY_AGEUNVERIFIED; +constexpr U64 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE | + REGION_FLAGS_SUN_FIXED | + REGION_FLAGS_DENY_ANONYMOUS | + REGION_FLAGS_DENY_AGEUNVERIFIED; inline bool is_flag_set(U64 flags, U64 flag) { @@ -133,81 +133,77 @@ inline U64 unset_prelude_flags(U64 flags) } // Region protocols -const U64 REGION_PROTOCOLS_AGENT_APPEARANCE_SERVICE = (1 << 0); +constexpr U64 REGION_PROTOCOLS_AGENT_APPEARANCE_SERVICE = (1ULL << 0); // estate constants. Need to match first few etries in indra.estate table. -const U32 ESTATE_ALL = 0; // will not match in db, reserved key for logic -const U32 ESTATE_MAINLAND = 1; -const U32 ESTATE_ORIENTATION = 2; -const U32 ESTATE_INTERNAL = 3; -const U32 ESTATE_SHOWCASE = 4; -const U32 ESTATE_TEEN = 5; -const U32 ESTATE_LAST_LINDEN = 5; // last linden owned/managed estate +constexpr U32 ESTATE_ALL = 0; // will not match in db, reserved key for logic +constexpr U32 ESTATE_MAINLAND = 1; +constexpr U32 ESTATE_ORIENTATION = 2; +constexpr U32 ESTATE_INTERNAL = 3; +constexpr U32 ESTATE_SHOWCASE = 4; +constexpr U32 ESTATE_TEEN = 5; +constexpr U32 ESTATE_LAST_LINDEN = 5; // last linden owned/managed estate // for EstateOwnerRequest, setaccess message -const U32 ESTATE_ACCESS_ALLOWED_AGENTS = 1 << 0; -const U32 ESTATE_ACCESS_ALLOWED_GROUPS = 1 << 1; -const U32 ESTATE_ACCESS_BANNED_AGENTS = 1 << 2; -const U32 ESTATE_ACCESS_MANAGERS = 1 << 3; +constexpr U32 ESTATE_ACCESS_ALLOWED_AGENTS = 1 << 0; +constexpr U32 ESTATE_ACCESS_ALLOWED_GROUPS = 1 << 1; +constexpr U32 ESTATE_ACCESS_BANNED_AGENTS = 1 << 2; +constexpr U32 ESTATE_ACCESS_MANAGERS = 1 << 3; //maximum number of access list entries we can fit in one packet -const S32 ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET = 63; +constexpr S32 ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET = 63; // for reply to "getinfo", don't need to forward to all sims in estate -const U32 ESTATE_ACCESS_SEND_TO_AGENT_ONLY = 1 << 4; +constexpr U32 ESTATE_ACCESS_SEND_TO_AGENT_ONLY = 1 << 4; -const U32 ESTATE_ACCESS_ALL = ESTATE_ACCESS_ALLOWED_AGENTS - | ESTATE_ACCESS_ALLOWED_GROUPS - | ESTATE_ACCESS_BANNED_AGENTS - | ESTATE_ACCESS_MANAGERS; +constexpr U32 ESTATE_ACCESS_ALL = ESTATE_ACCESS_ALLOWED_AGENTS + | ESTATE_ACCESS_ALLOWED_GROUPS + | ESTATE_ACCESS_BANNED_AGENTS + | ESTATE_ACCESS_MANAGERS; // for EstateOwnerRequest, estateaccessdelta, estateexperiencedelta messages -const U32 ESTATE_ACCESS_APPLY_TO_ALL_ESTATES = 1U << 0; -const U32 ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES = 1U << 1; +constexpr U32 ESTATE_ACCESS_APPLY_TO_ALL_ESTATES = 1U << 0; +constexpr U32 ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES = 1U << 1; -const U32 ESTATE_ACCESS_ALLOWED_AGENT_ADD = 1U << 2; -const U32 ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 1U << 3; -const U32 ESTATE_ACCESS_ALLOWED_GROUP_ADD = 1U << 4; -const U32 ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 1U << 5; -const U32 ESTATE_ACCESS_BANNED_AGENT_ADD = 1U << 6; -const U32 ESTATE_ACCESS_BANNED_AGENT_REMOVE = 1U << 7; -const U32 ESTATE_ACCESS_MANAGER_ADD = 1U << 8; -const U32 ESTATE_ACCESS_MANAGER_REMOVE = 1U << 9; -const U32 ESTATE_ACCESS_NO_REPLY = 1U << 10; -const U32 ESTATE_ACCESS_FAILED_BAN_ESTATE_MANAGER = 1U << 11; +constexpr U32 ESTATE_ACCESS_ALLOWED_AGENT_ADD = 1U << 2; +constexpr U32 ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 1U << 3; +constexpr U32 ESTATE_ACCESS_ALLOWED_GROUP_ADD = 1U << 4; +constexpr U32 ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 1U << 5; +constexpr U32 ESTATE_ACCESS_BANNED_AGENT_ADD = 1U << 6; +constexpr U32 ESTATE_ACCESS_BANNED_AGENT_REMOVE = 1U << 7; +constexpr U32 ESTATE_ACCESS_MANAGER_ADD = 1U << 8; +constexpr U32 ESTATE_ACCESS_MANAGER_REMOVE = 1U << 9; +constexpr U32 ESTATE_ACCESS_NO_REPLY = 1U << 10; +constexpr U32 ESTATE_ACCESS_FAILED_BAN_ESTATE_MANAGER = 1U << 11; -const S32 ESTATE_MAX_MANAGERS = 20; -const S32 ESTATE_MAX_MANAGERS_OS = 15; // OpenSim -const S32 ESTATE_MAX_ACCESS_IDS = 500; // max for access -const S32 ESTATE_MAX_BANNED_IDS = 750; // max for banned -const S32 ESTATE_MAX_BANNED_IDS_OS = 500; // max for banned // OpenSim -const S32 ESTATE_MAX_GROUP_IDS = (S32) ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET; +constexpr S32 ESTATE_MAX_MANAGERS = 20; +constexpr S32 ESTATE_MAX_MANAGERS_OS = 15; // OpenSim +constexpr S32 ESTATE_MAX_ACCESS_IDS = 500; // max for access +constexpr S32 ESTATE_MAX_BANNED_IDS = 750; // max for banned +constexpr S32 ESTATE_MAX_BANNED_IDS_OS = 500; // max for banned // OpenSim +constexpr S32 ESTATE_MAX_GROUP_IDS = (S32) ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET; // 'Sim Wide Delete' flags -const U32 SWD_OTHERS_LAND_ONLY = (1 << 0); -const U32 SWD_ALWAYS_RETURN_OBJECTS = (1 << 1); -const U32 SWD_SCRIPTED_ONLY = (1 << 2); +constexpr U32 SWD_OTHERS_LAND_ONLY = (1 << 0); +constexpr U32 SWD_ALWAYS_RETURN_OBJECTS = (1 << 1); +constexpr U32 SWD_SCRIPTED_ONLY = (1 << 2); // Controls experience key validity in the estate -const U32 EXPERIENCE_KEY_TYPE_NONE = 0; -const U32 EXPERIENCE_KEY_TYPE_BLOCKED = 1; -const U32 EXPERIENCE_KEY_TYPE_ALLOWED = 2; -const U32 EXPERIENCE_KEY_TYPE_TRUSTED = 3; +constexpr U32 EXPERIENCE_KEY_TYPE_NONE = 0; +constexpr U32 EXPERIENCE_KEY_TYPE_BLOCKED = 1; +constexpr U32 EXPERIENCE_KEY_TYPE_ALLOWED = 2; +constexpr U32 EXPERIENCE_KEY_TYPE_TRUSTED = 3; -const U32 EXPERIENCE_KEY_TYPE_FIRST = EXPERIENCE_KEY_TYPE_BLOCKED; -const U32 EXPERIENCE_KEY_TYPE_LAST = EXPERIENCE_KEY_TYPE_TRUSTED; +constexpr U32 EXPERIENCE_KEY_TYPE_FIRST = EXPERIENCE_KEY_TYPE_BLOCKED; +constexpr U32 EXPERIENCE_KEY_TYPE_LAST = EXPERIENCE_KEY_TYPE_TRUSTED; // -const U32 ESTATE_EXPERIENCE_TRUSTED_ADD = 1U << 2; -const U32 ESTATE_EXPERIENCE_TRUSTED_REMOVE = 1U << 3; -const U32 ESTATE_EXPERIENCE_ALLOWED_ADD = 1U << 4; -const U32 ESTATE_EXPERIENCE_ALLOWED_REMOVE = 1U << 5; -const U32 ESTATE_EXPERIENCE_BLOCKED_ADD = 1U << 6; -const U32 ESTATE_EXPERIENCE_BLOCKED_REMOVE = 1U << 7; - -const S32 ESTATE_MAX_EXPERIENCE_IDS = 8; - +constexpr U32 ESTATE_EXPERIENCE_TRUSTED_ADD = 1U << 2; +constexpr U32 ESTATE_EXPERIENCE_TRUSTED_REMOVE = 1U << 3; +constexpr U32 ESTATE_EXPERIENCE_ALLOWED_ADD = 1U << 4; +constexpr U32 ESTATE_EXPERIENCE_ALLOWED_REMOVE = 1U << 5; +constexpr U32 ESTATE_EXPERIENCE_BLOCKED_ADD = 1U << 6; +constexpr U32 ESTATE_EXPERIENCE_BLOCKED_REMOVE = 1U << 7; +constexpr S32 ESTATE_MAX_EXPERIENCE_IDS = 8; #endif - - diff --git a/indra/llmessage/llsdmessagereader.cpp b/indra/llmessage/llsdmessagereader.cpp index 8be6158d82..6ade7c0dad 100644 --- a/indra/llmessage/llsdmessagereader.cpp +++ b/indra/llmessage/llsdmessagereader.cpp @@ -242,7 +242,7 @@ void LLSDMessageReader::getString(const char *block, const char *var, return; } std::string data = getLLSD(mMessage, block, var, blocknum); - S32 data_size = data.size(); + auto data_size = data.size(); if (data_size >= buffer_size) { data_size = buffer_size - 1; @@ -261,7 +261,7 @@ void LLSDMessageReader::getString(const char *block, const char *var, //virtual S32 LLSDMessageReader::getNumberOfBlocks(const char *blockname) { - return mMessage[blockname].size(); + return static_cast(mMessage[blockname].size()); } S32 getElementSize(const LLSD& llsd) @@ -276,7 +276,7 @@ S32 getElementSize(const LLSD& llsd) case LLSD::TypeReal: return sizeof(F64); case LLSD::TypeString: - return llsd.size(); + return static_cast(llsd.size()); case LLSD::TypeUUID: return sizeof(LLUUID); case LLSD::TypeDate: @@ -286,7 +286,7 @@ S32 getElementSize(const LLSD& llsd) case LLSD::TypeBinary: { std::vector data = llsd; - return data.size() * sizeof(U8); + return static_cast(data.size() * sizeof(U8)); } case LLSD::TypeMap: case LLSD::TypeArray: diff --git a/indra/llmessage/lltemplatemessagedispatcher.cpp b/indra/llmessage/lltemplatemessagedispatcher.cpp index 93db7eba98..ef2034927a 100644 --- a/indra/llmessage/lltemplatemessagedispatcher.cpp +++ b/indra/llmessage/lltemplatemessagedispatcher.cpp @@ -45,7 +45,7 @@ void LLTemplateMessageDispatcher::dispatch(const std::string& msg_name, LLHTTPNode::ResponsePtr responsep) { std::vector data = message["body"]["binary-template-data"].asBinary(); - U32 size = data.size(); + auto size = data.size(); if(size == 0) { return; @@ -54,7 +54,7 @@ void LLTemplateMessageDispatcher::dispatch(const std::string& msg_name, LLHost host; host = gMessageSystem->getSender(); - bool validate_message = mTemplateMessageReader.validateMessage(&(data[0]), data.size(), host, true); + bool validate_message = mTemplateMessageReader.validateMessage(&(data[0]), static_cast(size), host, true); if (validate_message) { diff --git a/indra/llmessage/llxfer_file.cpp b/indra/llmessage/llxfer_file.cpp index 337926f2dc..efac9adc2e 100644 --- a/indra/llmessage/llxfer_file.cpp +++ b/indra/llmessage/llxfer_file.cpp @@ -317,7 +317,7 @@ S32 LLXfer_File::flush() if (mFp) { - S32 write_size = fwrite(mBuffer,1,mBufferLength,mFp); + S32 write_size = static_cast(fwrite(mBuffer,1,mBufferLength,mFp)); if (write_size != mBufferLength) { LL_WARNS("Xfer") << "Non-matching write size, requested " << mBufferLength diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index dc9fa0b0d6..64dba0cc43 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -2183,7 +2183,7 @@ S32 LLMessageSystem::sendError( if (LLMessageConfig::getMessageFlavor(ERROR_MESSAGE_NAME) == LLMessageConfig::TEMPLATE_FLAVOR) { - S32 msg_size = temp.size() + mMessageBuilder->getMessageSize(); + S32 msg_size = static_cast(temp.size()) + mMessageBuilder->getMessageSize(); if(msg_size >= ETHERNET_MTU_BYTES) { pack_data = false; @@ -2191,7 +2191,7 @@ S32 LLMessageSystem::sendError( } if(pack_data) { - addBinaryData("Data", (void*)temp.c_str(), temp.size()); + addBinaryData("Data", (void*)temp.c_str(), static_cast(temp.size())); } else { diff --git a/indra/llplugin/llpluginmessagepipe.cpp b/indra/llplugin/llpluginmessagepipe.cpp index 2cbc16ceec..085afc0944 100644 --- a/indra/llplugin/llpluginmessagepipe.cpp +++ b/indra/llplugin/llpluginmessagepipe.cpp @@ -371,7 +371,7 @@ bool LLPluginMessagePipe::pumpInput(F64 timeout) void LLPluginMessagePipe::processInput(void) { // Look for input delimiter(s) in the input buffer. - int delim; + size_t delim; mInputMutex.lock(); while((delim = mInput.find(MESSAGE_DELIMITER)) != std::string::npos) { diff --git a/indra/llplugin/llpluginsharedmemory.cpp b/indra/llplugin/llpluginsharedmemory.cpp index a10d251069..28a0f0bf4e 100644 --- a/indra/llplugin/llpluginsharedmemory.cpp +++ b/indra/llplugin/llpluginsharedmemory.cpp @@ -450,7 +450,7 @@ bool LLPluginSharedMemory::create(size_t size) NULL, // default security PAGE_READWRITE, // read/write access 0, // max. object size - mSize, // buffer size + static_cast(mSize), // buffer size mName.c_str()); // name of mapping object if(mImpl->mMapFile == NULL) diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index c5918967e1..4821878ca3 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -306,7 +306,7 @@ LLModel::EModelStatus load_face_from_dom_triangles( // Don't share verts within the same tri, degenerate // - U32 indx_size = indices.size(); + U32 indx_size = static_cast(indices.size()); U32 verts_new_tri = indx_size % 3; if ((verts_new_tri < 1 || indices[indx_size - 1] != shared_index) && (verts_new_tri < 2 || indices[indx_size - 2] != shared_index)) @@ -780,7 +780,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector& fac { //for each vertex if (j > 2) { - U32 size = verts.size(); + auto size = verts.size(); LLVolumeFace::VertexData v0 = verts[size-3]; LLVolumeFace::VertexData v1 = verts[size-1]; @@ -1162,7 +1162,7 @@ bool LLDAELoader::OpenFile(const std::string& filename) while (model_iter != mModelList.end()) { LLModel* mdl = *model_iter; - U32 material_count = mdl->mMaterialList.size(); + U32 material_count = static_cast(mdl->mMaterialList.size()); LL_INFOS() << "Importing " << mdl->mLabel << " model with " << material_count << " material references" << LL_ENDL; std::vector::iterator mat_iter = mdl->mMaterialList.begin(); std::vector::iterator end_iter = material_count > LIMIT_MATERIALS_OUTPUT @@ -1351,11 +1351,11 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do { //Get the children at this level daeTArray< daeSmartRef > children = pScene->getChildren(); - S32 childCount = children.getCount(); + auto childCount = children.getCount(); //Process any children that are joints //Not all children are joints, some could be ambient lights, cameras, geometry etc.. - for (S32 i = 0; i < childCount; ++i) + for (size_t i = 0; i < childCount; ++i) { domNode* pNode = daeSafeCast(children[i]); if (pNode) @@ -1376,7 +1376,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do if ( pSkeletonRootNode ) { //Once we have the root node - start acccessing it's joint components - const int jointCnt = mJointMap.size(); + const int jointCnt = static_cast(mJointMap.size()); JointMap :: const_iterator jointIt = mJointMap.begin(); //Loop over all the possible joints within the .dae - using the allowed joint list in the ctor. @@ -1523,9 +1523,9 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do if (t) { domListOfFloats& transform = t->getValue(); - S32 count = transform.getCount()/16; + auto count = transform.getCount()/16; - for (S32 k = 0; k < count; ++k) + for (size_t k = 0; k < count; ++k) { LLMatrix4 mat; @@ -1611,7 +1611,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do std::vector ::const_iterator jointIt = jointNames.begin(); // - const int jointCnt = model->mSkinInfo.mJointNames.size(); + const int jointCnt = static_cast(model->mSkinInfo.mJointNames.size()); for ( int i=0; imSkinInfo.mAlternateBindMatrix.size(); + auto bind_count = model->mSkinInfo.mAlternateBindMatrix.size(); if (bind_count > 0 && bind_count != jointCnt) { LL_WARNS("Mesh") << "Model " << model->mLabel << " has invalid joint bind matrix list." << LL_ENDL; @@ -1779,8 +1779,8 @@ void LLDAELoader::buildJointToNodeMappingFromScene( daeElement* pRoot ) if ( pScene ) { daeTArray< daeSmartRef > children = pScene->getChildren(); - S32 childCount = children.getCount(); - for (S32 i = 0; i < childCount; ++i) + auto childCount = children.getCount(); + for (size_t i = 0; i < childCount; ++i) { domNode* pNode = daeSafeCast(children[i]); processJointToNodeMapping( pNode ); @@ -1825,8 +1825,8 @@ void LLDAELoader::processJointToNodeMapping( domNode* pNode ) void LLDAELoader::processChildJoints( domNode* pParentNode ) { daeTArray< daeSmartRef > childOfChild = pParentNode->getChildren(); - S32 childOfChildCount = childOfChild.getCount(); - for (S32 i = 0; i < childOfChildCount; ++i) + auto childOfChildCount = childOfChild.getCount(); + for (size_t i = 0; i < childOfChildCount; ++i) { domNode* pChildNode = daeSafeCast( childOfChild[i] ); if ( pChildNode ) @@ -1927,7 +1927,7 @@ bool LLDAELoader::verifyController( domController* pController ) { sum += pVertexWeights->getVcount()->getValue()[i]; } - result = verifyCount( sum * inputs.getCount(), (domInt) pVertexWeights->getV()->getValue().getCount() ); + result = verifyCount( sum * static_cast(inputs.getCount()), (domInt) static_cast(pVertexWeights->getV()->getValue().getCount()) ); } } @@ -2060,9 +2060,9 @@ void LLDAELoader::processJointNode( domNode* pNode, JointTransformMap& jointTran //Gather and handle the incoming nodes children daeTArray< daeSmartRef > childOfChild = pNode->getChildren(); - S32 childOfChildCount = childOfChild.getCount(); + auto childOfChildCount = childOfChild.getCount(); - for (S32 i = 0; i < childOfChildCount; ++i) + for (size_t i = 0; i < childOfChildCount; ++i) { domNode* pChildNode = daeSafeCast( childOfChild[i] ); if ( pChildNode ) @@ -2281,8 +2281,8 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da //process children daeTArray< daeSmartRef > children = element->getChildren(); - int childCount = children.getCount(); - for (S32 i = 0; i < childCount; i++) + auto childCount = children.getCount(); + for (size_t i = 0; i < childCount; i++) { processElement(children[i],badElement, dae); } @@ -2713,7 +2713,7 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector& mo ret->remapVolumeFaces(); } - volume_faces = remainder.size(); + volume_faces = static_cast(remainder.size()); models_out.push_back(ret); diff --git a/indra/llprimitive/llgltfloader.cpp b/indra/llprimitive/llgltfloader.cpp index 810b648f17..776f81cc01 100644 --- a/indra/llprimitive/llgltfloader.cpp +++ b/indra/llprimitive/llgltfloader.cpp @@ -231,7 +231,7 @@ bool LLGLTFLoader::parseMaterials() image.numChannels = in_image.component; image.bytesPerChannel = in_image.bits >> 3; // Convert bits to bytes image.pixelType = in_image.pixel_type; // Maps exactly, i.e. TINYGLTF_COMPONENT_TYPE_UNSIGNED_BYTE == GL_UNSIGNED_BYTE, etc - image.size = in_image.image.size(); + image.size = static_cast(in_image.image.size()); image.height = in_image.height; image.width = in_image.width; image.data = in_image.image.data(); diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index 12af568b7e..dd4ab82abc 100644 --- a/indra/llprimitive/llgltfmaterial.cpp +++ b/indra/llprimitive/llgltfmaterial.cpp @@ -180,7 +180,7 @@ bool LLGLTFMaterial::fromJSON(const std::string& json, std::string& warn_msg, st tinygltf::Model model_in; - if (gltf.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, json.c_str(), json.length(), "")) + if (gltf.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, json.c_str(), static_cast(json.length()), "")) { setFromModel(model_in, 0); diff --git a/indra/llprimitive/llgltfmaterial_templates.h b/indra/llprimitive/llgltfmaterial_templates.h index 276cc71b19..4ec7f312af 100644 --- a/indra/llprimitive/llgltfmaterial_templates.h +++ b/indra/llprimitive/llgltfmaterial_templates.h @@ -87,12 +87,12 @@ void LLGLTFMaterial::setFromTexture(const tinygltf::Model& model, const T& textu template void LLGLTFMaterial::allocateTextureImage(tinygltf::Model& model, T& texture_info, const std::string& uri) { - const S32 image_idx = model.images.size(); + const S32 image_idx = static_cast(model.images.size()); model.images.emplace_back(); model.images[image_idx].uri = uri; // The texture, not to be confused with the texture info - const S32 texture_idx = model.textures.size(); + const S32 texture_idx = static_cast(model.textures.size()); model.textures.emplace_back(); tinygltf::Texture& texture = model.textures[texture_idx]; texture.source = image_idx; diff --git a/indra/llprimitive/llmediaentry.cpp b/indra/llprimitive/llmediaentry.cpp index e626a989f6..b5b17c53aa 100644 --- a/indra/llprimitive/llmediaentry.cpp +++ b/indra/llprimitive/llmediaentry.cpp @@ -353,7 +353,7 @@ U32 LLMediaEntry::setWhiteList( const std::vector &whitelist ) { // *NOTE: This code is VERY similar to the setWhitelist below. // IF YOU CHANGE THIS IMPLEMENTATION, BE SURE TO CHANGE THE OTHER! - U32 size = 0; + size_t size = 0; U32 count = 0; // First count to make sure the size constraint is not violated std::vector::const_iterator iter = whitelist.begin(); @@ -394,7 +394,7 @@ U32 LLMediaEntry::setWhiteList( const LLSD &whitelist ) { // *NOTE: This code is VERY similar to the setWhitelist above. // IF YOU CHANGE THIS IMPLEMENTATION, BE SURE TO CHANGE THE OTHER! - U32 size = 0; + size_t size = 0; U32 count = 0; // First check to make sure the size and count constraints are not violated LLSD::array_const_iterator iter = whitelist.beginArray(); diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index d721aa63c8..5beec014ab 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -933,7 +933,7 @@ LLSD LLModel::writeModel( //copy ostr to binary buffer std::string data = ostr.str(); const U8* buff = (U8*)data.data(); - U32 bytes = data.size(); + U32 bytes = static_cast(data.size()); LLSD::Binary w(bytes); for (U32 j = 0; j < bytes; ++j) @@ -980,7 +980,7 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, bool nowrite, bo { //write out skin block skin = zip_llsd(mdl["skin"]); - U32 size = skin.size(); + U32 size = static_cast(skin.size()); if (size > 0) { header["skin"]["offset"] = (LLSD::Integer) cur_offset; @@ -995,7 +995,7 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, bool nowrite, bo { //write out convex decomposition decomposition = zip_llsd(mdl["physics_convex"]); - U32 size = decomposition.size(); + U32 size = static_cast(decomposition.size()); if (size > 0) { header["physics_convex"]["offset"] = (LLSD::Integer) cur_offset; @@ -1017,7 +1017,7 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, bool nowrite, bo { out[i] = zip_llsd(mdl[model_names[i]]); - U32 size = out[i].size(); + U32 size = static_cast(out[i].size()); header[model_names[i]]["offset"] = (LLSD::Integer) cur_offset; header[model_names[i]]["size"] = (LLSD::Integer) size; @@ -1177,7 +1177,7 @@ void LLModel::updateHullCenters() mCenterOfHullCenters += cur_center; cur_center *= 1.f/mPhysics.mHull[i].size(); mHullCenter[i] = cur_center; - mHullPoints += mPhysics.mHull[i].size(); + mHullPoints += static_cast(mPhysics.mHull[i].size()); } if (mHullPoints > 0) @@ -1298,8 +1298,8 @@ bool LLModel::loadModel(std::istream& is) bool LLModel::isMaterialListSubset( LLModel* ref ) { - int refCnt = ref->mMaterialList.size(); - int modelCnt = mMaterialList.size(); + auto refCnt = ref->mMaterialList.size(); + auto modelCnt = mMaterialList.size(); // FIRE-30965 Cleanup braindead mesh parsing error handlers if(modelCnt > refCnt) { @@ -1307,11 +1307,11 @@ bool LLModel::isMaterialListSubset( LLModel* ref ) return false; } // - for (U32 src = 0; src < modelCnt; ++src) + for (size_t src = 0; src < modelCnt; ++src) { bool foundRef = false; - for (U32 dst = 0; dst < refCnt; ++dst) + for (size_t dst = 0; dst < refCnt; ++dst) { //LL_INFOS()<mMaterialList[dst]<mMaterialList[dst]; @@ -1665,18 +1665,18 @@ U32 LLMeshSkinInfo::sizeBytes() const { U32 res = sizeof(LLUUID); // mMeshID - res += sizeof(std::vector) + sizeof(std::string) * mJointNames.size(); + res += sizeof(std::vector) + sizeof(std::string) * static_cast(mJointNames.size()); for (U32 i = 0; i < mJointNames.size(); ++i) { // Query by JointKey rather than just a string, the key can be a U32 index for faster lookup - //res += mJointNames[i].size(); // actual size, not capacity - res += mJointNames[i].mName.size(); // actual size, not capacity + //res += static_cast(mJointNames[i].size()); // actual size, not capacity + res += static_cast(mJointNames[i].mName.size()); // actual size, not capacity // } - res += sizeof(std::vector) + sizeof(S32) * mJointNums.size(); - res += sizeof(std::vector) + 16 * sizeof(float) * mInvBindMatrix.size(); - res += sizeof(std::vector) + 16 * sizeof(float) * mAlternateBindMatrix.size(); + res += sizeof(std::vector) + sizeof(S32) * static_cast(mJointNums.size()); + res += sizeof(std::vector) + 16 * sizeof(float) * static_cast(mInvBindMatrix.size()); + res += sizeof(std::vector) + 16 * sizeof(float) * static_cast(mAlternateBindMatrix.size()); res += 16 * sizeof(float); //mBindShapeMatrix res += sizeof(float) + 3 * sizeof(bool); @@ -1793,15 +1793,15 @@ U32 LLModel::Decomposition::sizeBytes() const { U32 res = sizeof(LLUUID); // mMeshID - res += sizeof(LLModel::convex_hull_decomposition) + sizeof(std::vector) * mHull.size(); + res += sizeof(LLModel::convex_hull_decomposition) + sizeof(std::vector) * static_cast(mHull.size()); for (U32 i = 0; i < mHull.size(); ++i) { - res += mHull[i].size() * sizeof(LLVector3); + res += static_cast(mHull[i].size()) * sizeof(LLVector3); } - res += sizeof(LLModel::hull) + sizeof(LLVector3) * mBaseHull.size(); + res += sizeof(LLModel::hull) + sizeof(LLVector3) * static_cast(mBaseHull.size()); - res += sizeof(std::vector) + sizeof(std::vector) * mMesh.size(); + res += sizeof(std::vector) + sizeof(std::vector) * static_cast(mMesh.size()); for (U32 i = 0; i < mMesh.size(); ++i) { res += mMesh[i].sizeBytes(); @@ -1852,7 +1852,7 @@ LLSD LLModel::Decomposition::asLLSD() const for (U32 i = 0; i < mHull.size(); ++i) { - U32 size = mHull[i].size(); + U32 size = static_cast(mHull[i].size()); total += size; hulls[i] = (U8) (size); diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 02c10b7e77..9a0f72454f 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -127,8 +127,8 @@ public: U32 sizeBytes() const { U32 res = sizeof(std::vector) * 2; - res += sizeof(LLVector3) * mPositions.size(); - res += sizeof(LLVector3) * mNormals.size(); + res += sizeof(LLVector3) * static_cast(mPositions.size()); + res += sizeof(LLVector3) * static_cast(mNormals.size()); return res; } }; @@ -362,7 +362,7 @@ public: protected: LLUUID mDiffuseMapID; - void* mOpaqueData; // allow refs to viewer/platform-specific structs for each material + void* mOpaqueData{ nullptr }; // allow refs to viewer/platform-specific structs for each material // currently only stores an LLPointer< LLViewerFetchedTexture > > to // maintain refs to textures associated with each material for free // ref counting. diff --git a/indra/llprimitive/llprimtexturelist.cpp b/indra/llprimitive/llprimtexturelist.cpp index 44d99a95a9..2584466a43 100644 --- a/indra/llprimitive/llprimtexturelist.cpp +++ b/indra/llprimitive/llprimtexturelist.cpp @@ -83,13 +83,13 @@ void LLPrimTextureList::clear() void LLPrimTextureList::copy(const LLPrimTextureList& other_list) { // compare the sizes - S32 this_size = mEntryList.size(); - S32 other_size = other_list.mEntryList.size(); + auto this_size = mEntryList.size(); + auto other_size = other_list.mEntryList.size(); if (this_size > other_size) { // remove the extra entries - for (S32 index = this_size; index > other_size; --index) + for (size_t index = this_size; index > other_size; --index) { delete mEntryList[index-1]; } @@ -97,18 +97,18 @@ void LLPrimTextureList::copy(const LLPrimTextureList& other_list) this_size = other_size; } - S32 index = 0; + size_t index = 0; // copy for the entries that already exist for ( ; index < this_size; ++index) { delete mEntryList[index]; - mEntryList[index] = other_list.getTexture(index)->newCopy(); + mEntryList[index] = other_list.getTexture(static_cast(index))->newCopy(); } // add new entires if needed for ( ; index < other_size; ++index) { - mEntryList.push_back( other_list.getTexture(index)->newCopy() ); + mEntryList.push_back( other_list.getTexture(static_cast(index))->newCopy()); } } @@ -127,9 +127,9 @@ void LLPrimTextureList::take(LLPrimTextureList& other_list) // returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry& te) { - if (S32(index) >= mEntryList.size()) + if (size_t(index) >= mEntryList.size()) { - S32 current_size = mEntryList.size(); + auto current_size = mEntryList.size(); LL_WARNS() << "ignore copy of index = " << S32(index) << " into texture entry list of size = " << current_size << LL_ENDL; return TEM_CHANGE_NONE; } @@ -394,7 +394,7 @@ LLMaterialPtr LLPrimTextureList::getMaterialParams(const U8 index) S32 LLPrimTextureList::size() const { - return mEntryList.size(); + return static_cast(mEntryList.size()); } // sets the size of the mEntryList container @@ -405,12 +405,12 @@ void LLPrimTextureList::setSize(S32 new_size) new_size = 0; } - S32 current_size = mEntryList.size(); + auto current_size = mEntryList.size(); if (new_size > current_size) { mEntryList.resize(new_size); - for (S32 index = current_size; index < new_size; ++index) + for (size_t index = current_size; index < new_size; ++index) { if (current_size > 0 && mEntryList[current_size - 1]) @@ -428,7 +428,7 @@ void LLPrimTextureList::setSize(S32 new_size) } else if (new_size < current_size) { - for (S32 index = current_size-1; index >= new_size; --index) + for (size_t index = current_size-1; index >= new_size; --index) { delete mEntryList[index]; } diff --git a/indra/llprimitive/tests/llprimitive_test.cpp b/indra/llprimitive/tests/llprimitive_test.cpp index 60960067d0..0213a3e8b6 100644 --- a/indra/llprimitive/tests/llprimitive_test.cpp +++ b/indra/llprimitive/tests/llprimitive_test.cpp @@ -109,7 +109,7 @@ void LLPrimTextureList::take(LLPrimTextureList &other_list) { } void LLPrimTextureList::setSize(S32 new_size) { mEntryList.resize(new_size); } void LLPrimTextureList::setAllIDs(const LLUUID &id) { } LLTextureEntry * LLPrimTextureList::getTexture(const U8 index) const { return nullptr; } -S32 LLPrimTextureList::size() const { return mEntryList.size(); } +S32 LLPrimTextureList::size() const { return static_cast(mEntryList.size()); } class PRIMITIVE_TEST_SETUP { diff --git a/indra/llrender/llfontbitmapcache.cpp b/indra/llrender/llfontbitmapcache.cpp index d2c40ad590..46c2e89797 100644 --- a/indra/llrender/llfontbitmapcache.cpp +++ b/indra/llrender/llfontbitmapcache.cpp @@ -108,7 +108,7 @@ bool LLFontBitmapCache::nextOpenPos(S32 width, S32& pos_x, S32& pos_y, EFontGlyp S32 num_components = getNumComponents(bitmap_type); mImageRawVec[bitmap_idx].push_back(new LLImageRaw(mBitmapWidth, mBitmapHeight, num_components)); - bitmap_num = mImageRawVec[bitmap_idx].size() - 1; + bitmap_num = static_cast(mImageRawVec[bitmap_idx].size()) - 1; LLImageRaw* image_raw = getImageRaw(bitmap_type, bitmap_num); if (EFontGlyphType::Grayscale == bitmap_type) diff --git a/indra/llrender/llfontbitmapcache.h b/indra/llrender/llfontbitmapcache.h index 6b19ba2154..f2dfd87877 100644 --- a/indra/llrender/llfontbitmapcache.h +++ b/indra/llrender/llfontbitmapcache.h @@ -60,7 +60,7 @@ public: LLImageGL* getImageGL(EFontGlyphType bitmapType, U32 bitmapNum) const; S32 getMaxCharWidth() const { return mMaxCharWidth; } - U32 getNumBitmaps(EFontGlyphType bitmapType) const { return (bitmapType < EFontGlyphType::Count) ? mImageRawVec[static_cast(bitmapType)].size() : 0; } + U32 getNumBitmaps(EFontGlyphType bitmapType) const { return (bitmapType < EFontGlyphType::Count) ? static_cast(mImageRawVec[static_cast(bitmapType)].size()) : 0U; } S32 getBitmapWidth() const { return mBitmapWidth; } S32 getBitmapHeight() const { return mBitmapHeight; } diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index 0039d38b10..0b46dc8632 100644 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -382,7 +382,7 @@ S32 LLFontFreetype::ftOpenFace(const std::string& filename, S32 face_n) pFtStream = new LLFT_Stream(); pFtStream->base = 0; pFtStream->pos = 0; - pFtStream->size = file_size; + pFtStream->size = static_cast(file_size); pFtStream->descriptor.pointer = pFileStream; pFtStream->read = ft_read_cb; pFtStream->close = ft_close_cb; diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 729fb00aad..2f69f6633f 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -149,7 +149,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons if(!sDisplayFont) //do not display texts { - return wstr.length() ; + return static_cast(wstr.length()); } if (wstr.empty()) diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 2490268cf9..2c12220477 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -621,7 +621,7 @@ bool LLGLSLShader::mapAttributes(const std::vector* attrib } mAttribute.clear(); - U32 numAttributes = (attributes == NULL) ? 0 : attributes->size(); + U32 numAttributes = (attributes == NULL) ? 0U : static_cast(attributes->size()); #if LL_RELEASE_WITH_DEBUG_INFO mAttribute.resize(LLShaderMgr::instance()->mReservedAttribs.size() + numAttributes, { -1, NULL }); #else @@ -843,7 +843,7 @@ bool LLGLSLShader::mapUniforms(const vector* uniforms) mTexture.clear(); mValue.clear(); //initialize arrays - U32 numUniforms = (uniforms == NULL) ? 0 : uniforms->size(); + U32 numUniforms = (uniforms == NULL) ? 0U : static_cast(uniforms->size()); mUniform.resize(numUniforms + LLShaderMgr::instance()->mReservedUniforms.size(), -1); mTexture.resize(numUniforms + LLShaderMgr::instance()->mReservedUniforms.size(), -1); diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 95e8f1168a..698da92877 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -68,8 +68,8 @@ public: template struct UniformSetting { - S32 mUniform; - T mValue; + S32 mUniform{ 0 }; + T mValue{}; }; typedef UniformSetting IntSetting; diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 62167888c6..85a710d55c 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -208,7 +208,7 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt) return true; } - U32 offset = mTex.size(); + U32 offset = static_cast(mTex.size()); if( offset >= 4 ) { @@ -378,11 +378,11 @@ void LLRenderTarget::release() if (mFBO && (mTex.size() > 1)) { glBindFramebuffer(GL_FRAMEBUFFER, mFBO); - S32 z; + size_t z; for (z = mTex.size() - 1; z >= 1; z--) { sBytesAllocated -= mResX*mResY*4; - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+z, LLTexUnit::getInternalType(mUsage), 0, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, static_cast(GL_COLOR_ATTACHMENT0+z), LLTexUnit::getInternalType(mUsage), 0, 0); LLImageGL::deleteTextures(1, &mTex[z]); } glBindFramebuffer(GL_FRAMEBUFFER, sCurFBO); @@ -426,7 +426,7 @@ void LLRenderTarget::bindTarget() GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3}; - glDrawBuffers(mTex.size(), drawbuffers); + glDrawBuffers(static_cast(mTex.size()), drawbuffers); if (mTex.empty()) { //no color buffer to draw to @@ -485,7 +485,7 @@ U32 LLRenderTarget::getTexture(U32 attachment) const U32 LLRenderTarget::getNumTextures() const { - return mTex.size(); + return static_cast(mTex.size()); } void LLRenderTarget::bindTexture(U32 index, S32 channel, LLTexUnit::eTextureFilterOptions filter_options) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 464eb00153..655fd96e33 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1102,7 +1102,7 @@ bool LLShaderMgr::saveCachedProgramBinary(LLGLSLShader* shader) program_binary.resize(binary_info.mBinaryLength); GLenum error = glGetError(); // Clear current error - glGetProgramBinary(shader->mProgramObject, program_binary.size() * sizeof(U8), nullptr, &binary_info.mBinaryFormat, program_binary.data()); + glGetProgramBinary(shader->mProgramObject, static_cast(program_binary.size() * sizeof(U8)), nullptr, &binary_info.mBinaryFormat, program_binary.data()); error = glGetError(); if (error == GL_NO_ERROR) { diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index f0eab7bbd3..9076f54795 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -495,7 +495,7 @@ void LLAccordionCtrl::arrangeMultiple() if (mFitParent) { // All expanded tabs will have equal height - panel_height = calcExpandedTabHeight(i, panel_top); + panel_height = calcExpandedTabHeight(static_cast(i), panel_top); ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, panel_height); // Try to make accordion tab fit accordion view height. diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 5132d33bbf..64896ccfcb 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -73,7 +73,7 @@ bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType typ if (LLAssetType::lookupIsAssetIDKnowable(type)) { LLWString source = utf8str_to_wstring(src.asString()); - res = addToClipboard(source, 0, source.size()); + res = addToClipboard(source, 0, static_cast(source.size())); } if (res) { @@ -87,13 +87,13 @@ bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType typ bool LLClipboard::pasteFromClipboard(std::vector& inv_objects) const { bool res = false; - S32 count = mObjects.size(); + auto count = mObjects.size(); inv_objects.reserve(inv_objects.size() + count); if (count > 0) { res = true; inv_objects.clear(); - for (S32 i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) { inv_objects.push_back(mObjects[i]); } diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 301572e273..36c17b566a 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -1023,7 +1023,7 @@ void LLComboBox::updateSelection() LLWString selected_item = utf8str_to_wstring(getSelectedItemLabel()); LLWString wtext = left_wstring + selected_item.substr(left_wstring.size(), selected_item.size()); mTextEntry->setText(wstring_to_utf8str(wtext)); - mTextEntry->setSelection(left_wstring.size(), mTextEntry->getWText().size()); + mTextEntry->setSelection(static_cast(left_wstring.size()), static_cast(mTextEntry->getWText().size())); mTextEntry->endSelection(); mTextEntry->setTentative(false); mHasAutocompletedText = true; @@ -1034,7 +1034,7 @@ void LLComboBox::updateSelection() { LLWString selected_item = utf8str_to_wstring(getSelectedItemLabel()); mTextEntry->setText(wstring_to_utf8str(left_wstring) + " (" + getSelectedItemLabel() + ")"); - mTextEntry->setSelection(left_wstring.size(), mTextEntry->getWText().size()); + mTextEntry->setSelection(static_cast(left_wstring.size()), static_cast(mTextEntry->getWText().size())); mTextEntry->endSelection(); mTextEntry->setTentative(false); mHasAutocompletedText = true; diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 7b6859c785..3ef52eb26d 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -111,7 +111,7 @@ LLCommandManager::~LLCommandManager() U32 LLCommandManager::commandCount() const { - return mCommands.size(); + return static_cast(mCommands.size()); } LLCommand * LLCommandManager::getCommand(U32 commandIndex) diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 46359a02a3..59e6adf73a 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -214,7 +214,7 @@ protected: void addCommand(LLCommand * command); private: - typedef std::map CommandIndexMap; + typedef std::map CommandIndexMap; typedef std::vector CommandVector; CommandVector mCommands; diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index 44a1ba37f0..c4bd1acd83 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -180,11 +180,11 @@ void LLConsole::draw() { // This is done in update() if session support is enabled // - U32 num_lines=0; + size_t num_lines{ 0 }; paragraph_t::reverse_iterator paragraph_it; paragraph_it = mParagraphs.rbegin(); - U32 paragraph_num=mParagraphs.size(); + auto paragraph_num=mParagraphs.size(); while (!mParagraphs.empty() && paragraph_it != mParagraphs.rend()) { @@ -192,7 +192,7 @@ void LLConsole::draw() if(num_lines > mMaxLines || ( (mLinePersistTime > (F32)0.f) && ((*paragraph_it).mAddTime - skip_time)/(mLinePersistTime - mFadeTime) <= (F32)0.f)) { //All lines above here are done. Lose them. - for (U32 i=0;i(color_str.length()); mParagraphColorSegments.push_back(color_segment); } @@ -597,14 +597,14 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, const LLFontGL* font, L // skip_chars = 0; //} - //U32 drawable = font->maxDrawableChars(mParagraphText.c_str()+paragraph_offset, screen_width, line_end - paragraph_offset, LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + //U32 drawable = font->maxDrawableChars(mParagraphText.c_str()+paragraph_offset, screen_width, static_cast(line_end) - paragraph_offset, LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); if (line_end == LLWString::npos) { line_end = mParagraphText.size(); } S32 skip_chars = 0; // skip '\n' - U32 line_length = line_end - paragraph_offset; + S32 line_length = static_cast(line_end) - paragraph_offset; U32 drawable = font->maxDrawableChars(mParagraphText.c_str()+paragraph_offset, screen_width, line_length, LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); // diff --git a/indra/llui/llemojidictionary.cpp b/indra/llui/llemojidictionary.cpp index f16c38a11a..925608e47e 100644 --- a/indra/llui/llemojidictionary.cpp +++ b/indra/llui/llemojidictionary.cpp @@ -210,7 +210,7 @@ void LLEmojiDictionary::findByShortCode( std::size_t begin, end; if (searchInShortCode(begin, end, shortCode, needle)) { - results[begin].emplace_back(d.Character, shortCode, begin, end); + results[static_cast(begin)].emplace_back(d.Character, shortCode, begin, end); } } } diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index f3f132bb74..64cc55823d 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -399,7 +399,7 @@ U32 LLFlatListView::size(const bool only_visible_items) const } else { - return mItemPairs.size(); + return static_cast(mItemPairs.size()); } } @@ -573,7 +573,7 @@ void LLFlatListView::rearrangeItems() } // add paddings between items, excluding invisible ones - height += mItemPad * (mItemPairs.size() - invisible_children_count - 1); + height += mItemPad * (static_cast(mItemPairs.size()) - invisible_children_count - 1); LLRect rc = mItemsPanel->getRect(); S32 width = mItemsNoScrollWidth; diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 0e1d00681e..7010c6a6ad 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -272,7 +272,7 @@ public: void setCommitOnSelectionChange(bool b) { mCommitOnSelectionChange = b; } /** Get number of selected items in the list */ - U32 numSelected() const {return mSelectedItemPairs.size(); } + U32 numSelected() const {return static_cast(mSelectedItemPairs.size()); } /** Get number of (visible) items in the list */ U32 size(const bool only_visible_items = true) const; diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index e00a9295ea..cd43dd032f 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -778,7 +778,7 @@ void LLFolderView::removeSelectedItems() // items, since the removal will futz with internal data // structures. std::vector items; - S32 count = mSelectedItems.size(); + auto count = mSelectedItems.size(); if(count <= 0) return; LLFolderViewItem* item = NULL; selected_items_t::iterator item_it; @@ -823,7 +823,7 @@ void LLFolderView::removeSelectedItems() setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel.get()->hasFocus()); listeners.reserve(count); - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { listener = items[i]->getViewModelItem(); if(listener && (std::find(listeners.begin(), listeners.end(), listener) == listeners.end())) @@ -942,7 +942,7 @@ void LLFolderView::copy() { // *NOTE: total hack to clear the inventory clipboard LLClipboard::instance().reset(); - S32 count = mSelectedItems.size(); + auto count = mSelectedItems.size(); if(getVisible() && getEnabled() && (count > 0)) { LLFolderViewModelItem* listener = NULL; @@ -1096,7 +1096,7 @@ void LLFolderView::startRenamingSelectedItem( void ) // make sure selection is visible scrollToShowSelection(); - S32 count = mSelectedItems.size(); + auto count = mSelectedItems.size(); LLFolderViewItem* item = NULL; if(count > 0) { @@ -1353,7 +1353,7 @@ bool LLFolderView::handleKeyHere( KEY key, MASK mask ) // FIRE-19933: Open context menu on context menu key press case KEY_CONTEXT_MENU: - S32 count = mSelectedItems.size(); + auto count = mSelectedItems.size(); LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); if (( count > 0 && (hasVisibleChildren()) ) // show menu only if selected items are visible && menu ) @@ -1508,7 +1508,7 @@ bool LLFolderView::search(LLFolderViewItem* first_item, const std::string &searc std::string current_item_label(search_item->getViewModelItem()->getSearchableName()); LLStringUtil::toUpper(current_item_label); - S32 search_string_length = llmin(upper_case_string.size(), current_item_label.size()); + auto search_string_length = llmin(upper_case_string.size(), current_item_label.size()); if (!current_item_label.compare(0, search_string_length, upper_case_string)) { found = true; @@ -1548,7 +1548,7 @@ bool LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) mParentPanel.get()->setFocus(true); bool handled = childrenHandleRightMouseDown(x, y, mask) != NULL; - S32 count = mSelectedItems.size(); + auto count = mSelectedItems.size(); LLMenuGL* menu = static_cast(mPopupMenuHandle.get()); if (!menu) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index e1413dc73d..828e8b8350 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -1011,22 +1011,22 @@ void LLFolderViewItem::draw() return; } - std::string::size_type filter_string_length = mViewModelItem->hasFilterStringMatch() ? mViewModelItem->getFilterStringSize() : 0; + auto filter_string_length = mViewModelItem->hasFilterStringMatch() ? static_cast(mViewModelItem->getFilterStringSize()) : 0; F32 right_x = 0; F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; F32 text_left = (F32)getLabelXPos(); std::string combined_string = mLabel + mLabelSuffix; const LLFontGL* suffix_font = getLabelFontForStyle(LLFontGL::NORMAL); - S32 filter_offset = mViewModelItem->getFilterStringOffset(); + S32 filter_offset = static_cast(mViewModelItem->getFilterStringOffset()); if (filter_string_length > 0) { S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD); S32 top = getRect().getHeight() - TOP_PAD; if(mLabelSuffix.empty() || (font == suffix_font)) { - S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, mViewModelItem->getFilterStringOffset()) - 2; - S32 right = left + font->getWidth(combined_string, mViewModelItem->getFilterStringOffset(), filter_string_length) + 2; + S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, static_cast(mViewModelItem->getFilterStringOffset())) - 2; + S32 right = left + font->getWidth(combined_string, static_cast(mViewModelItem->getFilterStringOffset()), filter_string_length) + 2; LLUIImage* box_image = default_params.selection_image; LLRect box_rect(left, top, right, bottom); @@ -1047,7 +1047,7 @@ void LLFolderViewItem::draw() if(suffix_filter_length > 0) { S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size()); - S32 left = ll_round(text_left) + font->getWidthF32(mLabel, 0, mLabel.size()) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset) - 2; + S32 left = ll_round(text_left) + font->getWidthF32(mLabel, 0, static_cast(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset) - 2; S32 right = left + suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length) + 2; LLUIImage* box_image = default_params.selection_image; LLRect box_rect(left, top, right, bottom); @@ -1124,7 +1124,7 @@ void LLFolderViewItem::draw() if(suffix_filter_length > 0) { S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size()); - F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, mLabel.size()) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length); + F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, static_cast(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length); F32 yy = (F32)getRect().getHeight() - suffix_font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; suffix_font->renderUTF8(mLabelSuffix, suffix_offset, match_string_left, yy, sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index feddcc93cc..44ca0454e1 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -39,7 +39,7 @@ inline bool LLKeywordToken::isHead(const llwchar* s) const // strncmp is much faster than string compare bool res = true; const llwchar* t = mToken.c_str(); - S32 len = mToken.size(); + auto len = mToken.size(); for (S32 i=0; i* seg_list, const LLW return; } - S32 text_len = wtext.size() + 1; + S32 text_len = static_cast(wtext.size()) + 1; // Script editor ignoring font selection //seg_list->push_back( new LLNormalTextSegment( style, 0, text_len, editor ) ); @@ -750,23 +750,23 @@ void LLKeywords::insertSegments(const LLWString& wtext, std::vector Script editor ignoring font selection - //LLTextSegmentPtr text_segment = new LLNormalTextSegment( cur_token->getColor(), seg_start, pos, editor ); + //LLTextSegmentPtr text_segment = new LLNormalTextSegment( cur_token->getColor(), seg_start, static_cast(pos), editor ); LLStyleSP style = getDefaultStyle(editor); style->setColor(cur_token->getColor()); - LLTextSegmentPtr text_segment = new LLNormalTextSegment( style, seg_start, pos, editor ); + LLTextSegmentPtr text_segment = new LLNormalTextSegment( style, seg_start, static_cast(pos), editor ); // text_segment->setToken( cur_token ); insertSegment( seg_list, text_segment, text_len, style, editor); } // Script editor ignoring font selection - //LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, pos); - LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(getDefaultStyle(editor), pos); + //LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, static_cast(pos)); + LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(getDefaultStyle(editor), static_cast(pos)); // text_segment->setToken( cur_token ); insertSegment( seg_list, text_segment, text_len, style, editor); - seg_start = pos+1; + seg_start = static_cast(pos) + 1; pos = wtext.find('\n',seg_start); } diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 488381cbda..36620425b5 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -86,8 +86,8 @@ public: { } - S32 getLengthHead() const { return mToken.size(); } - S32 getLengthTail() const { return mDelimiter.size(); } + S32 getLengthHead() const { return static_cast(mToken.size()); } + S32 getLengthTail() const { return static_cast(mDelimiter.size()); } bool isHead(const llwchar* s) const; bool isTail(const llwchar* s) const; const LLWString& getToken() const { return mToken; } diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 1885212d75..754ac6d9c6 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -91,7 +91,7 @@ public: void addPanel(LLLayoutPanel* panel, EAnimate animate = NO_ANIMATE); void collapsePanel(LLPanel* panel, bool collapsed = true); - S32 getNumPanels() { return mPanels.size(); } + S32 getNumPanels() { return static_cast(mPanels.size()); } void updateLayout(); diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 4dc54b62a8..d23644fa6e 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -592,7 +592,7 @@ const std::string& LLLineEditor::getSuggestion(U32 index) const U32 LLLineEditor::getSuggestionCount() const { - return mSuggestionList.size(); + return static_cast(mSuggestionList.size()); } void LLLineEditor::replaceWithSuggestion(U32 index) @@ -1026,7 +1026,7 @@ void LLLineEditor::addChar(const llwchar uni_char) mText.erase(getCursor(), 1); } - S32 cur_bytes = mText.getString().size(); + S32 cur_bytes = static_cast(mText.getString().size()); S32 new_bytes = wchar_utf8_length(new_c); @@ -1039,7 +1039,7 @@ void LLLineEditor::addChar(const llwchar uni_char) } else if (mMaxLengthChars) { - S32 wide_chars = mText.getWString().size(); + auto wide_chars = mText.getWString().size(); if ((wide_chars + 1) > mMaxLengthChars) { allow_char = false; @@ -1385,7 +1385,7 @@ void LLLineEditor::pasteHelper(bool is_primary) if (mMaxLengthChars) { - U32 available_chars = mMaxLengthChars - mText.getWString().size(); + auto available_chars = mMaxLengthChars - mText.getWString().size(); if (available_chars < clean_string.size()) { @@ -2393,10 +2393,10 @@ bool LLLineEditor::postvalidateFloat(const std::string &str) LLWString trimmed = utf8str_to_wstring(str); LLWStringUtil::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if( 0 < len ) { - S32 i = 0; + size_t i = 0; // First character can be a negative sign if( '-' == trimmed[0] ) @@ -2453,7 +2453,7 @@ bool LLLineEditor::evaluateFloat() if (!success) { // Move the cursor to near the error on failure - setCursor(LLCalc::getInstance()->getLastErrorPos()); + setCursor(static_cast(LLCalc::getInstance()->getLastErrorPos())); // *TODO: Translated error message indicating the type of error? Select error text? } else @@ -2603,7 +2603,7 @@ void LLLineEditor::updatePreedit(const LLWString &preedit_string, if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) { mPreeditOverwrittenWString.assign( LLWString( mText, insert_preedit_at, mPreeditWString.length() ) ); - mText.erase(insert_preedit_at, mPreeditWString.length()); + mText.erase(insert_preedit_at, static_cast(mPreeditWString.length())); } else { diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index a3b8cc59df..d21c7127cc 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -198,7 +198,7 @@ LLMenuItemGL::LLMenuItemGL(const LLMenuItemGL::Params& p) { mAcceleratorMask |= MASK_SHIFT; } - S32 pipe_pos = shortcut.rfind("|"); + auto pipe_pos = shortcut.rfind("|"); std::string key_str = shortcut.substr(pipe_pos+1); LLKeyboard::keyFromString(key_str, &mAcceleratorKey); @@ -250,10 +250,10 @@ bool LLMenuItemGL::handleRightMouseDown(S32 x, S32 y, MASK mask) { // Holding CTRL & ALT while right clicking a menu entry will copy the menu // text and shortcut (accelerator) to the clipboard. The menu items action will not be called. - if( (MASK_CONTROL|MASK_ALT) == ((MASK_CONTROL|MASK_ALT) & mask) ) + if ((MASK_CONTROL|MASK_ALT) == ((MASK_CONTROL|MASK_ALT) & mask)) { - LLWString label = utf8string_to_wstring( getLabel() + ": " + mDrawAccelLabel.getString() ); - LLClipboard::instance().copyToClipboard( label, 0, label.size() ); + LLWString label = utf8string_to_wstring(getLabel() + ": " + mDrawAccelLabel.getString()); + LLClipboard::instance().copyToClipboard(label, 0, static_cast(label.size())); return false; } // @@ -566,8 +566,8 @@ void LLMenuItemGL::draw( void ) std::string::size_type offset = upper_case_label.find(mJumpKey); if (offset != std::string::npos) { - S32 x_begin = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, offset); - S32 x_end = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, offset + 1); + S32 x_begin = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, static_cast(offset)); + S32 x_end = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, static_cast(offset) + 1); gl_line_2d(x_begin, (MENU_ITEM_PADDING / 2) + 1, x_end, (MENU_ITEM_PADDING / 2) + 1); } } @@ -1672,8 +1672,8 @@ void LLMenuItemBranchDownGL::draw( void ) if (offset != std::string::npos) { S32 x_offset = ll_round((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getString(), 0, S32_MAX) / 2.f); - S32 x_begin = x_offset + getFont()->getWidth(mLabel, 0, offset); - S32 x_end = x_offset + getFont()->getWidth(mLabel, 0, offset + 1); + S32 x_begin = x_offset + getFont()->getWidth(mLabel, 0, static_cast(offset)); + S32 x_end = x_offset + getFont()->getWidth(mLabel, 0, static_cast(offset) + 1); gl_line_2d(x_begin, LABEL_BOTTOM_PAD_PIXELS, x_end, LABEL_BOTTOM_PAD_PIXELS); } } @@ -2091,7 +2091,7 @@ bool LLMenuGL::scrollItems(EScrollingDirection direction) // Otherwise viewer will hang for a time needed to scroll U32_MAX // times in std::advance(). STORM-659. size_t nitems = mItems.size(); - U32 scrollable_items = nitems < mMaxScrollableItems ? nitems : mMaxScrollableItems; + U32 scrollable_items = nitems < mMaxScrollableItems ? static_cast(nitems) : mMaxScrollableItems; // Advance by mMaxScrollableItems back from the end of the list // to make the last item visible. @@ -2623,7 +2623,7 @@ void LLMenuGL::empty( void ) // erase group of items from menu void LLMenuGL::erase( S32 begin, S32 end, bool arrange/* = true*/) { - S32 items = mItems.size(); + auto items = mItems.size(); if ( items == 0 || begin >= end || begin < 0 || end > items ) { @@ -2842,7 +2842,7 @@ void LLMenuGL::setTornOff(bool torn_off) U32 LLMenuGL::getItemCount() { - return mItems.size(); + return static_cast(mItems.size()); } LLMenuItemGL* LLMenuGL::getItem(S32 number) diff --git a/indra/llui/llmodaldialog.h b/indra/llui/llmodaldialog.h index 58c253c3f4..177664dde4 100644 --- a/indra/llui/llmodaldialog.h +++ b/indra/llui/llmodaldialog.h @@ -66,7 +66,7 @@ public: static void onAppFocusLost(); static void onAppFocusGained(); - static S32 activeCount() { return sModalStack.size(); } + static S32 activeCount() { return static_cast(sModalStack.size()); } static void shutdownModals(); protected: diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 630e45dddb..b2bfc8bc84 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -118,7 +118,7 @@ public: /*virtual*/ void draw() override; S32 getMaxNumSliders() { return mMaxNumSliders; } - S32 getCurNumSliders() { return mValue.size(); } + S32 getCurNumSliders() { return static_cast(mValue.size()); } F32 getOverlapThreshold() { return mOverlapThreshold; } bool canAddSliders() { return mValue.size() < mMaxNumSliders; } diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 7f36b92e1e..7963977d29 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1208,7 +1208,7 @@ bool LLNotificationChannel::isEmpty() const S32 LLNotificationChannel::size() const { - return mItems.size(); + return static_cast(mItems.size()); } size_t LLNotificationChannel::size() diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index eb7bba9b33..4e2bd85e29 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -251,7 +251,7 @@ public: void fromLLSD(const LLSD& sd); LLSD asLLSD() const; - S32 getNumElements() { return mFormData.size(); } + S32 getNumElements() { return static_cast(mFormData.size()); } LLSD getElement(S32 index) { return mFormData.get(index); } LLSD getElement(const std::string& element_name); void getElements(LLSD& elements, S32 offset = 0); diff --git a/indra/llui/llradiogroup.h b/indra/llui/llradiogroup.h index 810830ffa4..a24a7c86b2 100644 --- a/indra/llui/llradiogroup.h +++ b/indra/llui/llradiogroup.h @@ -87,7 +87,7 @@ public: LLCtrlSelectionInterface* getSelectionInterface() { return (LLCtrlSelectionInterface*)this; }; // LLCtrlSelectionInterface functions - /*virtual*/ S32 getItemCount() const { return mRadioButtons.size(); } + /*virtual*/ S32 getItemCount() const { return static_cast(mRadioButtons.size()); } /*virtual*/ bool getCanSelect() const { return true; } /*virtual*/ bool selectFirstItem() { return setSelectedIndex(0); } /*virtual*/ bool selectNthItem( S32 index ) { return setSelectedIndex(index); } diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp index 540e3abca8..5d4423543e 100644 --- a/indra/llui/llresmgr.cpp +++ b/indra/llui/llresmgr.cpp @@ -140,7 +140,7 @@ std::string LLResMgr::getMonetaryString( S32 input ) const S32 output_pos = 0; cur_group = 0; - S32 pos = digits.size()-1; + S32 pos = static_cast(digits.size()) - 1; S32 count_within_group = 0; while( (pos >= 0) && (groupings[cur_group] >= 0) ) { diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 2ddc40e01b..b71e5aa897 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -457,7 +457,7 @@ S32 LLScrollListCtrl::getItemCount() const } // Fix for FS-specific people list (radar) - return mItemList.size(); + return static_cast(mItemList.size()); } bool LLScrollListCtrl::hasSelectedItem() const @@ -1448,7 +1448,7 @@ bool LLScrollListCtrl::selectItemByStringMatch(const LLWString& target, bool pre bool found = false; LLWString target_trimmed( target ); - S32 target_len = target_trimmed.size(); + auto target_len = target_trimmed.size(); if( 0 == target_len ) { @@ -1511,8 +1511,8 @@ bool LLScrollListCtrl::selectItemByStringMatch(const LLWString& target, bool pre if (select) { // find offset of matching text (might have leading whitespace) - S32 offset = item_label.find(target_trimmed); - cellp->highlightText(offset, target_trimmed.size()); + auto offset = item_label.find(target_trimmed); + cellp->highlightText(static_cast(offset), static_cast(target_trimmed.size())); selectItem(item, -1); found = true; break; @@ -1538,7 +1538,7 @@ U32 LLScrollListCtrl::searchItems(const LLWString& substring, bool case_sensitiv U32 found = 0; LLWString substring_trimmed(substring); - S32 len = substring_trimmed.size(); + auto len = substring_trimmed.size(); if (0 == len) { @@ -1586,7 +1586,7 @@ U32 LLScrollListCtrl::searchItems(const LLWString& substring, bool case_sensitiv if (found_iter != std::string::npos) { // find offset of matching text - cellp->highlightText(found_iter, substring_trimmed.size()); + cellp->highlightText(static_cast(found_iter), static_cast(substring_trimmed.size())); selectItem(item, -1, false); found++; @@ -3315,7 +3315,7 @@ void LLScrollListCtrl::copy() { buffer += (*itor)->getContentsCSV() + "\n"; } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(buffer), 0, buffer.length()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(buffer), 0, static_cast(buffer.length())); } // virtual @@ -3399,7 +3399,7 @@ void LLScrollListCtrl::addColumn(const LLScrollListColumn::Params& column_params // Add column mColumns[name] = new LLScrollListColumn(column_params, this); LLScrollListColumn* new_column = mColumns[name]; - new_column->mIndex = mColumns.size()-1; + new_column->mIndex = static_cast(mColumns.size()) - 1; // Add button if (new_column->getWidth() > 0 || new_column->mRelWidth > 0 || new_column->mDynamicWidth) @@ -3646,7 +3646,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; if (!item_p.validateBlock() || !new_item) return NULL; - new_item->setNumColumns(mColumns.size()); + new_item->setNumColumns(static_cast(mColumns.size())); // Add any columns we don't already have S32 col_index = 0; @@ -3681,7 +3681,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS } addColumn(new_column); columnp = mColumns[column]; - new_item->setNumColumns(mColumns.size()); + new_item->setNumColumns(static_cast(mColumns.size())); } S32 index = columnp->mIndex; @@ -3714,7 +3714,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS new_column.name = "0"; addColumn(new_column); - new_item->setNumColumns(mColumns.size()); + new_item->setNumColumns(static_cast(mColumns.size())); } LLScrollListCell* cell = LLScrollListCell::create(LLScrollListCell::Params().value(item_p.value)); diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 256efcfbc1..9e799f35e2 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -184,7 +184,7 @@ public: virtual bool preProcessChildNode(LLXMLNodePtr child); virtual LLScrollListColumn* getColumn(S32 index); virtual LLScrollListColumn* getColumn(const std::string& name); - virtual S32 getNumColumns() const { return mColumnsIndexed.size(); } + virtual S32 getNumColumns() const { return static_cast(mColumnsIndexed.size()); } // Adds a single element, from an array of: // "columns" => [ "column" => column name, "value" => value, "type" => type, "font" => font, "font-style" => style ], "id" => uuid diff --git a/indra/llui/llscrolllistitem.cpp b/indra/llui/llscrolllistitem.cpp index 85da55e3e6..0d79d19a37 100644 --- a/indra/llui/llscrolllistitem.cpp +++ b/indra/llui/llscrolllistitem.cpp @@ -85,7 +85,7 @@ void LLScrollListItem::addColumn(const LLScrollListCell::Params& p) void LLScrollListItem::setNumColumns(S32 columns) { - S32 prev_columns = mColumns.size(); + auto prev_columns = mColumns.size(); if (columns < prev_columns) { std::for_each(mColumns.begin()+columns, mColumns.end(), DeletePointer()); @@ -93,7 +93,7 @@ void LLScrollListItem::setNumColumns(S32 columns) mColumns.resize(columns); - for (S32 col = prev_columns; col < columns; ++col) + for (auto col = prev_columns; col < columns; ++col) { mColumns[col] = NULL; } @@ -115,7 +115,7 @@ void LLScrollListItem::setColumn( S32 column, LLScrollListCell *cell ) S32 LLScrollListItem::getNumColumns() const { - return mColumns.size(); + return static_cast(mColumns.size()); } LLScrollListCell* LLScrollListItem::getColumn(const S32 i) const diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp index cfe96cc85a..afa965e30f 100644 --- a/indra/llui/llspellcheck.cpp +++ b/indra/llui/llspellcheck.cpp @@ -94,7 +94,7 @@ S32 LLSpellChecker::getSuggestions(const std::string& word, std::vectorfree_list(&suggestion_list, suggestion_cnt); } - return suggestions.size(); + return static_cast(suggestions.size()); } const LLSD LLSpellChecker::getDictionaryData(const std::string& dict_language) diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index 2afff0e06f..f69c1e7d11 100644 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -512,7 +512,7 @@ void LLStatBar::draw() if (mDisplayHistory && mStat.valid) { - const S32 num_values = frame_recording.getNumRecordedPeriods() - 1; + const S32 num_values = static_cast(frame_recording.getNumRecordedPeriods()) - 1; F32 min_value = 0.f, max_value = 0.f; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index de1fda15c6..4dcb0456e3 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1439,7 +1439,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child) if (mCurrentTabIdx >= (S32)mTabList.size()) { - mCurrentTabIdx = mTabList.size()-1; + mCurrentTabIdx = static_cast(mTabList.size()) - 1; } selectTab(mCurrentTabIdx); if (has_focus) @@ -1518,7 +1518,7 @@ S32 LLTabContainer::getCurrentPanelIndex() S32 LLTabContainer::getTabCount() { - return mTabList.size(); + return static_cast(mTabList.size()); } LLPanel* LLTabContainer::getPanelByIndex(S32 index) @@ -1585,7 +1585,7 @@ void LLTabContainer::selectFirstTab() void LLTabContainer::selectLastTab() { - selectTab( mTabList.size()-1 ); + selectTab(static_cast(mTabList.size()) - 1); } void LLTabContainer::selectNextTab() @@ -1623,12 +1623,12 @@ void LLTabContainer::selectPrevTab() } S32 idx = mCurrentTabIdx-1; if (idx < 0) - idx = mTabList.size()-1; + idx = static_cast(mTabList.size()) - 1; while (!selectTab(idx) && idx != mCurrentTabIdx) { idx = idx - 1; if (idx < 0) - idx = mTabList.size()-1; + idx = static_cast(mTabList.size()) - 1; } if (tab_has_focus) { diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 8c2927cecf..5823cdfa57 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -350,12 +350,12 @@ bool LLTextBase::truncate() if (value.type() == LLSD::TypeString) { // save a copy for strings. - utf8_byte_size = value.size(); + utf8_byte_size = static_cast(value.size()); } else { // non string LLSDs need explicit conversion to string - utf8_byte_size = value.asString().size(); + utf8_byte_size = static_cast(value.asString().size()); } if ( utf8_byte_size > mMaxTextByteLength ) @@ -365,7 +365,7 @@ bool LLTextBase::truncate() temp_utf8_text = utf8str_truncate( temp_utf8_text, mMaxTextByteLength ); LLWString text = utf8str_to_wstring( temp_utf8_text ); // remove extra bit of current string, to preserve formatting, etc. - removeStringNoUndo(text.size(), getWText().size() - text.size()); + removeStringNoUndo(static_cast(text.size()), static_cast(getWText().size() - text.size())); did_truncate = true; } } @@ -483,7 +483,7 @@ void LLTextBase::drawHighlightsBackground(const highlight_list_t& highlights, co continue; } } - selection_rects.push_back(selection_rect); + selection_rects.emplace_back(selection_rect); } // Only advance if the highlight ends on the current line @@ -499,12 +499,8 @@ void LLTextBase::drawHighlightsBackground(const highlight_list_t& highlights, co alpha *= getDrawContext().mAlpha; LLColor4 selection_color(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], alpha); - for (std::vector::iterator rect_it = selection_rects.begin(); - rect_it != selection_rects.end(); - ++rect_it) + for (auto& selection_rect : selection_rects) { - LLRect selection_rect = *rect_it; - selection_rect = *rect_it; selection_rect.translate(mVisibleTextRect.mLeft - content_display_rect.mLeft, mVisibleTextRect.mBottom - content_display_rect.mBottom); gl_rect_2d(selection_rect, selection_color); } @@ -766,7 +762,7 @@ void LLTextBase::drawText() } else if (useLabel()) { - text_len = mLabel.getWString().length(); + text_len = static_cast(mLabel.getWString().length()); } S32 selection_left = -1; @@ -835,7 +831,7 @@ void LLTextBase::drawText() // Find the start of the first word U32 word_start = seg_start, word_end = -1; - U32 text_length = wstrText.length(); + U32 text_length = static_cast(wstrText.length()); while ( (word_start < text_length) && (!LLStringOps::isAlpha(wstrText[word_start])) ) { word_start++; @@ -994,7 +990,7 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s beforeValueChange(); S32 old_len = getLength(); // length() returns character length - S32 insert_len = wstr.length(); + S32 insert_len = static_cast(wstr.length()); pos = getEditableIndex(pos, true); if (pos > old_len) @@ -1066,7 +1062,7 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s static LLUICachedControl useBWEmojis("FSUseBWEmojis", false); // Add B&W emoji font support LLStyleSP emoji_style; LLEmojiDictionary* ed = LLEmojiDictionary::instanceExists() ? LLEmojiDictionary::getInstance() : NULL; - for (S32 text_kitty = 0, text_len = wstr.size(); text_kitty < text_len; text_kitty++) + for (S32 text_kitty = 0, text_len = static_cast(wstr.size()); text_kitty < text_len; text_kitty++) { llwchar code = wstr[text_kitty]; bool isEmoji = ed ? ed->isEmoji(code) : LLStringOps::isEmoji(code); @@ -1523,7 +1519,6 @@ void LLTextBase::draw() : hasFocus() ? mFocusBgColor.get() : mWriteableBgColor.get(); - gl_rect_2d(text_rect, bg_color % alpha, true); } @@ -1640,7 +1635,7 @@ const std::string& LLTextBase::getSuggestion(U32 index) const U32 LLTextBase::getSuggestionCount() const { - return mSuggestionList.size(); + return static_cast(mSuggestionList.size()); } void LLTextBase::replaceWithSuggestion(U32 index) @@ -1653,7 +1648,7 @@ void LLTextBase::replaceWithSuggestion(U32 index) // Insert the suggestion in its place LLWString suggestion = utf8str_to_wstring(mSuggestionList[index]); LLStyleConstSP sp(new LLStyle(getStyleParams())); - LLTextSegmentPtr segmentp = new LLNormalTextSegment(sp, it->first, it->first + suggestion.size(), *this); + LLTextSegmentPtr segmentp = new LLNormalTextSegment(sp, it->first, it->first + static_cast(suggestion.size()), *this); segment_vec_t segments(1, segmentp); insertStringNoUndo(it->first, suggestion, &segments); @@ -2216,7 +2211,6 @@ LLTextBase::segment_set_t::iterator LLTextBase::getSegIterContaining(S32 index) index_segment->setStart(index); index_segment->setEnd(index); segment_set_t::iterator it = mSegments.upper_bound(index_segment); - return it; } @@ -2612,7 +2606,7 @@ void LLTextBase::resetLabel() style->setColor(mTentativeFgColor); LLStyleConstSP sp(style); - LLTextSegmentPtr label = new LLLabelTextSegment(sp, 0, mLabel.getWString().length() + 1, *this); + LLTextSegmentPtr label = new LLLabelTextSegment(sp, 0, static_cast(mLabel.getWString().length()) + 1, *this); insertSegment(label); } } @@ -2688,7 +2682,7 @@ void LLTextBase::appendWidget(const LLInlineViewSegment::Params& params, const s { segment_vec_t segments; LLWString widget_wide_text = utf8str_to_wstring(text); - segments.push_back(new LLInlineViewSegment(params, getLength(), getLength() + widget_wide_text.size())); + segments.push_back(new LLInlineViewSegment(params, getLength(), getLength() + static_cast(widget_wide_text.size()))); insertStringNoUndo(getLength(), widget_wide_text, &segments); } @@ -2738,11 +2732,11 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig highlight_params.font.style(normal_font_style); // LLStyleConstSP normal_sp(new LLStyle(highlight_params)); - segmentp = new LLOnHoverChangeableTextSegment(sp, normal_sp, cur_length, cur_length + wide_text.size(), *this); + segmentp = new LLOnHoverChangeableTextSegment(sp, normal_sp, cur_length, cur_length + static_cast(wide_text.size()), *this); } else { - segmentp = new LLNormalTextSegment(sp, cur_length, cur_length + wide_text.size(), *this); + segmentp = new LLNormalTextSegment(sp, cur_length, cur_length + static_cast(wide_text.size()), *this); } segment_vec_t segments; segments.push_back(segmentp); @@ -2756,7 +2750,7 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig segment_vec_t segments; S32 segment_start = old_length; - S32 segment_end = old_length + wide_text.size(); + S32 segment_end = old_length + static_cast(wide_text.size()); LLStyleConstSP sp(new LLStyle(style_params)); if (underline_on_hover_only || mSkipLinkUnderline) { @@ -2847,7 +2841,7 @@ void LLTextBase::replaceUrl(const std::string &url, S32 start = seg->getStart(); S32 end = seg->getEnd(); text = text.substr(0, start) + wlabel + text.substr(end, text.size() - end + 1); - seg->setEnd(start + wlabel.size()); + seg->setEnd(start + static_cast(wlabel.size())); modified = true; } @@ -2878,8 +2872,8 @@ void LLTextBase::replaceUrl(const std::string &url, //deselect(); // Make sure we're still within limits S32 text_length = getLength(); - mSelectionStart = llmin(mSelectionStart, text_length); - mSelectionEnd = llmin(mSelectionEnd, text_length); + mSelectionStart = llmin(mSelectionStart, static_cast(text_length)); + mSelectionEnd = llmin(mSelectionEnd, static_cast(text_length)); // setCursorPos(mCursorPos); needsReflow(); @@ -3230,7 +3224,7 @@ void LLTextBase::refreshHighlights() for (std::list >::const_iterator itRange = highlightRanges.begin(); itRange != highlightRanges.end(); ++itRange) { S32 idxStart = itRange->begin() - wstrText.begin(); - mHighlights.push_back(range_pair_t(idxStart, idxStart + itRange->size())); + mHighlights.emplace_back(range_pair_t(idxStart, idxStart + static_cast(itRange->size()))); } } mHighlightsDirty = false; @@ -3255,7 +3249,7 @@ bool LLTextBase::setCursor(S32 row, S32 column) { if (row < 0 || column < 0) return false; - S32 n_lines = mLineInfoList.size(); + S32 n_lines = static_cast(mLineInfoList.size()); for (S32 line = row; line < n_lines; ++line) { const line_info& li = mLineInfoList[line]; @@ -3903,8 +3897,8 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin // Prevent unnecessary calculations - //S32 offsetLength = text.length() - (segment_offset + mStart); - S32 offsetLength = text.length() - start_offset; + //S32 offsetLength = static_cast(text.length()) - (segment_offset + mStart); + S32 offsetLength = static_cast(text.length()) - start_offset; //if(getLength() < segment_offset + mStart) if(getLength() < start_offset) @@ -3989,7 +3983,7 @@ const LLWString& LLLabelTextSegment::getWText() const /*virtual*/ const S32 LLLabelTextSegment::getLength() const { - return mEditor.getWlabel().length(); + return static_cast(mEditor.getWlabel().length()); } // diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 292f8f19fb..a195e27852 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -481,8 +481,8 @@ public: // force reflow of text void needsReflow(S32 index = 0); - S32 getLength() const { return getWText().length(); } - S32 getLineCount() const { return mLineInfoList.size(); } + S32 getLength() const { return static_cast(getWText().length()); } + S32 getLineCount() const { return static_cast(mLineInfoList.size()); } S32 removeFirstLine(); // returns removed length void addDocumentChild(LLView* view); diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 997a721937..2dcc57c0ed 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -98,13 +98,13 @@ public: } virtual S32 undo( LLTextBase* editor ) { - remove(editor, getPosition(), mWString.length() ); + remove(editor, getPosition(), static_cast(mWString.length())); return getPosition(); } virtual S32 redo( LLTextBase* editor ) { - insert(editor, getPosition(), mWString ); - return getPosition() + mWString.length(); + insert(editor, getPosition(), mWString); + return getPosition() + static_cast(mWString.length()); } private: @@ -151,13 +151,13 @@ public: } virtual S32 undo( LLTextBase* editor ) { - remove(editor, getPosition(), mWString.length() ); + remove(editor, getPosition(), static_cast(mWString.length())); return getPosition(); } virtual S32 redo( LLTextBase* editor ) { - insert(editor, getPosition(), mWString ); - return getPosition() + mWString.length(); + insert(editor, getPosition(), mWString); + return getPosition() + static_cast(mWString.length()); } private: @@ -216,7 +216,7 @@ public: virtual S32 undo( LLTextBase* editor ) { insert(editor, getPosition(), mWString); - return getPosition() + mWString.length(); + return getPosition() + static_cast(mWString.length()); } virtual S32 redo( LLTextBase* editor ) { @@ -379,7 +379,7 @@ void LLTextEditor::selectNext(const std::string& search_text_in, bool case_insen if (selected_text == search_text) { // // We already have this word selected, we are searching for the next. -// setCursorPos(mCursorPos + search_text.size()); +// setCursorPos(mCursorPos + static_cast(search_text.size())); // [SL:KB] - Patch: UI-FloaterSearchReplace | Checked: 2010-10-29 (Catznip-2.3.0a) | Added: Catznip-2.3.0a if (search_up) { @@ -389,23 +389,23 @@ void LLTextEditor::selectNext(const std::string& search_text_in, bool case_insen else { // We already have this word selected, we are searching for the next. - setCursorPos(mCursorPos + search_text.size()); + setCursorPos(mCursorPos + static_cast(search_text.size())); } // [/SL:KB] } } -// S32 loc = text.find(search_text,mCursorPos); +// S32 loc = static_cast(text.find(search_text,mCursorPos)); // [SL:KB] - Patch: UI-FloaterSearchReplace | Checked: 2010-10-29 (Catznip-2.3.0a) | Added: Catznip-2.3.0a - S32 loc = (search_up) ? text.rfind(search_text, llmax(0, mCursorPos - (S32)search_text.size())) : text.find(search_text,mCursorPos); + S32 loc = (search_up) ? static_cast(text.rfind(search_text, llmax(0, mCursorPos - (S32)search_text.size()))) : static_cast(text.find(search_text,mCursorPos)); // [/SL:KB] // If Maybe we wrapped, search again if (wrap && (-1 == loc)) { -// loc = text.find(search_text); +// loc = static_cast(text.find(search_text)); // [SL:KB] - Patch: UI-FloaterSearchReplace | Checked: 2010-10-29 (Catznip-2.3.0a) | Added: Catznip-2.3.0a - loc = (search_up) ? text.rfind(search_text) : text.find(search_text); + loc = (search_up) ? static_cast(text.rfind(search_text)) : static_cast(text.find(search_text)); // [/SL:KB] } @@ -1678,8 +1678,8 @@ void LLTextEditor::cleanStringForPaste(LLWString & clean_string) if( mAllowEmbeddedItems ) { const llwchar LF = 10; - S32 len = clean_string.length(); - for( S32 i = 0; i < len; i++ ) + auto len = clean_string.length(); + for( size_t i = 0; i < len; i++ ) { llwchar wc = clean_string[i]; if( (wc < LLFontFreetype::FIRST_CHAR) && (wc != LF) ) @@ -2692,7 +2692,7 @@ void LLTextEditor::appendWidget(const LLInlineViewSegment::Params& params, const LLWString widget_wide_text = utf8str_to_wstring(text); - LLTextSegmentPtr segment = new LLInlineViewSegment(params, old_length, old_length + widget_wide_text.size()); + LLTextSegmentPtr segment = new LLInlineViewSegment(params, old_length, old_length + static_cast(widget_wide_text.size())); insert(getLength(), widget_wide_text, false, segment); // Set the cursor and scroll position @@ -3048,7 +3048,7 @@ void LLTextEditor::updatePreedit(const LLWString &preedit_string, if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) { mPreeditOverwrittenWString = getWText().substr(insert_preedit_at, mPreeditWString.length()); - removeStringNoUndo(insert_preedit_at, mPreeditWString.length()); + removeStringNoUndo(insert_preedit_at, static_cast(mPreeditWString.length())); } else { diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp index 8e2bfe6ac2..91e44cb867 100644 --- a/indra/llui/lltextparser.cpp +++ b/indra/llui/lltextparser.cpp @@ -73,11 +73,11 @@ S32 LLTextParser::findPattern(const std::string &text, LLSD highlight) found = (! ltext.find(pattern) ? 0 : std::string::npos); break; case ENDS_WITH: - S32 pos = ltext.rfind(pattern); - if (pos >= 0 && (ltext.length()-pattern.length()==pos)) found = pos; + auto pos = ltext.rfind(pattern); + if (pos != std::string::npos && pos >= 0 && (ltext.length()-pattern.length()==pos)) found = pos; break; } - return found; + return static_cast(found); } LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLColor4 &color, EHighlightPosition part, S32 index) @@ -99,8 +99,8 @@ LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLC S32 start = findPattern(text,mHighlights[i]); if (start >= 0 ) { - S32 end = std::string(mHighlights[i]["pattern"]).length(); - S32 len = text.length(); + auto end = std::string(mHighlights[i]["pattern"]).length(); + auto len = text.length(); EHighlightPosition newpart; if (start==0) { diff --git a/indra/llui/lltextvalidate.cpp b/indra/llui/lltextvalidate.cpp index 9e27ed6232..f9de6f7386 100644 --- a/indra/llui/lltextvalidate.cpp +++ b/indra/llui/lltextvalidate.cpp @@ -73,7 +73,7 @@ class ValidatorFloat : public ValidatorImpl std::basic_string trimmed = str; LLStringUtilBase::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { // May be a comma or period, depending on the locale @@ -118,7 +118,7 @@ class ValidatorInt : public ValidatorImpl std::basic_string trimmed = str; LLStringUtilBase::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { S32 i = 0; @@ -157,7 +157,7 @@ class ValidatorPositiveS32 : public ValidatorImpl std::basic_string trimmed = str; LLStringUtilBase::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { CHAR ch = trimmed.front(); @@ -167,7 +167,7 @@ class ValidatorPositiveS32 : public ValidatorImpl return setError("Validator_ShouldNotBeMinusOrZero", LLSD().with("CH", llsd(ch))); } - for (S32 i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { ch = trimmed[i]; if (!LLStringOps::isDigit(ch)) @@ -177,7 +177,7 @@ class ValidatorPositiveS32 : public ValidatorImpl } } - S32 val = strtol(trimmed); + auto val = strtol(trimmed); if (val <= 0) { return setError("Validator_InvalidNumericString", LLSD().with("STR", llsd(trimmed))); @@ -201,7 +201,7 @@ class ValidatorNonNegativeS32 : public ValidatorImpl std::basic_string trimmed = str; LLStringUtilBase::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { CHAR ch = trimmed.front(); @@ -211,7 +211,7 @@ class ValidatorNonNegativeS32 : public ValidatorImpl return setError("Validator_ShouldNotBeMinus", LLSD().with("CH", llsd(ch))); } - for (S32 i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { ch = trimmed[i]; if (!LLStringOps::isDigit(ch)) @@ -221,7 +221,7 @@ class ValidatorNonNegativeS32 : public ValidatorImpl } } - S32 val = strtol(trimmed); + auto val = strtol(trimmed); if (val < 0) { return setError("Validator_InvalidNumericString", LLSD().with("STR", llsd(trimmed))); @@ -244,7 +244,7 @@ class ValidatorNonNegativeS32NoSpace : public ValidatorImpl LLLocale locale(LLLocale::USER_LOCALE); std::basic_string test_str = str; - S32 len = test_str.length(); + auto len = test_str.length(); if (0 < len) { CHAR ch = test_str.front(); @@ -254,7 +254,7 @@ class ValidatorNonNegativeS32NoSpace : public ValidatorImpl return setError("Validator_ShouldNotBeMinus", LLSD().with("CH", llsd(ch))); } - for (S32 i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { ch = test_str[i]; if (!LLStringOps::isDigit(ch) || LLStringOps::isSpace(ch)) @@ -264,7 +264,7 @@ class ValidatorNonNegativeS32NoSpace : public ValidatorImpl } } - S32 val = strtol(test_str); + auto val = strtol(test_str); if (val < 0) { return setError("Validator_InvalidNumericString", LLSD().with("STR", llsd(test_str))); @@ -286,7 +286,7 @@ class ValidatorAlphaNum : public ValidatorImpl { LLLocale locale(LLLocale::USER_LOCALE); - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -313,7 +313,7 @@ class ValidatorAlphaNumSpace : public ValidatorImpl { LLLocale locale(LLLocale::USER_LOCALE); - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -341,7 +341,7 @@ class ValidatorASCIIPrintableNoPipe : public ValidatorImpl template bool validate(const std::basic_string& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -368,7 +368,7 @@ class ValidatorASCIIPrintableNoSpace : public ValidatorImpl template bool validate(const std::basic_string& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -395,7 +395,7 @@ protected: template bool validate(const std::basic_string& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -441,7 +441,7 @@ class ValidatorASCIIWithNewLine : public ValidatorImpl template bool validate(const std::basic_string& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; diff --git a/indra/llui/lltimectrl.cpp b/indra/llui/lltimectrl.cpp index f1bf60d262..e2e735b131 100644 --- a/indra/llui/lltimectrl.cpp +++ b/indra/llui/lltimectrl.cpp @@ -343,7 +343,7 @@ LLTimeCtrl::EEditingPart LLTimeCtrl::getEditingPart() S32 cur_pos = mEditor->getCursor(); std::string time_str = mEditor->getText(); - S32 colon_index = time_str.find_first_of(':'); + auto colon_index = time_str.find_first_of(':'); if (cur_pos <= colon_index) { @@ -376,7 +376,7 @@ std::string LLTimeCtrl::getMinutesString(const std::string& str) size_t colon_index = str.find_first_of(':'); ++colon_index; - int minutes_len = str.length() - colon_index - AMPM_LEN; + auto minutes_len = str.length() - colon_index - AMPM_LEN; std::string minutes_str = str.substr(colon_index, minutes_len); return minutes_str; @@ -411,7 +411,7 @@ bool LLTimeCtrl::isMinutesStringValid(const std::string& str) // static bool LLTimeCtrl::isPMAMStringValid(const std::string& str) { - S32 len = str.length(); + auto len = str.length(); bool valid = (str[--len] == 'M') && (str[--len] == 'P' || str[len] == 'A'); diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 69d135953f..c1e14c9d15 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -775,7 +775,7 @@ void LLToolBar::updateLayoutAsNeeded() { if (mButtons.size()) { - equalized_width = (full_screen_width - mPadBetween * (mButtons.size() + 1)) / mButtons.size(); + equalized_width = (full_screen_width - mPadBetween * (static_cast(mButtons.size()) + 1)) / static_cast(mButtons.size()); } } else if (mLayoutStyle == LAYOUT_STYLE_EQUALIZE) @@ -789,7 +789,7 @@ void LLToolBar::updateLayoutAsNeeded() } } - S32 total_button_width = mButtons.size() * equalized_width + (mButtons.size() + 1) * mPadBetween; + S32 total_button_width = static_cast(mButtons.size()) * equalized_width + (static_cast(mButtons.size()) + 1) * mPadBetween; if (mMaxRows > 0 && orientation == LLLayoutStack::HORIZONTAL && total_button_width > full_screen_width) { S32 buttons_per_row = llceil((F32)mButtons.size() / (F32)mMaxRows); diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 8c277047e0..bee15cb1db 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -222,12 +222,12 @@ public: protected: friend class LLUICtrlFactory; - LLCenterLayoutPanel(const Params& params) : LLLayoutPanel(params), mButtonPanel(NULL) {} + LLCenterLayoutPanel(const Params& params) : LLLayoutPanel(params) {}; private: reshape_callback_t mReshapeCallback; - LLToolBarEnums::EToolBarLocation mLocationId; - LLPanel * mButtonPanel; + LLToolBarEnums::EToolBarLocation mLocationId{ LLToolBarEnums::EToolBarLocation::TOOLBAR_NONE }; + LLPanel * mButtonPanel{ nullptr }; }; struct Params : public LLInitParam::Block diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 95e8c9c4a4..d835560f09 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -240,7 +240,7 @@ public: private: - S32 mValue; + S32 mValue{ 0 }; }; // diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp index 2e1dddf409..f7cdd4a251 100644 --- a/indra/llui/lluicolortable.cpp +++ b/indra/llui/lluicolortable.cpp @@ -134,7 +134,7 @@ void LLUIColorTable::insertFromParams(const Params& p, string_color_map_t& table // string_color_map_t::iterator color_value = mLoadedColors.find(previous->second); - ColorName oName; + ColorName oName{}; oName.nLen = previous->second.size(); oName.pName = const_cast(previous->second.c_str()); // That's ok, I won't hurt you. @@ -191,14 +191,12 @@ LLUIColor LLUIColorTable::getColor(const std::string& name, const LLColor4& defa LLUIColor LLUIColorTable::getColor( char const *name, const LLColor4& default_color) const // Change from std::string to char*, avoind lots of unecessary string constructions { // Change from std::string to char*, avoind lots of unecessary string constructions - // string_color_map_t::const_iterator iter = mUserSetColors.find(name); - ColorName oName; - oName.nLen = strlen( name ); + ColorName oName{}; + oName.nLen = strlen(name); oName.pName = const_cast(name); string_color_map_t::const_iterator iter = mUserSetColors.find(oName); - // if(iter != mUserSetColors.end()) @@ -207,10 +205,8 @@ LLUIColor LLUIColorTable::getColor( char const *name, const LLColor4& default_co } // Change from std::string to char*, avoind lots of unecessary string constructions - // iter = mLoadedColors.find(name); iter = mLoadedColors.find(oName); - // if(iter != mLoadedColors.end()) @@ -331,16 +327,14 @@ void LLUIColorTable::saveUserSettingsPaletteOnly() const bool LLUIColorTable::colorExists( char const *name ) const { // Change from std::string to char*, avoind lots of unecessary string constructions - // return ((mLoadedColors.find(color_name) != mLoadedColors.end()) // || (mUserSetColors.find(color_name) != mUserSetColors.end())); - ColorName oName; - oName.nLen = strlen( name ); + ColorName oName{}; + oName.nLen = strlen(name); oName.pName = const_cast(name); return ((mLoadedColors.find(oName) != mLoadedColors.end()) || (mUserSetColors.find(oName) != mUserSetColors.end())); - // } @@ -360,24 +354,22 @@ void LLUIColorTable::setColor(const std::string& name, const LLColor4& color, st { // Change from std::string to char*, avoind lots of unecessary string constructions - // string_color_map_t::iterator it = table.lower_bound(name); - ColorName oName; + ColorName oName{}; oName.nLen = name.size(); - oName.pName = const_cast( name.c_str() ); + oName.pName = const_cast(name.c_str()); string_color_map_t::iterator it = table.find(oName); // if(it != table.end() && !(table.key_comp()(name, it->first))) - if(it != table.end() ) - + if (it != table.end()) // { it->second = color; } else { - oName.pName = strdup( oName.pName ); + oName.pName = strdup(oName.pName); table.insert(string_color_map_t::value_type(oName, color)); } } diff --git a/indra/llui/lluicolortable.h b/indra/llui/lluicolortable.h index 4c6f25e044..459f2fb034 100644 --- a/indra/llui/lluicolortable.h +++ b/indra/llui/lluicolortable.h @@ -49,21 +49,19 @@ class LLUIColorTable : public LLSingleton struct ColorName { - char *pName; - int nLen; + char* pName; + size_t nLen; - bool operator<( ColorName const &aRHS ) const + bool operator<(ColorName const &aRHS) const { - if( nLen == aRHS.nLen ) - return strcmp( pName, aRHS.pName ) < 0; + if (nLen == aRHS.nLen) + return strcmp(pName, aRHS.pName) < 0; return nLen < aRHS.nLen; } }; typedef std::map string_color_map_t; - - // public: diff --git a/indra/llui/lluistring.h b/indra/llui/lluistring.h index 42bf19da64..9f95f7e16e 100644 --- a/indra/llui/lluistring.h +++ b/indra/llui/lluistring.h @@ -79,7 +79,7 @@ public: operator LLWString() const { return getUpdatedWResult(); } bool empty() const { return getUpdatedResult().empty(); } - S32 length() const { return getUpdatedWResult().size(); } + S32 length() const { return static_cast(getUpdatedWResult().size()); } void clear(); void clearArgs() { if (mArgs) mArgs->clear(); } diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 575516debe..6e25446dd8 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -446,7 +446,7 @@ bool LLUrlEntryInvalidSLURL::isSLURLvalid(const std::string &url) const LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); S32 x,y,z; if (path_parts == actual_parts) @@ -511,7 +511,7 @@ std::string LLUrlEntrySLURL::getLabel(const std::string &url, const LLUrlLabelCa LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts == 5) { // handle slurl with (X,Y,Z) coordinates @@ -1222,7 +1222,7 @@ LLUrlEntryParcel::~LLUrlEntryParcel() std::string LLUrlEntryParcel::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { LLSD path_array = LLURI(url).pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts < 3) // no parcel id { @@ -1313,7 +1313,7 @@ std::string LLUrlEntryPlace::getLabel(const std::string &url, const LLUrlLabelCa LLURI uri(url); std::string location = unescapeUrl(uri.hostName()); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts == 3) { // handle slurl with (X,Y,Z) coordinates @@ -1362,7 +1362,7 @@ std::string LLUrlEntryRegion::getLabel(const std::string &url, const LLUrlLabelC // LLSD path_array = LLURI(url).pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts < 3) // no region name { @@ -1426,7 +1426,7 @@ std::string LLUrlEntryTeleport::getLabel(const std::string &url, const LLUrlLabe // LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); std::string host = uri.hostName(); std::string label = LLTrans::getString("SLurlLabelTeleport"); if (!host.empty()) @@ -1600,7 +1600,7 @@ std::string LLUrlEntryWorldMap::getLabel(const std::string &url, const LLUrlLabe // LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts < 3) { return url; @@ -1730,10 +1730,7 @@ LLUrlEntryEmail::LLUrlEntryEmail() std::string LLUrlEntryEmail::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { - // Fix type - //int pos = url.find("mailto:"); - size_t pos = url.find("mailto:"); - // + auto pos = url.find("mailto:"); if (pos == std::string::npos) { diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index b1ed4782b0..a3247b5e6d 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -351,9 +351,9 @@ bool LLUrlRegistry::findUrl(const LLWString &text, LLUrlMatch &match, const LLUr { return false; } - S32 end = start + wurl.size() - 1; + auto end = start + wurl.size() - 1; - match.setValues(start, end, match.getUrl(), + match.setValues(static_cast(start), static_cast(end), match.getUrl(), match.getLabel(), match.getQuery(), match.getTooltip(), diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 73f09bca25..dd05c132a1 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -3706,13 +3706,13 @@ void LLSplashScreenWin32::updateImpl(const std::string& mesg) { if (!mWindow) return; - int output_str_len = MultiByteToWideChar(CP_UTF8, 0, mesg.c_str(), mesg.length(), NULL, 0); + int output_str_len = MultiByteToWideChar(CP_UTF8, 0, mesg.c_str(), static_cast(mesg.length()), NULL, 0); if( output_str_len>1024 ) return; WCHAR w_mesg[1025];//big enought to keep null terminatos - MultiByteToWideChar (CP_UTF8, 0, mesg.c_str(), mesg.length(), w_mesg, output_str_len); + MultiByteToWideChar (CP_UTF8, 0, mesg.c_str(), static_cast(mesg.length()), w_mesg, output_str_len); //looks like MultiByteToWideChar didn't add null terminator to converted string, see EXT-4858 w_mesg[output_str_len] = 0; @@ -4116,14 +4116,14 @@ U32 LLWindowWin32::fillReconvertString(const LLWString &text, S32 focus, S32 focus_length, RECONVERTSTRING *reconvert_string) { const llutf16string text_utf16 = wstring_to_utf16str(text); - const DWORD required_size = sizeof(RECONVERTSTRING) + (text_utf16.length() + 1) * sizeof(WCHAR); + const DWORD required_size = sizeof(RECONVERTSTRING) + (static_cast(text_utf16.length()) + 1) * sizeof(WCHAR); if (reconvert_string && reconvert_string->dwSize >= required_size) { const DWORD focus_utf16_at = wstring_utf16_length(text, 0, focus); const DWORD focus_utf16_length = wstring_utf16_length(text, focus, focus_length); reconvert_string->dwVersion = 0; - reconvert_string->dwStrLen = text_utf16.length(); + reconvert_string->dwStrLen = static_cast(text_utf16.length()); reconvert_string->dwStrOffset = sizeof(RECONVERTSTRING); reconvert_string->dwCompStrLen = focus_utf16_length; reconvert_string->dwCompStrOffset = focus_utf16_at * sizeof(WCHAR); @@ -4286,7 +4286,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) } } - S32 caret_position = preedit_string.length(); + S32 caret_position = static_cast(preedit_string.length()); if (indexes & GCS_CURSORPOS) { const S32 caret_position_utf16 = LLWinImm::getCompositionString(himc, GCS_CURSORPOS, NULL, 0); @@ -4332,7 +4332,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) { if (preedit_segment_lengths.size() == 0) { - preedit_segment_lengths.assign(1, preedit_string.length()); + preedit_segment_lengths.assign(1, static_cast(preedit_string.length())); } if (preedit_standouts.size() == 0) { diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index 33786f9b1b..49d5e89c47 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -670,7 +670,7 @@ bool LLXMLNode::parseFile(const std::string& filename, LLXMLNodePtr& node, LLXML buffer[nread] = 0; fclose(fp); - bool rv = parseBuffer(buffer, nread, node, defaults_tree); + bool rv = parseBuffer(buffer, static_cast(nread), node, defaults_tree); delete [] buffer; return rv; } @@ -2719,7 +2719,7 @@ U32 LLXMLNode::getChildCount() const { if (mChildren.notNull()) { - return mChildren->map.size(); + return static_cast(mChildren->map.size()); } return 0; } @@ -2738,7 +2738,7 @@ LLXMLNode *get_rand_node(LLXMLNode *node) { if (node->mChildren.notNull()) { - U32 num_children = node->mChildren->map.size(); + U32 num_children = static_cast(node->mChildren->map.size()); if (get_rand(2) == 0) { while (true) diff --git a/indra/llxml/llxmltree.cpp b/indra/llxml/llxmltree.cpp index f5ac9555e9..81911bb0db 100644 --- a/indra/llxml/llxmltree.cpp +++ b/indra/llxml/llxmltree.cpp @@ -565,7 +565,7 @@ bool LLXmlTreeParser::parseString(const std::string &string, LLXmlTreeNode** roo mKeepContents = keep_contents; - bool success = LLXmlParser::parse(string.c_str(), string.length(), true); + bool success = LLXmlParser::parse(string.c_str(), static_cast(string.length()), 1); *root = mRoot; mRoot = NULL; diff --git a/indra/newview/ao.cpp b/indra/newview/ao.cpp index 6b28803145..d398c73afe 100644 --- a/indra/newview/ao.cpp +++ b/indra/newview/ao.cpp @@ -193,8 +193,8 @@ void FloaterAO::updateList() } } - mSetSelector->selectNthItem(selected_index); - mSetSelectorSmall->selectNthItem(selected_index); + mSetSelector->selectNthItem(static_cast(selected_index)); + mSetSelectorSmall->selectNthItem(static_cast(selected_index)); enableSetControls(true); if (mSetSelector->getSelectedItemLabel().empty()) diff --git a/indra/newview/aoengine.cpp b/indra/newview/aoengine.cpp index e9f8ca527e..6e58399e17 100644 --- a/indra/newview/aoengine.cpp +++ b/indra/newview/aoengine.cpp @@ -896,7 +896,7 @@ void AOEngine::cycle(eCycleMode cycleMode) { if (state->mCurrentAnimation == 0) { - state->mCurrentAnimation = state->mAnimations.size() - 1; + state->mCurrentAnimation = static_cast(state->mAnimations.size()) - 1; } else { @@ -1044,7 +1044,7 @@ void AOEngine::addAnimation(const AOSet* set, AOSet::AOState* state, const LLInv anim.mInventoryUUID = item->getUUID(); anim.mOriginalUUID = item->getLinkedUUID(); anim.mName = item->getName(); - anim.mSortOrder = state->mAnimations.size() + 1; + anim.mSortOrder = static_cast(state->mAnimations.size()) + 1; state->mAnimations.emplace_back(std::move(anim)); bool wasProtected = gSavedPerAccountSettings.getBOOL("LockAOFolders"); @@ -1118,11 +1118,11 @@ bool AOEngine::findForeignItems(const LLUUID& uuid) const if (items) { - for (S32 index = items->size() - 1; index >= 0; --index) + for (S32 index = static_cast(items->size()) - 1; index >= 0; --index) { - bool move = false; + bool move{ false }; - LLPointer item = items->at(index); + const LLPointer& item = items->at(index); if (item->getIsLinkType()) { if (item->getInventoryType() != LLInventoryType::IT_ANIMATION) @@ -2263,7 +2263,7 @@ void AOEngine::processImport(bool from_timer) LL_DEBUGS("AOEngine") << "new_cat_id: " << new_cat_id << LL_ENDL; state->mInventoryUUID = new_cat_id; - S32 animationIndex = state->mAnimations.size() - 1; + S32 animationIndex = static_cast(state->mAnimations.size()) - 1; while (!state->mAnimations.empty()) { LL_DEBUGS("AOEngine") << "linking animation " << state->mAnimations[animationIndex].mName << LL_ENDL; diff --git a/indra/newview/chatbar_as_cmdline.cpp b/indra/newview/chatbar_as_cmdline.cpp index adb974ca71..a62d4da495 100644 --- a/indra/newview/chatbar_as_cmdline.cpp +++ b/indra/newview/chatbar_as_cmdline.cpp @@ -389,7 +389,7 @@ private: LLUUID mPackageDest; std::string mFolderName; EDeRezDestination mDest; - U32 mPackSize; + size_t mPackSize; EZtakeState mState; }; @@ -519,9 +519,9 @@ private: std::vector mToTake; LLUUID mTarget; S32 mCountdown; - S32 zeroClearX; - S32 zeroClearY; - S32 zeroClearZ; + size_t zeroClearX; + size_t zeroClearY; + size_t zeroClearZ; }; TMZtake* gMTake; @@ -980,7 +980,7 @@ bool cmd_line_chat(std::string_view revised_text, EChatType type, bool from_gest S32 random_min = atoi(random_nums[1].first); S32 random_max = atoi(random_nums[2].first); std::string look_for = "RAND(" + llformat("%d", random_min) + "," + llformat("%d", random_max) + ")"; - S32 random_string_pos = expr.find(look_for); + auto random_string_pos = expr.find(look_for); if (random_string_pos != std::string::npos) { S32 random_number = 0; diff --git a/indra/newview/daeexport.cpp b/indra/newview/daeexport.cpp index 225dedf4cb..4f29268e11 100644 --- a/indra/newview/daeexport.cpp +++ b/indra/newview/daeexport.cpp @@ -286,7 +286,7 @@ void ColladaExportFloater::addSelectedObjects() mObjectName = ""; } mSaver.updateTextureInfo(); - mNumTextures = mSaver.mTextures.size(); + mNumTextures = static_cast(mSaver.mTextures.size()); mNumExportableTextures = getNumExportableTextures(); } } diff --git a/indra/newview/exoflickr.cpp b/indra/newview/exoflickr.cpp index 28d0ef255f..625bdddc43 100644 --- a/indra/newview/exoflickr.cpp +++ b/indra/newview/exoflickr.cpp @@ -269,7 +269,7 @@ std::string exoFlickr::getSignatureForCall(const LLSD& parameters, std::string u std::string key = std::string(EXO_FLICKR_API_SECRET) + "&" + gSavedPerAccountSettings.getString("ExodusFlickrTokenSecret"); std::string to_hash = q.str(); - HMAC(EVP_sha1(), (void*)key.c_str(), key.length(), (unsigned char*)to_hash.c_str(), to_hash.length(), data, &length); + HMAC(EVP_sha1(), (void*)key.c_str(), static_cast(key.length()), (unsigned char*)to_hash.c_str(), to_hash.length(), data, &length); std::string signature = LLBase64::encode((U8*)data, length); return signature; } diff --git a/indra/newview/fschathistory.cpp b/indra/newview/fschathistory.cpp index 06c077a7cb..9f5ad93a32 100644 --- a/indra/newview/fschathistory.cpp +++ b/indra/newview/fschathistory.cpp @@ -836,8 +836,8 @@ public: (mSourceType == CHAT_SOURCE_AGENT || (mSourceType == CHAT_SOURCE_SYSTEM && mType == CHAT_TYPE_RADAR))) { //if it's an avatar name with a username add formatting - S32 username_start = chat.mFromName.rfind(" ("); - S32 username_end = chat.mFromName.rfind(')'); + auto username_start = chat.mFromName.rfind(" ("); + auto username_end = chat.mFromName.rfind(')'); if (username_start != std::string::npos && username_end == (chat.mFromName.length() - 1)) diff --git a/indra/newview/fscommon.cpp b/indra/newview/fscommon.cpp index 9323865030..c90be48d87 100644 --- a/indra/newview/fscommon.cpp +++ b/indra/newview/fscommon.cpp @@ -92,7 +92,7 @@ bool is_irc_me_prefix(std::string_view text) std::string unescape_name(std::string_view name) { // bugfix for SL-46920: preventing filenames that break stuff. - char * curl_str = curl_unescape(name.data(), name.size()); // Calling data() should be ok here because we also pass the length + char * curl_str = curl_unescape(name.data(), static_cast(name.size())); // Calling data() should be ok here because we also pass the length std::string unescaped_name(curl_str); curl_free(curl_str); curl_str = NULL; @@ -440,7 +440,7 @@ bool FSCommon::checkIsActionEnabled(const LLUUID& av_id, EFSRegistrarFunctionAct LLSD FSCommon::populateGroupCount() { LLStringUtil::format_map_t args; - S32 groupcount = gAgent.mGroups.size(); + S32 groupcount = static_cast(gAgent.mGroups.size()); S32 maxgroup = LLAgentBenefitsMgr::current().getGroupMembershipLimit(); args["[COUNT]"] = llformat("%d", groupcount); args["[REMAINING]"] = llformat("%d", maxgroup > groupcount ? maxgroup - groupcount : 0); diff --git a/indra/newview/fsdata.cpp b/indra/newview/fsdata.cpp index 627446c523..7b58cac222 100644 --- a/indra/newview/fsdata.cpp +++ b/indra/newview/fsdata.cpp @@ -682,7 +682,7 @@ LLSD FSData::resolveClientTag(const LLUUID& id, bool new_system, const LLColor4& { if (client_tag_visibility >= 3) { - U32 tag_len = strnlen((const char*)&id.mData[0], UUID_BYTES); + auto tag_len = strnlen((const char*)&id.mData[0], UUID_BYTES); std::string clienttagname = std::string((const char*)&id.mData[0], tag_len); LLStringFn::replace_ascii_controlchars(clienttagname, LL_UNKNOWN_CHAR); curtag["name"] = clienttagname; diff --git a/indra/newview/fsdiscordconnect.cpp b/indra/newview/fsdiscordconnect.cpp index af6044a189..cf32d27580 100644 --- a/indra/newview/fsdiscordconnect.cpp +++ b/indra/newview/fsdiscordconnect.cpp @@ -245,7 +245,7 @@ void FSDiscordConnect::updateRichPresence() const std::string regionId = gAgent.getRegion()->getRegionID().asString(); discordPresence.partyId = regionId.c_str(); - discordPresence.partySize = gAgent.getRegion()->mMapAvatars.size(); + discordPresence.partySize = static_cast(gAgent.getRegion()->mMapAvatars.size()); discordPresence.partyMax = LLRegionInfoModel::instance().mAgentLimit; Discord_UpdatePresence(&discordPresence); } diff --git a/indra/newview/fsfloatercontacts.h b/indra/newview/fsfloatercontacts.h index 122958f03a..88316a81ab 100644 --- a/indra/newview/fsfloatercontacts.h +++ b/indra/newview/fsfloatercontacts.h @@ -151,7 +151,7 @@ private: LLGroupList* mGroupList; bool mAllowRightsChange; - S32 mNumRightsChanged; + size_t mNumRightsChanged; bool mRightsChangeNotificationTriggered; std::string mFriendListFontName; diff --git a/indra/newview/fsfloaterexport.cpp b/indra/newview/fsfloaterexport.cpp index dd3ad04377..0b60e8b00b 100644 --- a/indra/newview/fsfloaterexport.cpp +++ b/indra/newview/fsfloaterexport.cpp @@ -876,7 +876,7 @@ void FSFloaterObjectExport::onLoadComplete(const LLUUID& asset_uuid, LLAssetType case LLAssetType::AT_BODYPART: { std::string asset(buffer.begin(), buffer.end()); - S32 position = asset.rfind("textures"); + auto position = asset.rfind("textures"); boost::regex pattern("[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}"); boost::sregex_iterator m1(asset.begin() + position, asset.end(), pattern); boost::sregex_iterator m2; @@ -908,9 +908,8 @@ void FSFloaterObjectExport::onLoadComplete(const LLUUID& asset_uuid, LLAssetType } std::string name; std::string description; - S32 i; - S32 count = gesture->mSteps.size(); - for (i = 0; i < count; ++i) + auto count = gesture->mSteps.size(); + for (size_t i = 0; i < count; ++i) { LLGestureStep* step = gesture->mSteps[i]; @@ -1180,7 +1179,7 @@ void FSFloaterObjectExport::addSelectedObjects() } updateTextureInfo(); - mNumTextures = mTextures.size(); + mNumTextures = static_cast(mTextures.size()); mNumExportableTextures = getNumExportableTextures(); } else diff --git a/indra/newview/fsfloaterexport.h b/indra/newview/fsfloaterexport.h index 39d702d333..49c00854ae 100644 --- a/indra/newview/fsfloaterexport.h +++ b/indra/newview/fsfloaterexport.h @@ -124,7 +124,7 @@ private: std::string mFilePath; LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList; LLFrameTimer mWaitTimer; - S32 mLastRequest; + size_t mLastRequest; bool mExported; bool mAborted; bool mDirty; diff --git a/indra/newview/fsfloaterim.cpp b/indra/newview/fsfloaterim.cpp index 9560cc44f2..7c79f054fa 100644 --- a/indra/newview/fsfloaterim.cpp +++ b/indra/newview/fsfloaterim.cpp @@ -1892,7 +1892,7 @@ bool FSFloaterIM::dropCategory(LLInventoryCategory* category, bool drop) items, LLInventoryModel::EXCLUDE_TRASH, buddies); - S32 count = items.size(); + auto count = items.size(); if (count == 0) { rv = false; diff --git a/indra/newview/fsfloaterimport.cpp b/indra/newview/fsfloaterimport.cpp index ad3a54fc40..32aabee57e 100644 --- a/indra/newview/fsfloaterimport.cpp +++ b/indra/newview/fsfloaterimport.cpp @@ -376,7 +376,7 @@ void FSFloaterImport::processPrim(LLSD& prim) case LLAssetType::AT_BODYPART: { std::string asset(buffer.begin(), buffer.end()); - S32 position = asset.rfind("textures"); + auto position = asset.rfind("textures"); boost::regex pattern("[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}"); boost::sregex_iterator m1(asset.begin() + position, asset.end(), pattern); boost::sregex_iterator m2; @@ -407,9 +407,8 @@ void FSFloaterImport::processPrim(LLSD& prim) break; } - S32 i; - S32 count = gesture->mSteps.size(); - for (i = 0; i < count; ++i) + auto count = gesture->mSteps.size(); + for (size_t i = 0; i < count; ++i) { LLGestureStep* step = gesture->mSteps[i]; @@ -1247,8 +1246,8 @@ void FSFloaterImport::uploadAsset(LLUUID asset_id, LLUUID inventory_item) perms_prefix = "Wearables"; std::string asset(asset_data.begin(), asset_data.end()); - S32 position = asset.rfind("type"); - S32 end = asset.find("\n", position); + auto position = asset.rfind("type"); + auto end = asset.find("\n", position); wearable_type = (LLWearableType::EType)boost::lexical_cast(asset.substr(position + 5, (end - (position + 5)))); if (getChild("temp_asset")->get()) @@ -1391,10 +1390,9 @@ void FSFloaterImport::uploadAsset(LLUUID asset_id, LLUUID inventory_item) break; } - S32 i; - S32 count = gesture->mSteps.size(); - bool replace = false; - for (i = 0; i < count; ++i) + auto count = gesture->mSteps.size(); + bool replace{ false }; + for (size_t i = 0; i < count; ++i) { LLGestureStep* step = gesture->mSteps[i]; diff --git a/indra/newview/fsfloaternearbychat.cpp b/indra/newview/fsfloaternearbychat.cpp index 2f42218ec9..22e5c7ccb6 100644 --- a/indra/newview/fsfloaternearbychat.cpp +++ b/indra/newview/fsfloaternearbychat.cpp @@ -531,8 +531,8 @@ void FSFloaterNearbyChat::processChatHistoryStyleUpdate(const LLSD& newvalue) bool FSFloaterNearbyChat::isWordsName(const std::string& name) { // checking to see if it's display name plus username in parentheses - S32 open_paren = name.find(" (", 0); - S32 close_paren = name.find(')', 0); + auto open_paren = name.find(" (", 0); + auto close_paren = name.find(')', 0); if (open_paren != std::string::npos && close_paren == name.length() - 1) @@ -542,7 +542,7 @@ bool FSFloaterNearbyChat::isWordsName(const std::string& name) else { //checking for a single space - S32 pos = name.find(' ', 0); + auto pos = name.find(' ', 0); return std::string::npos != pos && name.rfind(' ', name.length()) == pos && 0 != pos && name.length()-1 != pos; } } diff --git a/indra/newview/fsfloaternearbychat.h b/indra/newview/fsfloaternearbychat.h index 66697c6c53..2a7f2e5d24 100644 --- a/indra/newview/fsfloaternearbychat.h +++ b/indra/newview/fsfloaternearbychat.h @@ -90,7 +90,7 @@ public: LLChatEntry* getChatBox() { return mInputEditor; } - S32 getMessageArchiveLength() {return mMessageArchive.size();} + S32 getMessageArchiveLength() { return static_cast(mMessageArchive.size()); } virtual bool handleKeyHere( KEY key, MASK mask ); diff --git a/indra/newview/fsfloatervramusage.cpp b/indra/newview/fsfloatervramusage.cpp index 3d71f6b284..2082fa59de 100644 --- a/indra/newview/fsfloatervramusage.cpp +++ b/indra/newview/fsfloatervramusage.cpp @@ -166,7 +166,7 @@ U32 FSFloaterVRAMUsage::calcTexturSize( LLViewerObject *aObject, std::ostream *a if( !pTex || pTex->isMissingAsset() ) continue; - U32 textureId = stTextures.size(); + U32 textureId = static_cast(stTextures.size()); bool bOldTexId( false ); if( stTextures.end() != stTextures.find( pTex->getID() ) ) diff --git a/indra/newview/fslslpreproc.cpp b/indra/newview/fslslpreproc.cpp index 40e7bd0b25..b1bfe311b9 100644 --- a/indra/newview/fslslpreproc.cpp +++ b/indra/newview/fslslpreproc.cpp @@ -171,7 +171,7 @@ std::string FSLSLPreprocessor::encode(const std::string& script) std::string FSLSLPreprocessor::decode(const std::string& script) { - static const S32 startpoint = encode_start.length(); + static const auto startpoint = encode_start.length(); std::string tip = script.substr(0, startpoint); @@ -182,9 +182,9 @@ std::string FSLSLPreprocessor::decode(const std::string& script) return script; } - S32 end = script.find(encode_end); + auto end = script.find(encode_end); - if (end == -1) + if (end == std::string::npos) { LL_DEBUGS("FSLSLPreprocessor") << "No end" << LL_ENDL; return script; @@ -362,7 +362,7 @@ std::string FSLSLPreprocessor::lslopt(std::string script) while (boost::regex_search(std::string::const_iterator(top.begin()), std::string::const_iterator(top.end()), result, finddecls)) { - S32 len; + size_t len; if (result[1].matched) { @@ -697,7 +697,7 @@ void cache_script(std::string name, std::string content) LLAPRFile infile(path.c_str(), LL_APR_WB); if (infile.getFileHandle()) { - infile.write(content.c_str(), content.length()); + infile.write(content.c_str(), static_cast(content.length())); } infile.close(); @@ -988,14 +988,14 @@ static std::string reformat_switch_statements(std::string script, bool &lackDefa break; } LL_DEBUGS("FSLSLPreprocessor") << "arg=[" << arg << "]" << LL_ENDL;; - std::string rstate = scopeript2(buffer, res + slen + arg.length()); - S32 cutlen = slen + arg.length() + rstate.length(); + std::string rstate = scopeript2(buffer, res + slen + static_cast(arg.length())); + S32 cutlen = slen + static_cast(arg.length() + rstate.length()); // Call recursively to process nested switch statements (FIRE-10517) rstate = reformat_switch_statements(rstate, lackDefault); //rip off the scope edges - S32 slicestart = rstate.find("{") + 1; + auto slicestart = rstate.find("{") + 1; rstate = rstate.substr(slicestart, (rstate.rfind("}") - slicestart) - 1); LL_DEBUGS("FSLSLPreprocessor") << "rstate=[" << rstate << "]" << LL_ENDL; @@ -1012,12 +1012,12 @@ static std::string reformat_switch_statements(std::string script, bool &lackDefa if (statematches[1].matched) { S32 case_start = const_iterator_to_pos(rstate.begin(), statematches[1].first); - S32 next_curl = rstate.find("{", case_start + 1); - S32 next_semi = rstate.find(":", case_start + 1); - S32 case_end = (next_semi == -1) ? next_curl : - (next_curl < next_semi && next_curl != -1) ? next_curl : next_semi; + auto next_curl = rstate.find("{", case_start + 1); + auto next_semi = rstate.find(":", case_start + 1); + auto case_end = (next_semi == std::string::npos) ? next_curl : + (next_curl < next_semi && next_curl != std::string::npos) ? next_curl : next_semi; S32 caselen = const_iterator_to_pos(statematches[1].first, statematches[1].second); - if (case_end != -1) + if (case_end != std::string::npos) { std::string casearg = rstate.substr(case_start + caselen, case_end - (case_start + caselen)); LL_DEBUGS("FSLSLPreprocessor") << "casearg=[" << casearg << "]" << LL_ENDL; diff --git a/indra/newview/fsmoneytracker.cpp b/indra/newview/fsmoneytracker.cpp index c924108206..1ebad971e6 100644 --- a/indra/newview/fsmoneytracker.cpp +++ b/indra/newview/fsmoneytracker.cpp @@ -164,7 +164,7 @@ void FSMoneyTrackerListMenu::onContextMenuItemClick(const LLSD& userdata) if (!copy_text.empty()) { - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(copy_text), 0, copy_text.size() ); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(copy_text), 0, static_cast(copy_text.size())); } } } diff --git a/indra/newview/fsnearbychathub.cpp b/indra/newview/fsnearbychathub.cpp index 01db135876..da6df2f3d3 100644 --- a/indra/newview/fsnearbychathub.cpp +++ b/indra/newview/fsnearbychathub.cpp @@ -653,7 +653,7 @@ void FSNearbyChat::handleChatBarKeystroke(LLUICtrl* source, S32 channel /* = 0 * // Select to end of line, starting from the character // after the last one the user typed. - chat_entry->selectByCursorPosition(utf8_out_str.size() - rest_of_match.size(), utf8_out_str.size()); + chat_entry->selectByCursorPosition(static_cast(utf8_out_str.size() - rest_of_match.size()), static_cast(utf8_out_str.size())); } else { @@ -662,7 +662,7 @@ void FSNearbyChat::handleChatBarKeystroke(LLUICtrl* source, S32 channel /* = 0 * // Select to end of line, starting from the character // after the last one the user typed. S32 outlength = line_editor->getLength(); // in characters - line_editor->setSelection(length, outlength); + line_editor->setSelection(static_cast(length), outlength); line_editor->setCursor(outlength); } } @@ -827,12 +827,12 @@ void FSNearbyChat::handleChatBarKeystroke(LLUICtrl* source, S32 channel /* = 0 * if (chat_entry) { chat_entry->setText(prefix + replaced_text + suffix); - chat_entry->selectByCursorPosition(utf8string_to_wstring(prefix).size() + utf8string_to_wstring(match).size(), utf8string_to_wstring(prefix).size() + utf8string_to_wstring(replaced_text).size()); + chat_entry->selectByCursorPosition(static_cast(utf8string_to_wstring(prefix).size() + utf8string_to_wstring(match).size()), static_cast(utf8string_to_wstring(prefix).size() + utf8string_to_wstring(replaced_text).size())); } else { line_editor->setText(prefix + replaced_text + suffix); - line_editor->setSelection(utf8str_to_wstring(prefix + replaced_text).length(), cur_pos); + line_editor->setSelection(static_cast(utf8str_to_wstring(prefix + replaced_text).length()), cur_pos); } } } diff --git a/indra/newview/fspanelcontactsets.cpp b/indra/newview/fspanelcontactsets.cpp index b569a3f748..20896a32c7 100644 --- a/indra/newview/fspanelcontactsets.cpp +++ b/indra/newview/fspanelcontactsets.cpp @@ -248,7 +248,7 @@ void FSPanelContactSets::onClickRemoveAvatar() LLSD payload, args; std::string set = mContactSetCombo->getValue().asString(); - S32 selected_size = mAvatarSelections.size(); + auto selected_size = mAvatarSelections.size(); args["SET_NAME"] = set; args["TARGET"] = (selected_size > 1 ? llformat("%d", selected_size) : LLSLURL("agent", mAvatarSelections.front(), "about").getSLURLString()); payload["contact_set"] = set; diff --git a/indra/newview/fspanellogin.cpp b/indra/newview/fspanellogin.cpp index 1cdb5afbac..09a45e199d 100644 --- a/indra/newview/fspanellogin.cpp +++ b/indra/newview/fspanellogin.cpp @@ -334,8 +334,8 @@ void FSPanelLogin::addFavoritesToStartLocation() // Load favorites into the combo. std::string user_defined_name = getChild("username_combo")->getSimple(); std::string canonical_user_name = canonicalize_username(user_defined_name); - U32 resident_pos = canonical_user_name.find("Resident"); - if (resident_pos > 0) + auto resident_pos = canonical_user_name.find("Resident"); + if (resident_pos != std::string::npos) { canonical_user_name = canonical_user_name.substr(0, resident_pos - 1); } diff --git a/indra/newview/fspanellogin.h b/indra/newview/fspanellogin.h index b7fa040496..9a817c0bcf 100644 --- a/indra/newview/fspanellogin.h +++ b/indra/newview/fspanellogin.h @@ -128,9 +128,9 @@ private: static bool sCredentialSet; - unsigned int mUsernameLength; - unsigned int mPasswordLength; - unsigned int mLocationLength; + size_t mUsernameLength; + size_t mPasswordLength; + size_t mLocationLength; std::string mPreviousUsername; static std::string sPassword; diff --git a/indra/newview/growlnotifierwin.cpp b/indra/newview/growlnotifierwin.cpp index a618891f64..fff2e2e469 100644 --- a/indra/newview/growlnotifierwin.cpp +++ b/indra/newview/growlnotifierwin.cpp @@ -84,7 +84,7 @@ void GrowlNotifierWin::registerApplication(const std::string& application, const strcpy(string, it->c_str()); arr[i] = string; } - mGrowlImpl = new Growl (GROWL_TCP, NULL, application.c_str(), (const char **const)arr, notificationTypes.size(), + mGrowlImpl = new Growl (GROWL_TCP, NULL, application.c_str(), (const char **const)arr, static_cast(notificationTypes.size()), std::string(gDirUtilp->getDefaultSkinDir() + gDirUtilp->getDirDelimiter() + "textures" + gDirUtilp->getDirDelimiter() + "firestorm_icon.png").c_str()); for (i = 0; i < (S32)notificationTypes.size(); ++i) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 2428c0fb39..73a3a32443 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1513,7 +1513,7 @@ boost::signals2::connection LLAgent::whenPositionChanged(position_signal_t::slot //----------------------------------------------------------------------------- S32 LLAgent::getRegionsVisited() const { - return mRegionsVisited.size(); + return static_cast(mRegionsVisited.size()); } //----------------------------------------------------------------------------- @@ -3726,8 +3726,8 @@ bool LLAgent::isInGroup(const LLUUID& group_id, bool ignore_god_mode /* false */ if (!ignore_god_mode && isGodlike()) return true; - U32 count = mGroups.size(); - for(U32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3746,8 +3746,8 @@ bool LLAgent::hasPowerInGroup(const LLUUID& group_id, U64 power) const // GP_NO_POWERS can also mean no power is enough to grant an ability. if (GP_NO_POWERS == power) return false; - U32 count = mGroups.size(); - for(U32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3767,8 +3767,8 @@ U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const if (isGodlike()) return GP_ALL_POWERS; - U32 count = mGroups.size(); - for(U32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3781,8 +3781,8 @@ U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const bool LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3795,8 +3795,8 @@ bool LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const S32 LLAgent::getGroupContribution(const LLUUID& group_id) const { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3809,8 +3809,8 @@ S32 LLAgent::getGroupContribution(const LLUUID& group_id) const bool LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution) { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3832,8 +3832,8 @@ bool LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution) bool LLAgent::setUserGroupFlags(const LLUUID& group_id, bool accept_notices, bool list_in_profile) { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { diff --git a/indra/newview/llagentpicksinfo.cpp b/indra/newview/llagentpicksinfo.cpp index 5724adb450..4f943d75a7 100644 --- a/indra/newview/llagentpicksinfo.cpp +++ b/indra/newview/llagentpicksinfo.cpp @@ -147,5 +147,5 @@ void LLAgentPicksInfo::onServerRespond(LLAvatarData* picks) return; } - setNumberOfPicks(picks->picks_list.size()); + setNumberOfPicks(static_cast(picks->picks_list.size())); } diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 899546a43f..5e45766229 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1084,7 +1084,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it { LL_INFOS() << "setWearableOutfit() start" << LL_ENDL; - S32 count = wearables.size(); + auto count = wearables.size(); llassert(items.size() == count); // Check for whether outfit already matches the one requested @@ -1093,7 +1093,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it S32 type_counts[arr_size]; bool update_inventory{ false }; std::fill(type_counts,type_counts+arr_size,0); - for (S32 i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) { LLViewerWearable* new_wearable = wearables[i]; LLPointer new_item = items[i]; @@ -1572,7 +1572,7 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array) { // Build a compound message to send all the objects that need to be rezzed. - S32 obj_count = obj_item_array.size(); + auto obj_count = obj_item_array.size(); if (obj_count > 0) { LL_DEBUGS("Avatar") << "ATT attaching multiple, total obj_count " << obj_count << LL_ENDL; @@ -1941,7 +1941,7 @@ bool LLAgentWearables::itemUpdatePending(const LLUUID& item_id) const U32 LLAgentWearables::itemUpdatePendingCount() const { - return mItemsAwaitingWearableUpdate.size(); + return static_cast(mItemsAwaitingWearableUpdate.size()); } // MULTI-WEARABLE: DEPRECATED (see backwards compatibility) diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp index f980a073be..5a01d23b30 100644 --- a/indra/newview/llaisapi.cpp +++ b/indra/newview/llaisapi.cpp @@ -791,7 +791,7 @@ void AISAPI::FetchOrphans(completion_t callback) void AISAPI::EnqueueAISCommand(const std::string &procName, LLCoprocedureManager::CoProcedure_t proc) { LLCoprocedureManager &inst = LLCoprocedureManager::instance(); - S32 pending_in_pool = inst.countPending("AIS"); + auto pending_in_pool = inst.countPending("AIS"); std::string procFullName = "AIS(" + procName + ")"; if (pending_in_pool < MAX_SIMULTANEOUS_COROUTINES) { @@ -820,7 +820,7 @@ void AISAPI::onIdle(void *userdata) if (!sPostponedQuery.empty()) { LLCoprocedureManager &inst = LLCoprocedureManager::instance(); - S32 pending_in_pool = inst.countPending("AIS"); + auto pending_in_pool = inst.countPending("AIS"); while (pending_in_pool < MAX_SIMULTANEOUS_COROUTINES && !sPostponedQuery.empty()) { ais_query_item_t &item = sPostponedQuery.front(); @@ -1370,7 +1370,7 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth) uuid_int_map_t::const_iterator lookup_it = mCatDescendentsKnown.find(category_id); if (mCatDescendentsKnown.end() != lookup_it) { - S32 descendent_count = lookup_it->second; + S32 descendent_count = static_cast(lookup_it->second); LL_DEBUGS("Inventory") << "Setting descendents count to " << descendent_count << " for category " << category_id << LL_ENDL; new_cat->setDescendentCount(descendent_count); @@ -1423,7 +1423,7 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth) uuid_int_map_t::const_iterator lookup_it = mCatDescendentsKnown.find(category_id); if (mCatDescendentsKnown.end() != lookup_it) { - S32 descendent_count = lookup_it->second; + S32 descendent_count = static_cast(lookup_it->second); LL_DEBUGS("Inventory") << "Setting descendents count to " << descendent_count << " for new category " << category_id << LL_ENDL; new_cat->setDescendentCount(descendent_count); @@ -1599,7 +1599,7 @@ void AISUpdate::doUpdate() checkTimeout(); // Do version/descendant accounting. - for (std::map::const_iterator catit = mCatDescendentDeltas.begin(); + for (std::map::const_iterator catit = mCatDescendentDeltas.begin(); catit != mCatDescendentDeltas.end(); ++catit) { LL_DEBUGS("Inventory") << "descendant accounting for " << catit->first << LL_ENDL; @@ -1623,7 +1623,7 @@ void AISUpdate::doUpdate() LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); if (cat) { - S32 descendent_delta = catit->second; + S32 descendent_delta = static_cast(catit->second); S32 old_count = cat->getDescendentCount(); LL_DEBUGS("Inventory") << "Updating descendant count for " << cat->getName() << " " << cat_id @@ -1747,7 +1747,7 @@ void AISUpdate::doUpdate() ucv_it != mCatVersionsUpdated.end(); ++ucv_it) { const LLUUID id = ucv_it->first; - S32 version = ucv_it->second; + S32 version = static_cast(ucv_it->second); LLViewerInventoryCategory *cat = gInventory.getCategory(id); LL_DEBUGS("Inventory") << "cat version update " << cat->getName() << " to version " << cat->getVersion() << LL_ENDL; if (cat->getVersion() != version) diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h index 0dabd9f678..dd490c8268 100644 --- a/indra/newview/llaisapi.h +++ b/indra/newview/llaisapi.h @@ -134,7 +134,7 @@ private: // Todo: make throttle work over all fetch requests isntead of per-request const F32 AIS_EXPIRY_SECONDS = 0.008f; - typedef std::map uuid_int_map_t; + typedef std::map uuid_int_map_t; uuid_int_map_t mCatDescendentDeltas; uuid_int_map_t mCatDescendentsKnown; uuid_int_map_t mCatVersionsUpdated; diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 1a82552ad9..94d2084a93 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -728,7 +728,7 @@ public: bool isMostRecent(); void handleLateArrivals(); void resetTime(F32 timeout); - static S32 countActive() { return sActiveHoldingPatterns.size(); } + static S32 countActive() { return static_cast(sActiveHoldingPatterns.size()); } S32 index() { return mIndex; } private: @@ -1383,7 +1383,7 @@ static void removeDuplicateItems(LLInventoryModel::item_array_t& items) // encountered, so we actually keep the *last* of each duplicate // item. This is needed to give the right priority when adding // duplicate items to an existing outfit. - for (S32 i=items.size()-1; i>=0; i--) + for (S32 i = static_cast(items.size()) - 1; i >= 0; i--) { LLViewerInventoryItem *item = items.at(i); LLUUID item_id = item->getLinkedUUID(); @@ -2207,14 +2207,14 @@ void LLAppearanceMgr::filterWearableItems( items.clear(); for (S32 i=0; igetAllowMultiwear((LLWearableType::EType)i)) ? max_per_type : 1)); + auto start_index = llmax(0, size - ((LLWearableType::getInstance()->getAllowMultiwear((LLWearableType::EType)i)) ? max_per_type : 1)); // [/SL:KB[ - for (S32 j = start_index; jgetType(), true); } - for (S32 idxItem = 0, cntItem = itemsNew.size(); idxItem < cntItem; idxItem++) + for (size_t idxItem = 0, cntItem = itemsNew.size(); idxItem < cntItem; idxItem++) { RlvBehaviourNotifyHandler::onWear(itemsNew.at(idxItem)->getWearableType(), true); } @@ -3904,7 +3904,7 @@ struct WearablesOrderComparator LOG_CLASS(WearablesOrderComparator); WearablesOrderComparator(const LLWearableType::EType type) { - mControlSize = build_order_string(type, 0).size(); + mControlSize = static_cast(build_order_string(type, 0).size()); }; bool operator()(const LLInventoryItem* item1, const LLInventoryItem* item2) @@ -3939,7 +3939,7 @@ void LLAppearanceMgr::getWearableOrderingDescUpdates(LLInventoryModel::item_arra for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; type++) { - U32 size = items_by_type[type].size(); + U32 size = static_cast(items_by_type[type].size()); if (!size) continue; //sinking down invalid items which need reordering @@ -5042,7 +5042,7 @@ public: LLInventoryModel::item_array_t* items; gInventory.getDirectDescendentsOf(mComplete.front(), cats, items); - S32 count = items->size(); + auto count = items->size(); if(!count) { LL_WARNS() << "Nothing fetched in category " << mComplete.front() @@ -5058,7 +5058,7 @@ public: S32 version = cat ? cat->getVersion() : -2; LL_INFOS() << "stage1, category " << mComplete.front() << " got " << count << " items, version " << version << " passing to stage2 " << LL_ENDL; uuid_vec_t ids; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { ids.push_back(items->at(i)->getUUID()); } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index d4288202da..970147ed84 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -405,7 +405,7 @@ WorkQueue gMainloopWork("mainloop", 1024*1024); std::string SafeFileName(std::string filename) { std::string invalidChars = "\"\'\\/?*:.<>| "; - S32 position = filename.find_first_of(invalidChars); + auto position = filename.find_first_of(invalidChars); while (position != filename.npos) { filename[position] = '_'; @@ -1927,7 +1927,7 @@ bool LLAppViewer::doFrame() S32 LLAppViewer::updateTextureThreads(F32 max_time) { - S32 work_pending = 0; + size_t work_pending = 0; { LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Texture Cache"); work_pending += LLAppViewer::getTextureCache()->update(max_time); // unpauses the texture cache thread @@ -1940,7 +1940,7 @@ S32 LLAppViewer::updateTextureThreads(F32 max_time) LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Image Fetch"); work_pending += LLAppViewer::getTextureFetch()->update(max_time); // unpauses the texture fetch thread } - return work_pending; + return static_cast(work_pending); } void LLAppViewer::flushLFSIO() @@ -2378,9 +2378,9 @@ bool LLAppViewer::cleanup() while(1) { S32 pending = 0; - pending += LLAppViewer::getTextureCache()->update(1); // unpauses the worker thread - pending += LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread - pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread + pending += static_cast(LLAppViewer::getTextureCache()->update(1)); // unpauses the worker thread + pending += static_cast(LLAppViewer::getImageDecodeThread()->update(1)); // unpauses the image thread + pending += static_cast(LLAppViewer::getTextureFetch()->update(1)); // unpauses the texture fetch thread pending += LLLFSThread::updateClass(0); F64 idle_time = idleTimer.getElapsedTimeF64(); if(!pending) @@ -4179,7 +4179,7 @@ std::string LLAppViewer::getViewerInfoString(bool default_string) const else { // array value: build KEY_0, KEY_1 etc. entries - for (LLSD::Integer n(0), size(ii->second.size()); n < size; ++n) + for (LLSD::Integer n(0), size(static_cast(ii->second.size())); n < size; ++n) { args[STRINGIZE(ii->first << '_' << n)] = ii->second[n].asString(); } @@ -4458,7 +4458,7 @@ void LLAppViewer::recordMarkerVersion(LLAPRFile& marker_file) } // record the viewer version in the marker file - marker_file.write(marker_version.data(), marker_version.length()); + marker_file.write(marker_version.data(), static_cast(marker_version.length())); marker_file.flush(); // Make sure filesystem reflects what we wrote. } @@ -6022,7 +6022,7 @@ void LLAppViewer::updateNameLookupUrl(const LLViewerRegion * regionp) if (have_capability) { // we have support for display names, use it - U32 url_size = name_lookup_url.size(); + auto url_size = name_lookup_url.size(); // capabilities require URLs with slashes before query params: // https://:/cap//?ids= // but the caps are granted like: diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 489f45519c..642241cf47 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -1102,7 +1102,7 @@ bool LLAppViewerWin32::sendURLToOtherInstance(const std::string& url) COPYDATASTRUCT cds; const S32 SLURL_MESSAGE_TYPE = 0; cds.dwData = SLURL_MESSAGE_TYPE; - cds.cbData = url.length() + 1; + cds.cbData = static_cast(url.length()) + 1; cds.lpData = (void*)url.c_str(); LRESULT msg_result = SendMessage(other_window, WM_COPYDATA, NULL, (LPARAM)&cds); diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index 3882a99095..c0a4b29c59 100644 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -328,7 +328,7 @@ void LLAttachmentsMgr::LLItemRequestTimes::addTime(const LLUUID& inv_item_id) void LLAttachmentsMgr::LLItemRequestTimes::removeTime(const LLUUID& inv_item_id) { LLInventoryItem *item = gInventory.getItem(inv_item_id); - S32 remove_count = (*this).erase(inv_item_id); + auto remove_count = (*this).erase(inv_item_id); if (remove_count) { LL_DEBUGS("Avatar") << "ATT " << mOpName << " removing request time " diff --git a/indra/newview/llautoreplace.cpp b/indra/newview/llautoreplace.cpp index e1d494f7c7..f200ca8e31 100644 --- a/indra/newview/llautoreplace.cpp +++ b/indra/newview/llautoreplace.cpp @@ -81,7 +81,7 @@ void LLAutoReplace::autoreplaceCallback(S32& replacement_start, S32& replacement replacement_start = word_start; replacement_length = word_end - word_start + 1; replacement_string = utf8str_to_wstring(replacement_word); - S32 size_change = replacement_string.size() - old_string.size(); + S32 size_change = static_cast(replacement_string.size() - old_string.size()); cursor_pos += size_change; } } diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index d40c0797ea..41c14a171c 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -820,8 +820,8 @@ void LLAvatarActions::csr(const LLUUID& id, std::string name) std::string url = "http://csr.lindenlab.com/agent/"; // slow and stupid, but it's late - S32 len = name.length(); - for (S32 i = 0; i < len; i++) + auto len = name.length(); + for (size_t i = 0; i < len; i++) { if (name[i] == ' ') { @@ -1039,11 +1039,11 @@ namespace action_give_inventory return; } - S32 count = LLShareInfo::instance().mAvatarNames.size(); + auto count = LLShareInfo::instance().mAvatarNames.size(); bool shared = count && !inventory_selected_uuids.empty(); // iterate through avatars - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { const LLUUID& avatar_uuid = LLShareInfo::instance().mAvatarUuids[i]; @@ -1127,7 +1127,7 @@ namespace action_give_inventory // [RLVa:KB] - @share if ( (RlvActions::isRlvEnabled()) && (RlvActions::hasBehaviour(RLV_BHVR_SHARE)) ) { - for (int idxAvatar = avatar_uuids.size() - 1; idxAvatar >= 0; idxAvatar--) + for (int idxAvatar = static_cast(avatar_uuids.size()) - 1; idxAvatar >= 0; idxAvatar--) { if (!RlvActions::canGiveInventory(avatar_uuids[idxAvatar])) { @@ -1985,7 +1985,7 @@ bool getRegionAndPosGlobalFromAgentID(const LLUUID& idAgent, const LLViewerRegio for (; itRegion != endRegion; ++itRegion) { const LLViewerRegion* pRegion = *itRegion; - for (S32 idxRegionAgent = 0, cntRegionAgent = pRegion->mMapAvatars.size(); idxRegionAgent < cntRegionAgent; idxRegionAgent++) + for (size_t idxRegionAgent = 0, cntRegionAgent = pRegion->mMapAvatars.size(); idxRegionAgent < cntRegionAgent; idxRegionAgent++) { if (pRegion->mMapAvatarIDs.at(idxRegionAgent) == idAgent) { diff --git a/indra/newview/llavatarrendernotifier.cpp b/indra/newview/llavatarrendernotifier.cpp index d782dc3e0c..5742c033c7 100644 --- a/indra/newview/llavatarrendernotifier.cpp +++ b/indra/newview/llavatarrendernotifier.cpp @@ -315,7 +315,7 @@ void LLHUDRenderNotifier::updateNotificationHUD(hud_complexity_list_t complexity } mHUDComplexityList = complexity; - mHUDsCount = mHUDComplexityList.size(); + mHUDsCount = static_cast(mHUDComplexityList.size()); static LLCachedControl show_my_complexity_changes(gSavedSettings, "ShowMyComplexityChanges", 20); if (!show_my_complexity_changes) diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp index 1767092c25..5c437c433d 100644 --- a/indra/newview/llblocklist.cpp +++ b/indra/newview/llblocklist.cpp @@ -47,7 +47,7 @@ LLBlockList::LLBlockList(const Params& p) { LLMuteList::getInstance()->addObserver(this); - mMuteListSize = LLMuteList::getInstance()->getMutes().size(); + mMuteListSize = static_cast(LLMuteList::getInstance()->getMutes().size()); // Set up context menu. LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; @@ -92,7 +92,7 @@ void LLBlockList::createList() BlockListActionType LLBlockList::getCurrentMuteListActionType() { BlockListActionType type = NONE; - U32 curSize = LLMuteList::getInstance()->getMutes().size(); + U32 curSize = static_cast(LLMuteList::getInstance()->getMutes().size()); if( curSize > mMuteListSize) type = ADD; else if(curSize < mMuteListSize) @@ -266,7 +266,7 @@ void LLBlockList::refresh() selectItemPair(getItemPair(next_selected), true); } } - mMuteListSize = LLMuteList::getInstance()->getMutes().size(); + mMuteListSize = static_cast(LLMuteList::getInstance()->getMutes().size()); // Sort the list. sort(); diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index ec972ae14a..38e5c6c3e3 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -26,16 +26,11 @@ #include "llviewerprecompiledheaders.h" -#if LL_WINDOWS -#pragma warning( disable : 4800 ) // performance warning in -#endif - #include "llcallingcard.h" #include #include "indra_constants.h" -//#include "llcachename.h" #include "llstl.h" #include "lltimer.h" #include "lluuid.h" diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index d00d0344fa..e47e034bf3 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -471,7 +471,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) // to eat trailing spaces that might be part of a gesture. LLWStringUtil::trimHead(raw_text); - S32 length = raw_text.length(); + auto length = raw_text.length(); if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences { @@ -519,7 +519,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) // Select to end of line, starting from the character // after the last one the user typed. - self->mInputEditor->setSelection(length, outlength); + self->mInputEditor->setSelection(static_cast(length), outlength); } } diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index dc54d2f11d..9aff427313 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -765,8 +765,8 @@ public: mSourceType == CHAT_SOURCE_AGENT) { //if it's an avatar name with a username add formatting - S32 username_start = chat.mFromName.rfind(" ("); - S32 username_end = chat.mFromName.rfind(')'); + auto username_start = chat.mFromName.rfind(" ("); + auto username_end = chat.mFromName.rfind(')'); if (username_start != std::string::npos && username_end == (chat.mFromName.length() - 1)) diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 94ab1fc7e6..13c43be0ed 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -1049,7 +1049,7 @@ public: /** * Returns number of hosted chiclets. */ - S32 getChicletCount() {return mChicletList.size();}; + S32 getChicletCount() { return static_cast(mChicletList.size()); } /** * Returns index of chiclet in list. @@ -1285,7 +1285,7 @@ T* LLChicletPanel::createChiclet(const LLUUID& session_id, S32 index) template T* LLChicletPanel::createChiclet(const LLUUID& session_id) { - return createChiclet(session_id, mChicletList.size()); + return createChiclet(session_id, static_cast(mChicletList.size())); } template diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index d323ed2e87..96cb459d65 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -644,13 +644,13 @@ void LLCOFWearables::populateClothingList(LLAppearanceMgr::wearables_by_type_t& for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; ++type) { - U32 size = clothing_by_type[type].size(); + auto size = clothing_by_type[type].size(); if (!size) continue; LLAppearanceMgr::sortItemsByActualDescription(clothing_by_type[type]); //clothing items are displayed in reverse order, from furthest ones to closest ones (relatively to the body) - for (U32 i = size; i != 0; --i) + for (size_t i = size; i != 0; --i) { LLViewerInventoryItem* item = clothing_by_type[type][i-1]; @@ -673,8 +673,8 @@ void LLCOFWearables::addClothingTypesDummies(const LLAppearanceMgr::wearables_by for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; type++) { - U32 size = clothing_by_type[type].size(); - if (size) continue; + if (clothing_by_type[type].empty()) + continue; LLWearableType::EType w_type = static_cast(type); LLPanelInventoryListItemBase* item_panel = LLPanelDummyClothingListItem::create(w_type); diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp index 5b8d8b5480..f301af9511 100644 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -378,8 +378,8 @@ bool LLCommandLineParser::parseCommandLineString(const std::string& str) if (!str.empty()) { bool add_last_c = true; - S32 last_c_pos = str.size() - 1; //don't get out of bounds on pos+1, last char will be processed separately - for (S32 pos = 0; pos < last_c_pos; ++pos) + auto last_c_pos = str.size() - 1; //don't get out of bounds on pos+1, last char will be processed separately + for (size_t pos = 0; pos < last_c_pos; ++pos) { cmd_line_string.append(&str[pos], 1); if (str[pos] == '\\') diff --git a/indra/newview/llcommunicationchannel.cpp b/indra/newview/llcommunicationchannel.cpp index 074d60d879..810b282722 100644 --- a/indra/newview/llcommunicationchannel.cpp +++ b/indra/newview/llcommunicationchannel.cpp @@ -54,7 +54,7 @@ bool LLCommunicationChannel::filterByDoNotDisturbStatus(LLNotificationPtr) S32 LLCommunicationChannel::getHistorySize() const { - return mHistory.size(); + return static_cast(mHistory.size()); } LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::beginHistory() const diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index f51a7934ba..daba7cff6f 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -413,11 +413,11 @@ void LLControlAvatar::updateDebugText() S32 total_linkset_count = 0; if (mRootVolp) { - total_linkset_count = 1 + mRootVolp->getChildren().size(); + total_linkset_count = 1 + static_cast(mRootVolp->getChildren().size()); } std::vector volumes; getAnimatedVolumes(volumes); - S32 animated_volume_count = volumes.size(); + S32 animated_volume_count = static_cast(volumes.size()); std::string active_string; std::string type_string; std::string lod_string; diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 08861ebedf..3dd2513c47 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -346,7 +346,7 @@ LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep) face = new LLFace(this, mVObjp); - face->setTEOffset(mFaces.size()); + face->setTEOffset(static_cast(mFaces.size())); face->setTexture(texturep); face->setPoolType(gPipeline.getPoolTypeFromTE(te, texturep)); @@ -368,7 +368,7 @@ LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLFace *face; face = new LLFace(this, mVObjp); - face->setTEOffset(mFaces.size()); + face->setTEOffset(static_cast(mFaces.size())); face->setTexture(texturep); face->setNormalMap(normalp); face->setPoolType(gPipeline.getPoolTypeFromTE(te, texturep)); @@ -391,7 +391,7 @@ LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLFace *face; face = new LLFace(this, mVObjp); - face->setTEOffset(mFaces.size()); + face->setTEOffset(static_cast(mFaces.size())); face->setTexture(texturep); face->setNormalMap(normalp); face->setSpecularMap(specularp); @@ -424,7 +424,7 @@ void LLDrawable::setNumFaces(const S32 newFaces, LLFacePool *poolp, LLViewerText else // (newFaces > mFaces.size()) { mFaces.reserve(newFaces); - for (int i = mFaces.size(); i mFaces.size()) { mFaces.reserve(newFaces); - for (int i = mFaces.size(); imFaces.size(); + auto face_count = mFaces.size() + src->mFaces.size(); mFaces.reserve(face_count); - for (U32 i = 0; i < src->mFaces.size(); i++) + for (size_t i = 0; i < src->mFaces.size(); i++) { LLFace* facep = src->mFaces[i]; facep->setDrawable(this); diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 55479af047..ea623b93fc 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -315,7 +315,7 @@ void LLFacePool::addFaceReference(LLFace *facep) { if (-1 == facep->getReferenceIndex()) { - facep->setReferenceIndex(mReferences.size()); + facep->setReferenceIndex(static_cast(mReferences.size())); mReferences.push_back(facep); } } @@ -667,7 +667,7 @@ bool LLRenderPass::uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinI return false; } const LLVOAvatar::MatrixPaletteCache& mpc = avatar->updateSkinInfoMatrixPalette(skinInfo); - U32 count = mpc.mMatrixPalette.size(); + U32 count = static_cast(mpc.mMatrixPalette.size()); if (count == 0) { diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 6a67f4ffbb..d5c0e3e981 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -946,7 +946,7 @@ bool LLDrawPoolAlpha::uploadMatrixPalette(const LLDrawInfo& params) return false; } const LLVOAvatar::MatrixPaletteCache& mpc = params.mAvatar.get()->updateSkinInfoMatrixPalette(params.mSkinInfo); - U32 count = mpc.mMatrixPalette.size(); + U32 count = static_cast(mpc.mMatrixPalette.size()); if (count == 0) { diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp index 07834c58b4..bbc93c2af9 100644 --- a/indra/newview/lldrawpoolmaterials.cpp +++ b/indra/newview/lldrawpoolmaterials.cpp @@ -250,7 +250,7 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass) if (params.mAvatar != lastAvatar) { const LLVOAvatar::MatrixPaletteCache& mpc = params.mAvatar->updateSkinInfoMatrixPalette(params.mSkinInfo); - U32 count = mpc.mMatrixPalette.size(); + U32 count = static_cast(mpc.mMatrixPalette.size()); if (count == 0) { diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index a9ad34d9bd..d198fafc52 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -764,7 +764,7 @@ namespace LLEnvironment::DayInstance::ptr_t getBaseDayInstance() const { return mBaseDayInstance; } void setBaseDayInstance(const LLEnvironment::DayInstance::ptr_t &baseday); - S32 countExperiencesActive() const { return mActiveExperiences.size(); } + S32 countExperiencesActive() const { return static_cast(mActiveExperiences.size()); } bool isOverriddenSky() const { return !mSkyExperience.isNull(); } bool isOverriddenWater() const { return !mWaterExperience.isNull(); } diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index ae1ac476db..f1cb8d5cfe 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -256,7 +256,7 @@ bool LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) TimerBar* hover_bar = NULL; F32Seconds mouse_time_offset = ((F32)(x - mBarRect.mLeft) / (F32)mBarRect.getWidth()) * mTotalTimeDisplay; - for (int bar_index = 0, end_index = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); + for (size_t bar_index = 0, end_index = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); bar_index < end_index; ++bar_index) { @@ -730,7 +730,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t gGL.color3fv(base_col.mV); U32 count = 0; - U32 total_count = base_execution.size(); + U32 total_count = static_cast(base_execution.size()); last_p.clear(); @@ -752,7 +752,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t LLGLEnable blend(GL_BLEND); gGL.color3fv(cur_col.mV); count = 0; - total_count = cur_execution.size(); + total_count = static_cast(cur_execution.size()); for (std::vector::iterator iter = cur_execution.begin(); iter != cur_execution.end(); ++iter) { @@ -1044,7 +1044,7 @@ void LLFastTimerView::drawLineGraph() //highlight visible range { - S32 first_frame = mRecording.getNumRecordedPeriods() - mScrollIndex; + S32 first_frame = static_cast(mRecording.getNumRecordedPeriods()) - mScrollIndex; S32 last_frame = first_frame - MAX_VISIBLE_HISTORY; F32 frame_delta = ((F32) (mGraphRect.getWidth()))/(mRecording.getNumRecordedPeriods()-1); @@ -1109,7 +1109,7 @@ void LLFastTimerView::drawLineGraph() F32 time_scale_factor = (F32)mGraphRect.getHeight() / max_time.value(); F32 hz_scale_factor = (F32) mGraphRect.getHeight() / (1.f / max_time.value()); - for (U32 j = mRecording.getNumRecordedPeriods(); + for (U32 j = static_cast(mRecording.getNumRecordedPeriods()); j > 0; j--) { @@ -1700,7 +1700,7 @@ S32 LLFastTimerView::drawBar(LLRect bar_rect, TimerBarRow& row, S32 image_width, bool children_visible = visible && !time_block->getTreeNode().mCollapsed; bar_index++; - const U32 num_bars = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); + const auto num_bars = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); if (bar_index < num_bars && row.mBars[bar_index].mFirstChild) { bool is_last = false; diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 4af294741e..8400311d63 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -1417,7 +1417,7 @@ void LLFavoritesBarCtrl::fitLabelWidth(LLMenuItemCallGL* menu_item) // Check whether item name wider than menu if (menu_item->getNominalWidth() > max_width) { - S32 chars_total = item_name.length(); + S32 chars_total = static_cast(item_name.length()); S32 chars_fitted = 1; menu_item->setLabel(LLStringExplicit("")); S32 label_space = max_width - menu_item->getFont()->getWidth("...") - @@ -1542,7 +1542,7 @@ bool LLFavoritesBarCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) } void copy_slurl_to_clipboard_cb(std::string& slurl) { - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl),0,slurl.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl), 0, static_cast(slurl.size())); LLSD args; args["SLURL"] = slurl; @@ -1692,8 +1692,8 @@ bool LLFavoritesBarCtrl::isClipboardPasteable() const std::vector objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + auto count = objects.size(); + for(size_t i = 0; i < count; i++) { const LLUUID &item_id = objects.at(i); @@ -1721,9 +1721,9 @@ void LLFavoritesBarCtrl::pasteFromClipboard() const LLInventoryItem* item = NULL; std::vector objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); + auto count = objects.size(); LLUUID parent_id(mFavoriteFolderId); - for(S32 i = 0; i < count; i++) + for(size_t i = 0; i < count; i++) { item = model->getItem(objects.at(i)); if (item) diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index 4b52315502..07b5130c3e 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -201,7 +201,7 @@ static const std::vector sGraphicsLevelNames = boost::assign::list_ U32 LLFeatureManager::getMaxGraphicsLevel() const { - return sGraphicsLevelNames.size() - 1; + return static_cast(sGraphicsLevelNames.size()) - 1; } bool LLFeatureManager::isValidGraphicsLevel(U32 level) const diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 4d82611def..367803b78a 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -72,13 +72,13 @@ LLVolumeImplFlexible::LLVolumeImplFlexible(LLViewerObject* vo, LLFlexibleObjectD mVO->mDrawable->makeActive() ; } - mInstanceIndex = sInstanceList.size(); + mInstanceIndex = static_cast(sInstanceList.size()); sInstanceList.push_back(this); }//----------------------------------------------- LLVolumeImplFlexible::~LLVolumeImplFlexible() { - S32 end_idx = sInstanceList.size()-1; + S32 end_idx = static_cast(sInstanceList.size()) - 1; if (end_idx != mInstanceIndex) { diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp index 497fe3b9ba..c09c02d32b 100644 --- a/indra/newview/llfloaterbulkpermission.cpp +++ b/indra/newview/llfloaterbulkpermission.cpp @@ -223,7 +223,7 @@ bool LLFloaterBulkPermission::start() // Go to the next object and start if found. Returns false if no objects left, true otherwise. bool LLFloaterBulkPermission::nextObject() { - S32 count; + size_t count; bool successful_start = false; do { @@ -251,7 +251,7 @@ bool LLFloaterBulkPermission::popNext() { // get the head element from the container, and attempt to get its inventory. bool rv = false; - S32 count = mObjectIDs.size(); + auto count = mObjectIDs.size(); if(mCurrentObjectID.isNull() && (count > 0)) { mCurrentObjectID = mObjectIDs.at(0); diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp index 70eef55206..54dcaf4a8a 100644 --- a/indra/newview/llfloaterbump.cpp +++ b/indra/newview/llfloaterbump.cpp @@ -391,7 +391,7 @@ void FSBumpListMenu::onContextMenuItemClick(const LLSD& userdata) if (!bumps_text.empty()) { - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(bumps_text), 0, bumps_text.size() ); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(bumps_text), 0, static_cast(bumps_text.size())); } } } diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp index e634f47a7b..b5f38036d1 100644 --- a/indra/newview/llfloaterconversationpreview.cpp +++ b/indra/newview/llfloaterconversationpreview.cpp @@ -132,7 +132,7 @@ void LLFloaterConversationPreview::setPages(std::list* messages, const std delete mMessages; // Clean up temporary message list with "Loading..." text } mMessages = messages; - mCurrentPage = (mMessages->size() ? (mMessages->size() - 1) / mPageSize : 0); + mCurrentPage = (mMessages->size() ? (static_cast(mMessages->size()) - 1) / mPageSize : 0); mPageSpinner->setEnabled(true); mPageSpinner->setMaxValue(mCurrentPage+1); diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp index b1df06ac04..79f1cdcfad 100644 --- a/indra/newview/llfloateremojipicker.cpp +++ b/indra/newview/llfloateremojipicker.cpp @@ -106,16 +106,16 @@ public: F32 x = 4; // padding-left F32 y = getRect().getHeight() / 2; LLFontGL::getFontSansSerif()->render( - mText, // wstr - 0, // begin_offset - x, // x - y, // y - LLColor4::white, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - mText.size()); // max_chars + mText, // wstr + 0, // begin_offset + x, // x + y, // y + LLColor4::white, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast(mText.size())); // max_chars } virtual void updatePanel(bool allow_modify) override {} @@ -248,17 +248,17 @@ protected: { std::string text = mTitle.substr(0, mBegin); font->renderUTF8( - text, // text - 0, // begin_offset - x0, // x - y, // y - color, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - text.size(), // max_chars - x1); // max_pixels + text, // text + 0, // begin_offset + x0, // x + y, // y + color, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast(text.size()), // max_chars + x1); // max_pixels F32 dx = font->getWidthF32(text); x0 += dx; x1 -= dx; @@ -267,17 +267,17 @@ protected: { std::string text = mTitle.substr(mBegin, mEnd - mBegin); font->renderUTF8( - text, // text - 0, // begin_offset - x0, // x - y, // y - LLColor4::yellow6, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - text.size(), // max_chars - x1); // max_pixels + text, // text + 0, // begin_offset + x0, // x + y, // y + LLColor4::yellow6, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast(text.size()), // max_chars + x1); // max_pixels F32 dx = font->getWidthF32(text); x0 += dx; x1 -= dx; @@ -286,17 +286,17 @@ protected: { std::string text = mEnd ? mTitle.substr(mEnd) : mTitle; font->renderUTF8( - text, // text - 0, // begin_offset - x0, // x - y, // y - color, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - text.size(), // max_chars - x1); // max_pixels + text, // text + 0, // begin_offset + x0, // x + y, // y + color, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast(text.size()), // max_chars + x1); // max_pixels } } @@ -426,9 +426,9 @@ void LLFloaterEmojiPicker::initialize() showPreview(true); mSelectedGroupIndex = groupIndex == ALL_EMOJIS_GROUP_INDEX ? 0 : - (1 + std::distance(mFilteredEmojiGroups.begin(), + static_cast((1 + std::distance(mFilteredEmojiGroups.begin(), std::find(mFilteredEmojiGroups.begin(), mFilteredEmojiGroups.end(), groupIndex))) % - (1 + mFilteredEmojiGroups.size()); + (1 + mFilteredEmojiGroups.size())); mGroupButtons[mSelectedGroupIndex]->setToggleState(true); mGroupButtons[mSelectedGroupIndex]->setUseFontColor(true); @@ -1008,15 +1008,15 @@ bool LLFloaterEmojiPicker::moveFocusedIconUp() bool LLFloaterEmojiPicker::moveFocusedIconDown() { - S32 rowCount = mEmojiGrid->getPanelList().size(); - for (S32 i = mFocusedIconRow + 1; i < rowCount; ++i) + auto rowCount = mEmojiGrid->getPanelList().size(); + for (size_t i = mFocusedIconRow + 1; i < rowCount; ++i) { LLScrollingPanel* panel = mEmojiGrid->getPanelList()[i]; LLEmojiGridRow* row = dynamic_cast(panel); if (row && row->mList->getPanelList().size() > mFocusedIconCol) { mEmojiScroll->scrollToShowRect(row->getBoundingRect()); - mFocusedIconRow = i; + mFocusedIconRow = static_cast(i); selectFocusedIcon(); return true; } @@ -1044,7 +1044,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconPrev() if (row && row->mList->getPanelList().size()) { mEmojiScroll->scrollToShowRect(row->getBoundingRect()); - mFocusedIconCol = row->mList->getPanelList().size() - 1; + mFocusedIconCol = static_cast(row->mList->getPanelList().size()) - 1; mFocusedIconRow = i; selectFocusedIcon(); return true; @@ -1061,7 +1061,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() LLScrollingPanel* panel = mEmojiGrid->getPanelList()[mFocusedIconRow]; LLEmojiGridRow* row = dynamic_cast(panel); - S32 colCount = row ? row->mList->getPanelList().size() : 0; + S32 colCount = row ? static_cast(row->mList->getPanelList().size()) : 0; if (mFocusedIconCol < colCount - 1) { mFocusedIconCol++; @@ -1069,8 +1069,8 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() return true; } - S32 rowCount = mEmojiGrid->getPanelList().size(); - for (S32 i = mFocusedIconRow + 1; i < rowCount; ++i) + auto rowCount = mEmojiGrid->getPanelList().size(); + for (size_t i = mFocusedIconRow + 1; i < rowCount; ++i) { LLScrollingPanel* panel = mEmojiGrid->getPanelList()[i]; LLEmojiGridRow* row = dynamic_cast(panel); @@ -1078,7 +1078,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() { mEmojiScroll->scrollToShowRect(row->getBoundingRect()); mFocusedIconCol = 0; - mFocusedIconRow = i; + mFocusedIconRow = static_cast(i); selectFocusedIcon(); return true; } @@ -1129,10 +1129,10 @@ bool LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, bool called_from_parent switch (key) { case KEY_LEFT: - selectEmojiGroup((mSelectedGroupIndex + mFilteredEmojis.size()) % mGroupButtons.size()); + selectEmojiGroup(static_cast((mSelectedGroupIndex + mFilteredEmojis.size()) % mGroupButtons.size())); return true; case KEY_RIGHT: - selectEmojiGroup((mSelectedGroupIndex + 1) % mGroupButtons.size()); + selectEmojiGroup(static_cast((mSelectedGroupIndex + 1) % mGroupButtons.size())); return true; } } diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index 0411f6c039..0a187684ae 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -350,13 +350,13 @@ void LLPanelGroups::onGroupList(LLUICtrl* ctrl, void* userdata) void init_group_list(LLScrollListCtrl* group_list, const LLUUID& highlight_id, U64 powers_mask) { - S32 count = gAgent.mGroups.size(); + auto count = gAgent.mGroups.size(); LLUUID id; if (!group_list) return; group_list->operateOnAll(LLCtrlListInterface::OP_DELETE); - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { id = gAgent.mGroups.at(i).mID; LLGroupData* group_datap = &gAgent.mGroups.at(i); diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 4f67275b83..82f4fc58c8 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1799,8 +1799,8 @@ void LLFloaterIMContainer::setNearbyDistances() // Get the position of the agent const LLVector3d& me_pos = gAgent.getPositionGlobal(); // For each nearby avatar, compute and update the distance - int avatar_count = positions.size(); - for (int i = 0; i < avatar_count; i++) + auto avatar_count = positions.size(); + for (size_t i = 0; i < avatar_count; i++) { F64 dist = dist_vec_squared(positions[i], me_pos); item->setDistance(avatar_ids[i],dist); diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index fbe3b5f180..69e01802fb 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -214,7 +214,7 @@ public: void highlightConversationItemWidget(const LLUUID& session_id, bool is_highlighted); bool isScrolledOutOfSight(LLConversationViewSession* conversation_item_widget); boost::signals2::connection mMicroChangedSignal; - S32 getConversationListItemSize() { return mConversationsWidgets.size(); } + S32 getConversationListItemSize() { return static_cast(mConversationsWidgets.size()); } typedef std::list floater_list_t; void getDetachedConversationFloaters(floater_list_t& floaters); diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index af4bd4ee8a..a0ddf6ec58 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -441,7 +441,7 @@ bool LLFloaterIMNearbyChat::handleKeyHere( KEY key, MASK mask ) bool LLFloaterIMNearbyChat::matchChatTypeTrigger(const std::string& in_str, std::string* out_str) { - U32 in_len = in_str.length(); + auto in_len = in_str.length(); S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); bool string_was_found = false; @@ -480,7 +480,7 @@ void LLFloaterIMNearbyChat::onChatBoxKeystroke() // to eat trailing spaces that might be part of a gesture. LLWStringUtil::trimHead(raw_text); - S32 length = raw_text.length(); + auto length = raw_text.length(); if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences { @@ -527,7 +527,7 @@ void LLFloaterIMNearbyChat::onChatBoxKeystroke() mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part // Select to end of line, starting from the character // after the last one the user typed. - mInputEditor->selectByCursorPosition(utf8_out_str.size()-rest_of_match.size(),utf8_out_str.size()); + mInputEditor->selectByCursorPosition(static_cast(utf8_out_str.size() - rest_of_match.size()), static_cast(utf8_out_str.size())); } } @@ -559,7 +559,7 @@ void LLFloaterIMNearbyChat::onChatBoxFocusReceived() EChatType LLFloaterIMNearbyChat::processChatTypeTriggers(EChatType type, std::string &str) { - U32 length = str.length(); + auto length = str.length(); S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); for (S32 n = 0; n < cnt; n++) @@ -570,7 +570,7 @@ EChatType LLFloaterIMNearbyChat::processChatTypeTriggers(EChatType type, std::st if (!LLStringUtil::compareInsensitive(trigger, sChatTypeTriggers[n].name)) { - U32 trigger_length = sChatTypeTriggers[n].name.length(); + auto trigger_length = sChatTypeTriggers[n].name.length(); // It's to remove space after trigger name if (length > trigger_length && str[trigger_length] == ' ') @@ -773,8 +773,8 @@ void LLFloaterIMNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType bool LLFloaterIMNearbyChat::isWordsName(const std::string& name) { // checking to see if it's display name plus username in parentheses - S32 open_paren = name.find(" (", 0); - S32 close_paren = name.find(')', 0); + auto open_paren = name.find(" (", 0); + auto close_paren = name.find(')', 0); if (open_paren != std::string::npos && close_paren == name.length()-1) @@ -784,7 +784,7 @@ bool LLFloaterIMNearbyChat::isWordsName(const std::string& name) else { //checking for a single space - S32 pos = name.find(' ', 0); + auto pos = name.find(' ', 0); return std::string::npos != pos && name.rfind(' ', name.length()) == pos && 0 != pos && name.length()-1 != pos; } } diff --git a/indra/newview/llfloaterimnearbychat.h b/indra/newview/llfloaterimnearbychat.h index 06d1d4fe35..dccbc19e8b 100644 --- a/indra/newview/llfloaterimnearbychat.h +++ b/indra/newview/llfloaterimnearbychat.h @@ -72,7 +72,7 @@ public: LLChatEntry* getChatBox() { return mInputEditor; } std::string getCurrentChat(); - S32 getMessageArchiveLength() {return mMessageArchive.size();} + S32 getMessageArchiveLength() { return static_cast(mMessageArchive.size()); } virtual bool handleKeyHere( KEY key, MASK mask ); diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index af78f09455..fab0a28fd6 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -1248,7 +1248,7 @@ bool LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids) if (is_region_exist) { - S32 count = ids.size(); + auto count = ids.size(); if( isInviteAllowed() && (count > 0) ) { @@ -1258,7 +1258,7 @@ bool LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids) LLSD data; data["params"] = LLSD::emptyArray(); - for (int i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) { data["params"].append(ids[i]); } diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index 4a106cc6c2..76f96feddc 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -620,7 +620,7 @@ void LLFloaterInspect::refresh() args["NUM_VERTICES"] = format_res_string; res_mgr.getIntegerString(format_res_string, tcount); args["NUM_TRIANGLES"] = format_res_string; - res_mgr.getIntegerString(format_res_string, mTextureList.size()); + res_mgr.getIntegerString(format_res_string, static_cast(mTextureList.size())); args["NUM_TEXTURES"] = format_res_string; res_mgr.getIntegerString(format_res_string, mTextureMemory / 1024); args["TEXTURE_MEMORY"] = format_res_string; diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index d81cd1be42..0ffbb3b482 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -2726,7 +2726,7 @@ void LLPanelLandAccess::refresh() // Clear the sort order so we don't re-sort on every add. mListAccess->clearSortOrder(); mListAccess->deleteAllItems(); - S32 count = parcel->mAccessList.size(); + auto count = parcel->mAccessList.size(); getChild("AllowedText")->setTextArg("[COUNT]", llformat("%d",count)); getChild("AllowedText")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); @@ -2774,7 +2774,7 @@ void LLPanelLandAccess::refresh() // Clear the sort order so we don't re-sort on every add. mListBanned->clearSortOrder(); mListBanned->deleteAllItems(); - S32 count = parcel->mBanList.size(); + auto count = parcel->mBanList.size(); getChild("BanCheck")->setTextArg("[COUNT]", llformat("%d",count)); getChild("BanCheck")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); @@ -2982,13 +2982,13 @@ void LLPanelLandAccess::refresh_ui() getChildView("GroupCheck")->setEnabled(can_manage_allowed && can_allow_groups); } getChildView("AccessList")->setEnabled(can_manage_allowed); - S32 allowed_list_count = parcel->mAccessList.size(); + auto allowed_list_count = parcel->mAccessList.size(); getChildView("add_allowed")->setEnabled(can_manage_allowed && allowed_list_count < PARCEL_MAX_ACCESS_LIST); bool has_selected = (mListAccess && mListAccess->getSelectionInterface()->getFirstSelectedIndex() >= 0); getChildView("remove_allowed")->setEnabled(can_manage_allowed && has_selected); getChildView("BannedList")->setEnabled(can_manage_banned); - S32 banned_list_count = parcel->mBanList.size(); + auto banned_list_count = parcel->mBanList.size(); getChildView("add_banned")->setEnabled(can_manage_banned && banned_list_count < PARCEL_MAX_ACCESS_LIST); has_selected = (mListBanned && mListBanned->getSelectionInterface()->getFirstSelectedIndex() >= 0); getChildView("remove_banned")->setEnabled(can_manage_banned && has_selected); diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp index df602387b3..63c05b14f8 100644 --- a/indra/newview/llfloaterlandholdings.cpp +++ b/indra/newview/llfloaterlandholdings.cpp @@ -76,8 +76,8 @@ bool LLFloaterLandHoldings::postBuild() grant_list->sortByColumnIndex(0, true); grant_list->setDoubleClickCallback(onGrantList, this); - S32 count = gAgent.mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = gAgent.mGroups.size(); + for(size_t i = 0; i < count; ++i) { LLUUID id(gAgent.mGroups.at(i).mID); LLUIString areastr = getString("area_string"); diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 1b458f9c26..d51bf18327 100644 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -578,7 +578,7 @@ S32 LLFloaterMarketplaceListings::getFolderCount() LLInventoryModel::item_array_t * items; gInventory.getDirectDescendentsOf(mRootFolderId, cats, items); - return (cats->size() + items->size()); + return static_cast(cats->size() + items->size()); } else { diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index c13fa2caf9..84bc561acd 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1622,7 +1622,7 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides) LLModel* model = instance.mModel; const LLMeshSkinInfo *skin = &model->mSkinInfo; U32 joint_count = LLSkinningUtil::getMeshJointCount(skin); - U32 bind_count = highlight_overrides ? skin->mAlternateBindMatrix.size() : 0; // simply do not include overrides if data is not needed + U32 bind_count = highlight_overrides ? static_cast(skin->mAlternateBindMatrix.size()) : 0; // simply do not include overrides if data is not needed if (bind_count > 0 && bind_count != joint_count) { std::ostringstream out; @@ -1753,7 +1753,7 @@ void LLFloaterModelPreview::addStringToLogTab(const std::string& str, bool flash } LLWString text = utf8str_to_wstring(str); - S32 add_text_len = text.length() + 1; // newline + S32 add_text_len = static_cast(text.length()) + 1; // newline S32 editor_max_len = mUploadLogText->getMaxTextLength(); if (add_text_len > editor_max_len) { diff --git a/indra/newview/llfloatermyscripts.cpp b/indra/newview/llfloatermyscripts.cpp index a84f479d02..0283855f15 100644 --- a/indra/newview/llfloatermyscripts.cpp +++ b/indra/newview/llfloatermyscripts.cpp @@ -137,7 +137,7 @@ void LLFloaterMyScripts::setAttachmentDetails(LLSD content) return; } - S32 number_attachments = content["attachments"].size(); + S32 number_attachments = static_cast(content["attachments"].size()); for(int i = 0; i < number_attachments; i++) { @@ -148,7 +148,7 @@ void LLFloaterMyScripts::setAttachmentDetails(LLSD content) humanReadableLocation = LLTrans::getString(actualLocation.c_str()); } - S32 number_objects = content["attachments"][i]["objects"].size(); + S32 number_objects = static_cast(content["attachments"][i]["objects"].size()); for(int j = 0; j < number_objects; j++) { LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID(); diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index e0a234e3a2..ac84b31678 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -283,8 +283,14 @@ void LLFloaterPathfindingCharacters::showCapsule() const llassert(mSelectedCharacterId == character->getUUID()); if (LLPathingLib::getInstance() != NULL) { + // Interface in Nicky's physics stub package expects bool while Havok package still expects BOOL +#ifdef HAVOK_TPV + LLPathingLib::getInstance()->createPhysicsCapsuleRep(character->getLength(), character->getRadius(), + (BOOL)character->isHorizontal(), character->getUUID()); +#else LLPathingLib::getInstance()->createPhysicsCapsuleRep(character->getLength(), character->getRadius(), character->isHorizontal(), character->getUUID()); +#endif // HAVOK_TPV } } diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 760b66ca13..a7a74be26a 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -30,10 +30,6 @@ #include "llfloaterpathfindingconsole.h" -#include - -#include - #include "llagent.h" #include "llbutton.h" #include "llcheckboxctrl.h" @@ -46,7 +42,6 @@ #include "llpanel.h" #include "llpathfindingnavmeshzone.h" #include "llpathfindingpathtool.h" -#include "llpathinglib.h" #include "llsliderctrl.h" #include "llsd.h" #include "lltabcontainer.h" diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index b4452d4c46..402da273c8 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -135,7 +135,7 @@ void LLFloaterPathfindingObjects::draw() std::vector selectedItems = mObjectsScrollList->getAllSelected(); if (!selectedItems.empty()) { - int numSelectedItems = selectedItems.size(); + auto numSelectedItems = selectedItems.size(); S32 nameColumnIndex = getNameColumnIndex(); const LLColor4 &beaconColor = getBeaconColor(); const LLColor4 &beaconTextColor = getBeaconTextColor(); @@ -334,7 +334,7 @@ void LLFloaterPathfindingObjects::rebuildObjectsScrollList(bool update_if_needed if (!mHasObjectsToBeSelected) { std::vector selectedItems = mObjectsScrollList->getAllSelected(); - int numSelectedItems = selectedItems.size(); + auto numSelectedItems = selectedItems.size(); if (numSelectedItems > 0) { mObjectsToBeSelected.reserve(selectedItems.size()); @@ -835,7 +835,7 @@ void LLFloaterPathfindingObjects::selectScrollListItemsInWorld() std::vector selectedItems = mObjectsScrollList->getAllSelected(); if (!selectedItems.empty()) { - int numSelectedItems = selectedItems.size(); + auto numSelectedItems = selectedItems.size(); std::vectorviewerObjects; viewerObjects.reserve(numSelectedItems); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 7585a6019e..24b1d225d4 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -2240,7 +2240,7 @@ void LLFloaterPreference::refreshEnabledState() void LLFloaterPreference::onCopySearch() { std::string searchQuery = "secondlife:///app/openfloater/preferences?search=" + LLURI::escape(mFilterEdit->getText()); - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(searchQuery), 0, searchQuery.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(searchQuery), 0, static_cast(searchQuery.size())); } // @@ -5298,29 +5298,32 @@ S32 copy_prefs_file(const std::string& from, const std::string& to) LL_WARNS() << "copying " << from << " to " << to << LL_ENDL; S32 rv = 0; LLFILE* in = LLFile::fopen(from, "rb"); /*Flawfinder: ignore*/ - if(!in) + if (!in) { LL_WARNS() << "couldn't open source file " << from << " - copy aborted." << LL_ENDL; return -1; } LLFILE* out = LLFile::fopen(to, "wb"); /*Flawfinder: ignore*/ - if(!out) + if (!out) { fclose(in); LL_WARNS() << "couldn't open destination file " << to << " - copy aborted." << LL_ENDL; return -1; } - S32 read = 0; - const S32 COPY_BUFFER_SIZE = 16384; + size_t read = 0; + constexpr S32 COPY_BUFFER_SIZE = 16384; U8 buffer[COPY_BUFFER_SIZE]; - while(((read = fread(buffer, 1, sizeof(buffer), in)) > 0) - && (fwrite(buffer, 1, read, out) == (U32)read)); /* Flawfinder : ignore */ - if(ferror(in) || ferror(out)) rv = -2; + while (((read = fread(buffer, 1, sizeof(buffer), in)) > 0) + && (fwrite(buffer, 1, read, out) == read)); /* Flawfinder : ignore */ + if (ferror(in) || ferror(out)) + rv = -2; - if(in) fclose(in); - if(out) fclose(out); + if (in) + fclose(in); + if (out) + fclose(out); return rv; } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 3c0df0af5e..aaf73a79f1 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3962,7 +3962,7 @@ void LLPanelEstateAccess::copyListToClipboard(std::string list_name) } } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(list_to_copy), 0, list_to_copy.length()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(list_to_copy), 0, static_cast(list_to_copy.length())); } bool LLPanelEstateAccess::refreshFromRegion(LLViewerRegion* region) diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index e023f08d9b..7ad6ee9b49 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -403,7 +403,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) return; } - S32 number_parcels = content["parcels"].size(); + auto number_parcels = content["parcels"].size(); LLStringUtil::format_map_t args_parcels; args_parcels["[PARCELS]"] = llformat ("%d", number_parcels); @@ -418,10 +418,10 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) bool has_locations = false; bool has_local_ids = false; - for(S32 i = 0; i < number_parcels; i++) + for(size_t i = 0; i < number_parcels; i++) { std::string parcel_name = content["parcels"][i]["name"].asString(); - S32 number_objects = content["parcels"][i]["objects"].size(); + auto number_objects = content["parcels"][i]["objects"].size(); S32 local_id = 0; if(content["parcels"][i].has("local_id")) @@ -431,7 +431,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) local_id = content["parcels"][i]["local_id"].asInteger(); } - for(S32 j = 0; j < number_objects; j++) + for(size_t j = 0; j < number_objects; j++) { S32 size = content["parcels"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB; @@ -900,10 +900,10 @@ void LLPanelScriptLimitsRegionMemory::returnObjects() return; } - S32 number_parcels = mContent["parcels"].size(); + auto number_parcels = mContent["parcels"].size(); // a message per parcel containing all objects to be returned from that parcel - for(S32 i = 0; i < number_parcels; i++) + for(size_t i = 0; i < number_parcels; i++) { S32 local_id = 0; if(mContent["parcels"][i].has("local_id")) diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index b28c084b16..ef02d0f436 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -1280,11 +1280,11 @@ void LLFloaterWorldMap::buildLandmarkIDLists() mLandmarkItemIDList.reserve(mLandmarkItemIDList.size() + items.size()); // Filter duplicate landmarks on world map - std::set used_landmarks; + uuid_set_t used_landmarks; bool filterLandmarks = gSavedSettings.getBOOL("WorldmapFilterDuplicateLandmarks"); // - S32 count = items.size(); - for(S32 i = 0; i < count; ++i) + auto count = items.size(); + for(size_t i = 0; i < count; ++i) { LLInventoryItem* item = items.at(i); @@ -1914,7 +1914,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) LLScrollListCtrl *list = getChild("search_results"); list->operateOnAll(LLCtrlListInterface::OP_DELETE); - // S32 name_length = mCompletingRegionName.length(); // FIRE-23591 support map search partial matches (Patch by Kevin Cozens) + // auto name_length = mCompletingRegionName.length(); // FIRE-23591 support map search partial matches (Patch by Kevin Cozens) LLSD match; diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index 34a8471789..af2a7e35dd 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -83,7 +83,7 @@ const LLUUID& get_folder_uuid(const LLUUID& parentFolderUUID, LLInventoryCollect gInventory.collectDescendentsIf(parentFolderUUID, cats, items, LLInventoryModel::EXCLUDE_TRASH, matchFunctor); - S32 cats_count = cats.size(); + auto cats_count = cats.size(); if (cats_count > 1) { @@ -244,7 +244,7 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje { LLUUID creator_id = item->getCreatorUUID(); LLViewerInventoryItem* cur_item = NULL; - for ( S32 i = items->size() - 1; i >= 0; --i ) + for (S32 i = static_cast(items->size()); i >= 0; --i) { cur_item = items->at(i); if ( creator_id == cur_item->getCreatorUUID() ) @@ -261,7 +261,7 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje // Note: UUID's of compared items also may be not equal. std::string obj_name = obj->getName(); LLViewerInventoryItem* cur_item = NULL; - for ( S32 i = items->size() - 1; i >= 0; --i ) + for (S32 i = static_cast(items->size()); i >= 0; --i) { cur_item = items->at(i); if ( obj->getType() != cur_item->getType() ) @@ -281,7 +281,7 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje // then return true. Note: UUID's of compared items also may be not equal. std::string obj_name = obj->getName(); LLViewerInventoryCategory* cur_cat = NULL; - for ( S32 i = cats->size() - 1; i >= 0; --i ) + for (S32 i = static_cast(cats->size()) - 1; i >= 0; --i) { cur_cat = cats->at(i); if ( obj->getType() != cur_cat->getType() ) diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 1a69bb0dfd..efbc809326 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -687,7 +687,7 @@ bool LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::strin { // choose one at random { - S32 random = ll_rand(matching.size()); + S32 random = ll_rand(static_cast(matching.size())); gesture = matching[random]; @@ -761,7 +761,7 @@ bool LLGestureMgr::triggerGesture(KEY key, MASK mask) // choose one and play it if (matching.size() > 0) { - U32 random = ll_rand(matching.size()); + U32 random = ll_rand(static_cast(matching.size())); LLMultiGesture* gesture = matching[random]; @@ -799,7 +799,7 @@ bool LLGestureMgr::triggerGestureRelease(KEY key, MASK mask) S32 LLGestureMgr::getPlayingCount() const { - return mPlaying.size(); + return static_cast(mPlaying.size()); } @@ -1489,7 +1489,7 @@ void LLGestureMgr::notifyObservers() bool LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) { - S32 in_len = in_str.length(); + auto in_len = in_str.length(); //return whole trigger, if received text equals to it item_map_t::iterator it; @@ -1517,7 +1517,7 @@ bool LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) { const std::string& trigger = gesture->getTrigger(); - if (in_len > (S32)trigger.length()) + if (in_len > trigger.length()) { // too short, bail out continue; diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp index b6000db451..d830ab18e9 100644 --- a/indra/newview/llgiveinventory.cpp +++ b/indra/newview/llgiveinventory.cpp @@ -253,9 +253,9 @@ bool LLGiveInventory::doGiveInventoryCategory(const LLUUID& to_agent, items, LLInventoryModel::EXCLUDE_TRASH, giveable); - S32 count = cats.size(); + auto count = cats.size(); bool complete = true; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { if (!gInventory.isCategoryComplete(cats.at(i)->getUUID())) { @@ -526,8 +526,8 @@ bool LLGiveInventory::handleCopyProtectedCategory(const LLSD& notification, cons items, LLInventoryModel::EXCLUDE_TRASH, remove); - S32 count = items.size(); - for(S32 i = 0; i < count; ++i) + auto count = items.size(); + for(size_t i = 0; i < count; ++i) { gInventory.deleteObject(items.at(i)->getUUID()); } @@ -598,7 +598,7 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, // 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 bit from there to give some pad. - S32 count = items.size() + cats.size(); + auto count = items.size() + cats.size(); // Aurora Sim> //if (count > MAX_ITEMS) if (count > LLWorld::getInstance()->getMaxInventoryItemsTransfer()) @@ -618,7 +618,7 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, LLAgentUI::buildFullname(name); LLUUID transaction_id; transaction_id.generate(); - S32 bucket_size = (sizeof(U8) + UUID_BYTES) * (count + 1); + S32 bucket_size = (sizeof(U8) + UUID_BYTES) * (static_cast(count) + 1); U8* bucket = new U8[bucket_size]; U8* pos = bucket; U8 type = (U8)cat->getType(); diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 5464a7af1b..03cfebee51 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -1089,7 +1089,7 @@ public: { // takes (count, pointer) // &vector[0] gets pointer to contiguous array - LLImageGL::generateTextures(source.size(), &source[0]); + LLImageGL::generateTextures(static_cast(source.size()), &source[0]); } ~TextureHolder() @@ -1100,7 +1100,7 @@ public: texUnit->unbind(LLTexUnit::TT_TEXTURE); } // ensure that we delete these textures regardless of how we exit - LLImageGL::deleteTextures(source.size(), &source[0]); + LLImageGL::deleteTextures(static_cast(source.size()), &source[0]); } bool bind(U32 index) diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index ce748ecdd3..2c0ab2620c 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -207,8 +207,8 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s cache.mObjectId = id; cache.mRegionHandle = region->getHandle(); - U32 count = llmin(tes.size(), MAX_TES); - for (U32 i = 0; i < count; ++i) + auto count = llmin(tes.size(), MAX_TES); + for (size_t i = 0; i < count; ++i) { LLGLTFMaterial* mat = new LLGLTFMaterial(); // setTEGLTFMaterialOverride and cache will take ownership mat->applyOverrideLLSD(od[i]); @@ -381,7 +381,7 @@ void LLGLTFMaterialList::flushUpdates(void(*done_callback)(bool)) { LLSD& data = sUpdates; - S32 i = data.size(); + auto i = data.size(); for (ModifyMaterialData& e : sModifyQueue) { @@ -492,7 +492,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp } buffer.resize(size); - file.read((U8*)&buffer[0], buffer.size()); + file.read((U8*)&buffer[0], static_cast(buffer.size())); } { @@ -501,7 +501,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp LLSD asset; // read file into buffer - std::istrstream str(&buffer[0], buffer.size()); + std::istrstream str(&buffer[0], static_cast(buffer.size())); if (LLSDSerialize::deserialize(asset, str, buffer.size())) { @@ -518,7 +518,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp LL_PROFILE_ZONE_SCOPED; tinygltf::TinyGLTF gltf; - if (!gltf.LoadASCIIFromString(&asset_data->mModelIn, &error_msg, &warn_msg, data.c_str(), data.length(), "")) + if (!gltf.LoadASCIIFromString(&asset_data->mModelIn, &error_msg, &warn_msg, data.c_str(), static_cast(data.length()), "")) { LL_WARNS("GLTF") << "Failed to decode material asset: " << LL_NEWLINE diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp index 99a26d9dfd..774ff5b6c4 100644 --- a/indra/newview/llgrouplist.cpp +++ b/indra/newview/llgrouplist.cpp @@ -228,7 +228,7 @@ void LLGroupList::refresh() if (mForAgent) { const LLUUID& highlight_id = gAgent.getGroupID(); - S32 count = gAgent.mGroups.size(); + S32 count = static_cast(gAgent.mGroups.size()); LLUUID id; bool have_filter = !mNameFilter.empty(); diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 81dd9df873..2e4f453f88 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -186,7 +186,7 @@ S32 LLGroupRoleData::getMembersInRole(uuid_vec_t members, { // This is the everyone role, just return the size of members, // because everyone is in the everyone role. - return members.size(); + return static_cast(members.size()); } // Sort the members list, if needed. @@ -202,7 +202,7 @@ S32 LLGroupRoleData::getMembersInRole(uuid_vec_t members, } // Return the number of members in the intersection. - S32 max_size = llmin( members.size(), mMemberIDs.size() ); + auto max_size = llmin( members.size(), mMemberIDs.size() ); uuid_vec_t in_role( max_size ); uuid_vec_t::iterator in_role_end; in_role_end = std::set_intersection(mMemberIDs.begin(), mMemberIDs.end(), diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index 161e62cd12..df99e98dc8 100644 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -155,7 +155,7 @@ public: const uuid_vec_t& getRoleMembers() const { return mMemberIDs; } S32 getMembersInRole(uuid_vec_t members, bool needs_sort = true); - S32 getTotalMembersInRole() { return mMemberCount ? mMemberCount : mMemberIDs.size(); } //FIXME: Returns 0 for Everyone role when Member list isn't yet loaded, see MAINT-5225 + S32 getTotalMembersInRole() { return mMemberCount ? mMemberCount : static_cast(mMemberIDs.size()); } //FIXME: Returns 0 for Everyone role when Member list isn't yet loaded, see MAINT-5225 LLRoleData getRoleData() const { return mRoleData; } void setRoleData(LLRoleData data) { mRoleData = data; } diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index 64e382c389..c710434b3d 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -453,7 +453,7 @@ void LLHUDNameTag::addLine(const std::string &text_utf8, // "QualityAssurance AssuresQuality1" will end up as "QualityAssurance AssuresQua..." because we are enforcing single line do { - S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::ANYWHERE); + auto segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, static_cast(wline.length()), LLFontGL::ANYWHERE); if (segment_length + line_length < wline.length()) // since we only draw one string, line_length should be 0 { // token does does not fit into signle line, need to draw "...". @@ -461,7 +461,7 @@ void LLHUDNameTag::addLine(const std::string &text_utf8, const LLWString dots_pad(utf8str_to_wstring(std::string("...."))); S32 elipses_width = font->getWidthF32(dots_pad.c_str()); // truncated string length - segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels - elipses_width, wline.length(), LLFontGL::ANYWHERE); + segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels - elipses_width, static_cast(wline.length()), LLFontGL::ANYWHERE); const LLWString dots(utf8str_to_wstring(std::string("..."))); LLHUDTextSegment segment(iter->substr(line_length, segment_length) + dots, style, color, font); mTextSegments.push_back(segment); @@ -482,7 +482,7 @@ void LLHUDNameTag::addLine(const std::string &text_utf8, // "QualityAssurance AssuresQuality 1" will be split into two lines "QualityAssurance" and "AssuresQuality" do { - S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, static_cast(wline.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); LLHUDTextSegment segment(iter->substr(line_length, segment_length), style, color, font); mTextSegments.push_back(segment); line_length += segment_length; @@ -521,7 +521,7 @@ void LLHUDNameTag::addLabel(const std::string& label_utf8, F32 max_pixels) do { S32 segment_length = mFontp->maxDrawableChars(iter->substr(line_length).c_str(), - max_pixels, wstr.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + max_pixels, static_cast(wstr.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); LLHUDTextSegment segment(iter->substr(line_length, segment_length), LLFontGL::NORMAL, mColor, mFontp); mLabelSegments.push_back(segment); line_length += segment_length; diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index 80d88702da..5608ab763f 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -138,7 +138,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f)); F32 right_x; - font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true); + font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, static_cast(wstr.length()), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true); LLUI::popMatrix(); gGL.popMatrix(); diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index b5eaa0f391..60def2ea6e 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -315,7 +315,7 @@ void LLHUDText::addLine(const std::string &text_utf8, do { F32 max_pixels = HUD_TEXT_MAX_WIDTH_NO_BUBBLE; - S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, static_cast(wline.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); LLHUDTextSegment segment(iter->substr(line_length, segment_length), style, color, font); mTextSegments.push_back(segment); line_length += segment_length; diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index 4bf7b24163..24fe17bea8 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -251,7 +251,7 @@ void inventory_offer_handler(LLOfferInfo* info) // Strip any SLURL from the message display. (DEV-2754) std::string msg = info->mDesc; - int indx = msg.find(" ( http://slurl.com/secondlife/"); + auto indx = msg.find(" ( http://slurl.com/secondlife/"); if (indx == std::string::npos) { // try to find new slurl host @@ -1164,7 +1164,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, } else { - S32 index = original_name.find(" Resident"); + auto index = original_name.find(" Resident"); if (index != std::string::npos) { original_name = original_name.substr(0, index); @@ -2393,7 +2393,7 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url) message_data["region_id"].asUUID(), position, bin_bucket.data(), - bin_bucket.size(), + static_cast(bin_bucket.size()), sender, message_data["asset_id"].asUUID()); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index c62b7eeb3b..ead3c313be 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -886,7 +886,7 @@ void LLIMModel::LLIMSession::onAdHocNameCache(const LLAvatarName& av_name) if (!av_name.isValidName()) { - S32 separator_index = mName.rfind(" "); + auto separator_index = mName.rfind(" "); std::string name = mName.substr(0, separator_index); ++separator_index; std::string conference_word = mName.substr(separator_index, mName.length()); @@ -1339,7 +1339,7 @@ void LLIMModel::LLIMSession::addMessagesFromServerHistory(const LLSD& history, } } - S32 shifted_size = shift_msgs.size(); + auto shifted_size = shift_msgs.size(); while (shift_msgs.size() > 0) { // Finally add back any new messages, and tweak the index value to be correct. LLSD newer_message = shift_msgs.front(); @@ -1405,7 +1405,7 @@ LLIMModel::LLIMSession* LLIMModel::findIMSession(const LLUUID& session_id) const //*TODO consider switching to using std::set instead of std::list for holding LLUUIDs across the whole code LLIMModel::LLIMSession* LLIMModel::findAdHocIMSession(const uuid_vec_t& ids) { - S32 num = ids.size(); + auto num = ids.size(); if (!num) return NULL; if (mId2SessionMap.empty()) return NULL; @@ -1683,7 +1683,7 @@ void LLIMModel::getMessagesSilently(const LLUUID& session_id, chat_message_list_ return; } - int i = session->mMsgs.size() - start_index; + int i = static_cast(session->mMsgs.size()) - start_index; for (chat_message_list_t::iterator iter = session->mMsgs.begin(); iter != session->mMsgs.end() && i > 0; @@ -2122,14 +2122,14 @@ void LLIMModel::sendMessage(const std::string& utf8_text, const LLUUID& other_participant_id, EInstantMessage dialog) { -// FIRE-787: break up too long chat lines into multiple messages - U32 split = MAX_MSG_BUF_SIZE - 1; - U32 pos = 0; - U32 total = utf8_text.length(); + // FIRE-787: break up too long chat lines into multiple messages + size_t split = MAX_MSG_BUF_SIZE - 1; + size_t pos = 0; + size_t total = utf8_text.length(); - while(pos < total) + while (pos < total) { - U32 next_split = split; + size_t next_split = split; if (pos + next_split > total) { @@ -2139,8 +2139,7 @@ void LLIMModel::sendMessage(const std::string& utf8_text, else { // first, try to split at a space - while((U8(utf8_text[pos + next_split]) != ' ') - && (next_split > 0)) + while ((U8(utf8_text[pos + next_split]) != ' ') && (next_split > 0)) { --next_split; } @@ -2157,11 +2156,10 @@ void LLIMModel::sendMessage(const std::string& utf8_text, } } - if(next_split == 0) + if (next_split == 0) { next_split = split; - LL_WARNS("Splitting") << - "utf-8 couldn't be split correctly" << LL_ENDL; + LL_WARNS("Splitting") << "UTF-8 couldn't be split correctly" << LL_ENDL; } } @@ -2171,7 +2169,7 @@ void LLIMModel::sendMessage(const std::string& utf8_text, // *FIXME: Queue messages and wait for server deliverMessage(send, im_session_id, other_participant_id, dialog); } -// FIRE-787 + // FIRE-787 if((dialog == IM_NOTHING_SPECIAL) && (other_participant_id.notNull())) @@ -2282,12 +2280,12 @@ void start_deprecated_conference_chat( { U8* bucket; U8* pos; - S32 count; + size_t count; S32 bucket_size; // *FIX: this could suffer from endian issues count = agents_to_invite.size(); - bucket_size = UUID_BYTES * count; + bucket_size = UUID_BYTES * static_cast(count); bucket = new U8[bucket_size]; pos = bucket; @@ -4395,7 +4393,7 @@ void LLIMMgr::noteOfflineUsers( const LLUUID& session_id, const std::vector& ids) { - S32 count = ids.size(); + auto count = ids.size(); if(count == 0) { const std::string& only_user = LLTrans::getString("only_user_message"); @@ -4445,7 +4443,7 @@ void LLIMMgr::noteMutedUsers(const LLUUID& session_id, return; } - S32 count = ids.size(); + auto count = ids.size(); if(count > 0) { LLIMModel* im_model = LLIMModel::getInstance(); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 3a33c11a04..9550b55bcf 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -498,8 +498,8 @@ void LLInvFVBridge::removeBatch(std::vector& batch) LLViewerInventoryCategory* cat = NULL; LLInventoryModel::cat_array_t descendent_categories; LLInventoryModel::item_array_t descendent_items; - S32 count = batch.size(); - S32 i,j; + size_t count = batch.size(); + size_t i,j; for(i = 0; i < count; ++i) { bridge = (LLInvFVBridge*)(batch[i]); @@ -550,8 +550,8 @@ void LLInvFVBridge::removeBatchNoCheck(std::vector& ba uuid_vec_t move_ids; LLInventoryModel::update_map_t update; bool start_new_message = true; - S32 count = batch.size(); - S32 i; + size_t count = batch.size(); + size_t i; // first, hide any 'preview' floaters that correspond to the items // being deleted. @@ -686,11 +686,8 @@ bool LLInvFVBridge::isClipboardPasteable() const // In normal mode, we need to check each element of the clipboard to know if we can paste or not std::vector objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + for (const auto& item_id : objects) { - const LLUUID &item_id = objects.at(i); - // Folders are pastable if all items in there are copyable const LLInventoryCategory *cat = model->getCategory(item_id); if (cat) @@ -726,10 +723,9 @@ bool LLInvFVBridge::isClipboardPasteableAsLink() const std::vector objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + for (const auto& item_id : objects) { - const LLInventoryItem *item = model->getItem(objects.at(i)); + const LLInventoryItem *item = model->getItem(item_id); if (item) { if (!LLAssetType::lookupCanLink(item->getActualType())) @@ -742,7 +738,7 @@ bool LLInvFVBridge::isClipboardPasteableAsLink() const return false; } } - const LLViewerInventoryCategory *cat = model->getCategory(objects.at(i)); + const LLViewerInventoryCategory *cat = model->getCategory(item_id); if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType())) { return false; @@ -2388,8 +2384,7 @@ bool LLItemBridge::removeItem() if (!item->getIsLinkType()) { LLInventoryModel::item_array_t item_array = gInventory.collectLinksTo(mUUID); - const U32 num_links = item_array.size(); - if (num_links > 0) + if (!item_array.empty()) { // Warn if the user is will break any links when deleting this item. LLNotifications::instance().add(params); @@ -2630,8 +2625,8 @@ std::string LLFolderBridge::getLabelSuffix() const LLInventoryModel::item_array_t item_array; gInventory.collectDescendents(getUUID(), cat_array, item_array, true); // Fix item count formatting - //S32 count = item_array.size(); - //if(count > 0) + //auto count = item_array.size(); + //if (count > 0) //{ // std::ostringstream oss; // oss << count; @@ -2644,9 +2639,9 @@ std::string LLFolderBridge::getLabelSuffix() const LLLocale locale(""); LLStringUtil::format_map_t args; std::string count_str; - LLResMgr::getInstance()->getIntegerString(count_str, item_array.size()); + LLResMgr::getInstance()->getIntegerString(count_str, static_cast(item_array.size())); args["ITEMS"] = count_str; - LLResMgr::getInstance()->getIntegerString(count_str, cat_array.size()); + LLResMgr::getInstance()->getIntegerString(count_str, static_cast(cat_array.size())); args["CATEGORIES"] = count_str; suffix = " " + LLTrans::getString("InventoryItemsCount", args); } @@ -2789,7 +2784,7 @@ bool LLFolderBridge::isClipboardPasteable() const // Search for the direct descendent of current Friends subfolder among all pasted items, // and return false if is found. - for(S32 i = objects.size() - 1; i >= 0; --i) + for (S32 i = static_cast(objects.size()) - 1; i >= 0; --i) { const LLUUID &obj_id = objects.at(i); if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) ) @@ -2823,10 +2818,8 @@ bool LLFolderBridge::isClipboardPasteableAsLink() const const LLUUID ¤t_cat_id = current_cat->getUUID(); std::vector objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + for (const auto& obj_id : objects) { - const LLUUID &obj_id = objects.at(i); const LLInventoryCategory *cat = model->getCategory(obj_id); if (cat) { @@ -3482,13 +3475,13 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(*current_folder, cat_array, item_array); - S32 item_count(0); + size_t item_count(0); if( item_array ) { item_count = item_array->size(); } - S32 cat_count(0); + size_t cat_count(0); if( cat_array ) { cat_count = cat_array->size(); @@ -3507,18 +3500,18 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) // Fetch the items if (item_count) { - for (S32 i = 0; i < item_count; ++i) + for (size_t i = 0; i < item_count; ++i) { - ids.push_back(item_array->at(i)->getUUID()); + ids.emplace_back(item_array->at(i)->getUUID()); } outfit = new LLRightClickInventoryFetchObserver(ids); } // Fetch the subfolders if (cat_count) { - for (S32 i = 0; i < cat_count; ++i) + for (size_t i = 0; i < cat_count; ++i) { - ids.push_back(cat_array->at(i)->getUUID()); + ids.emplace_back(cat_array->at(i)->getUUID()); } categories = new LLRightClickInventoryFetchDescendentsObserver(ids); } @@ -3972,7 +3965,7 @@ void LLFolderBridge::copyOutfitToClipboard() LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(mUUID, cat_array, item_array); - S32 item_count(0); + size_t item_count(0); if( item_array ) { item_count = item_array->size(); @@ -3980,7 +3973,7 @@ void LLFolderBridge::copyOutfitToClipboard() if (item_count) { - for (S32 i = 0; i < item_count;) + for (size_t i = 0; i < item_count;) { LLSD uuid =item_array->at(i)->getUUID(); LLViewerInventoryItem* item = gInventory.getItem(uuid); @@ -3994,7 +3987,7 @@ void LLFolderBridge::copyOutfitToClipboard() } } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text),0,text.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text), 0, static_cast(text.size())); } void LLFolderBridge::openItem() @@ -4299,11 +4292,11 @@ void LLFolderBridge::perform_pasteFromClipboard() LLInventoryItem *item = model->getItem(item_id); LLInventoryCategory *cat = model->getCategory(item_id); - if (item && !can_move_item_to_marketplace(master_folder, dest_folder, item, error_msg, objects.size() - index, true)) + if (item && !can_move_item_to_marketplace(master_folder, dest_folder, item, error_msg, static_cast(objects.size()) - index, true)) { break; } - if (cat && !can_move_folder_to_marketplace(master_folder, dest_folder, cat, error_msg, objects.size() - index, true, true)) + if (cat && !can_move_folder_to_marketplace(master_folder, dest_folder, cat, error_msg, static_cast(objects.size()) - index, true, true)) { break; } @@ -5731,7 +5724,7 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response { LLInventoryObject::object_list_t inventory_objects; object->getInventoryContents(inventory_objects); - int contents_count = inventory_objects.size(); + int contents_count = static_cast(inventory_objects.size()); LLInventoryCopyAndWearObserver* inventoryObserver = new LLInventoryCopyAndWearObserver(cat_and_wear->mCatID, contents_count, cat_and_wear->mFolderResponded, cat_and_wear->mReplace); @@ -6400,8 +6393,8 @@ bool check_category(LLInventoryModel* model, LLInventoryModel::item_array_t descendent_items; model->collectDescendents(cat_id, descendent_categories, descendent_items, true); - S32 num_descendent_categories = descendent_categories.size(); - S32 num_descendent_items = descendent_items.size(); + auto num_descendent_categories = descendent_categories.size(); + auto num_descendent_items = descendent_items.size(); if (num_descendent_categories + num_descendent_items == 0) { @@ -6411,7 +6404,7 @@ bool check_category(LLInventoryModel* model, return check_item(cat_id, active_panel, filter); } - for (S32 i = 0; i < num_descendent_categories; ++i) + for (size_t i = 0; i < num_descendent_categories; ++i) { LLInventoryCategory* category = descendent_categories[i]; if(!check_category(model, category->getUUID(), active_panel, filter)) @@ -6420,7 +6413,7 @@ bool check_category(LLInventoryModel* model, } } - for (S32 i = 0; i < num_descendent_items; ++i) + for (size_t i = 0; i < num_descendent_items; ++i) { LLViewerInventoryItem* item = descendent_items[i]; if(!check_item(item->getUUID(), active_panel, filter)) @@ -6882,8 +6875,8 @@ void LLCallingCardBridge::checkSearchBySuffixChanges() // changes in mDisplayName are processed by rename function and here it will be always same // suffixes are also of fixed length, and we are processing change of one at a time, // so it should be safe to use length (note: mSearchableName is capitalized) - S32 old_length = mSearchableName.length(); - S32 new_length = mDisplayName.length() + getLabelSuffix().length(); + auto old_length = mSearchableName.length(); + auto new_length = mDisplayName.length() + getLabelSuffix().length(); if (old_length == new_length) { return; diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 3e35c37d28..63c6db5efb 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -494,7 +494,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent LLInventoryModel::cat_array_t* cat_array = NULL; LLInventoryModel::item_array_t* item_array = NULL; gInventory.getDirectDescendentsOf(object_id,cat_array,item_array); - S32 descendents_actual = 0; + size_t descendents_actual = 0; if(cat_array && item_array) { descendents_actual = cat_array->size() + item_array->size(); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 7ae741fcfa..484016f0ca 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -168,7 +168,7 @@ S32 count_descendants_items(const LLUUID& cat_id) LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array); - S32 count = item_array->size(); + S32 count = static_cast(item_array->size()); LLInventoryModel::cat_array_t cat_array_copy = *cat_array; for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) @@ -1236,7 +1236,7 @@ S32 compute_stock_count(LLUUID cat_uuid, bool force_count /* false */) LLInventoryModel::cat_array_t* cat_array; LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(cat_uuid,cat_array,item_array); - return item_array->size(); + return static_cast(item_array->size()); } // When force_count is true, we do not do any verification of the marketplace status and simply compute @@ -1490,7 +1490,7 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve existing_item_count += count_copyable_items(existing_items) + count_stock_folders(existing_categories); existing_stock_count += count_stock_items(existing_items); - existing_folder_count += existing_categories.size(); + existing_folder_count += static_cast(existing_categories.size()); // If the incoming item is a nocopy (stock) item, we need to consider that it will create a stock folder if (!inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()) && !move_in_stock) @@ -1562,7 +1562,7 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn LLInventoryModel::item_array_t descendent_items; gInventory.collectDescendents(inv_cat->getUUID(), descendent_categories, descendent_items, false); - int dragged_folder_count = descendent_categories.size() + bundle_size; // Note: We assume that we're moving a bunch of folders in. That might be wrong... + int dragged_folder_count = static_cast(descendent_categories.size()) + bundle_size; // Note: We assume that we're moving a bunch of folders in. That might be wrong... int dragged_item_count = count_copyable_items(descendent_items) + count_stock_folders(descendent_categories); int dragged_stock_count = count_stock_items(descendent_items); int existing_item_count = 0; @@ -1584,7 +1584,7 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn LLInventoryModel::item_array_t existing_items; gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, false); - existing_folder_count += existing_categories.size(); + existing_folder_count += static_cast(existing_categories.size()); existing_item_count += count_copyable_items(existing_items) + count_stock_folders(existing_categories); existing_stock_count += count_stock_items(existing_items); } @@ -2014,7 +2014,7 @@ void validate_marketplacelistings( } // How many types of items? Which type is it if only one? - S32 count = items_vector.size(); + auto count = items_vector.size(); U32 default_key = (U32)(LLInventoryType::IT_COUNT) << 24; // This is the key for any normal copyable item U32 unique_key = (count == 1 ? items_vector.begin()->first : default_key); // The key in the case of one item type only diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index f6a7abc287..0eae71aa58 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -257,7 +257,7 @@ void LLInventoryGallery::updateRootFolder() { updateRemovedItem(mItems[i]->getUUID()); } - S32 hidden_count = mHiddenItems.size(); + S32 hidden_count = static_cast(mHiddenItems.size()); for (S32 i = hidden_count - 1; i >= 0; i--) { updateRemovedItem(mHiddenItems[i]->getUUID()); @@ -343,7 +343,7 @@ void LLInventoryGallery::initGallery() { uuid_vec_t cats; getCurrentCategories(cats); - int n = cats.size(); + int n = static_cast(cats.size()); buildGalleryPanel(n); mScrollPanel->addChild(mGalleryPanel); for (int i = 0; i < n; i++) @@ -619,8 +619,8 @@ void LLInventoryGallery::removeFromGalleryMiddle(LLInventoryGalleryItem* item) removeFromGalleryLast(mItems[i]); } removeFromGalleryLast(mItems[n]); - int saved_count = saved.size(); - for (int i = 0; i < saved_count; i++) + size_t saved_count = saved.size(); + for (size_t i = 0; i < saved_count; i++) { addToGallery(saved.back()); saved.pop_back(); @@ -1882,13 +1882,10 @@ bool LLInventoryGallery::canPaste() const } // In normal mode, we need to check each element of the clipboard to know if we can paste or not - std::vector objects; + uuid_vec_t objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for (S32 i = 0; i < count; i++) + for (const auto& item_id : objects) { - const LLUUID& item_id = objects.at(i); - // Each item must be copyable to be pastable if (!isItemCopyable(item_id)) { diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index b0d8c4424b..e1fab299a3 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -724,12 +724,12 @@ LLViewerInventoryCategory* LLInventoryModel::getCategory(const LLUUID& id) const S32 LLInventoryModel::getItemCount() const { - return mItemMap.size(); + return static_cast(mItemMap.size()); } S32 LLInventoryModel::getCategoryCount() const { - return mCategoryMap.size(); + return static_cast(mCategoryMap.size()); } // Return the direct descendents of the id provided. The array @@ -890,17 +890,14 @@ void LLInventoryModel::ensureCategoryForTypeExists(LLFolderType::EType preferred } else if (root_id.notNull()) { - cat_array_t* cats = NULL; - cats = get_ptr_in_map(mParentChildCategoryTree, root_id); + cat_array_t* cats = get_ptr_in_map(mParentChildCategoryTree, root_id); if (cats) { - S32 count = cats->size(); - for (S32 i = 0; i < count; ++i) + for (auto& p_cat : *cats) { - LLViewerInventoryCategory* p_cat = cats->at(i); if (p_cat && p_cat->getPreferredType() == preferred_type) { - const LLUUID& folder_id = cats->at(i)->getUUID(); + const LLUUID& folder_id = p_cat->getUUID(); if (rv.isNull() || folder_id < rv) { rv = folder_id; @@ -959,17 +956,14 @@ const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot( } else if (root_id.notNull()) { - cat_array_t* cats = NULL; - cats = get_ptr_in_map(mParentChildCategoryTree, root_id); - if(cats) + cat_array_t* cats = get_ptr_in_map(mParentChildCategoryTree, root_id); + if (cats) { - S32 count = cats->size(); - for(S32 i = 0; i < count; ++i) + for (auto& p_cat : *cats) { - LLViewerInventoryCategory* p_cat = cats->at(i); - if(p_cat && p_cat->getPreferredType() == preferred_type) + if (p_cat && p_cat->getPreferredType() == preferred_type) { - const LLUUID& folder_id = cats->at(i)->getUUID(); + const LLUUID& folder_id = p_cat->getUUID(); if (rv.isNull() || folder_id < rv) { rv = folder_id; @@ -1380,10 +1374,8 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, cat_array_t* cat_array = get_ptr_in_map(mParentChildCategoryTree, id); if(cat_array) { - S32 count = cat_array->size(); - for(S32 i = 0; i < count; ++i) + for (auto& cat : *cat_array) { - LLViewerInventoryCategory* cat = cat_array->at(i); if(add(cat,NULL)) { cats.push_back(cat); @@ -1395,16 +1387,13 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, } } - LLViewerInventoryItem* item = NULL; item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, id); // Move onto items if(item_array) { - S32 count = item_array->size(); - for(S32 i = 0; i < count; ++i) + for (auto& item : *item_array) { - item = item_array->at(i); if(add(NULL, item)) { items.push_back(item); @@ -1424,10 +1413,8 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, // Note: if making it fully recursive, need more checking against infinite loops. if (follow_folder_links && item_array) { - S32 count = item_array->size(); - for(S32 i = 0; i < count; ++i) + for (const auto& item : *item_array) { - item = item_array->at(i); if (item && item->getActualType() == LLAssetType::AT_LINK_FOLDER) { LLViewerInventoryCategory *linked_cat = item->getLinkedCategory(); @@ -2079,10 +2066,10 @@ void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id, bo categories, items, LLInventoryModel::INCLUDE_TRASH); - S32 count = items.size(); + auto count = items.size(); LLUUID uu_id; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { uu_id = items.at(i)->getUUID(); @@ -2924,8 +2911,8 @@ bool LLInventoryModel::loadSkeleton( } } - S32 cached_category_count = 0; - S32 cached_item_count = 0; + size_t cached_category_count = 0; + size_t cached_item_count = 0; if(!temp_cats.empty()) { update_map_t child_counts; @@ -2974,12 +2961,10 @@ bool LLInventoryModel::loadSkeleton( // found to generate a set of categories we should add. We // will go through each category loaded and if the version // does not match, invalidate the version. - S32 count = categories.size(); cat_set_t::iterator not_cached = temp_cats.end(); - std::set cached_ids; - for(S32 i = 0; i < count; ++i) + uuid_set_t cached_ids; + for (auto& cat : categories) { - LLViewerInventoryCategory* cat = categories[i]; cat_set_t::iterator cit = temp_cats.find(cat); if (cit == temp_cats.end()) { @@ -3225,13 +3210,11 @@ void LLInventoryModel::buildParentChildMap() // Now we have a structure with all of the categories that we can // iterate over and insert into the correct place in the child // category tree. - S32 count = cats.size(); S32 i; S32 lost = 0; cat_array_t lost_cats; - for(i = 0; i < count; ++i) + for (auto& cat : cats) { - LLViewerInventoryCategory* cat = cats.at(i); catsp = getUnlockedCatArray(cat->getParentUUID()); #ifdef OPENSIM if(catsp && @@ -3323,13 +3306,10 @@ void LLInventoryModel::buildParentChildMap() items.push_back(item); } } - count = items.size(); lost = 0; uuid_vec_t lost_item_ids; - for(i = 0; i < count; ++i) + for (auto& item : items) { - LLPointer item; - item = items.at(i); itemsp = getUnlockedItemArray(item->getParentUUID()); if(itemsp) { @@ -3746,12 +3726,9 @@ bool LLInventoryModel::saveToFile(const std::string& filename, fileXML << LLSDOStreamer(cache_ver) << std::endl; - S32 count = categories.size(); S32 cat_count = 0; - S32 i; - for (i = 0; i < count; ++i) + for (auto& cat : categories) { - LLViewerInventoryCategory* cat = categories[i]; if (cat->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN) { fileXML << LLSDOStreamer(cat->exportLLSD()) << std::endl; @@ -3765,10 +3742,10 @@ bool LLInventoryModel::saveToFile(const std::string& filename, } } - S32 it_count = items.size(); - for (i = 0; i < it_count; ++i) + auto it_count = items.size(); + for (auto& item : items) { - fileXML << LLSDOStreamer(items[i]->asLLSD()) << std::endl; + fileXML << LLSDOStreamer(item->asLLSD()) << std::endl; if (fileXML.fail()) { @@ -4264,11 +4241,9 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) if (tid.notNull() && tid == LLInventoryState::sWearNewClothingTransactionID) { - count = wearable_ids.size(); - for (i = 0; i < count; ++i) + for (const auto& wearable_id : wearable_ids) { - LLViewerInventoryItem* wearable_item; - wearable_item = gInventory.getItem(wearable_ids[i]); + LLViewerInventoryItem* wearable_item = gInventory.getItem(wearable_id); LLAppearanceMgr::instance().wearItemOnAvatar(wearable_item->getUUID(), true, true); } } @@ -4366,7 +4341,7 @@ void LLInventoryModel::emptyFolderType(const std::string notification, LLFolderT LLInventoryModel::item_array_t items; const LLUUID trash_id = findCategoryUUIDForType(preferred_type); gInventory.collectDescendents(trash_id, cats, items, LLInventoryModel::INCLUDE_TRASH); //All descendants - S32 item_count = items.size() + cats.size(); + S32 item_count = static_cast(items.size() + cats.size()); args["COUNT"] = item_count; } LLNotificationsUtil::add(notification, args, LLSD(), @@ -4488,7 +4463,7 @@ void LLInventoryModel::checkTrashOverflow() LLInventoryModel::item_array_t items; const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH); gInventory.collectDescendents(trash_id, cats, items, LLInventoryModel::INCLUDE_TRASH); - S32 item_count = items.size() + cats.size(); + auto item_count = items.size() + cats.size(); if (item_count >= trash_max_capacity) { @@ -5632,7 +5607,7 @@ void LLInventoryModel::FetchItemHttpHandler::processData(LLSD & content, LLCore: LLInventoryModel::update_map_t update; LLUUID folder_id; LLSD content_items(content["items"]); - const S32 count(content_items.size()); + const S32 count(static_cast(content_items.size())); // Does this loop ever execute more than once? for (S32 i(0); i < count; ++i) diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index 1e713491cf..8772b024d8 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -1683,7 +1683,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http return; } - S32 size = mRequestSD["folders"].size(); + auto size = mRequestSD["folders"].size(); if (size > 1) { @@ -1700,7 +1700,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http { recursive_cats.push_back(folder_id); } - if (folders.size() == (S32)(size / 2)) + if (folders.size() == (size / 2)) { LLSD request_body; request_body["folders"] = folders; diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index bea42472d0..4a3634ca43 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -514,7 +514,7 @@ bool LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInven // from memory. return true; } - const S32 current_num_known_descendents = cats->size() + items->size(); + const S32 current_num_known_descendents = static_cast(cats->size() + items->size()); // Got the number of descendents that we were expecting, so we're done. if (current_num_known_descendents == expected_num_descendents) @@ -752,7 +752,7 @@ void LLInventoryCategoriesObserver::changed(U32 mask) continue; } - const S32 current_num_known_descendents = cats->size() + items->size(); + const S32 current_num_known_descendents = static_cast(cats->size() + items->size()); bool cat_changed = false; @@ -832,7 +832,7 @@ bool LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t } else { - current_num_known_descendents = cats->size() + items->size(); + current_num_known_descendents = static_cast(cats->size() + items->size()); } } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 853a65d926..eeb0e364a0 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1310,7 +1310,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, // Make sure panel won't lock in a loop over existing items if // folder is enormous and at least some work gets done const S32 MIN_ITEMS_PER_CALL = 500; - const S32 starting_item_count = mItemMap.size(); + const S32 starting_item_count = static_cast(mItemMap.size()); LLFolderViewFolder *parentp = dynamic_cast(folder_view_item); bool done = true; @@ -1341,7 +1341,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, if (!mBuildChildrenViews && mode == BUILD_TIMELIMIT - && MIN_ITEMS_PER_CALL + starting_item_count < mItemMap.size()) + && MIN_ITEMS_PER_CALL + starting_item_count < static_cast(mItemMap.size())) { // Single folder view, check if we still have time // @@ -1833,7 +1833,7 @@ bool LLInventoryPanel::beginIMSession() item_array, LLInventoryModel::EXCLUDE_TRASH, is_buddy); - S32 count = item_array.size(); + auto count = item_array.size(); if(count > 0) { //*TODO by what to replace that? @@ -1842,7 +1842,7 @@ bool LLInventoryPanel::beginIMSession() // create the session LLAvatarTracker& at = LLAvatarTracker::instance(); LLUUID id; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { id = item_array.at(i)->getCreatorUUID(); // [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9) @@ -1961,7 +1961,7 @@ void LLInventoryPanel::purgeSelectedItems() const std::set inventory_selected = mFolderRoot.get()->getSelectionList(); if (inventory_selected.empty()) return; LLSD args; - S32 count = inventory_selected.size(); + auto count = inventory_selected.size(); std::vector selected_items; for (std::set::const_iterator it = inventory_selected.begin(), end_it = inventory_selected.end(); it != end_it; @@ -1974,7 +1974,7 @@ void LLInventoryPanel::purgeSelectedItems() count += items.size() + cats.size(); selected_items.push_back(item_id); } - args["COUNT"] = count; + args["COUNT"] = static_cast(count); LLNotificationsUtil::add("PurgeSelectedItems", args, LLSD(), boost::bind(callbackPurgeSelectedItems, _1, _2, selected_items)); } diff --git a/indra/newview/llkeyconflict.cpp b/indra/newview/llkeyconflict.cpp index af70025647..666ab4f5d0 100644 --- a/indra/newview/llkeyconflict.cpp +++ b/indra/newview/llkeyconflict.cpp @@ -476,8 +476,8 @@ void LLKeyConflictHandler::saveToSettings(bool temporary) // so make sure to cleanup. // Also this helps in keeping file small. iter->second.mKeyBind.trimEmpty(); - U32 size = iter->second.mKeyBind.getDataCount(); - for (U32 i = 0; i < size; ++i) + auto size = iter->second.mKeyBind.getDataCount(); + for (size_t i = 0; i < size; ++i) { if (iter->first.empty()) { @@ -491,7 +491,7 @@ void LLKeyConflictHandler::saveToSettings(bool temporary) continue; } - LLKeyData data = key.mKeyBind.getKeyData(i); + LLKeyData data = key.mKeyBind.getKeyData(static_cast(i)); // Still write empty LLKeyData to make sure we will maintain UI position if (data.mKey == KEY_NONE) { diff --git a/indra/newview/lllandmarklist.cpp b/indra/newview/lllandmarklist.cpp index b88986ce25..3fa0ab99f3 100644 --- a/indra/newview/lllandmarklist.cpp +++ b/indra/newview/lllandmarklist.cpp @@ -118,7 +118,7 @@ void LLLandmarkList::processGetAssetReply( file.read((U8*)&buffer[0], file_length); buffer[file_length] = 0; - LLLandmark* landmark = LLLandmark::constructFromString(&buffer[0], buffer.size()); + LLLandmark* landmark = LLLandmark::constructFromString(&buffer[0], static_cast(buffer.size())); if (landmark) { gLandmarkList.mList[uuid] = landmark; diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp index cf0742299c..2fb8816960 100644 --- a/indra/newview/lllocalgltfmaterials.cpp +++ b/indra/newview/lllocalgltfmaterials.cpp @@ -340,19 +340,19 @@ S32 LLLocalGLTFMaterialMgr::addUnit(const std::string& filename) tinygltf::Model model; LLTinyGLTFHelper::loadModel(filename, model); - S32 materials_in_file = model.materials.size(); + auto materials_in_file = model.materials.size(); if (materials_in_file <= 0) { return 0; } S32 loaded_materials = 0; - for (S32 i = 0; i < materials_in_file; i++) + for (size_t i = 0; i < materials_in_file; i++) { // Todo: this is rather inefficient, files will be spammed with // separate loads and date checks, find a way to improve this. // May be doUpdates() should be checking individual files. - LLPointer unit = new LLLocalGLTFMaterial(filename, i); + LLPointer unit = new LLLocalGLTFMaterial(filename, static_cast(i)); // load material from file if (unit->updateSelf()) diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index aedf61ff5f..d8e704df6b 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -545,11 +545,11 @@ void LLLogChat::loadChatHistory(const std::string& file_name, std::list& m return; } - S32 save_num_messages = messages.size(); + auto save_num_messages = messages.size(); char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/ char *bptr; - S32 len; + size_t len; bool firstline = true; if (load_all_history || fseek(fptr, (LOG_RECALL_SIZE - 1) * -1 , SEEK_END)) @@ -1298,7 +1298,7 @@ void LLLoadHistoryThread::run() if(mNewLoad) { loadHistory(mFileName, mMessages, mLoadParams); - int count = mMessages->size(); + auto count = mMessages->size(); LL_INFOS() << "mMessages->size(): " << count << LL_ENDL; setFinished(); } @@ -1351,7 +1351,7 @@ void LLLoadHistoryThread::loadHistory(const std::string& file_name, std::list& buffer) tinygltf::Model model_in; - if (loader.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, data.c_str(), data.length(), "")) + if (loader.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, data.c_str(), static_cast(data.length()), "")) { // assets are only supposed to have one item // *NOTE: This duplicates some functionality from diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 271a35ba42..ee5e5b438e 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -431,7 +431,7 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUI const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); LLSD response_data; - U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size()); + U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), static_cast(content_binary.size())); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL; @@ -472,7 +472,7 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); LLSD response_data; - U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size()); + U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), static_cast(content_binary.size())); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL; @@ -539,7 +539,7 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content) const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); LLSD response_data; - U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size()); + U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), static_cast(content_binary.size())); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL; @@ -670,7 +670,7 @@ void LLMaterialMgr::processGetQueue() std::string materialString = zip_llsd(materialsData); - S32 materialSize = materialString.size(); + auto materialSize = materialString.size(); if (materialSize <= 0) { LL_ERRS("Materials") << "cannot zip LLSD binary content" << LL_ENDL; @@ -960,7 +960,7 @@ void LLMaterialMgr::processPutQueue() std::string materialString = zip_llsd(materialsData); - S32 materialSize = materialString.size(); + auto materialSize = materialString.size(); if (materialSize > 0) { diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp index be8d543711..0f3e0306af 100644 --- a/indra/newview/llmediadataclient.cpp +++ b/indra/newview/llmediadataclient.cpp @@ -692,7 +692,7 @@ void LLObjectMediaDataClient::sortQueue() mQueue.sort(compareRequestScores); // ...then cull items over the max - U32 size = mQueue.size(); + U32 size = static_cast(mQueue.size()); if (size > mMaxSortedQueueSize) { U32 num_to_cull = (size - mMaxSortedQueueSize); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 288c00b1ab..cffcd8f6b7 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -946,7 +946,7 @@ void LLMeshRepoThread::run() // Dispatch all HttpHandler notifications mHttpRequest->update(0L); } - sRequestWaterLevel = mHttpRequestSet.size(); // Stats data update + sRequestWaterLevel = static_cast(mHttpRequestSet.size()); // Stats data update // NOTE: order of queue processing intentionally favors LOD requests over header requests // Todo: we are processing mLODReqQ, mHeaderReqQ, mSkinRequests, mDecompositionRequests and mPhysicsShapeRequests @@ -3187,7 +3187,7 @@ void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespo LLCore::BufferArray * body(response->getBody()); S32 body_offset(0); U8 * data(NULL); - S32 data_size(body ? body->size() : 0); + auto data_size(body ? body->size() : 0); if (data_size > 0) { @@ -3248,7 +3248,7 @@ void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespo if (data) { body->read(body_offset, (char *) data, data_size - body_offset); - LLMeshRepository::sBytesReceived += data_size; + LLMeshRepository::sBytesReceived += static_cast(data_size); } else { @@ -3257,7 +3257,7 @@ void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespo } } - processData(body, body_offset, data, data_size - body_offset); + processData(body, body_offset, data, static_cast(data_size) - body_offset); delete [] data; } @@ -3730,8 +3730,8 @@ S32 LLMeshRepository::update() return 0 ; } - S32 size = mUploadWaitList.size() ; - for (S32 i = 0; i < size; ++i) + auto size = mUploadWaitList.size() ; + for (size_t i = 0; i < size; ++i) { mUploads.push_back(mUploadWaitList[i]); mUploadWaitList[i]->preStart() ; @@ -3739,7 +3739,7 @@ S32 LLMeshRepository::update() } mUploadWaitList.clear() ; - return size ; + return static_cast(size); } void LLMeshRepository::unregisterMesh(LLVOVolume* vobj) @@ -5107,7 +5107,7 @@ void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh, bool vertex_based) mesh.mVertexBase = mCurRequest->mPositions[0].mV; mesh.mVertexStrideBytes = 12; - mesh.mNumVertices = mCurRequest->mPositions.size(); + mesh.mNumVertices = static_cast(mCurRequest->mPositions.size()); if(!vertex_based) { @@ -5115,7 +5115,7 @@ void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh, bool vertex_based) mesh.mIndexBase = &(mCurRequest->mIndices[0]); mesh.mIndexStrideBytes = 6; - mesh.mNumTriangles = mCurRequest->mIndices.size()/3; + mesh.mNumTriangles = static_cast(mCurRequest->mIndices.size())/3; } if ((vertex_based || mesh.mNumTriangles > 0) && mesh.mNumVertices > 2) @@ -5521,10 +5521,10 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp) { decomp.mMesh.resize(decomp.mHull.size()); - for (U32 i = 0; i < decomp.mHull.size(); ++i) + for (size_t i = 0; i < decomp.mHull.size(); ++i) { LLCDHull hull; - hull.mNumVertices = decomp.mHull[i].size(); + hull.mNumVertices = static_cast(decomp.mHull[i].size()); hull.mVertexBase = decomp.mHull[i][0].mV; hull.mVertexStrideBytes = 12; @@ -5543,7 +5543,7 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp) if (!decomp.mBaseHull.empty() && decomp.mBaseHullMesh.empty()) { //get mesh for base hull LLCDHull hull; - hull.mNumVertices = decomp.mBaseHull.size(); + hull.mNumVertices = static_cast(decomp.mBaseHull.size()); hull.mVertexBase = decomp.mBaseHull[0].mV; hull.mVertexStrideBytes = 12; diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 701cccec16..5e0bf58d1b 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -3167,7 +3167,7 @@ void LLModelPreview::updateStatusMessages() mModelNoErrors = true; const U32 lod_high = LLModel::LOD_HIGH; - U32 high_submodel_count = mModel[lod_high].size() - countRootModels(mModel[lod_high]); + U32 high_submodel_count = static_cast(mModel[lod_high].size()) - countRootModels(mModel[lod_high]); for (S32 lod = 0; lod <= lod_high; ++lod) { @@ -3463,10 +3463,10 @@ void LLModelPreview::updateStatusMessages() if (!decomp.empty()) { - phys_hulls += decomp.size(); + phys_hulls += static_cast(decomp.size()); for (U32 i = 0; i < decomp.size(); ++i) { - phys_points += decomp[i].size(); + phys_points += static_cast(decomp[i].size()); } } else @@ -4550,8 +4550,8 @@ bool LLModelPreview::render() gGL.multMatrix((GLfloat*)mat.mMatrix); - U32 num_models = mVertexBuffer[mPreviewLOD][model].size(); - for (U32 i = 0; i < num_models; ++i) + auto num_models = mVertexBuffer[mPreviewLOD][model].size(); + for (size_t i = 0; i < num_models; ++i) { LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i]; @@ -4559,7 +4559,7 @@ bool LLModelPreview::render() if (textures) { - int materialCnt = instance.mModel->mMaterialList.size(); + auto materialCnt = instance.mModel->mMaterialList.size(); if (i < materialCnt) { const std::string& binding = instance.mModel->mMaterialList[i]; @@ -4711,9 +4711,9 @@ bool LLModelPreview::render() if (render_mesh) { - U32 num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); + auto num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); if (pass > 0){ - for (U32 i = 0; i < num_models; ++i) + for (size_t i = 0; i < num_models; ++i) { LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i]; @@ -4785,8 +4785,8 @@ bool LLModelPreview::render() if (physics.mHull.empty()) { - U32 num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); - for (U32 v = 0; v < num_models; ++v) + auto num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); + for (size_t v = 0; v < num_models; ++v) { LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][v]; @@ -4861,7 +4861,7 @@ bool LLModelPreview::render() const LLMeshSkinInfo *skin = &model->mSkinInfo; LLSkinningUtil::initJointNums(&model->mSkinInfo, getPreviewAvatar());// inits skin->mJointNums if nessesary U32 joint_count = LLSkinningUtil::getMeshJointCount(skin); - U32 bind_count = skin->mAlternateBindMatrix.size(); + auto bind_count = skin->mAlternateBindMatrix.size(); if (joint_overrides && bind_count > 0 @@ -4906,7 +4906,7 @@ bool LLModelPreview::render() } } - for (U32 i = 0, e = mVertexBuffer[mPreviewLOD][model].size(); i < e; ++i) + for (U32 i = 0, e = static_cast(mVertexBuffer[mPreviewLOD][model].size()); i < e; ++i) { LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i]; @@ -4917,7 +4917,7 @@ bool LLModelPreview::render() if (textures) { - int materialCnt = instance.mModel->mMaterialList.size(); + auto materialCnt = instance.mModel->mMaterialList.size(); if (i < materialCnt) { const std::string& binding = instance.mModel->mMaterialList[i]; diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 15a0ce5323..ace69c4593 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -123,7 +123,7 @@ void LLOutfitGallery::onOpen(const LLSD& info) { uuid_vec_t cats; getCurrentCategories(cats); - int n = cats.size(); + int n = static_cast(cats.size()); buildGalleryPanel(n); mScrollPanel->addChild(mGalleryPanel); for (int i = 0; i < n; i++) @@ -601,8 +601,8 @@ void LLOutfitGallery::removeFromGalleryMiddle(LLOutfitGalleryItem* item) removeFromGalleryLast(mItems[i]); } removeFromGalleryLast(mItems[n]); - int saved_count = saved.size(); - for (int i = 0; i < saved_count; i++) + auto saved_count = saved.size(); + for (size_t i = 0; i < saved_count; i++) { addToGallery(saved.back()); saved.pop_back(); diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 1fd60bf726..41815b355e 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -446,7 +446,7 @@ void LLOutfitsList::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const uuid_vec_t uuids; (*iter).second->getSelectedUUIDs(uuids); - S32 prev_size = selected_uuids.size(); + auto prev_size = selected_uuids.size(); selected_uuids.resize(prev_size + uuids.size()); std::copy(uuids.begin(), uuids.end(), selected_uuids.begin() + prev_size); } diff --git a/indra/newview/llpanelemojicomplete.cpp b/indra/newview/llpanelemojicomplete.cpp index a6d1912c44..6ae53324c6 100644 --- a/indra/newview/llpanelemojicomplete.cpp +++ b/indra/newview/llpanelemojicomplete.cpp @@ -99,13 +99,13 @@ void LLPanelEmojiComplete::draw() if (mVertical) { x = mRenderRect.mLeft; - y = mRenderRect.mTop - (mCurSelected - firstVisibleIdx + 1) * mEmojiHeight; + y = mRenderRect.mTop - static_cast(mCurSelected - firstVisibleIdx + 1) * mEmojiHeight; width = mRenderRect.getWidth(); height = mEmojiHeight; } else { - x = mRenderRect.mLeft + (mCurSelected - firstVisibleIdx) * mEmojiWidth; + x = mRenderRect.mLeft + static_cast(mCurSelected - firstVisibleIdx) * mEmojiWidth; y = mRenderRect.mBottom; width = mEmojiWidth; height = mRenderRect.getHeight(); @@ -118,7 +118,7 @@ void LLPanelEmojiComplete::draw() F32 textLeft = mVertical ? mRenderRect.mLeft + mEmojiWidth + mPadding : 0; F32 textWidth = mVertical ? getRect().getWidth() - textLeft - mPadding : 0; - for (U32 curIdx = firstVisibleIdx; curIdx < lastVisibleIdx; curIdx++) + for (size_t curIdx = firstVisibleIdx; curIdx < lastVisibleIdx; curIdx++) { LLWString text(1, mEmojis[curIdx].Character); mIconFont->render(text, 0, iconCenterX, iconCenterY, @@ -134,7 +134,7 @@ void LLPanelEmojiComplete::draw() std::string text = shortCode.substr(0, mEmojis[curIdx].Begin); mTextFont->renderUTF8(text, 0, x0, iconCenterY, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - text.size(), x1); + static_cast(text.size()), x1); x0 += mTextFont->getWidthF32(text); x1 = textLeft + textWidth - x0; } @@ -143,7 +143,7 @@ void LLPanelEmojiComplete::draw() std::string text = shortCode.substr(mEmojis[curIdx].Begin, mEmojis[curIdx].End - mEmojis[curIdx].Begin); mTextFont->renderUTF8(text, 0, x0, iconCenterY, LLColor4::yellow6, LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - text.size(), x1); + static_cast(text.size()), x1); x0 += mTextFont->getWidthF32(text); x1 = textLeft + textWidth - x0; } @@ -152,7 +152,7 @@ void LLPanelEmojiComplete::draw() std::string text = shortCode.substr(mEmojis[curIdx].End); mTextFont->renderUTF8(text, 0, x0, iconCenterY, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - text.size(), x1); + static_cast(text.size()), x1); } iconCenterY -= mEmojiHeight; } @@ -378,11 +378,11 @@ void LLPanelEmojiComplete::onEmojisChanged() { width += mScrollbar->getThickness(); } - height = mVisibleEmojis * mEmojiHeight; + height = static_cast(mVisibleEmojis) * mEmojiHeight; } else { - width = mVisibleEmojis * mEmojiWidth; + width = static_cast(mVisibleEmojis) * mEmojiWidth; height = getRect().getHeight(); } LLUICtrl::reshape(width, height, false); @@ -450,8 +450,8 @@ void LLPanelEmojiComplete::updateConstraints() if (!mNoScroll && mVisibleEmojis < mTotalEmojis) { mRenderRect.mRight -= mScrollbar->getThickness(); - mScrollbar->setDocSize(mTotalEmojis); - mScrollbar->setPageSize(mVisibleEmojis); + mScrollbar->setDocSize(static_cast(mTotalEmojis)); + mScrollbar->setPageSize(static_cast(mVisibleEmojis)); mScrollbar->setOrigin(mRenderRect.mRight, 0); mScrollbar->reshape(mScrollbar->getThickness(), mRenderRect.mTop, true); mScrollbar->setVisible(true); @@ -464,7 +464,7 @@ void LLPanelEmojiComplete::updateConstraints() else { mEmojiHeight = mRenderRect.getHeight(); - mRenderRect.stretch((mRenderRect.getWidth() - mVisibleEmojis * mEmojiWidth) / -2, 0); + mRenderRect.stretch((mRenderRect.getWidth() - static_cast(mVisibleEmojis) * mEmojiWidth) / -2, 0); } updateScrollPos(); @@ -491,7 +491,7 @@ void LLPanelEmojiComplete::updateScrollPos() if (mScrollbar && mScrollbar->getVisible()) { - mScrollbar->setDocPos(mScrollPos); + mScrollbar->setDocPos(static_cast(mScrollPos)); } } diff --git a/indra/newview/llpanelexperiencelog.cpp b/indra/newview/llpanelexperiencelog.cpp index 176da130bb..1878a81926 100644 --- a/indra/newview/llpanelexperiencelog.cpp +++ b/indra/newview/llpanelexperiencelog.cpp @@ -126,7 +126,7 @@ void LLPanelExperienceLog::refresh() events_to_save.erase(day->first); continue; } - int size = dayArray.size(); + int size = static_cast(dayArray.size()); if(itemsToSkip > size) { itemsToSkip -= size; @@ -137,7 +137,7 @@ void LLPanelExperienceLog::refresh() moreItems = true; break; } - for(int i = dayArray.size() - itemsToSkip - 1; i >= 0; i--) + for(int i = static_cast(dayArray.size()) - itemsToSkip - 1; i >= 0; i--) { if(items >= mPageSize) { diff --git a/indra/newview/llpanelgroupcreate.cpp b/indra/newview/llpanelgroupcreate.cpp index 01057aaeb0..d6edc4d529 100644 --- a/indra/newview/llpanelgroupcreate.cpp +++ b/indra/newview/llpanelgroupcreate.cpp @@ -228,7 +228,7 @@ void LLPanelGroupCreate::onBtnCreate() // Validate the group name length. std::string gr_name = mGroupNameEditor->getText(); LLStringUtil::trim(gr_name); - S32 group_name_len = gr_name.size(); + S32 group_name_len = static_cast(gr_name.size()); if (group_name_len < DB_GROUP_NAME_MIN_LEN || group_name_len > DB_GROUP_NAME_STR_LEN) { diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 33606efb73..54a1851c0d 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -1208,7 +1208,7 @@ void LLPanelGroupMembersSubTab::confirmEjectMembers() std::vector selection = mMembersList->getAllSelected(); if (selection.empty()) return; - S32 selection_count = selection.size(); + auto selection_count = selection.size(); if (selection_count == 1) { LLSD args; @@ -1923,7 +1923,7 @@ void LLPanelGroupMembersSubTab::confirmBanMembers() std::vector selection = mMembersList->getAllSelected(); if (selection.empty()) return; - S32 selection_count = selection.size(); + auto selection_count = selection.size(); if (selection_count == 1) { LLSD args; @@ -2302,7 +2302,7 @@ void LLPanelGroupRolesSubTab::update(LLGroupChange gc) if (matchesSearchFilter(rd.mRoleName, rd.mRoleTitle)) { // If this is the everyone role, then EVERYONE is in it. - S32 members_in_role = (*rit).first.isNull() ? gdatap->mMembers.size() : (*rit).second->getTotalMembersInRole(); + S32 members_in_role = (*rit).first.isNull() ? static_cast(gdatap->mMembers.size()) : (*rit).second->getTotalMembersInRole(); LLSD row = createRoleItem((*rit).first,rd.mRoleName, rd.mRoleTitle, members_in_role); item = mRolesList->addElement(row, ((*rit).first.isNull()) ? ADD_TOP : ADD_BOTTOM, this); if (had_selection && ((*rit).first == last_selected)) @@ -3219,7 +3219,7 @@ void LLPanelGroupBanListSubTab::activate() { mCreateBanButton->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS) && group_datap->mBanList.size() < GB_MAX_BANNED_AGENTS); - setBanCount(group_datap->mBanList.size()); + setBanCount(static_cast(group_datap->mBanList.size())); } else { @@ -3353,7 +3353,7 @@ void LLPanelGroupBanListSubTab::handleDeleteBanEntry() // update ban-count related elements mCreateBanButton->setEnabled(true); - setBanCount(gdatap->mBanList.size()); + setBanCount(static_cast(gdatap->mBanList.size())); LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mGroupID, LLGroupMgr::BAN_DELETE, ban_ids); } @@ -3433,7 +3433,7 @@ void LLPanelGroupBanListSubTab::populateBanList() mRefreshBanListButton->setEnabled(true); mCreateBanButton->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS) && gdatap->mBanList.size() < GB_MAX_BANNED_AGENTS); - setBanCount(gdatap->mBanList.size()); + setBanCount(static_cast(gdatap->mBanList.size())); } void LLPanelGroupBanListSubTab::setGroupID(const LLUUID& id) diff --git a/indra/newview/llpanellandaudio.cpp b/indra/newview/llpanellandaudio.cpp index eb02daa0a7..8a3d49b102 100644 --- a/indra/newview/llpanellandaudio.cpp +++ b/indra/newview/llpanellandaudio.cpp @@ -351,7 +351,7 @@ void LLPanelLandAudio::onBtnCopyToClipboard() if (!music_url.empty()) { - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(music_url), 0, music_url.size() ); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(music_url), 0, static_cast(music_url.size())); } } // diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 0d628d50e1..10054f5f3f 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -337,7 +337,7 @@ void LLPanelLogin::addFavoritesToStartLocation() { // first login panel has no favorites, just update name length and buttons std::string user_defined_name = getChild("username_combo")->getSimple(); - mUsernameLength = user_defined_name.length(); + mUsernameLength = static_cast(user_defined_name.length()); updateLoginButtons(); return; } @@ -357,7 +357,7 @@ void LLPanelLogin::addFavoritesToStartLocation() LLStringUtil::toLower(user_defined_name); std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites_" + LLGridManager::getInstance()->getGrid() + ".xml"); std::string old_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); - mUsernameLength = user_defined_name.length(); + mUsernameLength = static_cast(user_defined_name.length()); updateLoginButtons(); std::string::size_type index = user_defined_name.find_first_of(" ._"); @@ -599,13 +599,13 @@ void LLPanelLogin::setFields(LLPointer credential) login_id += lastname; } sInstance->getChild("username_combo")->setLabel(login_id); - sInstance->mUsernameLength = login_id.length(); + sInstance->mUsernameLength = static_cast(login_id.length()); } else if(identifier.has("type") && (std::string)identifier["type"] == "account") { std::string login_id = identifier["account_name"].asString(); sInstance->getChild("username_combo")->setLabel(login_id); - sInstance->mUsernameLength = login_id.length(); + sInstance->mUsernameLength = static_cast(login_id.length()); } else { @@ -629,7 +629,7 @@ void LLPanelLogin::setFields(LLPointer credential) // nice row of asterisks. const std::string filler("123456789!123456"); sInstance->getChild("password_edit")->setValue(filler); - sInstance->mPasswordLength = filler.length(); + sInstance->mPasswordLength = static_cast(filler.length()); sInstance->updateLoginButtons(); } else @@ -795,7 +795,7 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) { location_combo->setLabel(new_start_slurl.getLocationString()); - sInstance->mLocationLength = new_start_slurl.getLocationString().length(); + sInstance->mLocationLength = static_cast(new_start_slurl.getLocationString().length()); sInstance->updateLoginButtons(); } } @@ -1126,7 +1126,7 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) } LLLineEditor* password_edit(self->getChild("password_edit")); - self->mPasswordLength = password_edit->getText().length(); + self->mPasswordLength = static_cast(password_edit->getText().length()); self->updateLoginButtons(); } @@ -1160,8 +1160,8 @@ void LLPanelLogin::updateServer() // restore creds user_combo->setTextEntry(username); pswd_edit->setValue(password); - sInstance->mUsernameLength = username.length(); - sInstance->mPasswordLength = password.length(); + sInstance->mUsernameLength = static_cast(username.length()); + sInstance->mPasswordLength = static_cast(password.length()); } else { diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 945d546afa..3bdf89c321 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -188,7 +188,7 @@ U32 LLPanelMarketplaceInbox::getFreshItemCount() const U32 LLPanelMarketplaceInbox::getTotalItemCount() const { - U32 item_count = 0; + size_t item_count = 0; if (mInventoryPanel) { @@ -201,7 +201,7 @@ U32 LLPanelMarketplaceInbox::getTotalItemCount() const } } - return item_count; + return static_cast(item_count); } void LLPanelMarketplaceInbox::onClearSearch() diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index 88331da7e5..c078f9e53c 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -1321,7 +1321,7 @@ void LLPanelNearByMedia::onMenuAction(const LLSD& userdata) if (!url.empty()) { - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(url), 0, url.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(url), 0, static_cast(url.size())); } } else if ("copy_data" == command_name) @@ -1334,12 +1334,12 @@ void LLPanelNearByMedia::onMenuAction(const LLSD& userdata) { pos += encoding_specifier.size(); std::string res = LLBase64::decodeAsString(url.substr(pos)); - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(res), 0, res.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(res), 0, static_cast(res.size())); } else { url = LLURI::unescape(url); - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(url), 0, url.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(url), 0, static_cast(url.size())); } } } diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index a2afc952d5..e763beb574 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -733,7 +733,7 @@ const std::string& LLTaskCategoryBridge::getDisplayName() const LLInventoryObject::object_list_t contents; object->getInventoryContents(contents); - S32 numElements = contents.size(); + S32 numElements = static_cast(contents.size()); std::string elementsString = "FSObjectInventoryNoElements"; if (numElements == 1) diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 1534700e83..dc2dbe0194 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -264,7 +264,7 @@ void LLPanelOutfitsInventory::onCOFChanged() LLInventoryModel::cat_array_t cats; LLIsType is_of_type(LLAssetType::AT_OBJECT); gInventory.collectDescendentsIf(cof, cats, obj_items, LLInventoryModel::EXCLUDE_TRASH, is_of_type); - U32 attachments = obj_items.size(); + U32 attachments = static_cast(obj_items.size()); LLStringUtil::format_map_t args; args["COUNT"] = llformat("%d", attachments); diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 8425393294..642bfe9937 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -1003,7 +1003,7 @@ void LLPanelPeople::updateButtons() groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected // FIRE-12229 - //U32 groups_count = gAgent.mGroups.size(); + //U32 groups_count = static_cast(gAgent.mGroups.size()); //S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit(); //U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0; //groups_panel->getChild("groupcount")->setTextArg("[COUNT]", llformat("%d", groups_count)); @@ -1940,7 +1940,7 @@ void LLPanelPeople::onContactSetsMenuItemClicked(const LLSD& userdata) LLSD payload, args; std::string set = mContactSetCombo->getValue().asString(); - S32 selected_size = selected_uuids.size(); + S32 selected_size = static_cast(selected_uuids.size()); args["SET_NAME"] = set; args["TARGET"] = (selected_size > 1 ? llformat("%d", selected_size) : LLSLURL("agent", selected_uuids.front(), "about").getSLURLString()); payload["contact_set"] = set; diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index b7557d42db..7f064e82a6 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -1196,7 +1196,7 @@ void LLPanelPermissions::refresh() // // LLWString wline = utf8str_to_wstring(name); // // panel supports two lines long names -// S32 segment_length = font->maxDrawableChars(wline.c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); +// S32 segment_length = font->maxDrawableChars(wline.c_str(), max_pixels, static_cast(wline.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); // if (segment_length == wline.length()) // { // // no work needed @@ -1204,7 +1204,7 @@ void LLPanelPermissions::refresh() // } // // S32 first_line_length = segment_length; -// segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels, wline.length(), LLFontGL::ANYWHERE); +// segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels, static_cast(wline.length()), LLFontGL::ANYWHERE); // if (segment_length + first_line_length == wline.length()) // { // // no work needed @@ -1214,7 +1214,7 @@ void LLPanelPermissions::refresh() // // name does not fit, cut it, add ... // const LLWString dots_pad(utf8str_to_wstring(std::string("...."))); // S32 elipses_width = font->getWidthF32(dots_pad.c_str()); -// segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels - elipses_width, wline.length(), LLFontGL::ANYWHERE); +// segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels - elipses_width, static_cast(wline.length()), LLFontGL::ANYWHERE); // // name = name.substr(0, segment_length + first_line_length) + std::string("..."); //} diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index f73611e384..34f6509610 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -2004,7 +2004,7 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata) else if (item_name == "copy_user_id") { LLWString wstr = utf8str_to_wstring(getAvatarId().asString()); - LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); + LLClipboard::instance().copyToClipboard(wstr, 0, static_cast(wstr.size())); } else if (item_name == "agent_permissions") { @@ -2029,7 +2029,7 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata) { wstr = utf8str_to_wstring(av_name.getUserName()); } - LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); + LLClipboard::instance().copyToClipboard(wstr, 0, static_cast(wstr.size())); } else if (item_name == "edit_display_name") { @@ -2075,7 +2075,7 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata) else if (item_name == "copy_uri") { LLWString wstr = utf8str_to_wstring(LLSLURL("agent", agent_id, "about").getSLURLString()); - LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); + LLClipboard::instance().copyToClipboard(wstr, 0, static_cast(wstr.size())); } else if (item_name == "kick") { diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index 53af858567..8e03ac69f9 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -705,7 +705,7 @@ void LLTeleportHistoryPanel::getNextTab(const LLDate& item_date, S32& tab_idx, L // static LLCachedControl sFSTPHistoryTZ(gSavedSettings, "FSTPHistoryTZ"); // - S32 tabs_cnt = mItemContainers.size(); + S32 tabs_cnt = static_cast(mItemContainers.size()); S32 curr_year = 0, curr_month = 0, curr_day = 0; tab_date = LLDate::now(); @@ -843,7 +843,7 @@ void LLTeleportHistoryPanel::refresh() // tab_boundary_date would be earliest possible date for this tab S32 tab_idx = 0; getNextTab(date, tab_idx, tab_boundary_date); - tab_idx = mItemContainers.size() - 1 - tab_idx; + tab_idx = static_cast(mItemContainers.size()) - 1 - tab_idx; if (tab_idx >= 0) { LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx); @@ -899,7 +899,7 @@ void LLTeleportHistoryPanel::refresh() break; } - for (S32 n = mItemContainers.size() - 1; n >= 0; --n) + for (S32 n = static_cast(mItemContainers.size()) - 1; n >= 0; --n) { LLAccordionCtrlTab* tab = mItemContainers.at(n); LLFlatListView* fv = getFlatListViewFromTab(tab); @@ -964,7 +964,7 @@ void LLTeleportHistoryPanel::replaceItem(S32 removed_index) LLTeleportHistoryFlatItem* item = LLTeleportHistoryFlatItemStorage::instance() .getFlatItemForPersistentItem(mGearItemMenu, history_items[history_items.size() - 1], // Most recent item, it was added instead of removed - history_items.size(), // index will be decremented inside loop below + static_cast(history_items.size()), // index will be decremented inside loop below // Separate search filter for standalone TP history //sFilterSubString); (mIsStandAlone ? mFilterString : sFilterSubString)); @@ -974,7 +974,7 @@ void LLTeleportHistoryPanel::replaceItem(S32 removed_index) // Index of each item, from last to removed item should be decremented // to point to the right item in LLTeleportHistoryStorage - for (S32 tab_idx = mItemContainers.size() - 1; tab_idx >= 0; --tab_idx) + for (S32 tab_idx = static_cast(mItemContainers.size()) - 1; tab_idx >= 0; --tab_idx) { LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx); if (!tab->getVisible()) @@ -990,8 +990,8 @@ void LLTeleportHistoryPanel::replaceItem(S32 removed_index) std::vector items; fv->getItems(items); - S32 items_cnt = items.size(); - for (S32 n = 0; n < items_cnt; ++n) + auto items_cnt = items.size(); + for (size_t n = 0; n < items_cnt; ++n) { LLTeleportHistoryFlatItem *item = (LLTeleportHistoryFlatItem*) items[n]; @@ -1026,9 +1026,9 @@ void LLTeleportHistoryPanel::showTeleportHistory() mTeleportHistory = LLTeleportHistoryStorage::getInstance(); } - mCurrentItem = mTeleportHistory->getItems().size() - 1; + mCurrentItem = static_cast(mTeleportHistory->getItems().size()) - 1; - for (S32 n = mItemContainers.size() - 1; n >= 0; --n) + for (S32 n = static_cast(mItemContainers.size()) - 1; n >= 0; --n) { LLAccordionCtrlTab* tab = mItemContainers.at(n); if (tab) @@ -1053,9 +1053,9 @@ void LLTeleportHistoryPanel::handleItemSelect(LLFlatListView* selected) if (item) mLastSelectedItemIndex = item->getIndex(); - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { LLAccordionCtrlTab* tab = mItemContainers.at(n); @@ -1187,7 +1187,7 @@ LLFlatListView* LLTeleportHistoryPanel::getFlatListViewFromTab(LLAccordionCtrlTa void LLTeleportHistoryPanel::gotSLURLCallback(const std::string& slurl) { - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl), 0, slurl.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl), 0, static_cast(slurl.size())); LLSD args; args["SLURL"] = slurl; @@ -1201,9 +1201,9 @@ void LLTeleportHistoryPanel::onGearMenuAction(const LLSD& userdata) if ("expand_all" == command_name) { - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { mItemContainers.at(n)->setDisplayChildren(true); } @@ -1211,9 +1211,9 @@ void LLTeleportHistoryPanel::onGearMenuAction(const LLSD& userdata) } else if ("collapse_all" == command_name) { - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { mItemContainers.at(n)->setDisplayChildren(false); } @@ -1274,12 +1274,12 @@ bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const if (command_name == "collapse_all" || command_name == "expand_all") { - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); bool has_expanded_tabs = false; bool has_collapsed_tabs = false; - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { LLAccordionCtrlTab* tab = mItemContainers.at(n); if (!tab->getVisible()) diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index f4a287c115..5653478457 100644 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -531,11 +531,11 @@ void LLPanelWearing::getAttachmentLimitsCoro(std::string url) void LLPanelWearing::setAttachmentDetails(LLSD content) { mObjectNames.clear(); - S32 number_attachments = content["attachments"].size(); - for(int i = 0; i < number_attachments; i++) + auto number_attachments = content["attachments"].size(); + for(size_t i = 0; i < number_attachments; i++) { - S32 number_objects = content["attachments"][i]["objects"].size(); - for(int j = 0; j < number_objects; j++) + auto number_objects = content["attachments"][i]["objects"].size(); + for(size_t j = 0; j < number_objects; j++) { LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID(); std::string name = content["attachments"][i]["objects"][j]["name"].asString(); @@ -647,7 +647,7 @@ void LLPanelWearing::copyToClipboard() } } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text),0,text.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text), 0, static_cast(text.size())); } // Show avatar complexity in appearance floater diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index 52a7383da6..c9fbeba2f3 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -140,12 +140,12 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes if ( pContent.has(NAVMESH_DATA_FIELD) ) { const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary(); - unsigned int binSize = value.size(); + auto binSize = value.size(); std::string newStr(reinterpret_cast(&value[0]), binSize); std::istringstream streamdecomp( newStr ); size_t decompBinSize = 0; bool valid = false; - U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ; + U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh(valid, decompBinSize, streamdecomp, static_cast(binSize)); if ( !valid ) { LL_WARNS() << "Unable to decompress the navmesh llsd." << LL_ENDL; diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp index 2d9f6300bb..1d04ebd145 100644 --- a/indra/newview/llpathfindingpathtool.cpp +++ b/indra/newview/llpathfindingpathtool.cpp @@ -35,9 +35,6 @@ #include "llagent.h" #include "llpathfindingmanager.h" -#include "llpathinglib.h" -#include "llsingleton.h" -#include "lltool.h" #include "llviewercamera.h" #include "llviewerregion.h" #include "llviewerwindow.h" diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index c7d730046b..1ad566503e 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -314,7 +314,7 @@ namespace LLPerfStats std::vector positions; uuid_vec_t avatar_ids; LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, our_pos, distance); - return positions.size(); + return static_cast(positions.size()); } const U32 NUM_PERIODS = 50; diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 5c8aa3f3dc..f93e9b88cf 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -557,11 +557,9 @@ void LLPreviewGesture::addAnimations() // Copy into something we can sort std::vector animations; - - S32 count = items.size(); - for(i = 0; i < count; ++i) + for (auto& item : items) { - animations.push_back( items.at(i) ); + animations.emplace_back(item); } // Do the sort @@ -602,12 +600,9 @@ void LLPreviewGesture::addSounds() // Copy sounds into something we can sort std::vector sounds; - - S32 i; - S32 count = items.size(); - for(i = 0; i < count; ++i) + for (auto& item : items) { - sounds.push_back( items.at(i) ); + sounds.emplace_back(item); } // Do the sort @@ -960,8 +955,8 @@ void LLPreviewGesture::loadUIFromGesture(LLMultiGesture* gesture) //mKeyCombo->setEnabledByValue(LLKeyboard::stringFromKey(KEY_F10), gesture->mMask != MASK_CONTROL); // Make UI steps for each gesture step - S32 i; - S32 count = gesture->mSteps.size(); + size_t i; + size_t count = gesture->mSteps.size(); for (i = 0; i < count; ++i) { LLGestureStep* step = gesture->mSteps[i]; diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index f7a8c76144..78b4fd4412 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -671,7 +671,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync) LLSaveNotecardInfo* info = new LLSaveNotecardInfo(this, mItemUUID, mObjectUUID, tid, copyitem); - S32 size = buffer.length() + 1; + S32 size = static_cast(buffer.length()) + 1; file.write((U8*)buffer.c_str(), size); gAssetStorage->storeAssetData(tid, LLAssetType::AT_NOTECARD, diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index dcfd8e0697..af39508913 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1739,9 +1739,9 @@ struct LLEntryAndEdCore void LLScriptEdCore::deleteBridges() { - S32 count = mBridges.size(); + auto count = mBridges.size(); LLEntryAndEdCore* eandc; - for(S32 i = 0; i < count; i++) + for(size_t i = 0; i < count; i++) { eandc = mBridges.at(i); delete eandc; diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index b95d762311..48e739045c 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -1023,7 +1023,7 @@ void LLPreviewTexture::onButtonClickProfile() void LLPreviewTexture::onButtonClickUUID() { std::string uuid = mImageID.asString(); - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(uuid), 0, uuid.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(uuid), 0, static_cast(uuid.size())); } /* static */ @@ -1154,7 +1154,7 @@ void LLPreviewTexture::adjustAspectRatio() std::string ratio = std::to_string(num)+":" + std::to_string(denom); mRatiosList.push_back(ratio); combo->add(ratio); - combo->setCurrentByIndex(mRatiosList.size()- 1); + combo->setCurrentByIndex(static_cast(mRatiosList.size()) - 1); } else { diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index 47f01a170c..aae7918ef0 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -699,7 +699,7 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face) res /= 2; - S32 mip = i - (mMipChain.size() - mips); + GLint mip = i - (static_cast(mMipChain.size()) - mips); if (mip >= 0) { diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index a5d31ca060..31fadfe7bd 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -527,7 +527,7 @@ void LLSceneMonitor::dumpToFile(const std::string &file_name) os << std::setprecision(10); LLTrace::PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults(); - const U32 frame_count = scene_load_recording.getNumRecordedPeriods(); + const auto frame_count = scene_load_recording.getNumRecordedPeriods(); F64Seconds frame_time; diff --git a/indra/newview/llsceneview.cpp b/indra/newview/llsceneview.cpp index 35b41953d3..9c52440a0f 100644 --- a/indra/newview/llsceneview.cpp +++ b/indra/newview/llsceneview.cpp @@ -199,13 +199,13 @@ void LLSceneView::draw() F32 size_range = size_domain[1]-size_domain[0]; - U32 count = size[idx].size(); + auto count = size[idx].size(); F32 total = 0.f; gGL.begin(LLRender::LINE_STRIP); - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { F32 rad = size[idx][i]; total += rad; @@ -265,11 +265,11 @@ void LLSceneView::draw() U32 triangle_range = tri_domain[1]-tri_domain[0]; - U32 count = triangles[idx].size(); + auto count = triangles[idx].size(); gGL.begin(LLRender::LINE_STRIP); //plot triangles - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { U32 tri_count = triangles[idx][i]; F32 y = (F32) (tri_count-tri_domain[0])/triangle_range*tri_rect.getHeight()+tri_rect.mBottom; @@ -330,13 +330,13 @@ void LLSceneView::draw() F32 cost_range = streaming_domain[1]-streaming_domain[0]; - U32 count = streaming_cost[idx].size(); + auto count = streaming_cost[idx].size(); F32 total = 0; gGL.begin(LLRender::LINE_STRIP); //plot triangles - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { F32 sc = streaming_cost[idx][i]; total += sc; @@ -396,13 +396,13 @@ void LLSceneView::draw() F32 cost_range = physics_domain[1]-physics_domain[0]; - U32 count = physics_cost[idx].size(); + auto count = physics_cost[idx].size(); F32 total = 0; gGL.begin(LLRender::LINE_STRIP); //plot triangles - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { F32 pc = physics_cost[idx][i]; total += pc; diff --git a/indra/newview/llscripteditor.cpp b/indra/newview/llscripteditor.cpp index 5e308d374a..35d7397f65 100644 --- a/indra/newview/llscripteditor.cpp +++ b/indra/newview/llscripteditor.cpp @@ -183,8 +183,8 @@ void LLScriptEditor::loadKeywords(const std::string& filename, LL_PROFILE_ZONE_SCOPED; if (mKeywords.loadFromLegacyFile(filename)) { - S32 count = llmin(funcs.size(), tooltips.size()); - for(S32 i = 0; i < count; i++) + auto count = llmin(funcs.size(), tooltips.size()); + for (size_t i = 0; i < count; i++) { std::string name = utf8str_trim(funcs[i]); mKeywords.addToken(LLKeywordToken::TT_WORD, name, color, tooltips[i] ); diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp index 5ac4879bb8..f75f12feec 100644 --- a/indra/newview/llsechandler_basic.cpp +++ b/indra/newview/llsechandler_basic.cpp @@ -75,7 +75,7 @@ LLBasicCertificate::LLBasicCertificate(const std::string& pem_cert, { // BIO_new_mem_buf returns a read only bio, but takes a void* which isn't const // so we need to cast it. - BIO * pem_bio = BIO_new_mem_buf((void*)pem_cert.c_str(), pem_cert.length()); + BIO * pem_bio = BIO_new_mem_buf((void*)pem_cert.c_str(), static_cast(pem_cert.length())); if(pem_bio == NULL) { LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL; @@ -755,7 +755,7 @@ bool _cert_subdomain_wildcard_match(const std::string& subdomain, { // split wildcard into the portion before the *, and the portion after - int wildcard_pos = wildcard.find_first_of('*'); + auto wildcard_pos = wildcard.find_first_of('*'); // check the case where there is no wildcard. if(wildcard_pos == wildcard.npos) { @@ -787,7 +787,7 @@ bool _cert_subdomain_wildcard_match(const std::string& subdomain, std::string new_subdomain = subdomain.substr(wildcard_pos, subdomain.npos); // iterate through the current subdomain, finding instances of the match string. - int sub_pos = new_subdomain.find_first_of(new_wildcard_match_string); + auto sub_pos = new_subdomain.find_first_of(new_wildcard_match_string); while(sub_pos != std::string::npos) { new_subdomain = new_subdomain.substr(sub_pos, std::string::npos); @@ -819,8 +819,8 @@ bool _cert_hostname_wildcard_match(const std::string& hostname, const std::strin std::string new_cn = common_name; // find the last '.' in the hostname and the match name. - int subdomain_pos = new_hostname.find_last_of('.'); - int subcn_pos = new_cn.find_last_of('.'); + auto subdomain_pos = new_hostname.find_last_of('.'); + auto subcn_pos = new_cn.find_last_of('.'); // if the last char is a '.', strip it if(subdomain_pos == (new_hostname.length()-1)) @@ -1889,7 +1889,7 @@ std::string LLSecAPIBasicHandler::_legacyLoadPassword() unsigned char unique_id[MAC_ADDRESS_BYTES]; LLMachineID::getUniqueID(unique_id, sizeof(unique_id)); LLXORCipher cipher(unique_id, sizeof(unique_id)); - cipher.decrypt(&buffer[0], buffer.size()); + cipher.decrypt(&buffer[0], static_cast(buffer.size())); return std::string((const char*)&buffer[0], buffer.size()); } diff --git a/indra/newview/llsechandler_basic.h b/indra/newview/llsechandler_basic.h index 8368d7fdc9..82fdca0a78 100644 --- a/indra/newview/llsechandler_basic.h +++ b/indra/newview/llsechandler_basic.h @@ -138,7 +138,7 @@ public: virtual iterator find(const LLSD& params); // return the number of certs in the store - virtual int size() const { return mCerts.size(); } + virtual int size() const { return static_cast(mCerts.size()); } // insert the cert to the store. if a copy of the cert already exists in the store, it is removed first virtual void add(LLPointer cert) { insert(end(), cert); } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 0a51b291b7..0bbcca8328 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -7942,7 +7942,7 @@ void LLObjectSelection::updateEffects() S32 LLObjectSelection::getNumNodes() { - return mList.size(); + return static_cast(mList.size()); } // Fix for crash while selecting objects with derendered child prims @@ -8059,7 +8059,7 @@ bool LLObjectSelection::isEmpty() const S32 LLObjectSelection::getObjectCount() { cleanupNodes(); - S32 count = mList.size(); + S32 count = static_cast(mList.size()); return count; } @@ -8798,7 +8798,7 @@ bool LLSelectMgr::selectionMove(const LLVector3& displ, if (enable_rot) { - int children_count = obj->getChildren().size(); + auto children_count = obj->getChildren().size(); if (obj_count > 1 && children_count > 0) { // for linked sets, rotate around the group center diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 6b1bcf2b7d..06b7b4a0bf 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -592,7 +592,7 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem() U32 LLSidepanelInventory::getSelectedCount() { - int count = 0; + size_t count = 0; std::set selection_list = mPanelMainInventory->getActivePanel()->getRootFolder()->getSelectionList(); count += selection_list.size(); @@ -604,7 +604,7 @@ U32 LLSidepanelInventory::getSelectedCount() count += selection_list.size(); } - return count; + return static_cast(count); } LLInventoryPanel *LLSidepanelInventory::getActivePanel() diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index 5bb78fbc7f..28f15ac8a2 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -202,7 +202,7 @@ void LLSkinningUtil::checkSkinWeights(LLVector4a* weights, U32 num_vertices, con void LLSkinningUtil::scrubSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin) { - const S32 max_joints = skin->mJointNames.size(); + const S32 max_joints = static_cast(skin->mJointNames.size()); for (U32 j=0; jmJointNames.size(); + S32 num_joints = static_cast(skin->mJointNames.size()); if (num_verts > 0 && vol_face.mWeights && num_joints > 0) { initJointNums(const_cast(skin), avatar); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index d83ae3808b..0271944461 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2389,12 +2389,12 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume, bool wireframe LLCDMeshData mesh; mesh.mIndexBase = &index[0]; mesh.mVertexBase = pos[0].mV; - mesh.mNumVertices = pos.size(); + mesh.mNumVertices = static_cast(pos.size()); mesh.mVertexStrideBytes = 12; mesh.mIndexStrideBytes = 6; mesh.mIndexType = LLCDMeshData::INT_16; - mesh.mNumTriangles = index.size()/3; + mesh.mNumTriangles = static_cast(index.size())/3; LLCDMeshData res; diff --git a/indra/newview/llsplitbutton.cpp b/indra/newview/llsplitbutton.cpp index 77eedeaf2f..6c252ed31f 100644 --- a/indra/newview/llsplitbutton.cpp +++ b/indra/newview/llsplitbutton.cpp @@ -216,7 +216,7 @@ LLSplitButton::LLSplitButton(const LLSplitButton::Params& p) //a panel for hidden item buttons LLPanel::Params panel_params = p.items_panel; - mItemsPanel= prepareItemsPanel(panel_params, p.items.numValidElements()); + mItemsPanel= prepareItemsPanel(panel_params, static_cast(p.items.numValidElements())); addChild(mItemsPanel); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 5cf0e9ae93..e6b5cccf95 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -635,7 +635,7 @@ bool idle_startup() const std::string delims (" "); std::string system; - int begIdx, endIdx; + size_t begIdx, endIdx; std::string osString = LLOSInfo::instance().getOSStringSimple(); begIdx = osString.find_first_not_of (delims); @@ -4671,7 +4671,7 @@ bool process_login_success_response(U32 &first_sim_size_x, U32 &first_sim_size_y if (!look_at_str.empty()) { size_t len = look_at_str.size(); - LLMemoryStream mstr((U8*)look_at_str.c_str(), len); + LLMemoryStream mstr((U8*)look_at_str.c_str(), static_cast(len)); LLSD sd = LLSDSerialize::fromNotation(mstr, len); gAgentStartLookAt = ll_vector3_from_sd(sd); } @@ -4709,7 +4709,7 @@ bool process_login_success_response(U32 &first_sim_size_x, U32 &first_sim_size_y if(!home_location.empty()) { size_t len = home_location.size(); - LLMemoryStream mstr((U8*)home_location.c_str(), len); + LLMemoryStream mstr((U8*)home_location.c_str(), static_cast(len)); LLSD sd = LLSDSerialize::fromNotation(mstr, len); S32 region_x = sd["region_handle"][0].asInteger(); S32 region_y = sd["region_handle"][1].asInteger(); diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 720acd9ce5..61e52f5550 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1380,13 +1380,13 @@ U32 LLTextureCache::openAndReadEntries(std::vector& entries) void LLTextureCache::writeEntriesAndClose(const std::vector& entries) { - S32 num_entries = entries.size(); + auto num_entries = entries.size(); llassert_always(num_entries == mHeaderEntriesInfo.mEntries); if (!mReadOnly) { LLAPRFile* aprfile = openHeaderEntriesFile(false, (S32)sizeof(EntriesInfo)); - for (S32 idx=0; idxwrite((void*)(&entries[idx]), (S32)sizeof(Entry)); if(bytes_written != sizeof(Entry)) diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h index 4c882e220f..22cdd7ed5c 100644 --- a/indra/newview/lltexturecache.h +++ b/indra/newview/lltexturecache.h @@ -140,8 +140,8 @@ public: void unlockWorkers() { mWorkersMutex.unlock(); } // debug - S32 getNumReads() { return mReaders.size(); } - S32 getNumWrites() { return mWriters.size(); } + S32 getNumReads() { return static_cast(mReaders.size()); } + S32 getNumWrites() { return static_cast(mWriters.size()); } S64Bytes getUsage() { return S64Bytes(mTexturesSizeTotal); } S64Bytes getMaxUsage() { return S64Bytes(sCacheMaxTexturesSize); } U32 getEntries() { return mHeaderEntriesInfo.mEntries; } diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index b7d18aa129..29bffe4c7b 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1816,7 +1816,7 @@ bool LLTextureFetchWorker::doWork(S32 param) return true; } - S32 append_size(mHttpBufferArray->size()); + S32 append_size(static_cast(mHttpBufferArray->size())); S32 total_size(cur_size + append_size); S32 src_offset(0); llassert_always(append_size == mRequestedSize); @@ -2418,7 +2418,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response, { // get length of stream: LLCore::BufferArray * body(response->getBody()); - data_size = body ? body->size() : 0; + data_size = body ? static_cast(body->size()) : 0; LL_DEBUGS(LOG_TXT) << "HTTP RECEIVED: " << mID.asString() << " Bytes: " << data_size << LL_ENDL; if (data_size > 0) @@ -4025,7 +4025,7 @@ void LLTextureFetch::cancelHttpWaiters() int LLTextureFetch::getHttpWaitersCount() { mNetworkQueueMutex.lock(); // +Mfnq - int ret(mHttpWaitResource.size()); + int ret(static_cast(mHttpWaitResource.size())); mNetworkQueueMutex.unlock(); // -Mfnq return ret; } diff --git a/indra/newview/lltextureinfo.cpp b/indra/newview/lltextureinfo.cpp index e3c3864025..84ef45c97a 100644 --- a/indra/newview/lltextureinfo.cpp +++ b/indra/newview/lltextureinfo.cpp @@ -80,7 +80,7 @@ void LLTextureInfo::addRequest(const LLUUID& id) U32 LLTextureInfo::getTextureInfoMapSize() { - return mTextures.size(); + return static_cast(mTextures.size()); } bool LLTextureInfo::has(const LLUUID& id) diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp index 2bc8b479ec..80138a26be 100644 --- a/indra/newview/lltoastalertpanel.cpp +++ b/indra/newview/lltoastalertpanel.cpp @@ -167,14 +167,14 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal options = supplied_options; } - S32 num_options = options.size(); + auto num_options = options.size(); // Calc total width of buttons S32 button_width = 0; S32 sp = font->getWidth(std::string("OO")); S32 btn_total_width = 0; S32 default_size_btns = 0; - for( S32 i = 0; i < num_options; i++ ) + for (size_t i = 0; i < num_options; i++) { S32 w = S32(font->getWidth( options[i].second ) + 0.99f) + sp + 2 * LLBUTTON_H_PAD; if (mButtonData[i].mWidth > w) @@ -190,7 +190,7 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal if( num_options > 1 ) { - btn_total_width = btn_total_width + (button_width * default_size_btns) + ((num_options - 1) * BTN_HPAD); + btn_total_width = btn_total_width + (button_width * default_size_btns) + ((static_cast(num_options) - 1) * BTN_HPAD); } else { diff --git a/indra/newview/lltoastpanel.cpp b/indra/newview/lltoastpanel.cpp index 3a80223a09..a600068484 100644 --- a/indra/newview/lltoastpanel.cpp +++ b/indra/newview/lltoastpanel.cpp @@ -222,7 +222,7 @@ bool LLCheckBoxToastPanel::setCheckBox(const std::string& check_title, S32 dialog_width = max_msg_width + 2 * h_pad; S32 dialog_height = LLToastPanel::getRect().getHeight(); - dialog_height += LINE_HEIGHT * lines.size(); + dialog_height += LINE_HEIGHT * static_cast(lines.size()); dialog_height += LINE_HEIGHT / 2; LLToastPanel::reshape(dialog_width, dialog_height, false); @@ -233,7 +233,7 @@ bool LLCheckBoxToastPanel::setCheckBox(const std::string& check_title, LLRect check_rect; // if we are part of the toast, we need to leave space for buttons S32 msg_y = v_pad + (parent_view ? 0 : (BTN_HEIGHT + LINE_HEIGHT / 2)); - mCheck->setRect(check_rect.setOriginAndSize(msg_x, msg_y, max_msg_width, LINE_HEIGHT*lines.size())); + mCheck->setRect(check_rect.setOriginAndSize(msg_x, msg_y, max_msg_width, LINE_HEIGHT * static_cast(lines.size()))); mCheck->setLabel(check_title); mCheck->setCommitCallback(cb); diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index b2c8b3d5a8..0b31b0aaa6 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -377,16 +377,13 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, items, LLInventoryModel::EXCLUDE_TRASH, is_not_preferred); - S32 count = cats.size(); - S32 i; - for(i = 0; i < count; ++i) + for (auto& cat : cats) { - folder_ids.push_back(cats.at(i)->getUUID()); + folder_ids.emplace_back(cat->getUUID()); } - count = items.size(); - for(i = 0; i < count; ++i) + for (auto& item : items) { - item_ids.push_back(items.at(i)->getUUID()); + item_ids.emplace_back(item->getUUID()); } if (!folder_ids.empty() || !item_ids.empty()) { @@ -428,9 +425,9 @@ void LLToolDragAndDrop::beginMultiDrag( { // find categories (i.e. inventory folders) in the cargo. LLInventoryCategory* cat = NULL; - S32 count = llmin(cargo_ids.size(), types.size()); - std::set cat_ids; - for(S32 i = 0; i < count; ++i) + auto count = llmin(cargo_ids.size(), types.size()); + uuid_set_t cat_ids; + for (size_t i = 0; i < count; ++i) { cat = gInventory.getCategory(cargo_ids[i]); if (cat) @@ -448,10 +445,9 @@ void LLToolDragAndDrop::beginMultiDrag( items, LLInventoryModel::EXCLUDE_TRASH, is_not_preferred); - S32 cat_count = cats.size(); - for(S32 i = 0; i < cat_count; ++i) + for (auto& cat : cats) { - cat_ids.insert(cat->getUUID()); + cat_ids.emplace(cat->getUUID()); } } } diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h index 364319dc56..ad6402c4ad 100644 --- a/indra/newview/lltooldraganddrop.h +++ b/indra/newview/lltooldraganddrop.h @@ -87,7 +87,7 @@ public: void setCargoCount(U32 count) { mCargoCount = count; } void resetCargoCount() { mCargoCount = 0; } - U32 getCargoCount() const { return (mCargoCount > 0) ? mCargoCount : mCargoIDs.size(); } + U32 getCargoCount() const { return (mCargoCount > 0) ? mCargoCount : static_cast(mCargoIDs.size()); } S32 getCargoIndex() const { return mCurItemIndex; } static S32 getOperationId() { return sOperationId; } diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp index 81a369bfa8..fd0836fb10 100644 --- a/indra/newview/lltoolplacer.cpp +++ b/indra/newview/lltoolplacer.cpp @@ -92,7 +92,7 @@ U32 get_selected_plant(const std::map& list, const std::string& type, S { for (size_t i = 0; i < list.size(); ++i) { - if (list.at(i) && list.at(i)->mName == last_selected) + if (list.at(static_cast(i)) && list.at(static_cast(i))->mName == last_selected) { return (U32)i; } diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index 286e81a5aa..1c9d778137 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -1148,7 +1148,7 @@ std::string LLTranslate::addNoTranslateTags(std::string mesg) upd_msg.insert(dif + match.getStart(), AZURE_NOTRANSLATE_OPENING_TAG); upd_msg.insert(dif + AZURE_NOTRANSLATE_OPENING_TAG.size() + match.getEnd() + 1, AZURE_NOTRANSLATE_CLOSING_TAG); mesg.erase(match.getStart(), match.getEnd() - match.getStart()); - dif += match.getEnd() - match.getStart() + AZURE_NOTRANSLATE_OPENING_TAG.size() + AZURE_NOTRANSLATE_CLOSING_TAG.size(); + dif += match.getEnd() - match.getStart() + static_cast(AZURE_NOTRANSLATE_OPENING_TAG.size() + AZURE_NOTRANSLATE_CLOSING_TAG.size()); } return upd_msg; } @@ -1170,9 +1170,9 @@ std::string LLTranslate::removeNoTranslateTags(std::string mesg) { std::string upd_msg(mesg); LLUrlMatch match; - S32 opening_tag_size = AZURE_NOTRANSLATE_OPENING_TAG.size(); - S32 closing_tag_size = AZURE_NOTRANSLATE_CLOSING_TAG.size(); - S32 dif = 0; + auto opening_tag_size = AZURE_NOTRANSLATE_OPENING_TAG.size(); + auto closing_tag_size = AZURE_NOTRANSLATE_CLOSING_TAG.size(); + size_t dif = 0; //remove 'no-translate' tags we added to the links before while (LLUrlRegistry::instance().findUrl(mesg, match)) { diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp index 67323330b3..18a778015b 100644 --- a/indra/newview/lluploaddialog.cpp +++ b/indra/newview/lluploaddialog.cpp @@ -103,7 +103,7 @@ void LLUploadDialog::setMessage( const std::string& msg) S32 max_msg_width = 0; std::list msg_lines; - S32 size = msg.size() + 1; + auto size = msg.size() + 1; std::vector temp_msg(size); // non-const copy to make strtok happy strcpy( &temp_msg[0], msg.c_str()); char* token = strtok( &temp_msg[0], "\n" ); @@ -118,7 +118,7 @@ void LLUploadDialog::setMessage( const std::string& msg) S32 line_height = font->getLineHeight(); S32 dialog_width = max_msg_width + 2 * HPAD; - S32 dialog_height = line_height * msg_lines.size() + 2 * VPAD; + S32 dialog_height = line_height * static_cast(msg_lines.size()) + 2 * VPAD; reshape( dialog_width, dialog_height, false ); diff --git a/indra/newview/llurl.cpp b/indra/newview/llurl.cpp index 12fcac0293..e210e1c2a5 100644 --- a/indra/newview/llurl.cpp +++ b/indra/newview/llurl.cpp @@ -76,7 +76,7 @@ void LLURL::init(const char * url) char *parse; char *leftover_url = url_copy; - S32 span = 0; + size_t span = 0; // copy and lop off tag if ((parse = strchr(url_copy,'#'))) diff --git a/indra/newview/llurllineeditorctrl.cpp b/indra/newview/llurllineeditorctrl.cpp index c3b6167a7e..de0ed645eb 100644 --- a/indra/newview/llurllineeditorctrl.cpp +++ b/indra/newview/llurllineeditorctrl.cpp @@ -89,5 +89,5 @@ void LLURLLineEditor::copyEscapedURLToClipboard() else // human-readable location text_to_copy = utf8str_to_wstring(unescaped_text); - LLClipboard::instance().copyToClipboard(text_to_copy, 0, text_to_copy.size()); + LLClipboard::instance().copyToClipboard(text_to_copy, 0, static_cast(text_to_copy.size())); } diff --git a/indra/newview/llurlwhitelist.cpp b/indra/newview/llurlwhitelist.cpp index f5651646a6..e2d2fe00e2 100644 --- a/indra/newview/llurlwhitelist.cpp +++ b/indra/newview/llurlwhitelist.cpp @@ -128,8 +128,8 @@ bool LLUrlWhiteList::clear () std::string url_cleanup(std::string pattern) { LLStringUtil::trim(pattern); - S32 length = pattern.length(); - S32 position = 0; + size_t length = pattern.length(); + size_t position = 0; std::string::reverse_iterator it = pattern.rbegin(); ++it; // skip last char, might be '/' ++position; @@ -139,7 +139,7 @@ std::string url_cleanup(std::string pattern) if (c == '/') { // found second to last '/' - S32 desired_length = length - position; + auto desired_length = length - position; LLStringUtil::truncate(pattern, desired_length); break; } diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index a27a0b7d76..3576bfa33e 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -588,7 +588,7 @@ void LLViewerAssetStorage::assetRequestCoro( const LLSD::Binary &raw = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary(); - S32 size = raw.size(); + S32 size = static_cast(raw.size()); if (size > 0) { mTotalBytesFetched += size; diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index 975ef13b0d..2233428251 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -627,7 +627,7 @@ LLSD LLNewBufferedResourceUploadInfo::exportTempFile() // copy buffer to the cache for upload LLFileSystem file(getAssetId(), getAssetType(), LLFileSystem::APPEND); - file.write((U8*) mBuffer.c_str(), mBuffer.size()); + file.write((U8*) mBuffer.c_str(), static_cast(mBuffer.size())); return LLSD(); } @@ -729,7 +729,7 @@ LLSD LLBufferedAssetUploadInfo::prepareUpload() LLFileSystem file(getAssetId(), getAssetType(), LLFileSystem::APPEND); - S32 size = mContents.length() + 1; + S32 size = static_cast(mContents.length()) + 1; file.write((U8*)mContents.c_str(), size); mStoredToCache = true; diff --git a/indra/newview/llviewergesture.cpp b/indra/newview/llviewergesture.cpp index 3a79a93da0..7b7fff96d1 100644 --- a/indra/newview/llviewergesture.cpp +++ b/indra/newview/llviewergesture.cpp @@ -162,7 +162,7 @@ LLGesture *LLViewerGestureList::create_gesture(U8 **buffer, S32 max_size) // output_str bool LLViewerGestureList::matchPrefix(const std::string& in_str, std::string* out_str) { - S32 in_len = in_str.length(); + S32 in_len = static_cast(in_str.length()); std::string in_str_lc = in_str; LLStringUtil::toLower(in_str_lc); diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp index 5b230c81fc..198e02db66 100644 --- a/indra/newview/llviewerinput.cpp +++ b/indra/newview/llviewerinput.cpp @@ -1219,7 +1219,7 @@ bool LLViewerInput::handleGlobalBindsKeyDown(KEY key, MASK mask) return false; } S32 mode = getMode(); - return scanKey(mGlobalKeyBindings[mode], mGlobalKeyBindings[mode].size(), key, mask, true, false, false, false); + return scanKey(mGlobalKeyBindings[mode], static_cast(mGlobalKeyBindings[mode].size()), key, mask, true, false, false, false); } bool LLViewerInput::handleGlobalBindsKeyUp(KEY key, MASK mask) @@ -1232,7 +1232,7 @@ bool LLViewerInput::handleGlobalBindsKeyUp(KEY key, MASK mask) } S32 mode = getMode(); - return scanKey(mGlobalKeyBindings[mode], mGlobalKeyBindings[mode].size(), key, mask, false, true, false, false); + return scanKey(mGlobalKeyBindings[mode], static_cast(mGlobalKeyBindings[mode].size()), key, mask, false, true, false, false); } bool LLViewerInput::handleGlobalBindsMouse(EMouseClickType clicktype, MASK mask, bool down) @@ -1248,18 +1248,18 @@ bool LLViewerInput::handleGlobalBindsMouse(EMouseClickType clicktype, MASK mask, S32 mode = getMode(); if (down) { - res = scanMouse(mGlobalMouseBindings[mode], mGlobalMouseBindings[mode].size(), clicktype, mask, MOUSE_STATE_DOWN, true); + res = scanMouse(mGlobalMouseBindings[mode], static_cast(mGlobalMouseBindings[mode].size()), clicktype, mask, MOUSE_STATE_DOWN, true); } else { - res = scanMouse(mGlobalMouseBindings[mode], mGlobalMouseBindings[mode].size(), clicktype, mask, MOUSE_STATE_UP, true); + res = scanMouse(mGlobalMouseBindings[mode], static_cast(mGlobalMouseBindings[mode].size()), clicktype, mask, MOUSE_STATE_UP, true); } return res; } bool LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, const std::string& function_name) { - S32 index; + size_t index; typedef boost::function function_t; function_t function = NULL; std::string name; @@ -1306,7 +1306,7 @@ bool LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, cons // check for duplicate first and overwrite if (result->mIsGlobal) { - S32 size = mGlobalKeyBindings[mode].size(); + auto size = mGlobalKeyBindings[mode].size(); for (index = 0; index < size; index++) { if (key == mGlobalKeyBindings[mode][index].mKey && mask == mGlobalKeyBindings[mode][index].mMask) @@ -1318,7 +1318,7 @@ bool LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, cons } else { - S32 size = mKeyBindings[mode].size(); + auto size = mKeyBindings[mode].size(); for (index = 0; index < size; index++) { if (key == mKeyBindings[mode][index].mKey && mask == mKeyBindings[mode][index].mMask) @@ -1349,7 +1349,7 @@ bool LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, cons bool LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const MASK mask, const std::string& function_name) { - S32 index; + size_t index; typedef boost::function function_t; function_t function = NULL; @@ -1388,7 +1388,7 @@ bool LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const // check for duplicate first and overwrite if (result->mIsGlobal) { - S32 size = mGlobalMouseBindings[mode].size(); + auto size = mGlobalMouseBindings[mode].size(); for (index = 0; index < size; index++) { if (mouse == mGlobalMouseBindings[mode][index].mMouse && mask == mGlobalMouseBindings[mode][index].mMask) @@ -1400,7 +1400,7 @@ bool LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const } else { - S32 size = mMouseBindings[mode].size(); + auto size = mMouseBindings[mode].size(); for (index = 0; index < size; index++) { if (mouse == mMouseBindings[mode][index].mMouse && mask == mMouseBindings[mode][index].mMask) @@ -1703,7 +1703,7 @@ bool LLViewerInput::scanKey(KEY key, bool key_down, bool key_up, bool key_level) // don't process key down on repeated keys bool repeat = gKeyboard->getKeyRepeated(key); - bool res = scanKey(mKeyBindings[mode], mKeyBindings[mode].size(), key, mask, key_down, key_up, key_level, repeat); + bool res = scanKey(mKeyBindings[mode], static_cast(mKeyBindings[mode].size()), key, mask, key_down, key_up, key_level, repeat); return res; } @@ -1839,7 +1839,7 @@ bool LLViewerInput::scanMouse(EMouseClickType click, EMouseState state) const bool res = false; S32 mode = getMode(); MASK mask = gKeyboard->currentMask(true); - res = scanMouse(mMouseBindings[mode], mMouseBindings[mode].size(), click, mask, state, false); + res = scanMouse(mMouseBindings[mode], static_cast(mMouseBindings[mode].size()), click, mask, state, false); // No user defined actions found or those actions can't handle the key/button, // so handle CONTROL_LBUTTON if nessesary. @@ -1900,14 +1900,14 @@ void LLViewerInput::scanMouse() bool LLViewerInput::isMouseBindUsed(const EMouseClickType mouse, const MASK mask, const S32 mode) const { - S32 size = mMouseBindings[mode].size(); - for (S32 index = 0; index < size; index++) + auto size = mMouseBindings[mode].size(); + for (size_t index = 0; index < size; index++) { if (mouse == mMouseBindings[mode][index].mMouse && mask == mMouseBindings[mode][index].mMask) return true; } size = mGlobalMouseBindings[mode].size(); - for (S32 index = 0; index < size; index++) + for (size_t index = 0; index < size; index++) { if (mouse == mGlobalMouseBindings[mode][index].mMouse && mask == mGlobalMouseBindings[mode][index].mMask) return true; diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 6fb8d1498e..4e311fe88a 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -836,7 +836,7 @@ S32 LLViewerInventoryCategory::getViewerDescendentCount() const S32 descendents_actual = 0; if(cats && items) { - descendents_actual = cats->size() + items->size(); + descendents_actual = static_cast(cats->size() + items->size()); } return descendents_actual; } diff --git a/indra/newview/llviewerjointattachment.h b/indra/newview/llviewerjointattachment.h index 4b2ecb5cfb..e2ae60ba6f 100644 --- a/indra/newview/llviewerjointattachment.h +++ b/indra/newview/llviewerjointattachment.h @@ -77,7 +77,7 @@ public: S32 getGroup() const { return mGroup; } S32 getPieSlice() const { return mPieSlice; } - S32 getNumObjects() const { return mAttachedObjects.size(); } + S32 getNumObjects() const { return static_cast(mAttachedObjects.size()); } S32 getNumAnimatedObjects() const; void clampObjectPosition(); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 94f9f770dc..8ef5371d42 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -584,7 +584,7 @@ void do_bulk_upload(std::vector filenames, const LLSD& notification tinygltf::Model model; if (LLTinyGLTFHelper::loadModel(filename, model)) { - S32 materials_in_file = model.materials.size(); + S32 materials_in_file = static_cast(model.materials.size()); for (S32 i = 0; i < materials_in_file; i++) { @@ -632,7 +632,7 @@ bool get_bulk_upload_expected_cost(const std::vector& filenames, S3 if (LLTinyGLTFHelper::loadModel(filename, model)) { - S32 materials_in_file = model.materials.size(); + S32 materials_in_file = static_cast(model.materials.size()); for (S32 i = 0; i < materials_in_file; i++) { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 0902841851..3c5dd696cf 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -7976,8 +7976,8 @@ void send_group_notice(const LLUUID& group_id, item_def["owner_id"] = item->getPermissions().getOwner(); std::ostringstream ostr; LLSDSerialize::serialize(item_def, ostr, LLSDSerialize::LLSD_XML); - bin_bucket_size = ostr.str().copy( - (char*)bin_bucket, ostr.str().size()); + bin_bucket_size = static_cast(ostr.str().copy( + (char*)bin_bucket, ostr.str().size())); bin_bucket[bin_bucket_size] = '\0'; } else diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 6cf32cb179..2a0dfc4303 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -7528,7 +7528,7 @@ public: const LLSD& input) const { LLSD object_data = input["body"]["ObjectData"]; - S32 num_entries = object_data.size(); + S32 num_entries = static_cast(object_data.size()); for ( S32 i = 0; i < num_entries; i++ ) { diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 45eae21700..2ab5eb72e8 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -288,7 +288,7 @@ public: virtual void addChild(LLViewerObject *childp); virtual void removeChild(LLViewerObject *childp); const_child_list_t& getChildren() const { return mChildList; } - S32 numChildren() const { return mChildList.size(); } + S32 numChildren() const { return static_cast(mChildList.size()); } void addThisAndAllChildren(std::vector& objects); void addThisAndNonJointChildren(std::vector& objects); // bool isChild(LLViewerObject *childp) const; diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 22efd30222..53ac69c87d 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1723,7 +1723,7 @@ void LLViewerObjectList::removeFromActiveList(LLViewerObject* objectp) objectp->setListIndex(-1); - S32 last_index = mActiveObjects.size()-1; + S32 last_index = static_cast(mActiveObjects.size()) - 1; if (idx != last_index) { @@ -1754,7 +1754,7 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp) if (idx <= -1) { mActiveObjects.push_back(objectp); - objectp->setListIndex(mActiveObjects.size()-1); + objectp->setListIndex(static_cast(mActiveObjects.size()) - 1); objectp->setOnActiveList(true); } else diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index e91bf74873..ac71f74a9b 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -651,15 +651,13 @@ void LLViewerParcelMgr::removeObserver(LLParcelObserver* observer) void LLViewerParcelMgr::notifyObservers() { std::vector observers; - S32 count = mObservers.size(); - S32 i; - for(i = 0; i < count; ++i) + for (auto observer : mObservers) { - observers.push_back(mObservers.at(i)); + observers.emplace_back(observer); } - for(i = 0; i < count; ++i) + for (auto observer : observers) { - observers.at(i)->changed(); + observer->changed(); } } @@ -1956,7 +1954,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use // U8* bitmap = new U8[ bitmap_size ]; // msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size); // [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3) - msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, parcel_mgr.mCollisionBitmap, parcel_mgr.getCollisionBitmapSize()); + msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, parcel_mgr.mCollisionBitmap, static_cast(parcel_mgr.getCollisionBitmapSize())); // [/SL:KB] parcel_mgr.resetSegments(parcel_mgr.mCollisionSegments); @@ -2247,7 +2245,7 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 which) void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 flags, const LLAccessEntry::map& entries, LLViewerRegion* region, S32 parcel_local_id) { - S32 count = entries.size(); + S32 count = static_cast(entries.size()); S32 num_sections = (S32) ceil(count/PARCEL_MAX_ENTRIES_PER_PACKET); S32 sequence_id = 1; bool start_message = true; diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index f226864ebf..333c7b98ca 100644 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -279,7 +279,7 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt) LLVector3 gravity(0.f, 0.f, GRAVITY); - LLViewerPartSim::checkParticleCount(mParticles.size()); + LLViewerPartSim::checkParticleCount(static_cast(mParticles.size())); LLViewerCamera* camera = LLViewerCamera::getInstance(); LLViewerRegion *regionp = getRegion(); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 58735d4e17..9aca4786f7 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -142,7 +142,7 @@ public: bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web) { // make sure that we at least have a region name - int num_params = params.size(); + auto num_params = params.size(); if (num_params < 1) { return false; @@ -156,7 +156,7 @@ public: } boost::regex name_rx("[A-Za-z0-9()_%]+"); boost::regex coord_rx("[0-9]+"); - for (int i = 0; i < num_params; i++) + for (size_t i = 0; i < num_params; i++) { if (i > 0) { @@ -986,7 +986,7 @@ const LLUUID& LLViewerRegion::getOwner() const void LLViewerRegion::setRegionNameAndZone (const std::string& name_zone) { std::string::size_type pipe_pos = name_zone.find('|'); - S32 length = name_zone.size(); + auto length = name_zone.size(); if (pipe_pos != std::string::npos) { mName = name_zone.substr(0, pipe_pos); @@ -1267,7 +1267,7 @@ void LLViewerRegion::killCacheEntry(U32 local_id) U32 LLViewerRegion::getNumOfActiveCachedObjects() const { - return mImpl->mActiveSet.size(); + return static_cast(mImpl->mActiveSet.size()); } void LLViewerRegion::addActiveCacheEntry(LLVOCacheEntry* entry) @@ -1354,7 +1354,7 @@ bool LLViewerRegion::addVisibleGroup(LLViewerOctreeGroup* group) U32 LLViewerRegion::getNumOfVisibleGroups() const { - return mImpl ? mImpl->mVisibleGroups.size() : 0; + return mImpl ? static_cast(mImpl->mVisibleGroups.size()) : 0; } void LLViewerRegion::updateReflectionProbes() @@ -1831,7 +1831,7 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) } std::vector delete_list; - S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); + auto update_counter = llmin(max_update, mImpl->mActiveSet.size()); LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); for(; update_counter > 0; --update_counter, ++iter) @@ -1870,10 +1870,9 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) if(!delete_list.empty()) { mInvisibilityCheckHistory |= 1; - S32 count = delete_list.size(); - for(S32 i = 0; i < count; i++) + for (auto drawable : delete_list) { - gObjectList.killObject(delete_list[i]->getVObj()); + gObjectList.killObject(drawable->getVObj()); } delete_list.clear(); } @@ -2788,10 +2787,9 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) if(iter != mOrphanMap.end()) { std::vector* orphans = &mOrphanMap[entry->getLocalID()]; - S32 size = orphans->size(); - for(S32 i = 0; i < size; i++) + for (U32 orphan : *orphans) { - LLVOCacheEntry* child = getCacheEntry((*orphans)[i]); + LLVOCacheEntry* child = getCacheEntry(orphan); if(child) { entry->addChild(child); @@ -3072,7 +3070,7 @@ void LLViewerRegion::requestCacheMisses() mCacheDirty = true ; // LL_INFOS() << "KILLDEBUG Sent cache miss full " << full_count << " crc " << crc_count << LL_ENDL; - LLViewerStatsRecorder::instance().requestCacheMissesEvent(mCacheMissList.size()); + LLViewerStatsRecorder::instance().requestCacheMissesEvent(static_cast(mCacheMissList.size())); mCacheMissList.clear(); } diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 5d57765feb..ee65f8bcf4 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -273,7 +273,7 @@ public: } F32 right_x; - mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::UNDERLINE, LLFontGL::NO_SHADOW, mLabel.length(), S32_MAX, &right_x); + mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::UNDERLINE, LLFontGL::NO_SHADOW, static_cast(mLabel.length()), S32_MAX, &right_x); return right_x; } diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index a6c5a111d9..24b4baaf50 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3628,12 +3628,12 @@ void LLViewerMediaTexture::removeFace(U32 channel, LLFace* facep) return; } - S32 end = te_list.size(); + auto end = te_list.size(); for(std::list< LLPointer >::iterator iter = mTextureList.begin(); iter != mTextureList.end(); ++iter) { - S32 i = 0; + size_t i = 0; for(i = 0; i < end; i++) { diff --git a/indra/newview/llviewertextureanim.cpp b/indra/newview/llviewertextureanim.cpp index 9342eb2865..238e6830ea 100644 --- a/indra/newview/llviewertextureanim.cpp +++ b/indra/newview/llviewertextureanim.cpp @@ -43,13 +43,13 @@ LLViewerTextureAnim::LLViewerTextureAnim(LLVOVolume* vobj) : LLTextureAnim() mScaleS = mScaleT = 1; mRot = 0; - mInstanceIndex = sInstanceList.size(); + mInstanceIndex = static_cast(sInstanceList.size()); sInstanceList.push_back(this); } LLViewerTextureAnim::~LLViewerTextureAnim() { - S32 end_idx = sInstanceList.size()-1; + S32 end_idx = static_cast(sInstanceList.size()) - 1; if (end_idx != mInstanceIndex) { diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 35da0a5882..cdbda641c7 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -703,7 +703,7 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image) llassert_always(mInitialized) ; llassert(image); - S32 count = 0; + size_t count = 0; if (image->isInImageList()) { count = mImageList.erase(image) ; @@ -1239,7 +1239,7 @@ void LLViewerTextureList::decodeAllImages(F32 max_time) } std::shared_ptr main_queue = LLImageGLThread::sEnabledTextures ? LL::WorkQueue::getInstance("mainloop") : NULL; // Run threads - S32 fetch_pending = 0; + size_t fetch_pending = 0; while (1) { LLAppViewer::instance()->getTextureCache()->update(1); // unpauses the texture cache thread diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index ee9d8194bf..3e8bc7194f 100644 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -138,7 +138,7 @@ public: void handleIRCallback(void **data, const S32 number); - S32 getNumImages() { return mImageList.size(); } + S32 getNumImages() { return static_cast(mImageList.size()); } // Local UI images // Local UI images diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp index 485dd683be..b0a00c29a4 100644 --- a/indra/newview/llviewerthrottle.cpp +++ b/indra/newview/llviewerthrottle.cpp @@ -246,9 +246,9 @@ LLViewerThrottleGroup LLViewerThrottle::getThrottleGroup(const F32 bandwidth_kbp //Clamp the bandwidth users can set. F32 set_bandwidth = llclamp(bandwidth_kbps, MIN_BANDWIDTH, MAX_BANDWIDTH); - S32 count = mPresets.size(); + auto count = mPresets.size(); - S32 i; + size_t i; for (i = 0; i < count; i++) { if (mPresets[i].getTotal() > set_bandwidth) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index e0f9f9ce99..be3bf88ea8 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1767,13 +1767,13 @@ bool LLViewerWindow::handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S recording.getPerSec(LLStatViewer::FPS), //mFPSStat.getMeanPerSec(), recording.getLastValue(LLStatViewer::SIM_PHYSICS_FPS), recording.getLastValue(LLStatViewer::SIM_TIME_DILATION)); - S32 len = temp_str.length(); + int len = static_cast(temp_str.length()); TextOutA(hdc, 0, 0, temp_str.c_str(), len); LLVector3d pos_global = gAgent.getPositionGlobal(); temp_str = llformat( "Avatar pos %6.1lf %6.1lf %6.1lf", pos_global.mdV[0], pos_global.mdV[1], pos_global.mdV[2]); - len = temp_str.length(); + len = static_cast(temp_str.length()); TextOutA(hdc, 0, 25, temp_str.c_str(), len); TextOutA(hdc, 0, 50, "Set \"HeadlessClient FALSE\" in settings.ini file to reenable", 61); @@ -3065,12 +3065,12 @@ void LLViewerWindow::draw() bool crosshairRendered = false; - S32 length = avatars.size(); - if (length) + auto length = avatars.size(); + if (length > 0) { LGGContactSets& contact_sets = LGGContactSets::instance(); - for (S32 i = 0; i < length; i++) + for (size_t i = 0; i < length; i++) { LLUUID& targetKey = avatars[i]; if (targetKey == gAgentID) @@ -4680,12 +4680,12 @@ void renderNonMeshHullPhysics(LLVOVolume* vovolume, LLVolume* volume, LLColor4 c LLCDMeshData mesh; mesh.mIndexBase = &index[0]; mesh.mVertexBase = pos[0].mV; - mesh.mNumVertices = pos.size(); + mesh.mNumVertices = static_cast(pos.size()); mesh.mVertexStrideBytes = 12; mesh.mIndexStrideBytes = 6; mesh.mIndexType = LLCDMeshData::INT_16; - mesh.mNumTriangles = index.size() / 3; + mesh.mNumTriangles = static_cast(index.size()) / 3; LLCDMeshData res; LLCDResult retval; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3b7d3b42d1..a7ac77699e 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2476,7 +2476,7 @@ void LLVOAvatar::updateMeshData() S32 f_num = 0 ; const U32 VERTEX_NUMBER_THRESHOLD = 128 ;//small number of this means each part of an avatar has its own vertex buffer. - const S32 num_parts = mMeshLOD.size(); + const auto num_parts = mMeshLOD.size(); // this order is determined by number of LODS // if a mesh earlier in this list changed LODs while a later mesh doesn't, @@ -6421,7 +6421,7 @@ void LLVOAvatar::checkTextureLoading() return ; //have not been invisible for enough time. } - mLoadedCallbackTextures = pause ? mCallbackTextureList.size() : 0; + mLoadedCallbackTextures = pause ? static_cast(mCallbackTextureList.size()) : 0; for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = mCallbackTextureList.begin(); iter != mCallbackTextureList.end(); ++iter) @@ -7401,8 +7401,8 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::setisMesh() && pSkinData ) { - const int bindCnt = pSkinData->mAlternateBindMatrix.size(); - const int jointCnt = pSkinData->mJointNames.size(); + const int bindCnt = static_cast(pSkinData->mAlternateBindMatrix.size()); + const int jointCnt = static_cast(pSkinData->mJointNames.size()); if ((bindCnt > 0) && (bindCnt != jointCnt)) { LL_WARNS_ONCE() << "invalid mesh, bindCnt " << bindCnt << "!= jointCnt " << jointCnt << ", joint overrides will be ignored." << LL_ENDL; @@ -8844,7 +8844,7 @@ LLVOAvatar* LLVOAvatar::findAvatarFromAttachment( LLViewerObject* obj ) S32 LLVOAvatar::getAttachmentCount() const { - S32 count = 0; + size_t count = 0; for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) { @@ -8852,7 +8852,7 @@ S32 LLVOAvatar::getAttachmentCount() const count += pAttachment->mAttachedObjects.size(); } - return count; + return static_cast(count); } bool LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const @@ -9943,7 +9943,7 @@ void LLVOAvatar::addChat(const LLChat& chat) mChats.push_back(chat); - S32 chat_length = 0; + size_t chat_length = 0; for( chat_iter = mChats.begin(); chat_iter != mChats.end(); ++chat_iter) { chat_length += chat_iter->mText.size(); @@ -10600,7 +10600,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } // SUNSHINE CLEANUP - is this case OK now? - S32 num_params = contents->mParamWeights.size(); + auto num_params = contents->mParamWeights.size(); if (num_params <= 1) { // In this case, we have no reliable basis for knowing @@ -10655,7 +10655,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& contents, bool slam_params) { - S32 num_params = contents.mParamWeights.size(); + auto num_params = contents.mParamWeights.size(); ESex old_sex = getSex(); if (applyParsedTEMessage(contents.mTEContents) > 0 && isChanged(TEXTURE)) @@ -10733,7 +10733,7 @@ void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& conte bool interp_params = false; S32 params_changed_count = 0; - for( S32 i = 0; i < num_params; i++ ) + for( size_t i = 0; i < num_params; i++ ) { LLVisualParam* param = contents.mParams[i]; F32 newWeight = contents.mParamWeights[i]; @@ -12256,7 +12256,7 @@ void LLVOAvatar::accountRenderComplexityForObject( attached_object->mRiggedAttachedWarned = true; } - hud_object_complexity.texturesCount += textures.size(); + hud_object_complexity.texturesCount += static_cast(textures.size()); for (LLVOVolume::texture_cost_t::iterator volume_texture = textures.begin(); volume_texture != textures.end(); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index d4e62704cc..5c2e1949e9 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -1317,7 +1317,7 @@ void LLVOCache::removeEntry(HeaderEntryInfo* entry) removeFromCache(entry); delete entry; - mNumEntries = mHandleEntryMap.size() ; + mNumEntries = static_cast(mHandleEntryMap.size()); } } @@ -1504,7 +1504,7 @@ void LLVOCache::writeCacheHeader() success = check_write(&apr_file, (void*)*iter, sizeof(HeaderEntryInfo)); } - mNumEntries = mHeaderEntryQueue.size() ; + mNumEntries = static_cast(mHeaderEntryQueue.size()); if(success && mNumEntries < MAX_NUM_OBJECT_ENTRIES) { HeaderEntryInfo* entry = new HeaderEntryInfo() ; @@ -1784,7 +1784,7 @@ void LLVOCache::purgeEntries(U32 size) delete entry; } - mNumEntries = mHandleEntryMap.size() ; + mNumEntries = static_cast(mHandleEntryMap.size()); } void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, bool dirty_cache, bool removal_enabled) @@ -1863,7 +1863,7 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry: if(success) { - S32 num_entries = cache_entry_map.size(); // if removal is enabled num_entries might be wrong + S32 num_entries = static_cast(cache_entry_map.size()); // if removal is enabled num_entries might be wrong success = check_write(&apr_file, &num_entries, sizeof(S32)); if (success) { @@ -1991,7 +1991,7 @@ void LLVOCache::writeGenericExtrasToCache(U64 handle, const LLUUID& id, const LL // // TODO - clean up broken cache file // } - // U32 num_entries = cache_extras_entry_map.size(); + // auto num_entries = cache_extras_entry_map.size(); // out << num_entries << '\n'; // if(!out.good()) // { @@ -2027,7 +2027,7 @@ void LLVOCache::writeGenericExtrasToCache(U64 handle, const LLUUID& id, const LL LLViewerRegion* pRegion = LLWorld::getInstance()->getRegionFromHandle(handle); U32 num_entries = 0; - U32 inmem_entries = 0; + size_t inmem_entries = 0; U32 skipped = 0; inmem_entries = cache_extras_entry_map.size(); for (auto [local_id, entry] : cache_extras_entry_map) diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index c972e95e75..5bcf7ce587 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -147,7 +147,7 @@ public: void removeChild(LLVOCacheEntry* entry); void removeAllChildren(); LLVOCacheEntry* getChild(); //remove the first child, and return it. - S32 getNumOfChildren() const {return mChildrenList.size();} + S32 getNumOfChildren() const { return static_cast(mChildrenList.size()); } void setBoundingInfo(const LLVector3& pos, const LLVector3& scale); //called from processing object update message void updateParentBoundingInfo(); diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index f7b00e82c0..528347d83e 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -741,7 +741,7 @@ void LLGrassPartition::getGeometry(LLSpatialGroup* group) vertex_count += facep->getGeomCount(); index_count += facep->getIndicesCount(); - S32 idx = draw_vec.size()-1; + S32 idx = static_cast(draw_vec.size()) - 1; bool fullbright = facep->isState(LLFace::FULLBRIGHT); diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp index 90d76f09f9..e89b2c0f07 100644 --- a/indra/newview/llvoicevisualizer.cpp +++ b/indra/newview/llvoicevisualizer.cpp @@ -248,7 +248,7 @@ void LLVoiceVisualizer::lipStringToF32s ( std::string& in_string, F32*& out_F32s { delete[] out_F32s; // get rid of the current array - count_F32s = in_string.length(); + count_F32s = static_cast(in_string.length()); if (count_F32s == 0) { // we don't like zero length arrays diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 0286c42985..0801f3c17d 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -7552,8 +7552,8 @@ LLIOPipe::EStatus LLVivoxProtocolParser::process_impl( } // Look for input delimiter(s) in the input buffer. If one is found, send the message to the xml parser. - int start = 0; - int delim; + size_t start = 0; + size_t delim; while((delim = mInput.find("\n\n\n", start)) != std::string::npos) { @@ -7564,7 +7564,7 @@ LLIOPipe::EStatus LLVivoxProtocolParser::process_impl( XML_SetElementHandler(parser, ExpatStartTag, ExpatEndTag); XML_SetCharacterDataHandler(parser, ExpatCharHandler); XML_SetUserData(parser, this); - XML_Parse(parser, mInput.data() + start, delim - start, false); + XML_Parse(parser, mInput.data() + start, static_cast(delim - start), false); LL_DEBUGS("VivoxProtocolParser") << "parsing: " << mInput.substr(start, delim - start) << LL_ENDL; start = delim + 3; diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index a2ed56fc60..7745c0dffa 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -331,7 +331,7 @@ bool LLVOPartGroup::updateGeometry(LLDrawable *drawable) F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); pixel_meter_ratio *= pixel_meter_ratio; - LLViewerPartSim::checkParticleCount(mViewerPartGroupp->mParticles.size()) ; + LLViewerPartSim::checkParticleCount(static_cast(mViewerPartGroupp->mParticles.size())); S32 count=0; mDepth = 0.f; @@ -913,7 +913,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) llassert(facep->getGeomCount() == 4); llassert(facep->getIndicesCount() == 6); - S32 idx = draw_vec.size()-1; + S32 idx = static_cast(draw_vec.size()) - 1; bool fullbright = facep->isState(LLFace::FULLBRIGHT); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 056c9c6226..e7c2fee7ee 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5474,7 +5474,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, //add face to drawmap LLSpatialGroup::drawmap_elem_t& draw_vec = group->mDrawMap[passType]; - S32 idx = draw_vec.size()-1; + S32 idx = static_cast(draw_vec.size()) - 1; bool fullbright = (type == LLRenderPass::PASS_FULLBRIGHT) || (type == LLRenderPass::PASS_INVISIBLE) || diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index 988e8474dc..ca2d86c5ea 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -1206,14 +1206,14 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu return; } - const uuid_vec_t& ids = mUUIDs; // selected items IDs - U32 mask = 0; // mask of selected items' types - U32 n_items = ids.size(); // number of selected items - U32 n_worn = 0; // number of worn items among the selected ones - U32 n_already_worn = 0; // number of items worn of same type as selected items - U32 n_links = 0; // number of links among the selected items - U32 n_editable = 0; // number of editable items among the selected ones - U32 n_touchable = 0; // number of touchable items among the selected ones + const uuid_vec_t& ids = mUUIDs; // selected items IDs + U32 mask = 0; // mask of selected items' types + U32 n_items = static_cast(ids.size()); // number of selected items + U32 n_worn = 0; // number of worn items among the selected ones + U32 n_already_worn = 0; // number of items worn of same type as selected items + U32 n_links = 0; // number of links among the selected items + U32 n_editable = 0; // number of editable items among the selected ones + U32 n_touchable = 0; // number of touchable items among the selected ones bool can_be_worn = true; diff --git a/indra/newview/llwearablelist.h b/indra/newview/llwearablelist.h index be00c058a2..680b958b46 100644 --- a/indra/newview/llwearablelist.h +++ b/indra/newview/llwearablelist.h @@ -46,7 +46,7 @@ class LLWearableList : public LLSingleton public: void cleanup() ; - S32 getLength() const { return mList.size(); } + S32 getLength() const { return static_cast(mList.size()); } void getAsset(const LLAssetID& assetID, const std::string& wearable_name, diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index df93ae1209..2b9a2512af 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -131,8 +131,8 @@ std::string LLWeb::escapeURL(const std::string& url) // The CURL curl_escape() function escapes colons, slashes, // and all characters but A-Z and 0-9. Do a cheesy mini-escape. std::string escaped_url; - S32 len = url.length(); - for (S32 i = 0; i < len; i++) + auto len = url.length(); + for (size_t i = 0; i < len; i++) { char c = url[i]; if (c == ' ') diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index cbf5471920..781ea257b5 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1850,8 +1850,8 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positi { LLViewerRegion* regionp = *iter; const LLVector3d& origin_global = regionp->getOriginGlobal(); - S32 count = regionp->mMapAvatars.size(); - for (S32 i = 0; i < count; i++) + auto count = regionp->mMapAvatars.size(); + for (size_t i = 0; i < count; i++) { // //LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.at(i), origin_global); @@ -1932,7 +1932,7 @@ bool LLWorld::getAvatar(const LLUUID& idAvatar, LLVector3d& posAvatar) const for (const LLViewerRegion* pRegion : LLWorld::getInstance()->getRegionList()) { - for (S32 idxAgent = 0, cntAgent = pRegion->mMapAvatarIDs.size(); idxAgent < cntAgent; ++idxAgent) + for (size_t idxAgent = 0, cntAgent = pRegion->mMapAvatarIDs.size(); idxAgent < cntAgent; ++idxAgent) { if (idAvatar == pRegion->mMapAvatarIDs[idxAgent]) { diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index b45aa69217..549cfbb484 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -298,7 +298,7 @@ void LLXMLRPCTransaction::Handler::onCompleted(LLCore::HttpHandle handle, body->read(0, bodydata, body->size()); - mImpl->mResponse = XMLRPC_REQUEST_FromXML(bodydata, body->size(), 0); + mImpl->mResponse = XMLRPC_REQUEST_FromXML(bodydata, static_cast(body->size()), 0); delete[] bodydata; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 3c57c2ee9e..a49b6e25c2 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -3762,10 +3762,8 @@ void LLPipeline::renderHighlights() // Make sure the selection image gets downloaded and decoded mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - U32 count = mSelectedFaces.size(); - for (U32 i = 0; i < count; i++) + for (auto facep : mSelectedFaces) { - LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { LL_ERRS() << "Bad face on selection" << LL_ENDL; @@ -3781,10 +3779,8 @@ void LLPipeline::renderHighlights() // Paint 'em red! color.setVec(1.f, 0.f, 0.f, 0.5f); - int count = mHighlightFaces.size(); - for (S32 i = 0; i < count; i++) + for (auto facep : mHighlightFaces) { - LLFace* facep = mHighlightFaces[i]; facep->renderSelected(LLViewerTexture::sNullImagep, color); } } @@ -3810,10 +3806,8 @@ void LLPipeline::renderHighlights() mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - U32 count = mSelectedFaces.size(); - for (U32 i = 0; i < count; i++) + for (auto facep : mSelectedFaces) { - LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { LL_ERRS() << "Bad face on selection" << LL_ENDL; @@ -3840,10 +3834,8 @@ void LLPipeline::renderHighlights() mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - U32 count = mSelectedFaces.size(); - for (U32 i = 0; i < count; i++) + for (auto facep : mSelectedFaces) { - LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { LL_ERRS() << "Bad face on selection" << LL_ENDL; @@ -4881,7 +4873,7 @@ void LLPipeline::rebuildPools() assertInitialized(); - S32 max_count = mPools.size(); + auto max_count = mPools.size(); pool_set_t::iterator iter1 = mPools.upper_bound(mLastRebuildPool); while(max_count > 0 && mPools.size() > 0) // && num_rebuilds < MAX_REBUILDS) { diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 2bba613db9..65b9eda7e2 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -347,7 +347,7 @@ public: void findReferences(LLDrawable *drawablep); // Find the lists which have references to this object bool verify(); // Verify that all data in the pipeline is "correct" - S32 getLightCount() const { return mLights.size(); } + S32 getLightCount() const { return static_cast(mLights.size()); } void calcNearbyLights(LLCamera& camera); void setupHWLights(); diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index 35f41d2bad..615c1932b0 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -355,7 +355,7 @@ std::string RlvStrings::getAnonym(const std::string& strName) const char* pszName = strName.c_str(); U32 nHash = 0; // Test with 11,264 SL names showed a 3.33% - 3.82% occurance for each so we *should* get a very even spread - for (int idx = 0, cnt = strName.length(); idx < cnt; idx++) + for (size_t idx = 0, cnt = strName.length(); idx < cnt; idx++) nHash += pszName[idx]; return m_Anonyms[nHash % m_Anonyms.size()]; @@ -505,7 +505,7 @@ void RlvUtil::filterNames(std::string& strUTF8Text, bool fFilterLegacy, bool fCl { uuid_vec_t idAgents; LLWorld::getInstance()->getAvatars(&idAgents, NULL); - for (int idxAgent = 0, cntAgent = idAgents.size(); idxAgent < cntAgent; idxAgent++) + for (size_t idxAgent = 0, cntAgent = idAgents.size(); idxAgent < cntAgent; idxAgent++) { LLAvatarName avName; // NOTE: if we're agressively culling nearby names then ignore exceptions @@ -576,7 +576,7 @@ bool RlvUtil::isNearbyAgent(const LLUUID& idAgent) std::vector idAgents; LLWorld::getInstance()->getAvatars(&idAgents, NULL); - for (int idxAgent = 0, cntAgent = idAgents.size(); idxAgent < cntAgent; idxAgent++) + for (size_t idxAgent = 0, cntAgent = idAgents.size(); idxAgent < cntAgent; idxAgent++) if (idAgents[idxAgent] == idAgent) return true; } diff --git a/indra/newview/rlvextensions.cpp b/indra/newview/rlvextensions.cpp index 3371c3d61e..bbd861a4ea 100644 --- a/indra/newview/rlvextensions.cpp +++ b/indra/newview/rlvextensions.cpp @@ -67,8 +67,8 @@ bool RlvExtGetSet::onReplyCommand(const RlvCommand& rlvCmd, ERlvCmdRet& cmdRet) bool RlvExtGetSet::processCommand(const RlvCommand& rlvCmd, ERlvCmdRet& eRet) { std::string strBehaviour = rlvCmd.getBehaviour(), strGetSet, strSetting; - int idxSetting = strBehaviour.find('_'); - if ( (strBehaviour.length() >= 6) && (-1 != idxSetting) && ((int)strBehaviour.length() > idxSetting + 1) ) + size_t idxSetting = strBehaviour.find('_'); + if ( (strBehaviour.length() >= 6) && (std::string::npos != idxSetting) && (strBehaviour.length() > idxSetting + 1) ) { strSetting = strBehaviour.substr(idxSetting + 1); strBehaviour.erase(idxSetting); // Get rid of "_" diff --git a/indra/newview/rlvfloaters.cpp b/indra/newview/rlvfloaters.cpp index 8f5857dee8..68824e902e 100644 --- a/indra/newview/rlvfloaters.cpp +++ b/indra/newview/rlvfloaters.cpp @@ -275,7 +275,7 @@ std::string RlvFloaterBehaviours::getFormattedBehaviourString(ERlvBehaviourFilte void RlvFloaterBehaviours::onBtnCopyToClipboard() { LLWString wstrRestrictions = utf8str_to_wstring(getFormattedBehaviourString(ERlvBehaviourFilter::ALL)); - LLClipboard::instance().copyToClipboard(wstrRestrictions, 0, wstrRestrictions.length()); + LLClipboard::instance().copyToClipboard(wstrRestrictions, 0, static_cast(wstrRestrictions.length())); } // Checked: 2011-05-23 (RLVa-1.3.1c) | Modified: RLVa-1.3.1c diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index da39eefb93..2f73e001e2 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -1224,7 +1224,7 @@ void RlvHandler::onTeleportFinished(const LLVector3d& posArrival) size_t utf8str_strlen(const std::string& utf8) { const char* pUTF8 = utf8.c_str(); size_t length = 0; - for (int idx = 0, cnt = utf8.length(); idx < cnt ;idx++) + for (size_t idx = 0, cnt = utf8.length(); idx < cnt ;idx++) { // We're looking for characters that don't start with 10 as their high bits if ((pUTF8[idx] & 0xC0) != 0x80) @@ -1271,7 +1271,7 @@ bool RlvHandler::filterChat(std::string& strUTF8Text, bool fFilterEmote) const } else if (!hasBehaviour(RLV_BHVR_EMOTE)) { - int idx = strUTF8Text.find('.'); // Truncate at 20 characters or at the dot (whichever is shorter) + auto idx = strUTF8Text.find('.'); // Truncate at 20 characters or at the dot (whichever is shorter) strUTF8Text = utf8str_chtruncate(strUTF8Text, ( (idx > 0) && (idx < 20) ) ? idx + 1 : 20); } } @@ -3228,7 +3228,7 @@ void RlvHandler::onForceWearCallback(const uuid_vec_t& idItems, U32 nFlags) cons LLInventoryModel::cat_array_t folders; if (RlvInventory::instance().getPath(idItems, folders)) { - for (S32 idxFolder = 0, cntFolder = folders.size(); idxFolder < cntFolder; idxFolder++) + for (size_t idxFolder = 0, cntFolder = folders.size(); idxFolder < cntFolder; idxFolder++) onForceWear(folders.at(idxFolder), nFlags); // If we're not executing a command then we're a delayed callback and need to manually call done() @@ -3578,7 +3578,7 @@ ERlvCmdRet RlvHandler::onFindFolder(const RlvCommand& rlvCmd, std::string& strRe // We need to return an "in depth" result so whoever has the most '/' is our lucky winner // (maxSlashes needs to be initialized to -1 since children of the #RLV folder won't have '/' in their shared path) int maxSlashes = -1, curSlashes; std::string strFolderName; - for (S32 idxFolder = 0, cntFolder = folders.size(); idxFolder < cntFolder; idxFolder++) + for (size_t idxFolder = 0, cntFolder = folders.size(); idxFolder < cntFolder; idxFolder++) { strFolderName = RlvInventory::instance().getSharedPath(folders.at(idxFolder)); @@ -3592,7 +3592,7 @@ ERlvCmdRet RlvHandler::onFindFolder(const RlvCommand& rlvCmd, std::string& strRe } else if (RLV_BHVR_FINDFOLDERS == rlvCmd.getBehaviourType()) { - for (S32 idxFolder = 0, cntFolder = folders.size(); idxFolder < cntFolder; idxFolder++) + for (size_t idxFolder = 0, cntFolder = folders.size(); idxFolder < cntFolder; idxFolder++) { if (!strReply.empty()) strReply.push_back(','); @@ -3813,7 +3813,7 @@ ERlvCmdRet RlvHandler::onGetInv(const RlvCommand& rlvCmd, std::string& strReply) if (!pFolders) return RLV_RET_FAILED; - for (S32 idxFolder = 0, cntFolder = pFolders->size(); idxFolder < cntFolder; idxFolder++) + for (size_t idxFolder = 0, cntFolder = pFolders->size(); idxFolder < cntFolder; idxFolder++) { // Return all folders that: // - aren't hidden @@ -3856,12 +3856,12 @@ ERlvCmdRet RlvHandler::onGetInvWorn(const RlvCommand& rlvCmd, std::string& strRe // Add all the folders to a lookup map std::map mapFolders; mapFolders.insert(std::pair(pFolder->getUUID(), wi)); - for (S32 idxFolder = 0, cntFolder = folders.size(); idxFolder < cntFolder; idxFolder++) + for (size_t idxFolder = 0, cntFolder = folders.size(); idxFolder < cntFolder; idxFolder++) mapFolders.insert(std::pair(folders.at(idxFolder)->getUUID(), wi)); // Iterate over all the found items LLViewerInventoryItem* pItem; std::map::iterator itFolder; - for (S32 idxItem = 0, cntItem = items.size(); idxItem < cntItem; idxItem++) + for (size_t idxItem = 0, cntItem = items.size(); idxItem < cntItem; idxItem++) { pItem = items.at(idxItem); if (!RlvForceWear::isWearableItem(pItem)) @@ -4004,7 +4004,7 @@ ERlvCmdRet RlvHandler::onGetPath(const RlvCommand& rlvCmd, std::string& strReply } else if (RLV_BHVR_GETPATHNEW == rlvCmd.getBehaviourType()) { - for (S32 idxFolder = 0, cntFolder = folders.size(); idxFolder < cntFolder; idxFolder++) + for (size_t idxFolder = 0, cntFolder = folders.size(); idxFolder < cntFolder; idxFolder++) { if (!strReply.empty()) strReply.push_back(','); diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index 16b39509f7..5bc0aae4b6 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -762,8 +762,8 @@ bool RlvCommand::parseCommand(const std::string& strCommand, std::string& strBeh // (See behaviour notes for the command parsing truth table) // Format: [: