summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_portability.h
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2008-01-02 21:14:35 +0000
committerAndrey Hristov <andrey@php.net>2008-01-02 21:14:35 +0000
commitfdf20a8287172ec74d0acacdd58b9c0c25d670d5 (patch)
tree2a72f9d23f1d3f74342805b8905eae3d6fad8351 /ext/mysqlnd/mysqlnd_portability.h
parentfc74136a9066693c9fb9c51f085b2af1f8bbae5c (diff)
downloadphp-git-fdf20a8287172ec74d0acacdd58b9c0c25d670d5.tar.gz
- Fix problems with double definitions
- Clean up a bit a type mess - 4 types less. No need to have aliases for the same thing (unification is the name). - New macro for Johannes mysqlnd_stmt_ro_result_metadata
Diffstat (limited to 'ext/mysqlnd/mysqlnd_portability.h')
-rw-r--r--ext/mysqlnd/mysqlnd_portability.h136
1 files changed, 61 insertions, 75 deletions
diff --git a/ext/mysqlnd/mysqlnd_portability.h b/ext/mysqlnd/mysqlnd_portability.h
index 37aeb67e21..687c6d9b1f 100644
--- a/ext/mysqlnd/mysqlnd_portability.h
+++ b/ext/mysqlnd/mysqlnd_portability.h
@@ -69,6 +69,7 @@ typedef int8_t int8; /* Signed integer >= 8 bits */
#endif
#endif
+
#ifndef HAVE_UINT8
#ifndef HAVE_UINT8_T
typedef unsigned char uint8; /* Unsigned integer >= 8 bits */
@@ -97,47 +98,83 @@ typedef uint16_t uint16; /* Signed integer >= 16 bits */
typedef unsigned char uchar; /* Short for unsigned char */
#endif
-
-#if defined(HAVE_INT32_T) && defined(HAVE_UINT32_T)
+#ifndef HAVE_INT32
+#ifdef HAVE_INT32_T
typedef int32_t int32;
-typedef uint32_t uint32;
-
#elif SIZEOF_INT == 4
-
-#ifndef HAVE_INT32
typedef signed int int32;
-#endif
-#ifndef HAVE_UINT32
-typedef unsigned int uint32;
-#endif
-
#elif SIZEOF_LONG == 4
-
-#ifndef HAVE_INT32
typedef signed long int32;
+#else
+error "Neither int nor long is of 4 bytes width"
#endif
+#endif /* HAVE_INT32 */
+
+
#ifndef HAVE_UINT32
+#ifdef HAVE_UINT32_T
+typedef uint32_t uint32;
+#elif SIZEOF_INT == 4
+typedef unsigned int uint32;
+#elif SIZEOF_LONG == 4
typedef unsigned long uint32;
+#else
+#error "Neither int nor long is of 4 bytes width"
#endif
-
+#endif /* HAVE_UINT32 */
+
+
+#ifndef HAVE_INT64
+#ifdef HAVE_INT64_T
+typedef int64_t int64;
+#elif SIZEOF_INT == 8
+typedef signed int int64;
+#elif SIZEOF_LONG == 8
+typedef signed long int64;
+#elif SIZEOF_LONG_LONG == 8
+typedef signed long long int64;
#else
-error "Neither int or long is of 4 bytes width"
+#error "Neither int nor long nor long long is of 8 bytes width"
#endif
+#endif /* HAVE_INT64 */
+
+
+#ifndef HAVE_UINT64
+#ifdef HAVE_UINT64_T
+typedef uint64_t uint64;
+#elif SIZEOF_INT == 8
+typedef unsigned int uint64;
+#elif SIZEOF_LONG == 8
+typedef unsigned long uint64;
+#elif SIZEOF_LONG_LONG == 8
+typedef unsigned long long uint64;
+#else
+#error "Neither int nor long nor long long is of 8 bytes width"
+#endif
+#endif /* HAVE_INT64 */
-#if !defined(HAVE_ULONG) && !defined(__USE_MISC) && !defined(ulong)
-typedef unsigned long ulong; /* Short for unsigned long */
+
+#ifdef PHP_WIN32
+#define MYSQLND_LLU_SPEC "%I64u"
+#define MYSQLND_LL_SPEC "%I64d"
+#ifndef L64
+#define L64(x) x##i64
#endif
-#ifndef longlong_defined
-#if defined(HAVE_LONG_LONG) && SIZEOF_LONG != 8
-typedef unsigned long long int ulonglong; /* ulong or unsigned long long */
-typedef long long int longlong;
+typedef __int64 int64;
+typedef unsigned __int64 uint64;
#else
-typedef unsigned long ulonglong; /* ulong or unsigned long long */
-typedef long longlong;
+#define MYSQLND_LLU_SPEC "%llu"
+#define MYSQLND_LL_SPEC "%lld"
+#ifndef L64
+#define L64(x) x##LL
#endif
#endif
+typedef int64 longlong;
+typedef uint64 ulonglong;
+
+
#define int1store(T,A) do { *((zend_uchar*) (T)) = (A); } while(0)
#define uint1korr(A) (*(((uint8*)(A))))
@@ -280,29 +317,9 @@ typedef union {
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16) +\
(((uint32) ((uchar) (A)[3])) << 24))
-#define bit_uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24)) +\
- (((ulonglong) ((uchar) (A)[4])) << 32))
-/* From Andrey Hristov, based on uint5korr */
-#define bit_uint6korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[5])) +\
- (((uint32) (((uchar*) (A))[4])) << 8) +\
- (((uint32) (((uchar*) (A))[3])) << 16) +\
- (((uint32) (((uchar*) (A))[2])) << 24)) +\
- (((ulonglong) (((uint32) (((uchar*) (A))[1])) +\
- (((uint32) (((uchar*) (A))[0]) << 8)))) << 32))
-#define bit_uint7korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[6])) +\
- (((uint32) (((uchar*) (A))[5])) << 8) +\
- (((uint32) (((uchar*) (A))[4])) << 16) +\
- (((uint32) (((uchar*) (A))[3])) << 24)) +\
- (((ulonglong) (((uint32) (((uchar*) (A))[2])) +\
- (((uint32) (((uchar*) (A))[1])) << 8) +\
- (((uint32) (((uchar*) (A))[0])) << 16))) << 32))
-
-#define bit_uint8korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[7])) +\
+#define uint8korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[7])) +\
(((uint32) (((uchar*) (A))[6])) << 8) +\
(((uint32) (((uchar*) (A))[5])) << 16) +\
(((uint32) (((uchar*) (A))[4])) << 24)) +\
@@ -473,37 +490,6 @@ typedef union {
#endif /* WORDS_BIGENDIAN */
-#ifdef PHP_WIN32
-#define MYSQLND_LLU_SPEC "%I64u"
-#define MYSQLND_LL_SPEC "%I64d"
-#ifndef L64
-#define L64(x) x##i64
-#endif
-typedef unsigned __int64 my_uint64;
-typedef __int64 my_int64;
-typedef unsigned __int64 mynd_ulonglong;
-typedef __int64 mynd_longlong;
-#else
-#define MYSQLND_LLU_SPEC "%llu"
-#define MYSQLND_LL_SPEC "%lld"
-#ifndef L64
-#define L64(x) x##LL
-#endif
-#ifndef HAVE_UINT64_T
-typedef unsigned long long my_uint64;
-typedef unsigned long long mynd_ulonglong;
-#else
-typedef uint64_t my_uint64;
-typedef uint64_t mynd_ulonglong;
-#endif
-#ifndef HAVE_INT64_T
-typedef long long my_int64;
-typedef long long mynd_longlong;
-#else
-typedef int64_t my_int64;
-typedef int64_t mynd_longlong;
-#endif
-#endif
/*
* Local variables: