]> OCCT Git - occt-copy.git/commitdiff
Compatibility with obsolete MSVC compilers - added PRId64 macros
authorkgv <kgv@opencascade.com>
Fri, 16 Feb 2018 14:29:17 +0000 (17:29 +0300)
committerkgv <kgv@opencascade.com>
Fri, 16 Feb 2018 14:30:14 +0000 (17:30 +0300)
src/Standard/Standard_TypeDef.hxx

index d8fbdf73c80c5326a4623b0edd4c4c4aeda00914..6216e25fd62e838df914826896ddaf0c6406ceef 100755 (executable)
 
 #include <cstddef>
 #include <ctime>
-#include <stdint.h>
+
+// VC9 does not have stdint.h
+#if(defined(_MSC_VER) && (_MSC_VER < 1600))
+  // old MSVC - hasn't stdint header
+  typedef unsigned __int8   uint8_t;
+  typedef unsigned __int16  uint16_t;
+  typedef unsigned __int32  uint32_t;
+  typedef unsigned __int64  uint64_t;
+
+  typedef __int8   int8_t;
+  typedef __int16  int16_t;
+  typedef __int32  int32_t;
+  typedef __int64  int64_t;
+#else
+  #include <stdint.h>
+#endif
 
 #if(defined(_MSC_VER) && (_MSC_VER < 1800))
   // only Visual Studio 2013 (vc12) provides <cinttypes> header
   // we do not defined all macros here - only used by OCCT framework
+  #define PRId64 "I64d"
+  #define PRIu64 "I64u"
+  #define SCNd64 "I64d"
+  #define SCNu64 "I64u"
   #ifdef _WIN64
     #define PRIdPTR "I64d"
     #define PRIuPTR "I64u"
@@ -60,8 +79,8 @@ typedef std::time_t   Standard_Time;
 // Unicode primitives, char16_t, char32_t
 typedef char          Standard_Utf8Char;     //!< signed   UTF-8 char
 typedef unsigned char Standard_Utf8UChar;    //!< unsigned UTF-8 char
-#if (defined(__GNUC__) && !defined(__clang__) && ((__GNUC__ == 4 && __GNUC_MINOR__ <= 3) || __GNUC__ < 4))
-// compatibility with old GCC compilers
+#if ((defined(__GNUC__) && !defined(__clang__) && ((__GNUC__ == 4 && __GNUC_MINOR__ <= 3) || __GNUC__ < 4)) || (defined(_MSC_VER) && (_MSC_VER < 1600)))
+// compatibility with old GCC and MSVC compilers
 typedef uint16_t      Standard_ExtCharacter;
 typedef uint16_t      Standard_Utf16Char;
 typedef uint32_t      Standard_Utf32Char;