Bladeren bron

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.
Laura Hermanns 1 jaar geleden
bovenliggende
commit
727774f181
3 gewijzigde bestanden met toevoegingen van 4 en 4 verwijderingen
  1. 0 1
      code/AssetLib/Obj/ObjFileParser.cpp
  2. 2 1
      code/Common/StackAllocator.inl
  3. 2 2
      code/PostProcessing/ProcessHelper.cpp

+ 0 - 1
code/AssetLib/Obj/ObjFileParser.cpp

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

+ 2 - 1
code/Common/StackAllocator.inl

@@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include "StackAllocator.h"
 #include <assimp/ai_assert.h>
+#include <algorithm>
 
 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.
         // 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];
         m_storageBlocks.emplace_back(data);
         m_subIndex = byteSize;

+ 2 - 2
code/PostProcessing/ProcessHelper.cpp

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