From 46121a1559671cbeaa5bd089b4652b794b50d94e Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Thu, 29 Oct 2015 14:04:23 +0200 Subject: [PATCH] Mark single-parameter constructors explicit Suggested by cppcheck --- code/ASEParser.h | 4 ++-- code/Assimp.cpp | 2 +- code/BVHLoader.h | 2 +- code/BaseImporter.h | 2 +- code/BaseProcess.h | 4 ++-- code/CInterfaceIOWrapper.h | 4 ++-- code/ComputeUVMappingProcess.h | 2 +- code/FBXProperties.h | 2 +- code/IRRLoader.h | 4 ++-- code/Importer.h | 2 +- code/LWOFileData.h | 4 ++-- code/MD5Parser.h | 6 +++--- code/ObjFileData.h | 2 +- code/OgreStructs.h | 4 ++-- code/OgreXmlSerializer.h | 2 +- code/Q3BSPZipArchive.h | 2 +- code/Q3DLoader.h | 2 +- code/RawLoader.h | 4 ++-- code/SGSpatialSort.h | 2 +- code/SceneCombiner.h | 2 +- code/StdOStreamLogStream.h | 2 +- code/TinyFormatter.h | 2 +- code/UnrealLoader.h | 2 +- code/XFileHelper.h | 4 ++-- code/XFileParser.h | 2 +- code/irrXMLWrapper.h | 2 +- include/assimp/DefaultLogger.hpp | 2 +- include/assimp/Logger.hpp | 2 +- include/assimp/color4.h | 2 +- include/assimp/quaternion.h | 4 ++-- include/assimp/scene.h | 2 +- include/assimp/types.h | 2 +- 32 files changed, 43 insertions(+), 43 deletions(-) diff --git a/code/ASEParser.h b/code/ASEParser.h index e0a628606..da4f7bd48 100644 --- a/code/ASEParser.h +++ b/code/ASEParser.h @@ -138,7 +138,7 @@ struct Bone } //! Construction from an existing name - Bone( const std::string& name) + explicit Bone( const std::string& name) : mName (name) {} @@ -216,7 +216,7 @@ struct BaseNode enum Type {Light, Camera, Mesh, Dummy} mType; //! Constructor. Creates a default name for the node - BaseNode(Type _mType) + explicit BaseNode(Type _mType) : mType (_mType) , mProcessed (false) { diff --git a/code/Assimp.cpp b/code/Assimp.cpp index 03c39671b..497cb9b72 100644 --- a/code/Assimp.cpp +++ b/code/Assimp.cpp @@ -110,7 +110,7 @@ static boost::mutex gLogStreamMutex; class LogToCallbackRedirector : public LogStream { public: - LogToCallbackRedirector(const aiLogStream& s) + explicit LogToCallbackRedirector(const aiLogStream& s) : stream (s) { ai_assert(NULL != s.callback); } diff --git a/code/BVHLoader.h b/code/BVHLoader.h index 8c88484f6..5d950e3c7 100644 --- a/code/BVHLoader.h +++ b/code/BVHLoader.h @@ -83,7 +83,7 @@ class BVHLoader : public BaseImporter std::vector mChannelValues; // motion data values for that node. Of size NumChannels * NumFrames Node() { } - Node( const aiNode* pNode) : mNode( pNode) { } + explicit Node( const aiNode* pNode) : mNode( pNode) { } }; public: diff --git a/code/BaseImporter.h b/code/BaseImporter.h index e8ed7460d..cb6394ebc 100644 --- a/code/BaseImporter.h +++ b/code/BaseImporter.h @@ -70,7 +70,7 @@ class IOStream; template struct ScopeGuard { - ScopeGuard(T* obj) : obj(obj), mdismiss() {} + explicit ScopeGuard(T* obj) : obj(obj), mdismiss() {} ~ScopeGuard () throw() { if (!mdismiss) { delete obj; diff --git a/code/BaseProcess.h b/code/BaseProcess.h index 0e7530f16..25a3f1e53 100644 --- a/code/BaseProcess.h +++ b/code/BaseProcess.h @@ -74,7 +74,7 @@ public: template struct THeapData : public Base { - THeapData(T* in) + explicit THeapData(T* in) : data (in) {} @@ -89,7 +89,7 @@ public: template struct TStaticData : public Base { - TStaticData(T in) + explicit TStaticData(T in) : data (in) {} diff --git a/code/CInterfaceIOWrapper.h b/code/CInterfaceIOWrapper.h index a9437b551..13e5c3de3 100644 --- a/code/CInterfaceIOWrapper.h +++ b/code/CInterfaceIOWrapper.h @@ -57,7 +57,7 @@ class CIOStreamWrapper : public IOStream friend class CIOSystemWrapper; public: - CIOStreamWrapper(aiFile* pFile) + explicit CIOStreamWrapper(aiFile* pFile) : mFile(pFile) {} @@ -110,7 +110,7 @@ private: class CIOSystemWrapper : public IOSystem { public: - CIOSystemWrapper(aiFileIO* pFile) + explicit CIOSystemWrapper(aiFileIO* pFile) : mFileSystem(pFile) {} diff --git a/code/ComputeUVMappingProcess.h b/code/ComputeUVMappingProcess.h index 4b829eda5..476af0451 100644 --- a/code/ComputeUVMappingProcess.h +++ b/code/ComputeUVMappingProcess.h @@ -125,7 +125,7 @@ private: // temporary structure to describe a mapping struct MappingInfo { - MappingInfo(aiTextureMapping _type) + explicit MappingInfo(aiTextureMapping _type) : type (_type) , axis (0.f,1.f,0.f) , uv (0u) diff --git a/code/FBXProperties.h b/code/FBXProperties.h index 455a2aedb..93b89c34c 100644 --- a/code/FBXProperties.h +++ b/code/FBXProperties.h @@ -87,7 +87,7 @@ class TypedProperty : public Property { public: - TypedProperty(const T& value) + explicit TypedProperty(const T& value) : value(value) { } diff --git a/code/IRRLoader.h b/code/IRRLoader.h index 04a65a24b..fa5c4e89b 100644 --- a/code/IRRLoader.h +++ b/code/IRRLoader.h @@ -113,7 +113,7 @@ private: } type; - Animator(AT t = UNKNOWN) + explicit Animator(AT t = UNKNOWN) : type (t) , speed (0.001f) , direction (0.f,1.f,0.f) @@ -163,7 +163,7 @@ private: ANIMMESH } type; - Node(ET t) + explicit Node(ET t) : type (t) , scaling (1.f,1.f,1.f) // assume uniform scaling by default , parent() diff --git a/code/Importer.h b/code/Importer.h index fbf9826ea..f0c32b42d 100644 --- a/code/Importer.h +++ b/code/Importer.h @@ -167,7 +167,7 @@ public: // ------------------------------------------------------------------- /** Construct a batch loader from a given IO system to be used * to acess external files */ - BatchLoader(IOSystem* pIO); + explicit BatchLoader(IOSystem* pIO); ~BatchLoader(); diff --git a/code/LWOFileData.h b/code/LWOFileData.h index 5838b5026..fee874c36 100644 --- a/code/LWOFileData.h +++ b/code/LWOFileData.h @@ -269,7 +269,7 @@ struct Face : public aiFace {} //! Construction from given type - Face(uint32_t _type) + explicit Face(uint32_t _type) : surfaceIndex (0) , smoothGroup (0) , type (_type) @@ -305,7 +305,7 @@ struct Face : public aiFace */ struct VMapEntry { - VMapEntry(unsigned int _dims) + explicit VMapEntry(unsigned int _dims) : dims(_dims) {} diff --git a/code/MD5Parser.h b/code/MD5Parser.h index e08d6d8b4..1938cca8b 100644 --- a/code/MD5Parser.h +++ b/code/MD5Parser.h @@ -280,7 +280,7 @@ public: * * @param mSections List of file sections (output of MD5Parser) */ - MD5MeshParser(SectionList& mSections); + explicit MD5MeshParser(SectionList& mSections); //! List of all meshes MeshList mMeshes; @@ -305,7 +305,7 @@ public: * * @param mSections List of file sections (output of MD5Parser) */ - MD5AnimParser(SectionList& mSections); + explicit MD5AnimParser(SectionList& mSections); //! Output frame rate @@ -337,7 +337,7 @@ public: * * @param mSections List of file sections (output of MD5Parser) */ - MD5CameraParser(SectionList& mSections); + explicit MD5CameraParser(SectionList& mSections); //! Output frame rate diff --git a/code/ObjFileData.h b/code/ObjFileData.h index 9aa44576b..8b5393b77 100644 --- a/code/ObjFileData.h +++ b/code/ObjFileData.h @@ -242,7 +242,7 @@ struct Mesh { bool m_hasNormals; /// Constructor - Mesh( const std::string &name ) + explicit Mesh( const std::string &name ) : m_name( name ) , m_pMaterial(NULL) , m_uiNumIndices(0) diff --git a/code/OgreStructs.h b/code/OgreStructs.h index a18bac379..a184ed655 100644 --- a/code/OgreStructs.h +++ b/code/OgreStructs.h @@ -381,8 +381,8 @@ typedef std::vector VertexAnimationTrackList; class Animation { public: - Animation(Skeleton *parent); - Animation(Mesh *parent); + explicit Animation(Skeleton *parent); + explicit Animation(Mesh *parent); /// Returns the associated vertex data for a track in this animation. /** @note Only valid to call when parent Mesh is set. */ diff --git a/code/OgreXmlSerializer.h b/code/OgreXmlSerializer.h index feb288983..beddb8080 100644 --- a/code/OgreXmlSerializer.h +++ b/code/OgreXmlSerializer.h @@ -69,7 +69,7 @@ public: static bool ImportSkeleton(Assimp::IOSystem *pIOHandler, Mesh *mesh); private: - OgreXmlSerializer(XmlReader *reader) : + explicit OgreXmlSerializer(XmlReader *reader) : m_reader(reader) { } diff --git a/code/Q3BSPZipArchive.h b/code/Q3BSPZipArchive.h index 333db5960..3b9bc2b3f 100644 --- a/code/Q3BSPZipArchive.h +++ b/code/Q3BSPZipArchive.h @@ -90,7 +90,7 @@ class ZipFile : public IOStream { public: - ZipFile(size_t size); + explicit ZipFile(size_t size); ~ZipFile(); diff --git a/code/Q3DLoader.h b/code/Q3DLoader.h index 02eb0a426..b957e91af 100644 --- a/code/Q3DLoader.h +++ b/code/Q3DLoader.h @@ -103,7 +103,7 @@ private: struct Face { - Face(unsigned int s) + explicit Face(unsigned int s) : indices (s) , uvindices (s) , mat (0) diff --git a/code/RawLoader.h b/code/RawLoader.h index 85d52c795..6dcc3c868 100644 --- a/code/RawLoader.h +++ b/code/RawLoader.h @@ -88,7 +88,7 @@ private: struct MeshInformation { - MeshInformation(const std::string& _name) + explicit MeshInformation(const std::string& _name) : name(_name) { vertices.reserve(100); @@ -103,7 +103,7 @@ private: struct GroupInformation { - GroupInformation(const std::string& _name) + explicit GroupInformation(const std::string& _name) : name(_name) { meshes.reserve(10); diff --git a/code/SGSpatialSort.h b/code/SGSpatialSort.h index e60ee59d2..d2277b583 100644 --- a/code/SGSpatialSort.h +++ b/code/SGSpatialSort.h @@ -66,7 +66,7 @@ public: /** Construction from a given face array, handling smoothing groups * properly */ - SGSpatialSort(const std::vector& vPositions); + explicit SGSpatialSort(const std::vector& vPositions); // ------------------------------------------------------------------- /** Add a vertex to the spatial sort diff --git a/code/SceneCombiner.h b/code/SceneCombiner.h index 3e6f0da41..cc9330b6b 100644 --- a/code/SceneCombiner.h +++ b/code/SceneCombiner.h @@ -166,7 +166,7 @@ struct SceneHelper id[0] = 0; } - SceneHelper (aiScene* _scene) + explicit SceneHelper (aiScene* _scene) : scene (_scene) , idlen (0) { diff --git a/code/StdOStreamLogStream.h b/code/StdOStreamLogStream.h index 02bf508af..be1b2c640 100644 --- a/code/StdOStreamLogStream.h +++ b/code/StdOStreamLogStream.h @@ -16,7 +16,7 @@ public: /** @brief Construction from an existing std::ostream * @param _ostream Output stream to be used */ - StdOStreamLogStream(std::ostream& _ostream); + explicit StdOStreamLogStream(std::ostream& _ostream); /** @brief Destructor */ ~StdOStreamLogStream(); diff --git a/code/TinyFormatter.h b/code/TinyFormatter.h index 84ecfb62d..0559102f8 100644 --- a/code/TinyFormatter.h +++ b/code/TinyFormatter.h @@ -97,7 +97,7 @@ public: // being bound to const ref& function parameters. Copying streams is not permitted, though. // This workaround avoids this by manually specifying a copy ctor. #if !defined(__GNUC__) || !defined(__APPLE__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) - basic_formatter(const basic_formatter& other) { + explicit basic_formatter(const basic_formatter& other) { underlying << (string)other; } #endif diff --git a/code/UnrealLoader.h b/code/UnrealLoader.h index e9b6c404a..4d087bd78 100644 --- a/code/UnrealLoader.h +++ b/code/UnrealLoader.h @@ -87,7 +87,7 @@ struct TempMat { , numFaces (0) {} - TempMat(const Triangle& in) + explicit TempMat(const Triangle& in) : type ((Unreal::MeshFlags)in.mType) , tex (in.mTextureNum) , numFaces (0) diff --git a/code/XFileHelper.h b/code/XFileHelper.h index cb5d9abb0..1760162ce 100644 --- a/code/XFileHelper.h +++ b/code/XFileHelper.h @@ -129,7 +129,7 @@ struct Mesh std::vector mBones; - Mesh(const std::string &pName = "") { mName = pName; mNumTextures = 0; mNumColorSets = 0; } + explicit Mesh(const std::string &pName = "") { mName = pName; mNumTextures = 0; mNumColorSets = 0; } }; /** Helper structure to represent a XFile frame */ @@ -142,7 +142,7 @@ struct Node std::vector mMeshes; Node() { mParent = NULL; } - Node( Node* pParent) { mParent = pParent; } + explicit Node( Node* pParent) { mParent = pParent; } ~Node() { for( unsigned int a = 0; a < mChildren.size(); a++) diff --git a/code/XFileParser.h b/code/XFileParser.h index e4308a6e2..73426d6a5 100644 --- a/code/XFileParser.h +++ b/code/XFileParser.h @@ -68,7 +68,7 @@ public: /** Constructor. Creates a data structure out of the XFile given in the memory block. * @param pBuffer Null-terminated memory buffer containing the XFile */ - XFileParser( const std::vector& pBuffer); + explicit XFileParser( const std::vector& pBuffer); /** Destructor. Destroys all imported data along with it */ ~XFileParser(); diff --git a/code/irrXMLWrapper.h b/code/irrXMLWrapper.h index 526a04d1b..7eda2f5ae 100644 --- a/code/irrXMLWrapper.h +++ b/code/irrXMLWrapper.h @@ -76,7 +76,7 @@ public: // ---------------------------------------------------------------------------------- //! Construction from an existing IOStream - CIrrXML_IOStreamReader(IOStream* _stream) + explicit CIrrXML_IOStreamReader(IOStream* _stream) : stream (_stream) , t (0) { diff --git a/include/assimp/DefaultLogger.hpp b/include/assimp/DefaultLogger.hpp index 488f39d27..f4282827e 100644 --- a/include/assimp/DefaultLogger.hpp +++ b/include/assimp/DefaultLogger.hpp @@ -135,7 +135,7 @@ private: // ---------------------------------------------------------------------- /** @briefPrivate construction for internal use by create(). * @param severity Logging granularity */ - DefaultLogger(LogSeverity severity); + explicit DefaultLogger(LogSeverity severity); // ---------------------------------------------------------------------- /** @briefDestructor */ diff --git a/include/assimp/Logger.hpp b/include/assimp/Logger.hpp index 7e1c52908..5fc8e7d42 100644 --- a/include/assimp/Logger.hpp +++ b/include/assimp/Logger.hpp @@ -160,7 +160,7 @@ protected: Logger(); /** Construction with a given log severity */ - Logger(LogSeverity severity); + explicit Logger(LogSeverity severity); // ---------------------------------------------------------------------- /** @brief Called as a request to write a specific debug message diff --git a/include/assimp/color4.h b/include/assimp/color4.h index 1e2070b98..f97d9b9d6 100644 --- a/include/assimp/color4.h +++ b/include/assimp/color4.h @@ -59,7 +59,7 @@ public: aiColor4t () : r(), g(), b(), a() {} aiColor4t (TReal _r, TReal _g, TReal _b, TReal _a) : r(_r), g(_g), b(_b), a(_a) {} - aiColor4t (TReal _r) : r(_r), g(_r), b(_r), a(_r) {} + explicit aiColor4t (TReal _r) : r(_r), g(_r), b(_r), a(_r) {} aiColor4t (const aiColor4t& o) : r(o.r), g(o.g), b(o.b), a(o.a) {} diff --git a/include/assimp/quaternion.h b/include/assimp/quaternion.h index 34af2c483..d700703d3 100644 --- a/include/assimp/quaternion.h +++ b/include/assimp/quaternion.h @@ -60,7 +60,7 @@ public: : w(pw), x(px), y(py), z(pz) {} /** Construct from rotation matrix. Result is undefined if the matrix is not orthonormal. */ - aiQuaterniont( const aiMatrix3x3t& pRotMatrix); + explicit aiQuaterniont( const aiMatrix3x3t& pRotMatrix); /** Construct from euler angles */ aiQuaterniont( TReal rotx, TReal roty, TReal rotz); @@ -69,7 +69,7 @@ public: aiQuaterniont( aiVector3t axis, TReal angle); /** Construct from a normalized quaternion stored in a vec3 */ - aiQuaterniont( aiVector3t normalized); + explicit aiQuaterniont( aiVector3t normalized); /** Returns a matrix representation of the quaternion */ aiMatrix3x3t GetMatrix() const; diff --git a/include/assimp/scene.h b/include/assimp/scene.h index 2c51eaf79..87cb7a61c 100644 --- a/include/assimp/scene.h +++ b/include/assimp/scene.h @@ -135,7 +135,7 @@ struct aiNode /** Construction from a specific name */ - aiNode(const std::string& name) + explicit aiNode(const std::string& name) // set all members to zero by default : mName(name) , mParent(NULL) diff --git a/include/assimp/types.h b/include/assimp/types.h index 82be2d62f..35129b7a3 100644 --- a/include/assimp/types.h +++ b/include/assimp/types.h @@ -160,7 +160,7 @@ struct aiColor3D #ifdef __cplusplus aiColor3D () : r(0.0f), g(0.0f), b(0.0f) {} aiColor3D (float _r, float _g, float _b) : r(_r), g(_g), b(_b) {} - aiColor3D (float _r) : r(_r), g(_r), b(_r) {} + explicit aiColor3D (float _r) : r(_r), g(_r), b(_r) {} aiColor3D (const aiColor3D& o) : r(o.r), g(o.g), b(o.b) {} /** Component-wise comparison */