mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0023042: Potential mistakes in (s)printf usage
Use PRIuPTR macros for Standard_Size values in printf. Use STL streams instead of printf when reasonable.
This commit is contained in:
@@ -30,6 +30,29 @@
|
||||
#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
|
||||
#ifdef _WIN64
|
||||
#define PRIdPTR "I64d"
|
||||
#define PRIuPTR "I64u"
|
||||
#define SCNdPTR "I64d"
|
||||
#define SCNuPTR "I64u"
|
||||
#else
|
||||
#define PRIdPTR "d"
|
||||
#define PRIuPTR "u"
|
||||
#define SCNdPTR "d"
|
||||
#define SCNuPTR "u"
|
||||
#endif
|
||||
#else
|
||||
// should be just <cinttypes> since C++11
|
||||
// however we use this code for compatibility with old C99 compilers
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#define Standard_False (Standard_Boolean)0
|
||||
#define Standard_True (Standard_Boolean)1
|
||||
|
||||
@@ -37,19 +60,20 @@
|
||||
#include <Standard_Macro.hxx>
|
||||
#endif
|
||||
|
||||
typedef int Standard_Integer;
|
||||
typedef double Standard_Real;
|
||||
typedef unsigned int Standard_Boolean;
|
||||
typedef float Standard_ShortReal;
|
||||
typedef char Standard_Character;
|
||||
typedef short Standard_ExtCharacter;
|
||||
typedef unsigned char Standard_Byte;
|
||||
typedef void* Standard_Address;
|
||||
typedef size_t Standard_Size;
|
||||
typedef int Standard_Integer;
|
||||
typedef double Standard_Real;
|
||||
typedef unsigned int Standard_Boolean;
|
||||
typedef float Standard_ShortReal;
|
||||
typedef char Standard_Character;
|
||||
typedef short Standard_ExtCharacter;
|
||||
typedef unsigned char Standard_Byte;
|
||||
typedef void* Standard_Address;
|
||||
typedef size_t Standard_Size;
|
||||
typedef std::time_t Standard_Time;
|
||||
|
||||
//
|
||||
typedef const char* Standard_CString;
|
||||
typedef const short* Standard_ExtString;
|
||||
typedef const char* Standard_CString;
|
||||
typedef const short* Standard_ExtString;
|
||||
|
||||
// Unicode primitives, char16_t, char32_t
|
||||
typedef char Standard_Utf8Char; //!< signed UTF-8 char
|
||||
@@ -58,6 +82,4 @@ typedef uint16_t Standard_Utf16Char; //!< UTF-16 char (always unsigned)
|
||||
typedef uint32_t Standard_Utf32Char; //!< UTF-32 char (always unsigned)
|
||||
typedef wchar_t Standard_WideChar; //!< wide char (unsigned UTF-16 on Windows platform and signed UTF-32 on Linux)
|
||||
|
||||
typedef std::time_t Standard_Time;
|
||||
|
||||
#endif
|
||||
#endif // _Standard_TypeDef_HeaderFile
|
||||
|
Reference in New Issue
Block a user