Merge branch 'assimp:master' into master

pull/4839/head
Kazuki Y 2022-12-17 15:00:20 +09:00 committed by GitHub
commit 9b644494ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 14 deletions

View File

@ -55,6 +55,7 @@ const char NULL_RECORD[NumNullRecords] = { // 25 null bytes in 64-bit and 13 nul
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'
}; // who knows why, it looks like two integers 32/64 bit (compressed and uncompressed sizes?) + 1 byte (might be compression type?)
static std::string NULL_RECORD_STRING(NumNullRecords, '\0');
const std::string SEPARATOR = { '\x00', '\x01' }; // for use inside strings
const std::string MAGIC_NODE_TAG = "_$AssimpFbx$"; // from import
const int64_t SECOND = 46186158000; // FBX's kTime unit

View File

@ -360,7 +360,7 @@ void FBX::Node::EndBinary(
bool has_children
) {
// if there were children, add a null record
if (has_children) { s.PutString(Assimp::FBX::NULL_RECORD); }
if (has_children) { s.PutString(Assimp::FBX::NULL_RECORD_STRING); }
// now go back and write initial pos
this->end_pos = s.Tell();

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2022, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@ -117,6 +115,9 @@ void MD5Parser::ParseHeader() {
ReportError("MD5 version tag is unknown (10 is expected)");
}
SkipLine();
if (buffer == bufferEnd) {
return;
}
// print the command line options to the console
// FIX: can break the log length limit, so we need to be careful
@ -135,8 +136,9 @@ bool MD5Parser::ParseSection(Section &out) {
// first parse the name of the section
char *sz = buffer;
while (!IsSpaceOrNewLine(*buffer))
buffer++;
while (!IsSpaceOrNewLine(*buffer)) {
++buffer;
}
out.mName = std::string(sz, (uintptr_t)(buffer - sz));
SkipSpaces();
@ -144,14 +146,14 @@ bool MD5Parser::ParseSection(Section &out) {
while (running) {
if ('{' == *buffer) {
// it is a normal section so read all lines
buffer++;
++buffer;
bool run = true;
while (run) {
if (!SkipSpacesAndLineEnd()) {
return false; // seems this was the last section
}
if ('}' == *buffer) {
buffer++;
++buffer;
break;
}
@ -163,7 +165,7 @@ bool MD5Parser::ParseSection(Section &out) {
// terminate the line with zero
while (!IsLineEnd(*buffer))
buffer++;
++buffer;
if (*buffer) {
++lineNumber;
*buffer++ = '\0';

View File

@ -292,6 +292,7 @@ void OFFImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
if(!idx || idx > 9) {
ASSIMP_LOG_ERROR("OFF: Faces with zero indices aren't allowed");
--mesh->mNumFaces;
++i;
continue;
}
faces->mNumIndices = idx;

View File

@ -440,7 +440,7 @@ void ObjFileParser::getFace(aiPrimitiveType type) {
const bool vt = (!m_pModel->mTextureCoord.empty());
const bool vn = (!m_pModel->mNormals.empty());
int iPos = 0;
while (m_DataIt != m_DataItEnd) {
while (m_DataIt < m_DataItEnd) {
int iStep = 1;
if (IsLineEnd(*m_DataIt)) {

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2021, assimp team
Copyright (c) 2006-2022, assimp team
All rights reserved.
@ -111,6 +111,10 @@ inline Char_T getNextToken(Char_T pBuffer, Char_T pEnd) {
*/
template <class char_t>
inline char_t skipLine(char_t it, char_t end, unsigned int &uiLine) {
if (it >= end) {
return it;
}
while (!isEndOfBuffer(it, end) && !IsLineEnd(*it)) {
++it;
}