Merge pull request #1457 from jaredmulconry/issue_1330

Partially address issue #1330
pull/1461/head
Kim Kulling 2017-09-26 08:24:07 +02:00 committed by GitHub
commit b1410f8455
10 changed files with 74 additions and 22 deletions

View File

@ -439,11 +439,11 @@ void TokenizeBinary(TokenList& output_tokens, const char* input, unsigned int le
}
const char* cursor = input + 18;
const uint8_t unknown_1 = ReadByte(input, cursor, input + length);
const uint8_t unknown_2 = ReadByte(input, cursor, input + length);
const uint8_t unknown_3 = ReadByte(input, cursor, input + length);
const uint8_t unknown_4 = ReadByte(input, cursor, input + length);
const uint8_t unknown_5 = ReadByte(input, cursor, input + length);
/*Result ignored*/ ReadByte(input, cursor, input + length);
/*Result ignored*/ ReadByte(input, cursor, input + length);
/*Result ignored*/ ReadByte(input, cursor, input + length);
/*Result ignored*/ ReadByte(input, cursor, input + length);
/*Result ignored*/ ReadByte(input, cursor, input + length);
const uint32_t version = ReadWord(input, cursor, input + length);
const bool is64bits = version >= 7500;
while (cursor < input + length)

View File

@ -126,16 +126,16 @@ struct Header {
int32_t version;
//! scale factors for each axis
aiVector3D scale;
ai_real scale[3];
//! translation factors for each axis
aiVector3D translate;
ai_real translate[3];
//! bounding radius of the mesh
float boundingradius;
//! Position of the viewer's exe. Ignored
aiVector3D vEyePos;
ai_real vEyePos[3];
//! Number of textures
int32_t num_skins;

View File

@ -118,7 +118,7 @@ void MMDImporter::InternReadFile(const std::string &file, aiScene *pScene,
// Get the file-size and validate it, throwing an exception when fails
fileStream.seekg(0, fileStream.end);
size_t fileSize = fileStream.tellg();
size_t fileSize = static_cast<size_t>(fileStream.tellg());
fileStream.seekg(0, fileStream.beg);
if (fileSize < sizeof(pmx::PmxModel)) {

View File

@ -741,7 +741,7 @@ void glTF2Exporter::MergeMeshes()
for (unsigned int n = 0; n < mAsset->nodes.Size(); ++n) {
Ref<Node> node = mAsset->nodes.Get(n);
unsigned int nMeshes = node->meshes.size();
unsigned int nMeshes = static_cast<unsigned int>(node->meshes.size());
//skip if it's 1 or less meshes per node
if (nMeshes > 1) {

View File

@ -60,6 +60,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
extern "C" {
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattributes"
#endif
// -------------------------------------------------------------------------------
/**
* A node in the imported hierarchy.
@ -163,6 +168,9 @@ struct ASSIMP_API aiNode
#endif // __cplusplus
};
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
// -------------------------------------------------------------------------------
/**

View File

@ -16,6 +16,11 @@ IF ( NOT GLUT_FOUND )
ENDIF ( MSVC )
ENDIF ( NOT GLUT_FOUND )
if ( MSVC )
ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS )
ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
endif ( MSVC )
INCLUDE_DIRECTORIES(
${Assimp_SOURCE_DIR}/include
${Assimp_SOURCE_DIR}/code

View File

@ -11,6 +11,11 @@ IF ( NOT GLUT_FOUND )
ENDIF ( MSVC )
ENDIF ( NOT GLUT_FOUND )
if ( MSVC )
ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS )
ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
endif ( MSVC )
INCLUDE_DIRECTORIES(
${Assimp_SOURCE_DIR}/include
${Assimp_SOURCE_DIR}/code

View File

@ -13,6 +13,7 @@
// http://nehe.gamedev.net/
// ----------------------------------------------------------------------------
#include <windows.h>
#include <shellapi.h>
#include <stdio.h>
#include <GL/gl.h>
#include <GL/glu.h>
@ -666,7 +667,7 @@ BOOL CreateGLWindow(const char* title, int width, int height, int bits, bool ful
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
PFD_DOUBLEBUFFER, // Must Support Double Buffering
PFD_TYPE_RGBA, // Request An RGBA Format
bits, // Select Our Color Depth
BYTE(bits), // Select Our Color Depth
0, 0, 0, 0, 0, 0, // Color Bits Ignored
0, // No Alpha Buffer
0, // Shift Bit Ignored

View File

@ -39,6 +39,26 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------*/
#include <gtest/gtest.h>
#include "TestIOStream.h"
#include <cstdio>
#include <cstdlib>
#include <string>
#if defined(__GNUC__) || defined(__clang__)
#define TMP_PATH "/tmp/"
void MakeTmpFilePath(char* tmplate)
{
auto err = mkstemp(tmplate);
ASSERT_NE(err, -1);
}
#elif defined(_MSC_VER)
#include <io.h>
#define TMP_PATH "./"
void MakeTmpFilePath(char* tmplate)
{
auto pathtemplate = _mktemp(tmplate);
ASSERT_NE(pathtemplate, nullptr);
}
#endif
using namespace ::Assimp;
@ -46,16 +66,30 @@ class utDefaultIOStream : public ::testing::Test {
// empty
};
TEST_F( utDefaultIOStream, FileSizeTest ) {
char buffer[ L_tmpnam ];
tmpnam( buffer );
std::FILE *fs( std::fopen( buffer, "w+" ) );
size_t written( std::fwrite( buffer, 1, sizeof( char ) * L_tmpnam, fs ) );
EXPECT_NE( 0U, written );
std::fflush( fs );
TestDefaultIOStream myStream( fs, buffer );
const char data[]{"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Qui\
sque luctus sem diam, ut eleifend arcu auctor eu. Vestibulum id est vel nulla l\
obortis malesuada ut sed turpis. Nulla a volutpat tortor. Nunc vestibulum portt\
itor sapien ornare sagittis volutpat."};
TEST_F( utDefaultIOStream, FileSizeTest ) {
const auto dataSize = sizeof(data);
const auto dataCount = dataSize / sizeof(*data);
char fpath[] = { TMP_PATH"rndfp.XXXXXX" };
MakeTmpFilePath(fpath);
auto *fs = std::fopen(fpath, "w+" );
ASSERT_NE(fs, nullptr);
auto written = std::fwrite(data, sizeof(*data), dataCount, fs );
EXPECT_NE( 0U, written );
auto vflush = std::fflush( fs );
ASSERT_EQ(vflush, 0);
TestDefaultIOStream myStream( fs, fpath);
size_t size = myStream.FileSize();
EXPECT_EQ( size, sizeof( char ) * L_tmpnam );
remove( buffer );
EXPECT_EQ( size, dataSize);
remove(fpath);
}

View File

@ -23,7 +23,6 @@
#define _WIN32_IE 0x0600 // Ändern Sie dies in den geeigneten Wert für andere Versionen von IE.
#endif
#define WIN32_LEAN_AND_MEAN // Selten verwendete Teile der Windows-Header nicht einbinden.
// Windows-Headerdateien:
#include <windows.h>