]> granicus.if.org Git - php/commitdiff
More type fixes for Windows
authorAndrey Hristov <andrey@php.net>
Thu, 6 Nov 2008 18:37:32 +0000 (18:37 +0000)
committerAndrey Hristov <andrey@php.net>
Thu, 6 Nov 2008 18:37:32 +0000 (18:37 +0000)
ext/mysqlnd/config-win.h
ext/mysqlnd/mysqlnd_charset.c
ext/mysqlnd/mysqlnd_portability.h
ext/mysqlnd/mysqlnd_wireprotocol.c

index 15cd736b102b57e1eabba51038a45d6d2455300d..bc44050de358df7078b4e1cb08f6250d65ae8121 100644 (file)
@@ -3,6 +3,9 @@ This file is public domain and comes with NO WARRANTY of any kind */
 
 /* Defines for Win32 to make it compatible for MySQL */
 
+#ifndef _MYSQLND_CONFIG_WIN_H
+#define _MYSQLND_CONFIG_WIN_H
+
 #include <sys/locking.h>
 #include <windows.h>
 #include <math.h>                      /* Because of rint() */
@@ -10,7 +13,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
 #include <io.h>
 #include <malloc.h>
 
-#include "win32/php_stdint.h"
+#include <win32/php_stdint.h>
 
 #ifndef HAVE_INT8_T
 #define HAVE_INT8_T
@@ -61,35 +64,35 @@ This file is public domain and comes with NO WARRANTY of any kind */
 /* Optimized store functions for Intel x86 */
 
 #define sint2korr(A)   (*((int16_t *) (A)))
-#define sint3korr(A)   ((int32_t) ((((uchar) (A)[2]) & 128) ? \
+#define sint3korr(A)   ((int32_t) ((((zend_uchar) (A)[2]) & 128) ? \
                                                                                (((uint32_t) 255L << 24) | \
-                                                                               (((uint32_t) (uchar) (A)[2]) << 16) |\
-                                                                               (((uint32_t) (uchar) (A)[1]) << 8) | \
-                                                                               ((uint32_t) (uchar) (A)[0])) : \
-                                                                               (((uint32_t) (uchar) (A)[2]) << 16) |\
-                                                                               (((uint32_t) (uchar) (A)[1]) << 8) | \
-                                                                               ((uint32_t) (uchar) (A)[0])))
+                                                                               (((uint32_t) (zend_uchar) (A)[2]) << 16) |\
+                                                                               (((uint32_t) (zend_uchar) (A)[1]) << 8) | \
+                                                                               ((uint32_t) (zend_uchar) (A)[0])) : \
+                                                                               (((uint32_t) (zend_uchar) (A)[2]) << 16) |\
+                                                                               (((uint32_t) (zend_uchar) (A)[1]) << 8) | \
+                                                                               ((uint32_t) (zend_uchar) (A)[0])))
 #define sint4korr(A)   (*((int32_t *) (A)))
 #define uint2korr(A)   (*((uint16_t *) (A)))
 #define uint3korr(A)   (int32_t) (*((uint32_t *) (A)) & 0xFFFFFF)
 #define uint4korr(A)   (*((uint32_t *) (A)))
-#define uint5korr(A)   ((uint64_t)(((uint32_t) ((uchar) (A)[0])) +\
-                                                                       (((uint32_t) ((uchar) (A)[1])) << 8) +\
-                                                                       (((uint32_t) ((uchar) (A)[2])) << 16) +\
-                                                                       (((uint32_t) ((uchar) (A)[3])) << 24)) +\
-                                                                       (((uint64_t) ((uchar) (A)[4])) << 32))
+#define uint5korr(A)   ((uint64_t)(((uint32_t) ((zend_uchar) (A)[0])) +\
+                                                                       (((uint32_t) ((zend_uchar) (A)[1])) << 8) +\
+                                                                       (((uint32_t) ((zend_uchar) (A)[2])) << 16) +\
+                                                                       (((uint32_t) ((zend_uchar) (A)[3])) << 24)) +\
+                                                                       (((uint64_t) ((zend_uchar) (A)[4])) << 32))
 #define uint8korr(A)   (*((uint64_t *) (A)))
 #define sint8korr(A)   (*((int64_t *) (A)))
 #define int2store(T,A) *((uint16_t*) (T))= (uint16_t) (A)
-#define int3store(T,A)         {       *(T)=  (uchar) ((A));\
-                                                               *(T+1)=(uchar) (((uint32_t) (A) >> 8));\
-                                                               *(T+2)=(uchar) (((A) >> 16)); }
+#define int3store(T,A)         {       *(T)=  (zend_uchar) ((A));\
+                                                               *(T+1)=(zend_uchar) (((uint32_t) (A) >> 8));\
+                                                               *(T+2)=(zend_uchar) (((A) >> 16)); }
 #define int4store(T,A) *((int32_t *) (T))= (int32_t) (A)
-#define int5store(T,A) {       *(T)= (uchar)((A));\
-                                                       *((T)+1)=(uchar) (((A) >> 8));\
-                                                       *((T)+2)=(uchar) (((A) >> 16));\
-                                                       *((T)+3)=(uchar) (((A) >> 24)); \
-                                                       *((T)+4)=(uchar) (((A) >> 32)); }
+#define int5store(T,A) {       *(T)= (zend_uchar)((A));\
+                                                       *((T)+1)=(zend_uchar) (((A) >> 8));\
+                                                       *((T)+2)=(zend_uchar) (((A) >> 16));\
+                                                       *((T)+3)=(zend_uchar) (((A) >> 24)); \
+                                                       *((T)+4)=(zend_uchar) (((A) >> 32)); }
 #define int8store(T,A) *((uint64_t *) (T))= (uint64_t) (A)
 
 #define float8get(V,M) {       *((int32_t *) &V) = *((int32_t*) M); \
@@ -99,3 +102,14 @@ This file is public domain and comes with NO WARRANTY of any kind */
 #define float4get(V,M) { *((int32_t *) &(V)) = *((int32_t*) (M)); }
 
 #endif /* _WIN64 */
+
+#endif /* _MYSQLND_CONFIG_WIN_H */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
index 5c323d6b65d09f15881948d9bd952a9857dfef41..e4ce06e36ca91e886e043f45d5c31b478efe12c6 100644 (file)
@@ -268,7 +268,7 @@ static unsigned int mysqlnd_mbcharlen_ucs2(unsigned int ucs2 __attribute((unused
 
 static unsigned int check_mb_ujis(const char *start, const char *end)
 {
-       if (*(uchar*)start < 0x80) {
+       if (*(zend_uchar*)start < 0x80) {
                return 0;       /* invalid ujis character */
        }
        if (valid_ujis(*(start)) && valid_ujis(*((start)+1))) {
index 3658dbf750b919af23ca75b060c916c0f37e12f2..a7c3563c9cee567be2a2e547797dfa452965b4aa 100644 (file)
@@ -59,8 +59,8 @@ This file is public domain and comes with NO WARRANTY of any kind */
 #define HAVE_LONG_LONG 1
 #endif
 
+
 /* Typdefs for easyier portability */
-#if 0
 #ifndef HAVE_INT8_T
 #ifndef HAVE_INT8
 typedef signed char int8_t;                    /* Signed integer >= 8    bits */
@@ -93,9 +93,6 @@ typedef uint16 uint16_t;                      /* Signed integer >= 16 bits */
 #endif
 #endif
 
-#ifndef HAVE_UCHAR
-typedef unsigned char uchar;           /* Short for unsigned char */
-#endif
 
 #ifndef HAVE_INT32_T
 #ifdef HAVE_INT32
@@ -157,7 +154,6 @@ typedef unsigned long long uint64_t;
 #endif
 #endif /* HAVE_INT64_T */
 
-#endif
 
 #ifdef PHP_WIN32
 #define MYSQLND_LLU_SPEC "%I64u"
@@ -180,47 +176,47 @@ typedef unsigned long long uint64_t;
 #define uint1korr(A)   (*(((uint8_t*)(A))))
 
 /* Bit values are sent in reverted order of bytes, compared to normal !!! */
-#define bit_uint2korr(A) ((uint16_t) (((uint16_t) (((uchar*) (A))[1])) +\
-                                                                       ((uint16_t) (((uchar*) (A))[0]) << 8)))
-#define bit_uint3korr(A) ((uint32_t) (((uint32_t) (((uchar*) (A))[2])) +\
-                                                                       (((uint32_t) (((uchar*) (A))[1])) << 8) +\
-                                                                       (((uint32_t) (((uchar*) (A))[0])) << 16)))
-
-#define bit_uint4korr(A) ((uint32_t) (((uint32_t) (((uchar*) (A))[3])) +\
-                                                                       (((uint32_t) (((uchar*) (A))[2])) << 8) +\
-                                                                       (((uint32_t) (((uchar*) (A))[1])) << 16) +\
-                                                                       (((uint32_t) (((uchar*) (A))[0])) << 24)))
-
-#define bit_uint5korr(A)  ((uint64_t)(((uint32_t) ((uchar) (A)[4])) +\
-                                  (((uint32_t) ((uchar) (A)[3])) << 8) +\
-                                  (((uint32_t) ((uchar) (A)[2])) << 16) +\
-                                  (((uint32_t) ((uchar) (A)[1])) << 24)) +\
-                               (((uint64_t) ((uchar) (A)[0])) << 32))
-
-#define bit_uint6korr(A)       ((uint64_t)(((uint32_t) (((uchar*) (A))[5])) +\
-                                                                       (((uint32_t) (((uchar*) (A))[4])) << 8) +\
-                                                                       (((uint32_t) (((uchar*) (A))[3])) << 16) +\
-                                                                       (((uint32_t) (((uchar*) (A))[2])) << 24)) +\
-                                                                       (((uint64_t) (((uint32_t) (((uchar*) (A))[1])) +\
-                                                                       (((uint32_t) (((uchar*) (A))[0]) << 8)))) << 32))
-
-#define bit_uint7korr(A)       ((uint64_t)(((uint32_t) (((uchar*) (A))[6])) +\
-                                                                       (((uint32_t) (((uchar*) (A))[5])) << 8) +\
-                                                                       (((uint32_t) (((uchar*) (A))[4])) << 16) +\
-                                                                       (((uint32_t) (((uchar*) (A))[3])) << 24)) +\
-                                                                       (((uint64_t) (((uint32_t) (((uchar*) (A))[2])) +\
-                                                                       (((uint32_t) (((uchar*) (A))[1])) << 8) +\
-                                                                       (((uint32_t) (((uchar*) (A))[0])) << 16))) << 32))
-
-
-#define bit_uint8korr(A) ((uint64_t)(((uint32_t) (((uchar*) (A))[7])) +\
-                                                                       (((uint32_t) (((uchar*) (A))[6])) << 8) +\
-                                                                       (((uint32_t) (((uchar*) (A))[5])) << 16) +\
-                                                                       (((uint32_t) (((uchar*) (A))[4])) << 24)) +\
-                                                                       (((uint64_t) (((uint32_t) (((uchar*) (A))[3])) +\
-                                                                       (((uint32_t) (((uchar*) (A))[2])) << 8) +\
-                                                                       (((uint32_t) (((uchar*) (A))[1])) << 16) +\
-                                                                       (((uint32_t) (((uchar*) (A))[0])) << 24))) << 32))
+#define bit_uint2korr(A) ((uint16_t) (((uint16_t) (((zend_uchar*) (A))[1])) +\
+                                                                       ((uint16_t) (((zend_uchar*) (A))[0]) << 8)))
+#define bit_uint3korr(A) ((uint32_t) (((uint32_t) (((zend_uchar*) (A))[2])) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[1])) << 8) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[0])) << 16)))
+
+#define bit_uint4korr(A) ((uint32_t) (((uint32_t) (((zend_uchar*) (A))[3])) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[2])) << 8) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[1])) << 16) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[0])) << 24)))
+
+#define bit_uint5korr(A)  ((uint64_t)(((uint32_t) ((zend_uchar) (A)[4])) +\
+                                  (((uint32_t) ((zend_uchar) (A)[3])) << 8) +\
+                                  (((uint32_t) ((zend_uchar) (A)[2])) << 16) +\
+                                  (((uint32_t) ((zend_uchar) (A)[1])) << 24)) +\
+                               (((uint64_t) ((zend_uchar) (A)[0])) << 32))
+
+#define bit_uint6korr(A)       ((uint64_t)(((uint32_t) (((zend_uchar*) (A))[5])) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[4])) << 8) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[3])) << 16) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[2])) << 24)) +\
+                                                                       (((uint64_t) (((uint32_t) (((zend_uchar*) (A))[1])) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[0]) << 8)))) << 32))
+
+#define bit_uint7korr(A)       ((uint64_t)(((uint32_t) (((zend_uchar*) (A))[6])) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[5])) << 8) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[4])) << 16) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[3])) << 24)) +\
+                                                                       (((uint64_t) (((uint32_t) (((zend_uchar*) (A))[2])) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[1])) << 8) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[0])) << 16))) << 32))
+
+
+#define bit_uint8korr(A) ((uint64_t)(((uint32_t) (((zend_uchar*) (A))[7])) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[6])) << 8) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[5])) << 16) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[4])) << 24)) +\
+                                                                       (((uint64_t) (((uint32_t) (((zend_uchar*) (A))[3])) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[2])) << 8) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[1])) << 16) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[0])) << 24))) << 32))
 
 
 /*
@@ -231,20 +227,20 @@ typedef unsigned long long uint64_t;
 /* Optimized store functions for Intel x86, non-valid for WIN64. __i386__ is GCC */
 #if defined(__i386__) && !defined(_WIN64)
 #define sint2korr(A)    (*((int16_t *) (A)))
-#define sint3korr(A)    ((int32_t) ((((uchar) (A)[2]) & 128) ? \
+#define sint3korr(A)    ((int32_t) ((((zend_uchar) (A)[2]) & 128) ? \
                    (((uint32_t) 255L << 24) | \
-                   (((uint32_t) (uchar) (A)[2]) << 16) |\
-                   (((uint32_t) (uchar) (A)[1]) << 8) | \
-                    ((uint32_t) (uchar) (A)[0])) : \
-                   (((uint32_t) (uchar) (A)[2]) << 16) |\
-                   (((uint32_t) (uchar) (A)[1]) << 8) | \
-                    ((uint32_t) (uchar) (A)[0])))
+                   (((uint32_t) (zend_uchar) (A)[2]) << 16) |\
+                   (((uint32_t) (zend_uchar) (A)[1]) << 8) | \
+                    ((uint32_t) (zend_uchar) (A)[0])) : \
+                   (((uint32_t) (zend_uchar) (A)[2]) << 16) |\
+                   (((uint32_t) (zend_uchar) (A)[1]) << 8) | \
+                    ((uint32_t) (zend_uchar) (A)[0])))
 #define sint4korr(A)  (*((long *) (A)))
 
 #define uint2korr(A)  (*((uint16_t *) (A)))
-#define uint3korr(A)  (uint32_t) (((uint32_t) ((uchar) (A)[0])) +\
-                               (((uint32_t) ((uchar) (A)[1])) << 8) +\
-                               (((uint32_t) ((uchar) (A)[2])) << 16))
+#define uint3korr(A)  (uint32_t) (((uint32_t) ((zend_uchar) (A)[0])) +\
+                               (((uint32_t) ((zend_uchar) (A)[1])) << 8) +\
+                               (((uint32_t) ((zend_uchar) (A)[2])) << 16))
 #define uint4korr(A)  (*((unsigned long *) (A)))
 
 
@@ -253,25 +249,25 @@ typedef unsigned long long uint64_t;
 #define sint8korr(A)    (*((int64_t *) (A)))
 #define int2store(T,A)    *((uint16_t*) (T))= (uint16_t) (A)
 #define int3store(T,A)   { \
-                  *(T)=  (uchar) ((A));\
-                  *(T+1)=(uchar) (((uint32_t) (A) >> 8));\
-                  *(T+2)=(uchar) (((A) >> 16)); }
+                  *(T)=  (zend_uchar) ((A));\
+                  *(T+1)=(zend_uchar) (((uint32_t) (A) >> 8));\
+                  *(T+2)=(zend_uchar) (((A) >> 16)); }
 #define int4store(T,A)    *((long *) (T))= (long) (A)
 #define int5store(T,A)    { \
-              *((uchar *)(T))= (uchar)((A));\
-              *(((uchar *)(T))+1)=(uchar) (((A) >> 8));\
-              *(((uchar *)(T))+2)=(uchar) (((A) >> 16));\
-              *(((uchar *)(T))+3)=(uchar) (((A) >> 24)); \
-              *(((uchar *)(T))+4)=(uchar) (((A) >> 32)); }
+              *((zend_uchar *)(T))= (zend_uchar)((A));\
+              *(((zend_uchar *)(T))+1)=(zend_uchar) (((A) >> 8));\
+              *(((zend_uchar *)(T))+2)=(zend_uchar) (((A) >> 16));\
+              *(((zend_uchar *)(T))+3)=(zend_uchar) (((A) >> 24)); \
+              *(((zend_uchar *)(T))+4)=(zend_uchar) (((A) >> 32)); }
 
 /* From Andrey Hristov, based on int5store() */
 #define int6store(T,A)    { \
-              *(((uchar *)(T)))= (uchar)((A));\
-              *(((uchar *)(T))+1))=(uchar) (((A) >> 8));\
-              *(((uchar *)(T))+2))=(uchar) (((A) >> 16));\
-              *(((uchar *)(T))+3))=(uchar) (((A) >> 24)); \
-              *(((uchar *)(T))+4))=(uchar) (((A) >> 32)); \
-              *(((uchar *)(T))+5))=(uchar) (((A) >> 40)); }
+              *(((zend_uchar *)(T)))= (zend_uchar)((A));\
+              *(((zend_uchar *)(T))+1))=(zend_uchar) (((A) >> 8));\
+              *(((zend_uchar *)(T))+2))=(zend_uchar) (((A) >> 16));\
+              *(((zend_uchar *)(T))+3))=(zend_uchar) (((A) >> 24)); \
+              *(((zend_uchar *)(T))+4))=(zend_uchar) (((A) >> 32)); \
+              *(((zend_uchar *)(T))+5))=(zend_uchar) (((A) >> 40)); }
 
 #define int8store(T,A)    *((uint64_t *) (T))= (uint64_t) (A)
 
@@ -291,55 +287,55 @@ typedef union {
 
 /* If we haven't defined sint2korr, which is because the platform is not x86 or it's WIN64 */
 #ifndef sint2korr
-#define sint2korr(A)    (int16_t) (((int16_t) ((uchar) (A)[0])) +\
+#define sint2korr(A)    (int16_t) (((int16_t) ((zend_uchar) (A)[0])) +\
                                  ((int16_t) ((int16_t) (A)[1]) << 8))
-#define sint3korr(A)    ((int32_t) ((((uchar) (A)[2]) & 128) ? \
+#define sint3korr(A)    ((int32_t) ((((zend_uchar) (A)[2]) & 128) ? \
                   (((uint32_t) 255L << 24) | \
-                  (((uint32_t) (uchar) (A)[2]) << 16) |\
-                  (((uint32_t) (uchar) (A)[1]) << 8) | \
-                   ((uint32_t) (uchar) (A)[0])) : \
-                  (((uint32_t) (uchar) (A)[2]) << 16) |\
-                  (((uint32_t) (uchar) (A)[1]) << 8) | \
-                  ((uint32_t) (uchar) (A)[0])))
-#define sint4korr(A)  (int32_t) (((int32_t) ((uchar) (A)[0])) +\
-                              (((int32_t) ((uchar) (A)[1]) << 8)) +\
-                              (((int32_t) ((uchar) (A)[2]) << 16)) +\
+                  (((uint32_t) (zend_uchar) (A)[2]) << 16) |\
+                  (((uint32_t) (zend_uchar) (A)[1]) << 8) | \
+                   ((uint32_t) (zend_uchar) (A)[0])) : \
+                  (((uint32_t) (zend_uchar) (A)[2]) << 16) |\
+                  (((uint32_t) (zend_uchar) (A)[1]) << 8) | \
+                  ((uint32_t) (zend_uchar) (A)[0])))
+#define sint4korr(A)  (int32_t) (((int32_t) ((zend_uchar) (A)[0])) +\
+                              (((int32_t) ((zend_uchar) (A)[1]) << 8)) +\
+                              (((int32_t) ((zend_uchar) (A)[2]) << 16)) +\
                               (((int32_t) ((int16_t) (A)[3]) << 24)))
 
 #define sint8korr(A)  (int64_t) uint8korr(A)
-#define uint2korr(A)  (uint16_t) (((uint16_t) ((uchar) (A)[0])) +\
-                               ((uint16_t) ((uchar) (A)[1]) << 8))
-#define uint3korr(A)  (uint32_t) (((uint32_t) ((uchar) (A)[0])) +\
-                               (((uint32_t) ((uchar) (A)[1])) << 8) +\
-                               (((uint32_t) ((uchar) (A)[2])) << 16))
-#define uint4korr(A)  (uint32_t) (((uint32_t) ((uchar) (A)[0])) +\
-                               (((uint32_t) ((uchar) (A)[1])) << 8) +\
-                               (((uint32_t) ((uchar) (A)[2])) << 16) +\
-                               (((uint32_t) ((uchar) (A)[3])) << 24))
-
-
-#define bit_uint8korr(A) ((uint64_t)(((uint32_t) (((uchar*) (A))[7])) +\
-                                                                       (((uint32_t) (((uchar*) (A))[6])) << 8) +\
-                                                                       (((uint32_t) (((uchar*) (A))[5])) << 16) +\
-                                                                       (((uint32_t) (((uchar*) (A))[4])) << 24)) +\
-                                                                       (((uint64_t) (((uint32_t) (((uchar*) (A))[3])) +\
-                                                                       (((uint32_t) (((uchar*) (A))[2])) << 8) +\
-                                                                       (((uint32_t) (((uchar*) (A))[1])) << 16) +\
-                                                                       (((uint32_t) (((uchar*) (A))[0])) << 24))) << 32))
-
-#define uint8korr(A)   ((uint64_t)(((uint32_t) ((uchar) (A)[0])) +\
-                                                                       (((uint32_t) ((uchar) (A)[1])) << 8) +\
-                                                                       (((uint32_t) ((uchar) (A)[2])) << 16) +\
-                                                                       (((uint32_t) ((uchar) (A)[3])) << 24)) +\
-                                                                       (((uint64_t) (((uint32_t) ((uchar) (A)[4])) +\
-                                                                       (((uint32_t) ((uchar) (A)[5])) << 8) +\
-                                                                       (((uint32_t) ((uchar) (A)[6])) << 16) +\
-                                                                       (((uint32_t) ((uchar) (A)[7])) << 24))) << 32))
+#define uint2korr(A)  (uint16_t) (((uint16_t) ((zend_uchar) (A)[0])) +\
+                               ((uint16_t) ((zend_uchar) (A)[1]) << 8))
+#define uint3korr(A)  (uint32_t) (((uint32_t) ((zend_uchar) (A)[0])) +\
+                               (((uint32_t) ((zend_uchar) (A)[1])) << 8) +\
+                               (((uint32_t) ((zend_uchar) (A)[2])) << 16))
+#define uint4korr(A)  (uint32_t) (((uint32_t) ((zend_uchar) (A)[0])) +\
+                               (((uint32_t) ((zend_uchar) (A)[1])) << 8) +\
+                               (((uint32_t) ((zend_uchar) (A)[2])) << 16) +\
+                               (((uint32_t) ((zend_uchar) (A)[3])) << 24))
+
+
+#define bit_uint8korr(A) ((uint64_t)(((uint32_t) (((zend_uchar*) (A))[7])) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[6])) << 8) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[5])) << 16) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[4])) << 24)) +\
+                                                                       (((uint64_t) (((uint32_t) (((zend_uchar*) (A))[3])) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[2])) << 8) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[1])) << 16) +\
+                                                                       (((uint32_t) (((zend_uchar*) (A))[0])) << 24))) << 32))
+
+#define uint8korr(A)   ((uint64_t)(((uint32_t) ((zend_uchar) (A)[0])) +\
+                                                                       (((uint32_t) ((zend_uchar) (A)[1])) << 8) +\
+                                                                       (((uint32_t) ((zend_uchar) (A)[2])) << 16) +\
+                                                                       (((uint32_t) ((zend_uchar) (A)[3])) << 24)) +\
+                                                                       (((uint64_t) (((uint32_t) ((zend_uchar) (A)[4])) +\
+                                                                       (((uint32_t) ((zend_uchar) (A)[5])) << 8) +\
+                                                                       (((uint32_t) ((zend_uchar) (A)[6])) << 16) +\
+                                                                       (((uint32_t) ((zend_uchar) (A)[7])) << 24))) << 32))
 
 
 #define int2store(T,A)  do { uint32_t def_temp= (uint32_t) (A) ;\
-                  *((uchar*) (T))  =  (uchar)(def_temp); \
-                  *((uchar*) (T+1)) = (uchar)((def_temp >> 8)); } while (0)
+                  *((zend_uchar*) (T))  =  (zend_uchar)(def_temp); \
+                  *((zend_uchar*) (T+1)) = (zend_uchar)((def_temp >> 8)); } while (0)
 #define int3store(T,A)  do { /*lint -save -e734 */\
                   *(((char *)(T)))   = (char) ((A));\
                   *(((char *)(T))+1) = (char) (((A) >> 8));\
index f25a79ad205a5cc1ca17f54687c3e41677d0e077..5148c5415542120d94cac8b9fffaf9535985fcac 100644 (file)
@@ -662,7 +662,7 @@ void php_mysqlnd_greet_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
 static
 void php_mysqlnd_crypt(zend_uchar *buffer, const zend_uchar *s1, const zend_uchar *s2, size_t len)
 {
-       const unsigned char *s1_end = s1 + len;
+       const zend_uchar *s1_end = s1 + len;
        while (s1 < s1_end) {
                *buffer++= *s1++ ^ *s2++;
        }
@@ -675,8 +675,8 @@ void php_mysqlnd_scramble(zend_uchar * const buffer, const zend_uchar * const sc
                                                  const zend_uchar * const password)
 {
        PHP_SHA1_CTX context;
-       unsigned char sha1[SHA1_MAX_LENGTH];
-       unsigned char sha2[SHA1_MAX_LENGTH];
+       zend_uchar sha1[SHA1_MAX_LENGTH];
+       zend_uchar sha2[SHA1_MAX_LENGTH];
        
 
        /* Phase 1: hash password */
@@ -686,17 +686,17 @@ void php_mysqlnd_scramble(zend_uchar * const buffer, const zend_uchar * const sc
 
        /* Phase 2: hash sha1 */
        PHP_SHA1Init(&context);
-       PHP_SHA1Update(&context, (unsigned char*)sha1, SHA1_MAX_LENGTH);
+       PHP_SHA1Update(&context, (zend_uchar*)sha1, SHA1_MAX_LENGTH);
        PHP_SHA1Final(sha2, &context);
 
        /* Phase 3: hash scramble + sha2 */
        PHP_SHA1Init(&context);
        PHP_SHA1Update(&context, scramble, SCRAMBLE_LENGTH);
-       PHP_SHA1Update(&context, (unsigned char*)sha2, SHA1_MAX_LENGTH);
+       PHP_SHA1Update(&context, (zend_uchar*)sha2, SHA1_MAX_LENGTH);
        PHP_SHA1Final(buffer, &context);
 
        /* let's crypt buffer now */
-       php_mysqlnd_crypt(buffer, (const uchar *)buffer, (const uchar *)sha1, SHA1_MAX_LENGTH);
+       php_mysqlnd_crypt(buffer, (const zend_uchar *)buffer, (const zend_uchar *)sha1, SHA1_MAX_LENGTH);
 }
 /* }}} */
 
@@ -744,8 +744,7 @@ size_t php_mysqlnd_auth_write(void *_packet, MYSQLND *conn TSRMLS_DC)
                /* In 4.1 we use CLIENT_SECURE_CONNECTION and thus the len of the buf should be passed */
                int1store(p, 20);
                p++;
-               php_mysqlnd_scramble((unsigned char*)p, packet->server_scramble_buf,
-                                                        (unsigned char *)packet->password);
+               php_mysqlnd_scramble((zend_uchar*)p, packet->server_scramble_buf, (zend_uchar*)packet->password);
                p+= 20;
        } else {
                /* Zero length */