Bladeren bron

fix large glb reading by providing a proper helper for reading size_t type (#6307)

Co-authored-by: Vitaly Ovchinnikov <[email protected]>
Co-authored-by: Kim Kulling <[email protected]>
Vitaly Ovchinnikov 1 week geleden
bovenliggende
commit
69f8eb21fd
1 gewijzigde bestanden met toevoegingen van 15 en 0 verwijderingen
  1. 15 0
      code/AssetLib/glTFCommon/glTFCommon.h

+ 15 - 0
code/AssetLib/glTFCommon/glTFCommon.h

@@ -347,6 +347,21 @@ struct ReadHelper<int64_t> {
     }
     }
 };
 };
 
 
+#ifdef __APPLE__
+
+// On Mac size_t and uint64_t are not the same, so we need a specialized version
+// here to properly parse byteOffset and other parameters > 2^31
+// On Windows and Linux the types match andno additional specialization is required
+
+template <>
+struct ReadHelper<size_t> {
+    static bool Read(Value &val, size_t &out) {
+        return val.IsInt64() ? out = val.GetInt64(), true : false;
+    }
+};
+
+#endif
+
 template <class T>
 template <class T>
 inline static bool ReadValue(Value &val, T &out) {
 inline static bool ReadValue(Value &val, T &out) {
     return ReadHelper<T>::Read(val, out);
     return ReadHelper<T>::Read(val, out);