diff --git a/src/Mod/Mesh/App/Core/IO/Reader3MF.cpp b/src/Mod/Mesh/App/Core/IO/Reader3MF.cpp index 3cd6a3b644..9dd5ae1a87 100644 --- a/src/Mod/Mesh/App/Core/IO/Reader3MF.cpp +++ b/src/Mod/Mesh/App/Core/IO/Reader3MF.cpp @@ -176,6 +176,7 @@ bool Reader3MF::LoadBuild(XERCES_CPP_NAMESPACE_QUALIFIER DOMNodeList* nodes) bool Reader3MF::LoadItems(XERCES_CPP_NAMESPACE_QUALIFIER DOMNodeList* nodes) { + const std::size_t numEntries = 12; if (!nodes) return false; @@ -193,8 +194,8 @@ bool Reader3MF::LoadItems(XERCES_CPP_NAMESPACE_QUALIFIER DOMNodeList* nodes) boost::char_separator sep(" ,"); boost::tokenizer > tokens(transform, sep); std::vector token_results; - token_results.assign(tokens.begin(),tokens.end()); - if (token_results.size() == 12) { + token_results.assign(tokens.begin(), tokens.end()); + if (token_results.size() == numEntries) { mat[0][0] = std::stod(token_results[0]); mat[1][0] = std::stod(token_results[1]); mat[2][0] = std::stod(token_results[2]); diff --git a/src/Mod/Mesh/App/Core/IO/Reader3MF.h b/src/Mod/Mesh/App/Core/IO/Reader3MF.h index 46f1007371..67da6d703d 100644 --- a/src/Mod/Mesh/App/Core/IO/Reader3MF.h +++ b/src/Mod/Mesh/App/Core/IO/Reader3MF.h @@ -49,7 +49,7 @@ public: * * Passes an input stream to the constructor. */ - Reader3MF(std::istream &str); + explicit Reader3MF(std::istream &str); /*! * \brief Reader3MF @@ -57,7 +57,7 @@ public: * * Passes a file name to the constructor */ - Reader3MF(const std::string &filename); + explicit Reader3MF(const std::string &filename); /*! * \brief Load the mesh from the input stream or file * \return true on success and false otherwise diff --git a/src/Mod/Mesh/App/Core/IO/Writer3MF.h b/src/Mod/Mesh/App/Core/IO/Writer3MF.h index 9a8b0ca6df..03b9a04a11 100644 --- a/src/Mod/Mesh/App/Core/IO/Writer3MF.h +++ b/src/Mod/Mesh/App/Core/IO/Writer3MF.h @@ -54,14 +54,14 @@ public: * Passes an output stream to the constructor. * \param str */ - Writer3MF(std::ostream &str); + explicit Writer3MF(std::ostream &str); /*! * \brief Writer3MF * Passes a file name to the constructor * \param filename */ - Writer3MF(const std::string &filename); + explicit Writer3MF(const std::string &filename); /*! * \brief Add a mesh object resource to the 3MF file. diff --git a/src/Mod/Mesh/App/Core/MeshIO.cpp b/src/Mod/Mesh/App/Core/MeshIO.cpp index c601501df1..0999bf961a 100644 --- a/src/Mod/Mesh/App/Core/MeshIO.cpp +++ b/src/Mod/Mesh/App/Core/MeshIO.cpp @@ -151,7 +151,7 @@ MeshIO::Format MeshInput::getFormat(const char* FileName) return MeshIO::Format::SMF; } else { - throw Base::FileException("File extension not supported",FileName); + throw Base::FileException("File extension not supported", FileName); } } @@ -160,9 +160,9 @@ bool MeshInput::LoadAny(const char* FileName) // ask for read permission Base::FileInfo fi(FileName); if (!fi.exists() || !fi.isFile()) - throw Base::FileException("File does not exist",FileName); + throw Base::FileException("File does not exist", FileName); if (!fi.isReadable()) - throw Base::FileException("No permission on the file",FileName); + throw Base::FileException("No permission on the file", FileName); Base::ifstream str(fi, std::ios::in | std::ios::binary); @@ -200,7 +200,7 @@ bool MeshInput::LoadAny(const char* FileName) ok = LoadPLY( str ); } else { - throw Base::FileException("File extension not supported",FileName); + throw Base::FileException("File extension not supported", FileName); } return ok; @@ -336,7 +336,7 @@ bool MeshInput::LoadOBJ (std::istream &rstrIn) std::string line; float fX, fY, fZ; - int i1=1,i2=1,i3=1,i4=1; + int i1=1, i2=1, i3=1, i4=1; MeshFacet item; if (!rstrIn || rstrIn.bad()) @@ -363,9 +363,9 @@ bool MeshInput::LoadOBJ (std::istream &rstrIn) fX = (float)std::atof(what[1].first); fY = (float)std::atof(what[4].first); fZ = (float)std::atof(what[7].first); - float r = std::min(std::atof(what[10].first),255) / 255.0f; - float g = std::min(std::atof(what[11].first),255) / 255.0f; - float b = std::min(std::atof(what[12].first),255) / 255.0f; + float r = std::min(std::atof(what[10].first), 255) / 255.0f; + float g = std::min(std::atof(what[11].first), 255) / 255.0f; + float b = std::min(std::atof(what[12].first), 255) / 255.0f; meshPoints.push_back(MeshPoint(Base::Vector3f(fX, fY, fZ))); App::Color c(r,g,b); diff --git a/src/Mod/Mesh/App/Core/MeshIO.h b/src/Mod/Mesh/App/Core/MeshIO.h index 7ed54f64eb..5d59de7d76 100644 --- a/src/Mod/Mesh/App/Core/MeshIO.h +++ b/src/Mod/Mesh/App/Core/MeshIO.h @@ -105,7 +105,7 @@ public: bool LoadAny(const char* FileName); /// Loads from a stream and the given format bool LoadFormat(std::istream &str, MeshIO::Format fmt); - /** Loads an STL file either in binary or ASCII format. + /** Loads an STL file either in binary or ASCII format. * Therefore the file header gets checked to decide if the file is binary or not. */ bool LoadSTL (std::istream &rstrIn);