From e197fa459d331be2027aa7ce8e4bf61a9da4f4f7 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 3 Jan 2005 19:39:09 +0100 Subject: [PATCH 1/2] bug#7626 - ndb UintPtr handling ndb/include/ndb_types.h: redo UintPtr handling --- ndb/include/ndb_types.h | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/ndb/include/ndb_types.h b/ndb/include/ndb_types.h index 0d603cc2ab3..1284ace3bbc 100644 --- a/ndb/include/ndb_types.h +++ b/ndb/include/ndb_types.h @@ -30,31 +30,22 @@ typedef unsigned int Uint32; typedef unsigned int UintR; -#ifdef __SIZE_TYPE__ -typedef __SIZE_TYPE__ UintPtr; -#else -#include -#ifdef HAVE_STDINT_H -#include -#endif -#ifdef HAVE_INTTYPES_H -#include -#endif -#if defined(WIN32) || defined(NDB_WIN32) -typedef Uint32 UintPtr; -#else -typedef uintptr_t UintPtr; -#endif -#endif - #if defined(WIN32) || defined(NDB_WIN32) typedef unsigned __int64 Uint64; typedef signed __int64 Int64; -typedef UintPtr ssize_t; #else typedef unsigned long long Uint64; typedef signed long long Int64; #endif +#ifdef __SIZE_TYPE__ +typedef __SIZE_TYPE__ UintPtr; +#else +#if SIZEOF_CHARP == 4 +typedef Uint32 UintPtr; +#else +typedef Uint64 UintPtr; +#endif +#endif #endif From 9ecd9ac6b984f999b89a62fae782e1d6f277495a Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 3 Jan 2005 20:10:23 +0100 Subject: [PATCH 2/2] bug#7626 - post review version ndb/include/ndb_global.h.in: move types into ndb_global.h.in Check sizeof of Uint8, Uint32 & Uint64 ndb/include/ndb_types.h: move types into ndb_global.h.in --- ndb/include/ndb_global.h.in | 36 ++++++++++++++++++++++++++++++++++++ ndb/include/ndb_types.h | 27 +-------------------------- 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/ndb/include/ndb_global.h.in b/ndb/include/ndb_global.h.in index aefb319730c..cadbb8cabf2 100644 --- a/ndb/include/ndb_global.h.in +++ b/ndb/include/ndb_global.h.in @@ -16,12 +16,48 @@ #define HAVE_STRCASECMP #define strcasecmp _strcmpi #pragma warning(disable: 4503 4786) +typedef unsigned __int64 Uint64; +typedef signed __int64 Int64; #else #undef NDB_WIN32 #define DIR_SEPARATOR "/" +typedef unsigned long long Uint64; +typedef signed long long Int64; #endif #include + +typedef signed char Int8; +typedef unsigned char Uint8; +typedef signed short Int16; +typedef unsigned short Uint16; +typedef signed int Int32; +typedef unsigned int Uint32; + +typedef unsigned int UintR; + +#ifdef __SIZE_TYPE__ +typedef __SIZE_TYPE__ UintPtr; +#elif SIZEOF_CHARP == 4 +typedef Uint32 UintPtr; +#elif SIZEOF_CHARP == 8 +typedef Uint64 UintPtr; +#else +#error "Unknown size of (char *)" +#endif + +#if ! (SIZEOF_CHAR == 1) +#error "Invalid define for Uint8" +#endif + +#if ! (SIZEOF_INT == 4) +#error "Invalid define for Uint32" +#endif + +#if ! (SIZEOF_LONG_LONG == 8) +#error "Invalid define for Uint64" +#endif + #include #ifdef _AIX diff --git a/ndb/include/ndb_types.h b/ndb/include/ndb_types.h index 1284ace3bbc..6cf9bb40d7f 100644 --- a/ndb/include/ndb_types.h +++ b/ndb/include/ndb_types.h @@ -21,31 +21,6 @@ #ifndef NDB_TYPES_H #define NDB_TYPES_H -typedef signed char Int8; -typedef unsigned char Uint8; -typedef signed short Int16; -typedef unsigned short Uint16; -typedef signed int Int32; -typedef unsigned int Uint32; - -typedef unsigned int UintR; - -#if defined(WIN32) || defined(NDB_WIN32) -typedef unsigned __int64 Uint64; -typedef signed __int64 Int64; -#else -typedef unsigned long long Uint64; -typedef signed long long Int64; -#endif - -#ifdef __SIZE_TYPE__ -typedef __SIZE_TYPE__ UintPtr; -#else -#if SIZEOF_CHARP == 4 -typedef Uint32 UintPtr; -#else -typedef Uint64 UintPtr; -#endif -#endif +#include "ndb_global.h" #endif