[Ffmpeg-devel] stdint.h and inttypes.h for non-C99 compilers

Alexander Chemeris ipse.ffmpeg
Wed Dec 13 11:46:14 CET 2006


Hello,

On 12/13/06, Steve Lhomme <steve.lhomme at free.fr> wrote:
> You don't have a tool to compare files ?
Sure, I have. But it always a good form - send only changes.
And give a comment why this changes are here.
I appreciate your comments, but they will be accepted faster,
if you respect this principles. :)

===================================================================
> --- inttypes.h  (revision 7)
> +++ inttypes.h  (working copy)
> @@ -30,7 +30,7 @@
>  ///////////////////////////////////////////////////////////////////////////////
>
>  #ifndef _MSC_VER // [
> -#error "Use this header only with Microsoft Visual Studio 2003 or later!"
> +#error "Use this header only with Microsoft Visual C++ and Visual Studio!"
>  #endif // _MSC_VER ]
>
>  #ifndef _MSC_INTTYPES_H_ // [
Accepted in a different form.

> @@ -42,6 +42,10 @@
>
>  #include <stdint.h>
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
>  // 7.8 Format conversion of integer types
>
>  typedef struct {
> @@ -268,7 +272,7 @@
>
>  // This is modified version of div() function from Microsoft's div.c found
>  // in %MSVC.NET%\crt\src\div.c
> -_inline imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
> +_inline imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom)
>  {
>     imaxdiv_t result;
>
> @@ -292,5 +296,8 @@
>  #define wcstoimax _wcstoi64
>  #define wcstoumax _wcstoui64
>
> +#ifdef __cplusplus
> +}
> +#endif
>
>  #endif // _MSC_INTTYPES_H_ ]
Why do you change this?
Is __cdecl is not enough?


===================================================================
> --- stdint.h    (revision 7)
> +++ stdint.h    (working copy)
> @@ -30,7 +30,7 @@
>  ///////////////////////////////////////////////////////////////////////////////
>
>  #ifndef _MSC_VER // [
> -#error "Use this header only with Microsoft Visual Studio 2003 or later!"
> +#error "Use this header only with Microsoft Visual C++ and Visual Studio!"
>  #endif // _MSC_VER ]
>
>  #ifndef _MSC_STDINT_H_ // [
Accepted in a different form.

> @@ -47,14 +47,14 @@
>  // 7.18.1 Integer types
>
>  // 7.18.1.1 Exact-width integer types
> -typedef INT8    int8_t;
> -typedef INT16   int16_t;
> -typedef INT32   int32_t;  // There is LONG32 type defined the same. Should it be used here?
> -typedef INT64   int64_t;  // There is LONG64 type defined the same. Should it be used here?
> -typedef UINT8   uint8_t;
> -typedef UINT16  uint16_t;
> -typedef UINT32  uint32_t;  // There are ULONG32 and DWORD32 type defined the same. Should one of them be used here?
> -typedef UINT64  uint64_t;  // There are ULONG64 and DWORD64 type defined the same. Should one of them be used here?
> +typedef signed __int8   int8_t;
> +typedef signed __int16  int16_t;
> +typedef signed __int32  int32_t;  // There is LONG32 type defined the same. Should it be used here?
> +typedef signed __int64  int64_t;  // There is LONG64 type defined the same. Should it be used here?
> +typedef unsigned __int8  uint8_t;
> +typedef unsigned __int16 uint16_t;
> +typedef unsigned __int32 uint32_t;  // There are ULONG32 and DWORD32 type defined the same. Should one of them be used here?
> +typedef unsigned __int64 uint64_t;  // There are ULONG64 and DWORD64 type defined the same. Should one of them be used here?
>
>  // 7.18.1.2 Minimum-width integer types
>  typedef int8_t    int_least8_t;
I should test VC6 compatibility... If this will help - I commit it.

> @@ -160,11 +160,13 @@
>  #define SIG_ATOMIC_MIN  INT_MIN
>  #define SIG_ATOMIC_MAX  INT_MAX
>
> +#ifndef SIZE_MAX
>  #ifdef _WIN64 // [
>  #  define SIZE_MAX  _UI64_MAX
>  #else // _WIN64 ][
>  #  define SIZE_MAX  _UI32_MAX
>  #endif // _WIN64 ]
> +#endif
>
>  // WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
>  #ifndef WCHAR_MIN // [
Ok. Fixed.

-- 
Regards,
Alexander Chemeris.




More information about the ffmpeg-devel mailing list