summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/assimp/code/HMPLoader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/assimp/code/HMPLoader.cpp')
-rw-r--r--src/3rdparty/assimp/code/HMPLoader.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/3rdparty/assimp/code/HMPLoader.cpp b/src/3rdparty/assimp/code/HMPLoader.cpp
index 560852691..2a669201e 100644
--- a/src/3rdparty/assimp/code/HMPLoader.cpp
+++ b/src/3rdparty/assimp/code/HMPLoader.cpp
@@ -3,7 +3,8 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2016, assimp team
+Copyright (c) 2006-2017, assimp team
+
All rights reserved.
@@ -51,6 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
#include <assimp/scene.h>
+#include <assimp/importerdesc.h>
using namespace Assimp;
@@ -127,8 +129,7 @@ void HMPImporter::InternReadFile( const std::string& pFile,
throw DeadlyImportError( "HMP File is too small.");
// Allocate storage and copy the contents of the file to a memory buffer
- std::vector<uint8_t> buffer(fileSize);
- mBuffer = &buffer[0];
+ mBuffer = new uint8_t[fileSize];
file->Read( (void*)mBuffer, 1, fileSize);
iFileSize = (unsigned int)fileSize;
@@ -174,7 +175,9 @@ void HMPImporter::InternReadFile( const std::string& pFile,
// Set the AI_SCENE_FLAGS_TERRAIN bit
pScene->mFlags |= AI_SCENE_FLAGS_TERRAIN;
- // File buffer destructs automatically now
+ delete[] mBuffer;
+ mBuffer= nullptr;
+
}
// ------------------------------------------------------------------------------------------------
@@ -445,15 +448,18 @@ void HMPImporter::CreateOutputFaceList(unsigned int width,unsigned int height)
void HMPImporter::ReadFirstSkin(unsigned int iNumSkins, const unsigned char* szCursor,
const unsigned char** szCursorOut)
{
- ai_assert(0 != iNumSkins && NULL != szCursor);
+ ai_assert( 0 != iNumSkins );
+ ai_assert( nullptr != szCursor);
// read the type of the skin ...
// sometimes we need to skip 12 bytes here, I don't know why ...
- uint32_t iType = *((uint32_t*)szCursor);szCursor += sizeof(uint32_t);
+ uint32_t iType = *((uint32_t*)szCursor);
+ szCursor += sizeof(uint32_t);
if (0 == iType)
{
szCursor += sizeof(uint32_t) * 2;
- iType = *((uint32_t*)szCursor);szCursor += sizeof(uint32_t);
+ iType = *((uint32_t*)szCursor);
+ szCursor += sizeof(uint32_t);
if (!iType)
throw DeadlyImportError("Unable to read HMP7 skin chunk");