From 41724ace2d0fdba04330b95d4018b499a09ea73c Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Mon, 18 Sep 2017 14:10:58 +0300 Subject: [PATCH 1/5] Collada: Silence uninitialized variable warning This is a false positive. Value of 'method' is only used if 'targetMeshes' contains something and all paths through the first loop which add stuff to 'targetMeshes' also set 'method'. --- code/ColladaLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index 0e970b468..ccf79ed62 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -674,7 +674,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada:: // create morph target meshes if any std::vector targetMeshes; std::vector targetWeights; - Collada::MorphMethod method; + Collada::MorphMethod method = Collada::Normalized; for(std::map::const_iterator it = pParser.mControllerLibrary.begin(); it != pParser.mControllerLibrary.end(); it++) From 4652be8f18842cf3dc2cbcac1b3e8bd21115a2e4 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Mon, 18 Sep 2017 14:59:55 +0300 Subject: [PATCH 2/5] FIReader: Silence uninitialized variable warning This is a false positive. First time through the loop 'imod3' is always 0 so c1 is not used. It's also set so further iterations have a valid 'c1'. If 'value' is empty the switch doesn't look at 'c1' either since 'imod3' is still 0. --- code/FIReader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/FIReader.cpp b/code/FIReader.cpp index 981d0b913..95b22a1b8 100755 --- a/code/FIReader.cpp +++ b/code/FIReader.cpp @@ -168,7 +168,7 @@ struct FIBase64ValueImpl: public FIBase64Value { if (!strValueValid) { strValueValid = true; std::ostringstream os; - uint8_t c1, c2; + uint8_t c1 = 0, c2; int imod3 = 0; std::vector::size_type valueSize = value.size(); for (std::vector::size_type i = 0; i < valueSize; ++i) { From b74fc9495aeb35346a0b941de3f984d17eebd3dc Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Mon, 18 Sep 2017 15:13:19 +0300 Subject: [PATCH 3/5] PlyLoader: Fix operator precedence issue in header check The previous version might read past end of buffer --- code/PlyLoader.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/PlyLoader.cpp b/code/PlyLoader.cpp index d348fe113..c6e862bf1 100644 --- a/code/PlyLoader.cpp +++ b/code/PlyLoader.cpp @@ -170,9 +170,10 @@ void PLYImporter::InternReadFile(const std::string& pFile, std::vector headerCheck; streamedBuffer.getNextLine(headerCheck); - if ((headerCheck.size() >= 3) && (headerCheck[0] != 'P' && headerCheck[0] != 'p') || - (headerCheck[1] != 'L' && headerCheck[1] != 'l') || - (headerCheck[2] != 'Y' && headerCheck[2] != 'y')) + if ((headerCheck.size() < 3) || + (headerCheck[0] != 'P' && headerCheck[0] != 'p') || + (headerCheck[1] != 'L' && headerCheck[1] != 'l') || + (headerCheck[2] != 'Y' && headerCheck[2] != 'y') ) { streamedBuffer.close(); throw DeadlyImportError("Invalid .ply file: Magic number \'ply\' is no there"); From 40c308af4423429452e0ee03fb3d50bc60a5d6c0 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Mon, 18 Sep 2017 15:18:45 +0300 Subject: [PATCH 4/5] glTF: Silence uninitialized variable warning This is a false positive. 'jointNamesIndex' is either set by the loop or the following conditional is false which also sets it. The undefined value is never seen by the following code. --- code/glTF2Exporter.cpp | 2 +- code/glTFExporter.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/glTF2Exporter.cpp b/code/glTF2Exporter.cpp index a3940e9ea..bcd1e2858 100644 --- a/code/glTF2Exporter.cpp +++ b/code/glTF2Exporter.cpp @@ -541,7 +541,7 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref& meshRef, Ref nodeRef = mAsset.nodes.Get(aib->mName.C_Str()); nodeRef->jointName = nodeRef->name; - unsigned int jointNamesIndex; + unsigned int jointNamesIndex = 0; bool addJointToJointNames = true; for ( unsigned int idx_joint = 0; idx_joint < skinRef->jointNames.size(); ++idx_joint) { if (skinRef->jointNames[idx_joint]->jointName.compare(nodeRef->jointName) == 0) { diff --git a/code/glTFExporter.cpp b/code/glTFExporter.cpp index 7215a98c3..a5df09ac7 100644 --- a/code/glTFExporter.cpp +++ b/code/glTFExporter.cpp @@ -444,7 +444,7 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref& meshRef, Ref nodeRef = mAsset.nodes.Get(aib->mName.C_Str()); nodeRef->jointName = nodeRef->id; - unsigned int jointNamesIndex; + unsigned int jointNamesIndex = 0; bool addJointToJointNames = true; for ( unsigned int idx_joint = 0; idx_joint < skinRef->jointNames.size(); ++idx_joint) { if (skinRef->jointNames[idx_joint]->jointName.compare(nodeRef->jointName) == 0) { From 982430c3ce408201ca6201b204b35e382ec0e101 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Mon, 18 Sep 2017 15:21:51 +0300 Subject: [PATCH 5/5] BlenderDNA: Silence warning about inline function which is declared but not defined It's a templated method which is meant to be specialized. The base version is never called. Just remove 'inline' to make GCC shut up. --- code/BlenderDNA.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlenderDNA.h b/code/BlenderDNA.h index de0a5a62f..4c7d0fc26 100644 --- a/code/BlenderDNA.h +++ b/code/BlenderDNA.h @@ -253,7 +253,7 @@ public: * a compiler complain is the result. * @param dest Destination value to be written * @param db File database, including input stream. */ - template inline void Convert (T& dest, const FileDatabase& db) const; + template void Convert (T& dest, const FileDatabase& db) const; // -------------------------------------------------------- // generic converter