Fix compilation for MSVC14. (#5490)

- std::min/max were not defined in StackAllocator.inl; Also added explicit template arguments to break macro expansion if Windows.h is included prior and NOMINMAX macro is not present.
- Made static_assert statements compatible with C++11 in ProcessHelper.cpp.
- Removed unused string_view include in ObjFileParser.cpp.
pull/5494/head
Laura Hermanns 2024-03-11 04:09:23 -04:00 committed by GitHub
parent bb9101ae9e
commit 727774f181
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -52,7 +52,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <cstdlib> #include <cstdlib>
#include <memory> #include <memory>
#include <utility> #include <utility>
#include <string_view>
namespace Assimp { namespace Assimp {

View File

@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "StackAllocator.h" #include "StackAllocator.h"
#include <assimp/ai_assert.h> #include <assimp/ai_assert.h>
#include <algorithm>
using namespace Assimp; using namespace Assimp;
@ -56,7 +57,7 @@ inline void *StackAllocator::Allocate(size_t byteSize) {
{ {
// double block size every time, up to maximum of g_maxBytesPerBlock. // double block size every time, up to maximum of g_maxBytesPerBlock.
// Block size must be at least as large as byteSize, but we want to use this for small allocations anyway. // Block size must be at least as large as byteSize, but we want to use this for small allocations anyway.
m_blockAllocationSize = std::max(std::min(m_blockAllocationSize * 2, g_maxBytesPerBlock), byteSize); m_blockAllocationSize = std::max<std::size_t>(std::min<std::size_t>(m_blockAllocationSize * 2, g_maxBytesPerBlock), byteSize);
uint8_t *data = new uint8_t[m_blockAllocationSize]; uint8_t *data = new uint8_t[m_blockAllocationSize];
m_storageBlocks.emplace_back(data); m_storageBlocks.emplace_back(data);
m_subIndex = byteSize; m_subIndex = byteSize;

View File

@ -177,8 +177,8 @@ unsigned int GetMeshVFormatUnique(const aiMesh *pcMesh) {
if (pcMesh->HasTangentsAndBitangents()) iRet |= 0x4; if (pcMesh->HasTangentsAndBitangents()) iRet |= 0x4;
static_assert(8 >= AI_MAX_NUMBER_OF_COLOR_SETS); static_assert(8 >= AI_MAX_NUMBER_OF_COLOR_SETS, "static_assert(8 >= AI_MAX_NUMBER_OF_COLOR_SETS)");
static_assert(8 >= AI_MAX_NUMBER_OF_TEXTURECOORDS); static_assert(8 >= AI_MAX_NUMBER_OF_TEXTURECOORDS, "static_assert(8 >= AI_MAX_NUMBER_OF_TEXTURECOORDS)");
// texture coordinates // texture coordinates
unsigned int p = 0; unsigned int p = 0;