From dcf6002bed89939fe0836433169104f603ee814c Mon Sep 17 00:00:00 2001 From: Jonne Nauha Date: Fri, 2 May 2014 01:38:13 +0300 Subject: [PATCH] Try fix travis ci produced build errors on gcc and clang. --- code/OgreImporter.h | 3 --- code/OgreMaterial.cpp | 13 ++++++------- code/OgreParsingUtils.h | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/code/OgreImporter.h b/code/OgreImporter.h index b4c958a65..1a16aa860 100644 --- a/code/OgreImporter.h +++ b/code/OgreImporter.h @@ -5,11 +5,8 @@ #ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER #include "BaseImporter.h" -#include "irrXMLWrapper.h" #include "OgreParsingUtils.h" -#include - namespace Assimp { namespace Ogre diff --git a/code/OgreMaterial.cpp b/code/OgreMaterial.cpp index 506b0fde9..5ce162ed9 100644 --- a/code/OgreMaterial.cpp +++ b/code/OgreMaterial.cpp @@ -46,7 +46,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "OgreImporter.h" -#include "irrXMLWrapper.h" #include "TinyFormatter.h" using namespace std; @@ -195,8 +194,8 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste if (linePart == partTechnique) { - string techniqueName = Trim(SkipLine(ss)); - ReadTechnique(techniqueName, ss, material); + string techniqueName = SkipLine(ss); + ReadTechnique(Trim(techniqueName), ss, material); } // Read informations from a custom material @@ -315,8 +314,8 @@ bool OgreImporter::ReadTechnique(const std::string &techniqueName, stringstream /// @todo Techniques have other attributes than just passes. if (linePart == partPass) { - string passName = Trim(SkipLine(ss)); - ReadPass(passName, ss, material); + string passName = SkipLine(ss); + ReadPass(Trim(passName), ss, material); } } return true; @@ -374,8 +373,8 @@ bool OgreImporter::ReadPass(const std::string &passName, stringstream &ss, aiMat } else if (linePart == partTextureUnit) { - string textureUnitName = Trim(SkipLine(ss)); - ReadTextureUnit(textureUnitName, ss, material); + string textureUnitName = SkipLine(ss); + ReadTextureUnit(Trim(textureUnitName), ss, material); } } return true; diff --git a/code/OgreParsingUtils.h b/code/OgreParsingUtils.h index 40ee35d4c..9e5b83e82 100644 --- a/code/OgreParsingUtils.h +++ b/code/OgreParsingUtils.h @@ -33,7 +33,10 @@ inline int GetAttribute(const XmlReader* reader, const std::string &name) if (value) return atoi(value); else + { ThrowAttibuteError(reader, name); + return 0; + } } template<> @@ -43,7 +46,10 @@ inline unsigned int GetAttribute(const XmlReader* reader, const st if (value) return static_cast(atoi(value)); ///< @todo Find a better way... else + { ThrowAttibuteError(reader, name); + return 0; + } } template<> @@ -53,7 +59,10 @@ inline float GetAttribute(const XmlReader* reader, const std::string &nam if (value) return fast_atof(value); else + { ThrowAttibuteError(reader, name); + return 0.f; + } } template<> @@ -63,7 +72,10 @@ inline std::string GetAttribute(const XmlReader* reader, const std: if (value) return std::string(value); else + { ThrowAttibuteError(reader, name); + return ""; + } } template<> @@ -75,7 +87,10 @@ inline bool GetAttribute(const XmlReader* reader, const std::string &name) else if (ASSIMP_stricmp(value, "false") == 0) return false; else + { ThrowAttibuteError(reader, name, "Boolean value is expected to be 'true' or 'false', encountered '" + value + "'"); + return false; + } } inline bool NextNode(XmlReader* reader)