From f1c53450468b141aa31b51dadaa8023c397d639f Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Tue, 23 Jan 2018 16:25:45 -0800 Subject: [PATCH] Define basic_types backward compatible layer Use C99 types internally but define old types for compatibility with older API. (r1690 and earlier) TBR=braveyao@chromium.org Bug: libyuv:774 Test: try bots build on all platforms Change-Id: I06f89537da3875f74e65189897e67b69af2c2ec2 Reviewed-on: https://chromium-review.googlesource.com/882501 Reviewed-by: Frank Barchard --- README.chromium | 2 +- include/libyuv/basic_types.h | 39 +++++++++++++++++------------------- include/libyuv/version.h | 2 +- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/README.chromium b/README.chromium index 8d6e615a0..ab3fa706d 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1690 +Version: 1691 License: BSD License File: LICENSE diff --git a/include/libyuv/basic_types.h b/include/libyuv/basic_types.h index 6320b2eda..52cfee60e 100644 --- a/include/libyuv/basic_types.h +++ b/include/libyuv/basic_types.h @@ -11,37 +11,33 @@ #ifndef INCLUDE_LIBYUV_BASIC_TYPES_H_ #define INCLUDE_LIBYUV_BASIC_TYPES_H_ -#include // for NULL, size_t +#include // For size_t and NULL + +#if !defined(INT_TYPES_DEFINED) && !defined(GG_LONGLONG) +#define INT_TYPES_DEFINED #if defined(_MSC_VER) && (_MSC_VER < 1600) #include // for uintptr_t on x86 -#else -#include // for uintptr_t -#endif - -#ifndef GG_LONGLONG -#ifndef INT_TYPES_DEFINED -#define INT_TYPES_DEFINED -#ifdef COMPILER_MSVC typedef unsigned __int64 uint64_t; typedef __int64 int64_t; -#else // COMPILER_MSVC -#if defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__) -typedef unsigned long uint64_t; // NOLINT -typedef long int64_t; // NOLINT -#else // defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__) -typedef unsigned long long uint64_t; // NOLINT -typedef long long int64_t; // NOLINT -#endif // __LP64__ -#endif // COMPILER_MSVC typedef unsigned int uint32_t; typedef int int32_t; -typedef unsigned short uint16_t; // NOLINT -typedef short int16_t; // NOLINT +typedef unsigned short uint16_t; +typedef short int16_t; typedef unsigned char uint8_t; typedef signed char int8_t; +#else +#include // for uintptr_t and C99 types +#endif // defined(_MSC_VER) && (_MSC_VER < 1600) +typedef uint64_t uint64; +typedef int64_t int64; +typedef uint32_t uint32; +typedef int32_t int32; +typedef uint16_t uint16; +typedef int16_t int16; +typedef uint8_t uint8; +typedef int8_t int8; #endif // INT_TYPES_DEFINED -#endif // GG_LONGLONG #if !defined(LIBYUV_API) #if defined(_WIN32) || defined(__CYGWIN__) @@ -61,6 +57,7 @@ typedef signed char int8_t; #endif // __GNUC__ #endif // LIBYUV_API +// TODO(fbarchard): Remove bool macros. #define LIBYUV_BOOL int #define LIBYUV_FALSE 0 #define LIBYUV_TRUE 1 diff --git a/include/libyuv/version.h b/include/libyuv/version.h index dc0bf6f0b..8c78b65bf 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 1690 +#define LIBYUV_VERSION 1691 #endif // INCLUDE_LIBYUV_VERSION_H_