From 5cda81e84b2a5922673a2d8bf69c80f14a961b42 Mon Sep 17 00:00:00 2001 From: Rahul Sheth Date: Fri, 24 May 2019 17:03:42 -0400 Subject: [PATCH] code fixes for Hunter-based build --- code/3MF/D3MFOpcPackage.cpp | 10 ++++++++++ code/OpenGEX/OpenGEXImporter.cpp | 12 ++++++++++++ code/Q3BSP/Q3BSPZipArchive.cpp | 10 ++++++++++ 3 files changed, 32 insertions(+) diff --git a/code/3MF/D3MFOpcPackage.cpp b/code/3MF/D3MFOpcPackage.cpp index 221cf9370..3a6e4dbc9 100644 --- a/code/3MF/D3MFOpcPackage.cpp +++ b/code/3MF/D3MFOpcPackage.cpp @@ -152,6 +152,15 @@ int IOSystem2Unzip::testerror(voidpf /*opaque*/, voidpf /*stream*/) { zlib_filefunc_def IOSystem2Unzip::get(IOSystem* pIOHandler) { zlib_filefunc_def mapping; +#ifdef ASSIMP_USE_HUNTER + mapping.zopen_file = (open_file_func)open; + mapping.zread_file = (read_file_func)read; + mapping.zwrite_file = (write_file_func)write; + mapping.ztell_file = (tell_file_func)tell; + mapping.zseek_file = (seek_file_func)seek; + mapping.zclose_file = (close_file_func)close; + mapping.zerror_file = (error_file_func)testerror; +#else mapping.zopen_file = open; mapping.zread_file = read; mapping.zwrite_file = write; @@ -159,6 +168,7 @@ zlib_filefunc_def IOSystem2Unzip::get(IOSystem* pIOHandler) { mapping.zseek_file = seek; mapping.zclose_file = close; mapping.zerror_file = testerror; +#endif mapping.opaque = reinterpret_cast(pIOHandler); return mapping; diff --git a/code/OpenGEX/OpenGEXImporter.cpp b/code/OpenGEX/OpenGEXImporter.cpp index 2de9bd85e..07d3efd5e 100644 --- a/code/OpenGEX/OpenGEXImporter.cpp +++ b/code/OpenGEX/OpenGEXImporter.cpp @@ -213,7 +213,11 @@ static void propId2StdString( Property *prop, std::string &name, std::string &ke } if ( nullptr != prop->m_key ) { +#ifdef ASSIMP_USE_HUNTER + name = prop->m_key->m_text.m_buffer; +#else name = prop->m_key->m_buffer; +#endif if ( Value::ddl_string == prop->m_value->m_type ) { key = prop->m_value->getString(); } @@ -498,7 +502,11 @@ static void getRefNames( DDLNode *node, std::vector &names ) { for( size_t i = 0; i < ref->m_numRefs; i++ ) { Name *currentName( ref->m_referencedName[ i ] ); if( nullptr != currentName && nullptr != currentName->m_id ) { +#ifdef ASSIMP_USE_HUNTER + const std::string name( currentName->m_id->m_text.m_buffer ); +#else const std::string name( currentName->m_id->m_buffer ); +#endif if( !name.empty() ) { names.push_back( name ); } @@ -1039,7 +1047,11 @@ void OpenGEXImporter::handleColorNode( ODDLParser::DDLNode *node, aiScene * /*pS col.g = col4.g; col.b = col4.b; } +#ifdef ASSIMP_USE_HUNTER + const ColorType colType( getColorType( &prop->m_key->m_text ) ); +#else const ColorType colType( getColorType( prop->m_key ) ); +#endif if( DiffuseColor == colType ) { m_currentMaterial->AddProperty( &col, 1, AI_MATKEY_COLOR_DIFFUSE ); } else if( SpecularColor == colType ) { diff --git a/code/Q3BSP/Q3BSPZipArchive.cpp b/code/Q3BSP/Q3BSPZipArchive.cpp index 0b6664842..931f2b905 100644 --- a/code/Q3BSP/Q3BSPZipArchive.cpp +++ b/code/Q3BSP/Q3BSPZipArchive.cpp @@ -123,6 +123,15 @@ int IOSystem2Unzip::testerror(voidpf /*opaque*/, voidpf /*stream*/) { zlib_filefunc_def IOSystem2Unzip::get(IOSystem* pIOHandler) { zlib_filefunc_def mapping; +#ifdef ASSIMP_USE_HUNTER + mapping.zopen_file = (open_file_func)open; + mapping.zread_file = (read_file_func)read; + mapping.zwrite_file = (write_file_func)write; + mapping.ztell_file = (tell_file_func)tell; + mapping.zseek_file = (seek_file_func)seek; + mapping.zclose_file = (close_file_func)close; + mapping.zerror_file = (error_file_func)testerror; +#else mapping.zopen_file = open; mapping.zread_file = read; mapping.zwrite_file = write; @@ -130,6 +139,7 @@ zlib_filefunc_def IOSystem2Unzip::get(IOSystem* pIOHandler) { mapping.zseek_file = seek; mapping.zclose_file = close; mapping.zerror_file = testerror; +#endif mapping.opaque = (voidpf) pIOHandler; return mapping;