OpenGEX: fix coverity findings.
parent
e1084b5314
commit
6575696459
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "DefaultIOSystem.h"
|
#include "DefaultIOSystem.h"
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include "MakeVerboseFormat.h"
|
#include "MakeVerboseFormat.h"
|
||||||
|
#include "StringComparison.h"
|
||||||
|
|
||||||
#include <openddlparser/OpenDDLParser.h>
|
#include <openddlparser/OpenDDLParser.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
@ -50,6 +51,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
static const std::string OpenGexExt = "ogex";
|
||||||
|
|
||||||
static const aiImporterDesc desc = {
|
static const aiImporterDesc desc = {
|
||||||
"Open Game Engine Exchange",
|
"Open Game Engine Exchange",
|
||||||
"",
|
"",
|
||||||
|
@ -60,7 +63,7 @@ static const aiImporterDesc desc = {
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
"ogex"
|
OpenGexExt.c_str()
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Grammar {
|
namespace Grammar {
|
||||||
|
@ -283,7 +286,7 @@ OpenGEXImporter::~OpenGEXImporter() {
|
||||||
bool OpenGEXImporter::CanRead( const std::string &file, IOSystem *pIOHandler, bool checkSig ) const {
|
bool OpenGEXImporter::CanRead( const std::string &file, IOSystem *pIOHandler, bool checkSig ) const {
|
||||||
bool canRead( false );
|
bool canRead( false );
|
||||||
if( !checkSig ) {
|
if( !checkSig ) {
|
||||||
canRead = SimpleExtensionCheck( file, "ogex" );
|
canRead = SimpleExtensionCheck( file, OpenGexExt.c_str() );
|
||||||
} else {
|
} else {
|
||||||
static const char *token[] = { "Metric", "GeometryNode", "VertexArray (attrib", "IndexArray" };
|
static const char *token[] = { "Metric", "GeometryNode", "VertexArray (attrib", "IndexArray" };
|
||||||
canRead = BaseImporter::SearchFileHeaderForToken( pIOHandler, file, token, 4 );
|
canRead = BaseImporter::SearchFileHeaderForToken( pIOHandler, file, token, 4 );
|
||||||
|
@ -1007,11 +1010,11 @@ void OpenGEXImporter::handleParamNode( ODDLParser::DDLNode *node, aiScene *pScen
|
||||||
}
|
}
|
||||||
const float floatVal( val->getFloat() );
|
const float floatVal( val->getFloat() );
|
||||||
if ( prop->m_value != nullptr ) {
|
if ( prop->m_value != nullptr ) {
|
||||||
if ( "fov" == prop->m_value->getString() ) {
|
if ( 0 == ASSIMP_strincmp( "fov", prop->m_value->getString(), 3 ) ) {
|
||||||
m_currentCamera->mHorizontalFOV = floatVal;
|
m_currentCamera->mHorizontalFOV = floatVal;
|
||||||
} else if ( "near" == prop->m_value->getString() ) {
|
} else if ( 0 == ASSIMP_strincmp( "near", prop->m_value->getString(), 3 ) ) {
|
||||||
m_currentCamera->mClipPlaneNear = floatVal;
|
m_currentCamera->mClipPlaneNear = floatVal;
|
||||||
} else if ( "far" == prop->m_value->getString() ) {
|
} else if ( 0 == ASSIMP_strincmp( "far", prop->m_value->getString(), 3 ) ) {
|
||||||
m_currentCamera->mClipPlaneFar = floatVal;
|
m_currentCamera->mClipPlaneFar = floatVal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1029,7 +1032,8 @@ void OpenGEXImporter::handleAttenNode( ODDLParser::DDLNode *node, aiScene *pScen
|
||||||
if ( nullptr != prop->m_value ) {
|
if ( nullptr != prop->m_value ) {
|
||||||
Value *val( node->getValue() );
|
Value *val( node->getValue() );
|
||||||
const float floatVal( val->getFloat() );
|
const float floatVal( val->getFloat() );
|
||||||
if ( "scale" == prop->m_value->getString() ) {
|
if ( 0 == strncmp( "scale", prop->m_value->getString(), strlen( "scale" ) ) ) {
|
||||||
|
//if ( "scale" == prop->m_value->getString() ) {
|
||||||
m_currentLight->mAttenuationQuadratic = floatVal;
|
m_currentLight->mAttenuationQuadratic = floatVal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1106,7 +1110,7 @@ void OpenGEXImporter::resolveReferences() {
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
void OpenGEXImporter::createNodeTree( aiScene *pScene ) {
|
void OpenGEXImporter::createNodeTree( aiScene *pScene ) {
|
||||||
if( NULL == m_root ) {
|
if( nullptr == m_root ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1121,13 +1125,13 @@ void OpenGEXImporter::createNodeTree( aiScene *pScene ) {
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
void OpenGEXImporter::pushNode( aiNode *node, aiScene *pScene ) {
|
void OpenGEXImporter::pushNode( aiNode *node, aiScene *pScene ) {
|
||||||
ai_assert( NULL != pScene );
|
ai_assert( nullptr != pScene );
|
||||||
|
|
||||||
if ( NULL == node ) {
|
if ( NULL == node ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChildInfo *info( NULL );
|
ChildInfo *info( nullptr );
|
||||||
if( m_nodeStack.empty() ) {
|
if( m_nodeStack.empty() ) {
|
||||||
node->mParent = pScene->mRootNode;
|
node->mParent = pScene->mRootNode;
|
||||||
NodeChildMap::iterator it( m_nodeChildMap.find( node->mParent ) );
|
NodeChildMap::iterator it( m_nodeChildMap.find( node->mParent ) );
|
||||||
|
@ -1141,7 +1145,7 @@ void OpenGEXImporter::pushNode( aiNode *node, aiScene *pScene ) {
|
||||||
info->m_children.push_back( node );
|
info->m_children.push_back( node );
|
||||||
} else {
|
} else {
|
||||||
aiNode *parent( m_nodeStack.back() );
|
aiNode *parent( m_nodeStack.back() );
|
||||||
ai_assert( NULL != parent );
|
ai_assert( nullptr != parent );
|
||||||
node->mParent = parent;
|
node->mParent = parent;
|
||||||
NodeChildMap::iterator it( m_nodeChildMap.find( node->mParent ) );
|
NodeChildMap::iterator it( m_nodeChildMap.find( node->mParent ) );
|
||||||
if( m_nodeChildMap.end() == it ) {
|
if( m_nodeChildMap.end() == it ) {
|
||||||
|
@ -1158,7 +1162,7 @@ void OpenGEXImporter::pushNode( aiNode *node, aiScene *pScene ) {
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
aiNode *OpenGEXImporter::popNode() {
|
aiNode *OpenGEXImporter::popNode() {
|
||||||
if( m_nodeStack.empty() ) {
|
if( m_nodeStack.empty() ) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
aiNode *node( top() );
|
aiNode *node( top() );
|
||||||
|
@ -1170,7 +1174,7 @@ aiNode *OpenGEXImporter::popNode() {
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
aiNode *OpenGEXImporter::top() const {
|
aiNode *OpenGEXImporter::top() const {
|
||||||
if( m_nodeStack.empty() ) {
|
if( m_nodeStack.empty() ) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_nodeStack.back();
|
return m_nodeStack.back();
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue