Fixed a bunch of clang warnings

1. Fix misleading indentation warnings.
2. Fix creating a temporary const copy when iterating over a map (thanks to range analysis warnings)
3. Fix creating a copy when iterating over a range without reference qualifier (also thanks to range analysis warnings)
pull/2976/head
Hanif Bin Ariffin 2020-01-30 18:42:30 -05:00
parent 78b074ac5a
commit bbe6f7f213
4 changed files with 5 additions and 5 deletions

View File

@ -250,7 +250,7 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
const Mesh& ndmesh = (const Mesh&)(root); const Mesh& ndmesh = (const Mesh&)(root);
if (ndmesh.vertex_positions.size() && ndmesh.texture_coords.size()) { if (ndmesh.vertex_positions.size() && ndmesh.texture_coords.size()) {
typedef std::pair<unsigned int,Mesh::FaceRefList> Entry; typedef std::pair<const unsigned int,Mesh::FaceRefList> Entry;
for(const Entry& reflist : ndmesh.temp_map) { for(const Entry& reflist : ndmesh.temp_map) {
{ // create mesh { // create mesh
size_t n = 0; size_t n = 0;

View File

@ -323,7 +323,7 @@ public:
// oh well. // oh well.
bool have_param = false, have_point = false; bool have_param = false, have_point = false;
IfcVector3 point; IfcVector3 point;
for(const Entry sel :entity.Trim1) { for(const Entry& sel :entity.Trim1) {
if (const ::Assimp::STEP::EXPRESS::REAL* const r = sel->ToPtr<::Assimp::STEP::EXPRESS::REAL>()) { if (const ::Assimp::STEP::EXPRESS::REAL* const r = sel->ToPtr<::Assimp::STEP::EXPRESS::REAL>()) {
range.first = *r; range.first = *r;
have_param = true; have_param = true;
@ -340,7 +340,7 @@ public:
} }
} }
have_param = false, have_point = false; have_param = false, have_point = false;
for(const Entry sel :entity.Trim2) { for(const Entry& sel :entity.Trim2) {
if (const ::Assimp::STEP::EXPRESS::REAL* const r = sel->ToPtr<::Assimp::STEP::EXPRESS::REAL>()) { if (const ::Assimp::STEP::EXPRESS::REAL* const r = sel->ToPtr<::Assimp::STEP::EXPRESS::REAL>()) {
range.second = *r; range.second = *r;
have_param = true; have_param = true;

View File

@ -1421,7 +1421,7 @@ void MDLImporter::InternReadFile_3DGS_MDL7( )
avOutList[i].reserve(3); avOutList[i].reserve(3);
// buffer to held the names of all groups in the file // buffer to held the names of all groups in the file
const size_t buffersize( AI_MDL7_MAX_GROUPNAMESIZE*pcHeader->groups_num ); const size_t buffersize(AI_MDL7_MAX_GROUPNAMESIZE*pcHeader->groups_num);
char* aszGroupNameBuffer = new char[ buffersize ]; char* aszGroupNameBuffer = new char[ buffersize ];
// read all groups // read all groups

View File

@ -685,7 +685,7 @@ bool XGLImporter::ReadMesh(TempScope& scope)
} }
// finally extract output meshes and add them to the scope // finally extract output meshes and add them to the scope
typedef std::pair<unsigned int, TempMaterialMesh> pairt; typedef std::pair<const unsigned int, TempMaterialMesh> pairt;
for(const pairt& p : bymat) { for(const pairt& p : bymat) {
aiMesh* const m = ToOutputMesh(p.second); aiMesh* const m = ToOutputMesh(p.second);
scope.meshes_linear.push_back(m); scope.meshes_linear.push_back(m);