Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump contrib/utf8cpp from 60c490b to 2ad9957 #269

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
856547b
Fix Q1 MDL group frame loading, e.g. Q1 progs/flame2.mdl
Garux Apr 5, 2021
83c0dce
Merge branch 'master' into Q1MDLgroup
kimkulling Apr 14, 2021
c776924
fix -Waddress-of-packed-member
Garux May 30, 2021
3b56544
Merge branch 'Q1MDLgroup' of https://github.com/Garux/assimp into Q1M…
Garux May 30, 2021
93edbe8
Use Safe Constants Idioms for ObjFileParser::DEFAULT_MATERIAL.
Sep 10, 2021
5895c0c
more const in format detection
Sep 11, 2021
1eb0d18
Including <exception>
sadiki0 Sep 15, 2021
8c84afa
Merge branch 'master' into const-tokens
krishty Sep 15, 2021
79f3368
Merge branch 'master' into static
mahiuchun Sep 17, 2021
95d1232
Merge pull request #4083 from markoffline/patch-1
kimkulling Sep 20, 2021
e6543cb
Merge branch 'master' into static
mahiuchun Sep 20, 2021
4fd7330
Merge pull request #4076 from mahiuchun/static
kimkulling Sep 21, 2021
fb5b5e9
Fix possible nullptr dereferencing in material parsing
kimkulling Sep 21, 2021
590307d
Merge pull request #4085 from assimp/kimkulling-issue_3442
kimkulling Sep 21, 2021
95263b2
Update ObjTools.h
kimkulling Sep 21, 2021
d286aad
Merge pull request #4086 from assimp/kimkulling-obj_refactorings
kimkulling Sep 21, 2021
6cb6a6a
Merge branch 'master' into const-tokens
kimkulling Sep 24, 2021
96e2f1c
Merge pull request #4078 from krishty/const-tokens
kimkulling Sep 24, 2021
1f76b2e
Merge branch 'master' into Q1MDLgroup
kimkulling Oct 1, 2021
2f5a311
Merge pull request #3743 from Garux/Q1MDLgroup
kimkulling Oct 1, 2021
ac6b898
Add support for normal maps, the classic way
kimkulling Oct 1, 2021
3e4cca4
Merge pull request #4106 from assimp/kimkulling-issues-3726
kimkulling Oct 1, 2021
ae951fb
Fix aiString length in aiProcess_EmbedTextures
davidepi Oct 2, 2021
babf3b8
Merge pull request #4108 from davidepi/fix-aistring-embedtextures
kimkulling Oct 4, 2021
da53c38
contrib/zip is now a submodule
krishty Oct 6, 2021
89b20df
contrib/utf8cpp is now a submodule
krishty Oct 6, 2021
ff2b527
Visual C++: warnings are no longer treated as errors
krishty Oct 6, 2021
4e8ca06
fixed contrib/utf8cpp at version 2.3.6 from 2018 to test dependabot
krishty Oct 7, 2021
bf40207
added dependabot configuration
krishty Oct 7, 2021
e5085ec
fixed dependabot configuration error
krishty Oct 7, 2021
d7ae8ee
added dependabot configuration
krishty Oct 7, 2021
826be54
contrib/unzip is now a submodule
krishty Oct 7, 2021
025be78
contrib/rapidjson is now a submodule
krishty Oct 7, 2021
15d2258
fixed contrib/zip at version 0.1.15
krishty Oct 7, 2021
b8c4e0e
contrib/poly2tri is now a submodule
krishty Oct 7, 2021
88152b3
contrib/openddlparser is now a submodule
krishty Oct 7, 2021
a50d3e4
contrib/draco is now a submodule
krishty Oct 8, 2021
1e95572
contrib/android-cmake is now a submodule
krishty Oct 8, 2021
7d2a63f
contrib/googletest is now a submodule
krishty Oct 8, 2021
13dfc0d
contrib/pugixml is now a submodule
krishty Oct 8, 2021
b0b635e
Merge branch 'dependencies-as-submodules'
krishty Oct 8, 2021
a754b43
allowing more dependency updates
krishty Oct 8, 2021
de4fd7d
Bump contrib/utf8cpp from `60c490b` to `2ad9957`
dependabot[bot] Jan 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions code/AssetLib/Obj/ObjFileMtlImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ void ObjFileMtlImporter::getIlluminationModel(int &illum_model) {
// Loads a single float value.
void ObjFileMtlImporter::getFloatValue(ai_real &value) {
m_DataIt = CopyNextWord<DataArrayIt>(m_DataIt, m_DataItEnd, &m_buffer[0], BUFFERSIZE);
size_t len = std::strlen(&m_buffer[0]);
if (0 == len) {
value = 0.0f;
return;
}

value = (ai_real)fast_atof(&m_buffer[0]);
}

Expand Down
3 changes: 1 addition & 2 deletions code/AssetLib/Obj/ObjFileParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/BaseImporter.h>
#include <assimp/DefaultIOSystem.h>
#include <assimp/ParsingUtils.h>
#include <assimp/material.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/Importer.hpp>
#include <cstdlib>
Expand All @@ -56,7 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

namespace Assimp {

const std::string ObjFileParser::DEFAULT_MATERIAL = AI_DEFAULT_MATERIAL_NAME;
constexpr char ObjFileParser::DEFAULT_MATERIAL[];

ObjFileParser::ObjFileParser() :
m_DataIt(),
Expand Down
3 changes: 2 additions & 1 deletion code/AssetLib/Obj/ObjFileParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define OBJ_FILEPARSER_H_INC

#include <assimp/IOStreamBuffer.h>
#include <assimp/material.h>
#include <assimp/mesh.h>
#include <assimp/vector2.h>
#include <assimp/vector3.h>
Expand Down Expand Up @@ -140,7 +141,7 @@ class ASSIMP_API ObjFileParser {
// because the class contains pointer to allocated memory

/// Default material name
static const std::string DEFAULT_MATERIAL;
static constexpr char DEFAULT_MATERIAL[] = AI_DEFAULT_MATERIAL_NAME;
//! Iterator to current position in buffer
DataArrayIt m_DataIt;
//! Iterator to end position of buffer
Expand Down
119 changes: 70 additions & 49 deletions code/AssetLib/Obj/ObjTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------

Copyright (c) 2006-2020, assimp team
Copyright (c) 2006-2021, assimp team

All rights reserved.

Expand Down Expand Up @@ -51,57 +51,62 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

namespace Assimp {

/** @brief Returns true, if the last entry of the buffer is reached.
* @param it Iterator of current position.
* @param end Iterator with end of buffer.
/**
* @brief Returns true, if the last entry of the buffer is reached.
* @param[in] it Iterator of current position.
* @param[in] end Iterator with end of buffer.
* @return true, if the end of the buffer is reached.
*/
template <class char_t>
inline bool isEndOfBuffer(char_t it, char_t end) {
if (it == end) {
return true;
} else {
--end;
}
--end;

return (it == end);
}

/** @brief Returns next word separated by a space
* @param pBuffer Pointer to data buffer
* @param pEnd Pointer to end of buffer
/**
* @brief Returns next word separated by a space
* @param[in] pBuffer Pointer to data buffer
* @param[in] pEnd Pointer to end of buffer
* @return Pointer to next space
*/
template <class Char_T>
inline Char_T getNextWord(Char_T pBuffer, Char_T pEnd) {
while (!isEndOfBuffer(pBuffer, pEnd)) {
if (!IsSpaceOrNewLine(*pBuffer) || IsLineEnd(*pBuffer)) {
//if ( *pBuffer != '\\' )
break;
}
pBuffer++;
++pBuffer;
}

return pBuffer;
}

/** @brief Returns pointer a next token
* @param pBuffer Pointer to data buffer
* @param pEnd Pointer to end of buffer
/**
* @brief Returns pointer a next token
* @param[in] pBuffer Pointer to data buffer
* @param[in] pEnd Pointer to end of buffer
* @return Pointer to next token
*/
template <class Char_T>
inline Char_T getNextToken(Char_T pBuffer, Char_T pEnd) {
while (!isEndOfBuffer(pBuffer, pEnd)) {
if (IsSpaceOrNewLine(*pBuffer))
if (IsSpaceOrNewLine(*pBuffer)) {
break;
pBuffer++;
}
++pBuffer;
}
return getNextWord(pBuffer, pEnd);
}

/** @brief Skips a line
* @param it Iterator set to current position
* @param end Iterator set to end of scratch buffer for readout
* @param uiLine Current line number in format
/**
* @brief Skips a line
* @param[in] it Iterator set to current position
* @param[in] end Iterator set to end of scratch buffer for readout
* @param[out] uiLine Current line number in format
* @return Current-iterator with new position
*/
template <class char_t>
Expand All @@ -122,11 +127,12 @@ inline char_t skipLine(char_t it, char_t end, unsigned int &uiLine) {
return it;
}

/** @brief Get a name from the current line. Preserve space in the middle,
/**
* @brief Get a name from the current line. Preserve space in the middle,
* but trim it at the end.
* @param it set to current position
* @param end set to end of scratch buffer for readout
* @param name Separated name
* @param[in] it set to current position
* @param[in] end set to end of scratch buffer for readout
* @param[out] name Separated name
* @return Current-iterator with new position
*/
template <class char_t>
Expand All @@ -150,15 +156,16 @@ inline char_t getName(char_t it, char_t end, std::string &name) {
++it;
}
std::string strName(pStart, &(*it));
if (strName.empty())
return it;
else
if (!strName.empty()) {
name = strName;
}


return it;
}

/** @brief Get a name from the current line. Do not preserve space
/**
* @brief Get a name from the current line. Do not preserve space
* in the middle, but trim it at the end.
* @param it set to current position
* @param end set to end of scratch buffer for readout
Expand Down Expand Up @@ -188,19 +195,19 @@ inline char_t getNameNoSpace(char_t it, char_t end, std::string &name) {
++it;
}
std::string strName(pStart, &(*it));
if (strName.empty())
return it;
else
if (!strName.empty()) {
name = strName;

}

return it;
}

/** @brief Get next word from given line
* @param it set to current position
* @param end set to end of scratch buffer for readout
* @param pBuffer Buffer for next word
* @param length Buffer length
/**
* @brief Get next word from given line
* @param[in] it set to current position
* @param[in] end set to end of scratch buffer for readout
* @param[in] pBuffer Buffer for next word
* @param[in] length Buffer length
* @return Current-iterator with new position
*/
template <class char_t>
Expand All @@ -209,19 +216,21 @@ inline char_t CopyNextWord(char_t it, char_t end, char *pBuffer, size_t length)
it = getNextWord<char_t>(it, end);
while (!IsSpaceOrNewLine(*it) && !isEndOfBuffer(it, end)) {
pBuffer[index] = *it;
index++;
if (index == length - 1)
++index;
if (index == length - 1) {
break;
}
++it;
}
pBuffer[index] = '\0';
return it;
}

/** @brief Get next float from given line
* @param it set to current position
* @param end set to end of scratch buffer for readout
* @param value Separated float value.
/**
* @brief Get next float from given line
* @param[in] it set to current position
* @param[in] end set to end of scratch buffer for readout
* @param[out] value Separated float value.
* @return Current-iterator with new position
*/
template <class char_t>
Expand All @@ -234,21 +243,33 @@ inline char_t getFloat(char_t it, char_t end, ai_real &value) {
return it;
}


/**
* @brief Will remove white-spaces for a string.
* @param[in] str The string to clean
* @return The trimmed string.
*/
template <class string_type>
string_type trim_whitespaces(string_type str) {
while (!str.empty() && IsSpace(str[0]))
inline string_type trim_whitespaces(string_type str) {
while (!str.empty() && IsSpace(str[0])) {
str.erase(0);
while (!str.empty() && IsSpace(str[str.length() - 1]))
}
while (!str.empty() && IsSpace(str[str.length() - 1])) {
str.erase(str.length() - 1);
}
return str;
}

/**
* @brief Checks for a line-end.
* @param[in] it Current iterator in string.
* @param[in] end End of the string.
* @return The trimmed string.
*/
template <class T>
bool hasLineEnd(T it, T end) {
bool hasLineEnd(false);
bool hasLineEnd = false;
while (!isEndOfBuffer(it, end)) {
it++;
++it;
if (IsLineEnd(it)) {
hasLineEnd = true;
break;
Expand Down
2 changes: 1 addition & 1 deletion include/assimp/Importer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Public ASSIMP data structures
#include <assimp/types.h>

//#include <exception>
#include <exception>

namespace Assimp {
// =======================================================================
Expand Down