Merge branch 'master' into issue_2668
commit
b8e53c967f
|
@ -16,6 +16,7 @@ matrix:
|
||||||
image:
|
image:
|
||||||
- Visual Studio 2015
|
- Visual Studio 2015
|
||||||
- Visual Studio 2017
|
- Visual Studio 2017
|
||||||
|
- MinGW
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
- Win32
|
- Win32
|
||||||
|
@ -26,10 +27,13 @@ configuration: Release
|
||||||
install:
|
install:
|
||||||
- set PATH=C:\Ruby24-x64\bin;%PATH%
|
- set PATH=C:\Ruby24-x64\bin;%PATH%
|
||||||
- set CMAKE_DEFINES -DASSIMP_WERROR=ON
|
- set CMAKE_DEFINES -DASSIMP_WERROR=ON
|
||||||
|
- if [%COMPILER%]==[MinGW] set PATH=C:\MinGW\bin;%PATH%
|
||||||
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015
|
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015
|
||||||
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" set CMAKE_GENERATOR_NAME=Visual Studio 15 2017
|
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" set CMAKE_GENERATOR_NAME=Visual Studio 15 2017
|
||||||
- if "%platform%"=="x64" set CMAKE_GENERATOR_NAME=%CMAKE_GENERATOR_NAME% Win64
|
- if "%platform%"=="x64" set CMAKE_GENERATOR_NAME=%CMAKE_GENERATOR_NAME% Win64
|
||||||
- cmake %CMAKE_DEFINES% -G "%CMAKE_GENERATOR_NAME%" .
|
- cmake %CMAKE_DEFINES% -G "%CMAKE_GENERATOR_NAME%" .
|
||||||
|
# Rename sh.exe as sh.exe in PATH interferes with MinGW
|
||||||
|
- rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe"
|
||||||
- set PATH=%PATH%;"C:\\Program Files (x86)\\Inno Setup 5"
|
- set PATH=%PATH%;"C:\\Program Files (x86)\\Inno Setup 5"
|
||||||
- ps: Invoke-WebRequest -Uri https://download.microsoft.com/download/5/7/b/57b2947c-7221-4f33-b35e-2fc78cb10df4/vc_redist.x64.exe -OutFile .\packaging\windows-innosetup\vc_redist.x64.exe
|
- ps: Invoke-WebRequest -Uri https://download.microsoft.com/download/5/7/b/57b2947c-7221-4f33-b35e-2fc78cb10df4/vc_redist.x64.exe -OutFile .\packaging\windows-innosetup\vc_redist.x64.exe
|
||||||
- ps: Invoke-WebRequest -Uri https://download.microsoft.com/download/1/d/8/1d8137db-b5bb-4925-8c5d-927424a2e4de/vc_redist.x86.exe -OutFile .\packaging\windows-innosetup\vc_redist.x86.exe
|
- ps: Invoke-WebRequest -Uri https://download.microsoft.com/download/1/d/8/1d8137db-b5bb-4925-8c5d-927424a2e4de/vc_redist.x86.exe -OutFile .\packaging\windows-innosetup\vc_redist.x86.exe
|
||||||
|
|
|
@ -344,7 +344,7 @@ void MD2Importer::InternReadFile( const std::string& pFile,
|
||||||
if (pcSkins->name[0])
|
if (pcSkins->name[0])
|
||||||
{
|
{
|
||||||
aiString szString;
|
aiString szString;
|
||||||
const size_t iLen = ::strlen(pcSkins->name);
|
const ai_uint32 iLen = (ai_uint32) ::strlen(pcSkins->name);
|
||||||
::memcpy(szString.data,pcSkins->name,iLen);
|
::memcpy(szString.data,pcSkins->name,iLen);
|
||||||
szString.data[iLen] = '\0';
|
szString.data[iLen] = '\0';
|
||||||
szString.length = iLen;
|
szString.length = iLen;
|
||||||
|
|
|
@ -235,7 +235,7 @@ bool MD5Parser::ParseSection(Section& out)
|
||||||
const char* szStart = ++sz; \
|
const char* szStart = ++sz; \
|
||||||
while('\"'!=*sz)++sz; \
|
while('\"'!=*sz)++sz; \
|
||||||
const char* szEnd = (sz++); \
|
const char* szEnd = (sz++); \
|
||||||
out.length = (size_t)(szEnd - szStart); \
|
out.length = (ai_uint32) (szEnd - szStart); \
|
||||||
::memcpy(out.data,szStart,out.length); \
|
::memcpy(out.data,szStart,out.length); \
|
||||||
out.data[out.length] = '\0';
|
out.data[out.length] = '\0';
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -545,23 +545,7 @@ aiReturn aiMaterial::AddProperty (const aiString* pInput,
|
||||||
unsigned int type,
|
unsigned int type,
|
||||||
unsigned int index)
|
unsigned int index)
|
||||||
{
|
{
|
||||||
// We don't want to add the whole buffer .. write a 32 bit length
|
ai_assert(sizeof(ai_uint32)==4);
|
||||||
// prefix followed by the zero-terminated UTF8 string.
|
|
||||||
// (HACK) I don't want to break the ABI now, but we definitely
|
|
||||||
// ought to change aiString::mLength to uint32_t one day.
|
|
||||||
if (sizeof(size_t) == 8) {
|
|
||||||
aiString copy = *pInput;
|
|
||||||
uint32_t* s = reinterpret_cast<uint32_t*>(©.length);
|
|
||||||
s[1] = static_cast<uint32_t>(pInput->length);
|
|
||||||
|
|
||||||
return AddBinaryProperty(s+1,
|
|
||||||
static_cast<unsigned int>(pInput->length+1+4),
|
|
||||||
pKey,
|
|
||||||
type,
|
|
||||||
index,
|
|
||||||
aiPTI_String);
|
|
||||||
}
|
|
||||||
ai_assert(sizeof(size_t)==4);
|
|
||||||
return AddBinaryProperty(pInput,
|
return AddBinaryProperty(pInput,
|
||||||
static_cast<unsigned int>(pInput->length+1+4),
|
static_cast<unsigned int>(pInput->length+1+4),
|
||||||
pKey,
|
pKey,
|
||||||
|
|
|
@ -354,12 +354,12 @@ void ComputeUVMappingProcess::ComputePlaneMapping(aiMesh* mesh,const aiVector3D&
|
||||||
}
|
}
|
||||||
else if (axis * base_axis_z >= angle_epsilon) {
|
else if (axis * base_axis_z >= angle_epsilon) {
|
||||||
FindMeshCenter(mesh, center, min, max);
|
FindMeshCenter(mesh, center, min, max);
|
||||||
diffu = max.y - min.y;
|
diffu = max.x - min.x;
|
||||||
diffv = max.z - min.z;
|
diffv = max.y - min.y;
|
||||||
|
|
||||||
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
|
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
|
||||||
const aiVector3D& pos = mesh->mVertices[pnt];
|
const aiVector3D& pos = mesh->mVertices[pnt];
|
||||||
out[pnt].Set((pos.y - min.y) / diffu,(pos.x - min.x) / diffv,0.0);
|
out[pnt].Set((pos.x - min.x) / diffu,(pos.y - min.y) / diffv,0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// slower code path in case the mapping axis is not one of the coordinate system axes
|
// slower code path in case the mapping axis is not one of the coordinate system axes
|
||||||
|
|
|
@ -958,7 +958,7 @@ void ValidateDSProcess::Validate( const aiString* pString)
|
||||||
{
|
{
|
||||||
if (pString->length > MAXLEN)
|
if (pString->length > MAXLEN)
|
||||||
{
|
{
|
||||||
ReportError("aiString::length is too large (%lu, maximum is %lu)",
|
ReportError("aiString::length is too large (%u, maximum is %lu)",
|
||||||
pString->length,MAXLEN);
|
pString->length,MAXLEN);
|
||||||
}
|
}
|
||||||
const char* sz = pString->data;
|
const char* sz = pString->data;
|
||||||
|
|
|
@ -266,7 +266,7 @@ void glTFImporter::ImportMeshes(glTF::Asset& r)
|
||||||
|
|
||||||
aim->mName = mesh.id;
|
aim->mName = mesh.id;
|
||||||
if (mesh.primitives.size() > 1) {
|
if (mesh.primitives.size() > 1) {
|
||||||
size_t& len = aim->mName.length;
|
ai_uint32& len = aim->mName.length;
|
||||||
aim->mName.data[len] = '-';
|
aim->mName.data[len] = '-';
|
||||||
len += 1 + ASSIMP_itoa10(aim->mName.data + len + 1, unsigned(MAXLEN - len - 1), p);
|
len += 1 + ASSIMP_itoa10(aim->mName.data + len + 1, unsigned(MAXLEN - len - 1), p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,7 +385,7 @@ void glTF2Importer::ImportMeshes(glTF2::Asset& r)
|
||||||
aim->mName = mesh.name.empty() ? mesh.id : mesh.name;
|
aim->mName = mesh.name.empty() ? mesh.id : mesh.name;
|
||||||
|
|
||||||
if (mesh.primitives.size() > 1) {
|
if (mesh.primitives.size() > 1) {
|
||||||
size_t& len = aim->mName.length;
|
ai_uint32& len = aim->mName.length;
|
||||||
aim->mName.data[len] = '-';
|
aim->mName.data[len] = '-';
|
||||||
len += 1 + ASSIMP_itoa10(aim->mName.data + len + 1, unsigned(MAXLEN - len - 1), p);
|
len += 1 + ASSIMP_itoa10(aim->mName.data + len + 1, unsigned(MAXLEN - len - 1), p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
// Our compile configuration
|
// Our compile configuration
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
@ -65,11 +66,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "matrix4x4.h"
|
#include "matrix4x4.h"
|
||||||
#include "quaternion.h"
|
#include "quaternion.h"
|
||||||
|
|
||||||
|
typedef int32_t ai_int32;
|
||||||
|
typedef uint32_t ai_uint32 ;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <new> // for std::nothrow_t
|
#include <new> // for std::nothrow_t
|
||||||
#include <string> // for aiString::Set(const std::string&)
|
#include <string> // for aiString::Set(const std::string&)
|
||||||
|
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
//! @cond never
|
//! @cond never
|
||||||
namespace Intern {
|
namespace Intern {
|
||||||
|
@ -269,8 +274,8 @@ struct aiString
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Copy constructor */
|
/** Copy constructor */
|
||||||
aiString(const aiString& rOther) :
|
aiString(const aiString& rOther)
|
||||||
length(rOther.length)
|
: length(rOther.length)
|
||||||
{
|
{
|
||||||
// Crop the string to the maximum length
|
// Crop the string to the maximum length
|
||||||
length = length>=MAXLEN?MAXLEN-1:length;
|
length = length>=MAXLEN?MAXLEN-1:length;
|
||||||
|
@ -280,7 +285,7 @@ struct aiString
|
||||||
|
|
||||||
/** Constructor from std::string */
|
/** Constructor from std::string */
|
||||||
explicit aiString(const std::string& pString) :
|
explicit aiString(const std::string& pString) :
|
||||||
length(pString.length())
|
length( (ai_uint32) pString.length())
|
||||||
{
|
{
|
||||||
length = length>=MAXLEN?MAXLEN-1:length;
|
length = length>=MAXLEN?MAXLEN-1:length;
|
||||||
memcpy( data, pString.c_str(), length);
|
memcpy( data, pString.c_str(), length);
|
||||||
|
@ -292,15 +297,15 @@ struct aiString
|
||||||
if( pString.length() > MAXLEN - 1) {
|
if( pString.length() > MAXLEN - 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
length = pString.length();
|
length = (ai_uint32)pString.length();
|
||||||
memcpy( data, pString.c_str(), length);
|
memcpy( data, pString.c_str(), length);
|
||||||
data[length] = 0;
|
data[length] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Copy a const char* to the aiString */
|
/** Copy a const char* to the aiString */
|
||||||
void Set( const char* sz) {
|
void Set( const char* sz) {
|
||||||
const size_t len = ::strlen(sz);
|
const ai_int32 len = (ai_uint32) ::strlen(sz);
|
||||||
if( len > MAXLEN - 1) {
|
if( len > (ai_int32)MAXLEN - 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
length = len;
|
length = len;
|
||||||
|
@ -346,7 +351,7 @@ struct aiString
|
||||||
|
|
||||||
/** Append a string to the string */
|
/** Append a string to the string */
|
||||||
void Append (const char* app) {
|
void Append (const char* app) {
|
||||||
const size_t len = ::strlen(app);
|
const ai_uint32 len = (ai_uint32) ::strlen(app);
|
||||||
if (!len) {
|
if (!len) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -379,7 +384,7 @@ struct aiString
|
||||||
/** Binary length of the string excluding the terminal 0. This is NOT the
|
/** Binary length of the string excluding the terminal 0. This is NOT the
|
||||||
* logical length of strings containing UTF-8 multi-byte sequences! It's
|
* logical length of strings containing UTF-8 multi-byte sequences! It's
|
||||||
* the number of bytes from the beginning of the string to its end.*/
|
* the number of bytes from the beginning of the string to its end.*/
|
||||||
size_t length;
|
ai_uint32 length;
|
||||||
|
|
||||||
/** String buffer. Size limit is MAXLEN */
|
/** String buffer. Size limit is MAXLEN */
|
||||||
char data[MAXLEN];
|
char data[MAXLEN];
|
||||||
|
|
Loading…
Reference in New Issue