// ------------------------------------------------------------------------------------------------
using namespace Assimp;
-namespace Assimp
-{
+namespace Assimp {
// underlying structure for aiPropertyStore
typedef BatchLoader::PropertyMap PropertyMap;
// ------------------------------------------------------------------------------------------------
// Custom LogStream implementation for the C-API
-class LogToCallbackRedirector : public LogStream
-{
+class LogToCallbackRedirector : public LogStream {
public:
explicit LogToCallbackRedirector(const aiLogStream& s)
- : stream (s) {
- ai_assert(NULL != s.callback);
+ : stream (s) {
+ ai_assert(NULL != s.callback);
}
~LogToCallbackRedirector() {
};
// ------------------------------------------------------------------------------------------------
-void ReportSceneNotFoundError()
-{
+void ReportSceneNotFoundError() {
DefaultLogger::get()->error("Unable to find the Assimp::Importer for this aiScene. "
"The C-API does not accept scenes produced by the C++ API and vice versa");
// ------------------------------------------------------------------------------------------------
// Reads the given file and returns its content.
-const aiScene* aiImportFile( const char* pFile, unsigned int pFlags)
-{
+const aiScene* aiImportFile( const char* pFile, unsigned int pFlags) {
return aiImportFileEx(pFile,pFlags,NULL);
}
// ------------------------------------------------------------------------------------------------
-const aiScene* aiImportFileEx( const char* pFile, unsigned int pFlags, aiFileIO* pFS)
-{
+const aiScene* aiImportFileEx( const char* pFile, unsigned int pFlags, aiFileIO* pFS) {
return aiImportFileExWithProperties(pFile, pFlags, pFS, NULL);
}
// ------------------------------------------------------------------------------------------------
-const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFlags,
- aiFileIO* pFS,
- const aiPropertyStore* props)
-{
+const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFlags,
+ aiFileIO* pFS, const aiPropertyStore* props) {
ai_assert(NULL != pFile);
const aiScene* scene = NULL;
pimpl->mMatrixProperties = pp->matrices;
}
// setup a custom IO system if necessary
- if (pFS) {
+ if (pFS) {
imp->SetIOHandler( new CIOSystemWrapper (pFS) );
}
if( scene) {
ScenePrivateData* priv = const_cast<ScenePrivateData*>( ScenePriv(scene) );
priv->mOrigImporter = imp;
- }
- else {
+ } else {
// if failed, extract error code and destroy the import
gLastErrorString = imp->GetErrorString();
delete imp;
// return imported data. If the import failed the pointer is NULL anyways
ASSIMP_END_EXCEPTION_REGION(const aiScene*);
+
return scene;
}
static bool isDataDefinitionEnd( const char *tmp ) {
if ( *tmp == '\\' ) {
tmp++;
- if ( IsLineEnd( tmp ) ) {
- return false;
+ if ( IsLineEnd( *tmp ) ) {
+ tmp++;
+ return true;
}
- } else {
- return IsLineEnd( tmp );
}
return false;
}
size_t ObjFileParser::getNumComponentsInDataDefinition() {
size_t numComponents( 0 );
const char* tmp( &m_DataIt[0] );
- while ( !isDataDefinitionEnd( tmp ) ) {
- //while( !IsLineEnd( *tmp ) ) {
+ bool end_of_definition = false;
+ while ( !end_of_definition ) {
+ //while( !IsLineEnd( *tmp ) ) {
+ if ( isDataDefinitionEnd( tmp ) ) {
+ tmp += 2;
+ } else if ( IsLineEnd( *tmp ) ) {
+ end_of_definition = true;
+ }
if ( !SkipSpaces( &tmp ) ) {
break;
}
TEST_F( utObjTools, skipDataLine_TwoLines_Success ) {
TestObjFileParser test_parser;
- std::string data( "vn -2.061493116917992e-15 -0.9009688496589661 \\n-0.4338837265968323" );
+ std::string data( "vn -2.061493116917992e-15 -0.9009688496589661 \\\n-0.4338837265968323" );
std::vector<char> buffer;
buffer.resize( data.size() );
::memcpy( &buffer[ 0 ], &data[ 0 ], data.size() );
TEST_F( utObjTools, countComponents_TwoLines_Success ) {
TestObjFileParser test_parser;
- std::string data( "-2.061493116917992e-15 -0.9009688496589661 \\n-0.4338837265968323" );
+ std::string data( "-2.061493116917992e-15 -0.9009688496589661 \\\n-0.4338837265968323" );
std::vector<char> buffer;
buffer.resize( data.size() );
::memcpy( &buffer[ 0 ], &data[ 0 ], data.size() );