From 7cbb5f4d3b7772861044876d570d142f9fc510cc Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Sat, 7 Oct 2017 18:36:09 +0300 Subject: [PATCH] B3DImporter: Replace bad pointer casting with memcpy --- code/B3DImporter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/B3DImporter.cpp b/code/B3DImporter.cpp index d156761..bc888fb 100644 --- a/code/B3DImporter.cpp +++ b/code/B3DImporter.cpp @@ -171,7 +171,8 @@ int B3DImporter::ReadByte(){ // ------------------------------------------------------------------------------------------------ int B3DImporter::ReadInt(){ if( _pos+4<=_buf.size() ){ - int n=*(int*)&_buf[_pos]; + int n; + memcpy(&n, &_buf[_pos], 4); _pos+=4; return n; } @@ -182,7 +183,8 @@ int B3DImporter::ReadInt(){ // ------------------------------------------------------------------------------------------------ float B3DImporter::ReadFloat(){ if( _pos+4<=_buf.size() ){ - float n=*(float*)&_buf[_pos]; + float n; + memcpy(&n, &_buf[_pos], 4); _pos+=4; return n; } -- 2.7.4