From 2a48c195301490e289ce7cf423b34e08028aae02 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 26 Jul 2022 21:43:44 +0300 Subject: SL-17828 Crash at LLPolyMorphData::loadBinary These files are usually prepackaged with viewer, either all issues should lead to an error or all issues should use warns. I don't think it is a critical issue, so instead of crashing, printing out filename. --- indra/llappearance/llpolymesh.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/llappearance/llpolymesh.cpp') diff --git a/indra/llappearance/llpolymesh.cpp b/indra/llappearance/llpolymesh.cpp index 0a7a8d27bb..3892e4ce43 100644 --- a/indra/llappearance/llpolymesh.cpp +++ b/indra/llappearance/llpolymesh.cpp @@ -612,14 +612,16 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) // we reached the end of the morphs break; } - LLPolyMorphData* morph_data = new LLPolyMorphData(std::string(morphName)); + std::string morph_name(morphName); + LLPolyMorphData* morph_data = new LLPolyMorphData(morph_name); BOOL result = morph_data->loadBinary(fp, this); if (!result) { - delete morph_data; - continue; + LL_WARNS() << "Failure loading " << morph_name << " from " << fileName << LL_ENDL; + delete morph_data; + continue; } mMorphData.insert(morph_data); -- cgit v1.2.3 From 74a9280c698b4f88a46549923a2d717b82dd7ee2 Mon Sep 17 00:00:00 2001 From: Fawrsk <45524015+Fawrsk@users.noreply.github.com> Date: Tue, 3 Jan 2023 17:08:15 -0400 Subject: SL-18893 Clean up for loops in llappearance to use C++11 range based for loops (#38) --- indra/llappearance/llpolymesh.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'indra/llappearance/llpolymesh.cpp') diff --git a/indra/llappearance/llpolymesh.cpp b/indra/llappearance/llpolymesh.cpp index 3892e4ce43..d0f0199d61 100644 --- a/indra/llappearance/llpolymesh.cpp +++ b/indra/llappearance/llpolymesh.cpp @@ -890,11 +890,10 @@ void LLPolyMesh::dumpDiagInfo() LL_INFOS() << "-----------------------------------------------------" << LL_ENDL; // print each loaded mesh, and it's memory usage - for(LLPolyMeshSharedDataTable::iterator iter = sGlobalSharedMeshList.begin(); - iter != sGlobalSharedMeshList.end(); ++iter) + for(const auto& mesh_pair : sGlobalSharedMeshList) { - const std::string& mesh_name = iter->first; - LLPolyMeshSharedData* mesh = iter->second; + const std::string& mesh_name = mesh_pair.first; + LLPolyMeshSharedData* mesh = mesh_pair.second; S32 num_verts = mesh->mNumVertices; S32 num_faces = mesh->mNumFaces; @@ -997,14 +996,12 @@ LLPolyMorphData* LLPolyMesh::getMorphData(const std::string& morph_name) { if (!mSharedData) return NULL; - for (LLPolyMeshSharedData::morphdata_list_t::iterator iter = mSharedData->mMorphData.begin(); - iter != mSharedData->mMorphData.end(); ++iter) + for (auto morph_data : mSharedData->mMorphData) { - LLPolyMorphData *morph_data = *iter; - if (morph_data->getName() == morph_name) - { - return morph_data; - } + if (morph_data->getName() == morph_name) + { + return morph_data; + } } return NULL; } -- cgit v1.2.3 From 7419037ef6e8a5497283278baa8582b264d3aefa Mon Sep 17 00:00:00 2001 From: Fawrsk Date: Tue, 10 Jan 2023 05:43:27 -0400 Subject: SL-18893 Fixes for pull requests #38, #41, and #42 (#46) Eliminate unnecessary copies, and remove uses of auto --- indra/llappearance/llpolymesh.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llappearance/llpolymesh.cpp') diff --git a/indra/llappearance/llpolymesh.cpp b/indra/llappearance/llpolymesh.cpp index d0f0199d61..dab14851c8 100644 --- a/indra/llappearance/llpolymesh.cpp +++ b/indra/llappearance/llpolymesh.cpp @@ -890,7 +890,7 @@ void LLPolyMesh::dumpDiagInfo() LL_INFOS() << "-----------------------------------------------------" << LL_ENDL; // print each loaded mesh, and it's memory usage - for(const auto& mesh_pair : sGlobalSharedMeshList) + for(const LLPolyMeshSharedDataTable::value_type& mesh_pair : sGlobalSharedMeshList) { const std::string& mesh_name = mesh_pair.first; LLPolyMeshSharedData* mesh = mesh_pair.second; @@ -996,7 +996,7 @@ LLPolyMorphData* LLPolyMesh::getMorphData(const std::string& morph_name) { if (!mSharedData) return NULL; - for (auto morph_data : mSharedData->mMorphData) + for (LLPolyMorphData* morph_data : mSharedData->mMorphData) { if (morph_data->getName() == morph_name) { -- cgit v1.2.3