summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2008-11-06 10:36:30 +0000
committerAndrey Hristov <andrey@php.net>2008-11-06 10:36:30 +0000
commit0b46d6b5a53efb4e9093757f437c3057cc3818d6 (patch)
treec8baa8ea5fe53b4e7860c4773c8e3ca8ea56f139
parenta5368aeb7362d9135e5462d478d3631afccd44d1 (diff)
downloadphp-git-0b46d6b5a53efb4e9093757f437c3057cc3818d6.tar.gz
Get rid of many defines (which simplifies the code a lot),
as well as uint->unsigned int
-rw-r--r--ext/mysqlnd/config-win.h57
-rw-r--r--ext/mysqlnd/mysqlnd.c26
-rw-r--r--ext/mysqlnd/mysqlnd.h6
-rw-r--r--ext/mysqlnd/mysqlnd_block_alloc.c6
-rw-r--r--ext/mysqlnd/mysqlnd_charset.c60
-rw-r--r--ext/mysqlnd/mysqlnd_debug.c16
-rw-r--r--ext/mysqlnd/mysqlnd_debug.h8
-rw-r--r--ext/mysqlnd/mysqlnd_loaddata.c6
-rw-r--r--ext/mysqlnd/mysqlnd_portability.h117
-rw-r--r--ext/mysqlnd/mysqlnd_priv.h4
-rw-r--r--ext/mysqlnd/mysqlnd_ps_codec.c28
-rw-r--r--ext/mysqlnd/mysqlnd_result.c10
-rw-r--r--ext/mysqlnd/mysqlnd_structs.h40
-rw-r--r--ext/mysqlnd/mysqlnd_wireprotocol.c6
-rw-r--r--ext/mysqlnd/mysqlnd_wireprotocol.h4
15 files changed, 168 insertions, 226 deletions
diff --git a/ext/mysqlnd/config-win.h b/ext/mysqlnd/config-win.h
index 104df4fc4c..485f88258c 100644
--- a/ext/mysqlnd/config-win.h
+++ b/ext/mysqlnd/config-win.h
@@ -18,10 +18,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
#define SYSTEM_TYPE "Win95/Win98"
#endif
-#ifdef _WIN64
-#define MACHINE_TYPE "ia64" /* Define to machine type name */
-#else
-#define MACHINE_TYPE "i32" /* Define to machine type name */
+#ifndef _WIN64
#ifndef _WIN32
#define _WIN32 /* Compatible with old source */
#endif
@@ -40,10 +37,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
/* Type information */
/*
-typedef unsigned short ushort;
typedef unsigned int uint;
-typedef unsigned __int64 ulonglong;
-typedef __int64 longlong;
*/
typedef int sigset_t;
#define longlong_defined
@@ -58,43 +52,40 @@ typedef int sigset_t;
#define sint2korr(A) (*((int16_t *) (A)))
#define sint3korr(A) ((int32_t) ((((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) 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 *) (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))
+ (((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 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)= (uchar) ((A));\
+ *(T+1)=(uchar) (((uint32_t) (A) >> 8));\
+ *(T+2)=(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)= (uchar)((A));\
+ *((T)+1)=(uchar) (((A) >> 8));\
+ *((T)+2)=(uchar) (((A) >> 16));\
+ *((T)+3)=(uchar) (((A) >> 24)); \
+ *((T)+4)=(uchar) (((A) >> 32)); }
#define int8store(T,A) *((uint64_t *) (T))= (uint64_t) (A)
-#define doubleget(V,M) { *((int32_t *) &V) = *((int32_t*) M); \
- *(((int32_t *) &V)+1) = *(((int32_t*) M)+1); }
-#define doublestore(T,V) { *((int32_t *) T) = *((int32_t*) &V); \
- *(((int32_t *) T)+1) = *(((int32_t*) &V)+1); }
+#define float8get(V,M) { *((int32_t *) &V) = *((int32_t*) M); \
+ *(((int32_t *) &V)+1) = *(((int32_t*) M)+1); }
+#define float8store(T,V) { *((int32_t *) T) = *((int32_t*) &V); \
+ *(((int32_t *) T)+1) = *(((int32_t*) &V)+1); }
#define float4get(V,M) { *((int32_t *) &(V)) = *((int32_t*) (M)); }
-#define float8get(V,M) doubleget((V),(M))
-#define float4store(V,M) memcpy((char*) V,(char*) (&M),sizeof(float))
-#define float8store(V,M) doublestore((V),(M))
#endif /* _WIN64 */
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c
index 6e66531082..9506c24abc 100644
--- a/ext/mysqlnd/mysqlnd.c
+++ b/ext/mysqlnd/mysqlnd.c
@@ -439,7 +439,7 @@ MYSQLND_METHOD(mysqlnd_conn, set_server_option)(MYSQLND * const conn,
char buffer[2];
DBG_ENTER("mysqlnd_conn::set_server_option");
- int2store(buffer, (uint) option);
+ int2store(buffer, (unsigned int) option);
ret = mysqlnd_simple_command(conn, COM_SET_OPTION, buffer, sizeof(buffer),
PROT_EOF_PACKET, FALSE, TRUE TSRMLS_CC);
DBG_RETURN(ret);
@@ -758,12 +758,12 @@ PHPAPI MYSQLND *mysqlnd_connect(MYSQLND *conn,
mysqlnd_local_infile_default(conn);
{
- uint buf_size;
- buf_size = MYSQLND_G(net_read_buffer_size); /* this is long, cast to uint*/
+ unsigned int buf_size;
+ buf_size = MYSQLND_G(net_read_buffer_size); /* this is long, cast to unsigned int*/
conn->m->set_client_option(conn, MYSQLND_OPT_NET_READ_BUFFER_SIZE,
(char *)&buf_size TSRMLS_CC);
- buf_size = MYSQLND_G(net_cmd_buffer_size); /* this is long, cast to uint*/
+ buf_size = MYSQLND_G(net_cmd_buffer_size); /* this is long, cast to unsigned int*/
conn->m->set_client_option(conn, MYSQLND_OPT_NET_CMD_BUFFER_SIZE,
(char *)&buf_size TSRMLS_CC);
}
@@ -781,7 +781,7 @@ PHPAPI MYSQLND *mysqlnd_connect(MYSQLND *conn,
conn->result_set_memory_pool = mysqlnd_mempool_create(16000 TSRMLS_CC);
#if PHP_MAJOR_VERSION >= 6
{
- uint as_unicode = 1;
+ unsigned int as_unicode = 1;
conn->m->set_client_option(conn, MYSQLND_OPT_NUMERIC_AND_DATETIME_AS_UNICODE,
(char *)&as_unicode TSRMLS_CC);
DBG_INF("unicode set");
@@ -1702,11 +1702,11 @@ MYSQLND_METHOD(mysqlnd_conn, set_client_option)(MYSQLND * const conn,
switch (option) {
#if PHP_MAJOR_VERSION >= 6
case MYSQLND_OPT_NUMERIC_AND_DATETIME_AS_UNICODE:
- conn->options.numeric_and_datetime_as_unicode = *(uint*) value;
+ conn->options.numeric_and_datetime_as_unicode = *(unsigned int*) value;
break;
#endif
case MYSQLND_OPT_NET_CMD_BUFFER_SIZE:
- conn->net.cmd_buffer.length = *(uint*) value;
+ conn->net.cmd_buffer.length = *(unsigned int*) value;
if (!conn->net.cmd_buffer.buffer) {
conn->net.cmd_buffer.buffer = mnd_pemalloc(conn->net.cmd_buffer.length, conn->persistent);
} else {
@@ -1716,26 +1716,26 @@ MYSQLND_METHOD(mysqlnd_conn, set_client_option)(MYSQLND * const conn,
}
break;
case MYSQLND_OPT_NET_READ_BUFFER_SIZE:
- conn->options.net_read_buffer_size = *(uint*) value;
+ conn->options.net_read_buffer_size = *(unsigned int*) value;
break;
#ifdef MYSQLND_STRING_TO_INT_CONVERSION
case MYSQLND_OPT_INT_AND_FLOAT_NATIVE:
- conn->options.int_and_float_native = *(uint*) value;
+ conn->options.int_and_float_native = *(unsigned int*) value;
break;
#endif
case MYSQL_OPT_CONNECT_TIMEOUT:
- conn->options.timeout_connect = *(uint*) value;
+ conn->options.timeout_connect = *(unsigned int*) value;
break;
#ifdef WHEN_SUPPORTED_BY_MYSQLI
case MYSQL_OPT_READ_TIMEOUT:
- conn->options.timeout_read = *(uint*) value;
+ conn->options.timeout_read = *(unsigned int*) value;
break;
case MYSQL_OPT_WRITE_TIMEOUT:
- conn->options.timeout_write = *(uint*) value;
+ conn->options.timeout_write = *(unsigned int*) value;
break;
#endif
case MYSQL_OPT_LOCAL_INFILE:
- if (!value || (*(uint*) value) ? 1 : 0) {
+ if (!value || (*(unsigned int*) value) ? 1 : 0) {
conn->options.flags |= CLIENT_LOCAL_FILES;
} else {
conn->options.flags &= ~CLIENT_LOCAL_FILES;
diff --git a/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h
index 817fef2c54..39de34f695 100644
--- a/ext/mysqlnd/mysqlnd.h
+++ b/ext/mysqlnd/mysqlnd.h
@@ -23,8 +23,8 @@
#ifndef MYSQLND_H
#define MYSQLND_H
-#define MYSQLND_VERSION "mysqlnd 5.0.4-dev - 080501 - $Revision$"
-#define MYSQLND_VERSION_ID 50004
+#define MYSQLND_VERSION "mysqlnd 5.0.5-dev - 081106 - $Revision$"
+#define MYSQLND_VERSION_ID 50005
/* This forces inlining of some accessor functions */
#define MYSQLND_USE_OPTIMISATIONS 1
@@ -74,7 +74,7 @@ PHPAPI void _mysqlnd_end_psession(MYSQLND *conn TSRMLS_DC);
PHPAPI void mysqlnd_minfo_print_hash(zval *values);
#define mysqlnd_thread_safe() TRUE
-PHPAPI const MYSQLND_CHARSET * mysqlnd_find_charset_nr(uint charsetno);
+PHPAPI const MYSQLND_CHARSET * mysqlnd_find_charset_nr(unsigned int charsetno);
PHPAPI const MYSQLND_CHARSET * mysqlnd_find_charset_name(const char * const charsetname);
diff --git a/ext/mysqlnd/mysqlnd_block_alloc.c b/ext/mysqlnd/mysqlnd_block_alloc.c
index 0bc85b25cc..1991e413f2 100644
--- a/ext/mysqlnd/mysqlnd_block_alloc.c
+++ b/ext/mysqlnd/mysqlnd_block_alloc.c
@@ -31,7 +31,7 @@
static void
mysqlnd_mempool_free_contents(MYSQLND_MEMORY_POOL * pool TSRMLS_DC)
{
- uint i;
+ unsigned int i;
DBG_ENTER("mysqlnd_mempool_dtor");
for (i = 0; i < pool->free_chunk_list_elements; i++) {
MYSQLND_MEMORY_POOL_CHUNK * chunk = pool->free_chunk_list[i];
@@ -76,7 +76,7 @@ mysqlnd_mempool_free_chunk(MYSQLND_MEMORY_POOL_CHUNK * chunk, zend_bool cache_it
/* {{{ mysqlnd_mempool_resize_chunk */
static void
-mysqlnd_mempool_resize_chunk(MYSQLND_MEMORY_POOL_CHUNK * chunk, uint size TSRMLS_DC)
+mysqlnd_mempool_resize_chunk(MYSQLND_MEMORY_POOL_CHUNK * chunk, unsigned int size TSRMLS_DC)
{
DBG_ENTER("mysqlnd_mempool_resize_chunk");
if (chunk->from_pool) {
@@ -124,7 +124,7 @@ mysqlnd_mempool_resize_chunk(MYSQLND_MEMORY_POOL_CHUNK * chunk, uint size TSRMLS
/* {{{ mysqlnd_mempool_get_chunk */
static
-MYSQLND_MEMORY_POOL_CHUNK * mysqlnd_mempool_get_chunk(MYSQLND_MEMORY_POOL * pool, uint size TSRMLS_DC)
+MYSQLND_MEMORY_POOL_CHUNK * mysqlnd_mempool_get_chunk(MYSQLND_MEMORY_POOL * pool, unsigned int size TSRMLS_DC)
{
MYSQLND_MEMORY_POOL_CHUNK *chunk = NULL;
DBG_ENTER("mysqlnd_mempool_get_chunk");
diff --git a/ext/mysqlnd/mysqlnd_charset.c b/ext/mysqlnd/mysqlnd_charset.c
index 5e72c7decd..5c323d6b65 100644
--- a/ext/mysqlnd/mysqlnd_charset.c
+++ b/ext/mysqlnd/mysqlnd_charset.c
@@ -25,7 +25,7 @@
/* {{{ utf8 functions */
-static uint check_mb_utf8_sequence(const char *start, const char *end)
+static unsigned int check_mb_utf8_sequence(const char *start, const char *end)
{
zend_uchar c;
@@ -63,13 +63,13 @@ static uint check_mb_utf8_sequence(const char *start, const char *end)
return 0;
}
-static uint check_mb_utf8_valid(const char *start, const char *end)
+static unsigned int check_mb_utf8_valid(const char *start, const char *end)
{
- uint len = check_mb_utf8_sequence(start, end);
+ unsigned int len = check_mb_utf8_sequence(start, end);
return (len > 1)? len:0;
}
-static uint mysqlnd_mbcharlen_utf8(uint utf8)
+static unsigned int mysqlnd_mbcharlen_utf8(unsigned int utf8)
{
if (utf8 < 0x80) {
return 1; /* single byte character */
@@ -91,19 +91,19 @@ static uint mysqlnd_mbcharlen_utf8(uint utf8)
/* {{{ big5 functions */
-#define valid_big5head(c) (0xA1 <= (uint)(c) && (uint)(c) <= 0xF9)
-#define valid_big5tail(c) ((0x40 <= (uint)(c) && (uint)(c) <= 0x7E) || \
- (0xA1 <= (uint)(c) && (uint)(c) <= 0xFE))
+#define valid_big5head(c) (0xA1 <= (unsigned int)(c) && (unsigned int)(c) <= 0xF9)
+#define valid_big5tail(c) ((0x40 <= (unsigned int)(c) && (unsigned int)(c) <= 0x7E) || \
+ (0xA1 <= (unsigned int)(c) && (unsigned int)(c) <= 0xFE))
#define isbig5code(c,d) (isbig5head(c) && isbig5tail(d))
-static uint check_mb_big5(const char *start, const char *end)
+static unsigned int check_mb_big5(const char *start, const char *end)
{
return (valid_big5head(*(start)) && (end - start) > 1 && valid_big5tail(*(start + 1)) ? 2 : 0);
}
-static uint mysqlnd_mbcharlen_big5(uint big5)
+static unsigned int mysqlnd_mbcharlen_big5(unsigned int big5)
{
return (valid_big5head(big5)) ? 2 : 1;
}
@@ -115,14 +115,14 @@ static uint mysqlnd_mbcharlen_big5(uint big5)
#define valid_cp932tail(c) ((0x40 <= (c) && (c) <= 0x7E) || (0x80 <= (c) && c <= 0xFC))
-static uint check_mb_cp932(const char *start, const char *end)
+static unsigned int check_mb_cp932(const char *start, const char *end)
{
return (valid_cp932head((zend_uchar)start[0]) && (end - start > 1) &&
valid_cp932tail((zend_uchar)start[1])) ? 2 : 0;
}
-static uint mysqlnd_mbcharlen_cp932(uint cp932)
+static unsigned int mysqlnd_mbcharlen_cp932(unsigned int cp932)
{
return (valid_cp932head((zend_uchar)cp932)) ? 2 : 1;
}
@@ -132,7 +132,7 @@ static uint mysqlnd_mbcharlen_cp932(uint cp932)
/* {{{ euckr functions */
#define valid_euckr(c) ((0xA1 <= (zend_uchar)(c) && (zend_uchar)(c) <= 0xFE))
-static uint check_mb_euckr(const char *start, const char *end)
+static unsigned int check_mb_euckr(const char *start, const char *end)
{
if (end - start <= 1) {
return 0; /* invalid length */
@@ -147,7 +147,7 @@ static uint check_mb_euckr(const char *start, const char *end)
}
-static uint mysqlnd_mbcharlen_euckr(uint kr)
+static unsigned int mysqlnd_mbcharlen_euckr(unsigned int kr)
{
return (valid_euckr(kr)) ? 2 : 1;
}
@@ -160,7 +160,7 @@ static uint mysqlnd_mbcharlen_euckr(uint kr)
#define valid_eucjpms_ss2(c) (((c) & 0xFF) == 0x8E)
#define valid_eucjpms_ss3(c) (((c) & 0xFF) == 0x8F)
-static uint check_mb_eucjpms(const char *start, const char *end)
+static unsigned int check_mb_eucjpms(const char *start, const char *end)
{
if (*((zend_uchar *)start) < 0x80) {
return 0; /* invalid eucjpms character */
@@ -179,7 +179,7 @@ static uint check_mb_eucjpms(const char *start, const char *end)
}
-static uint mysqlnd_mbcharlen_eucjpms(uint jpms)
+static unsigned int mysqlnd_mbcharlen_eucjpms(unsigned int jpms)
{
if (valid_eucjpms(jpms) || valid_eucjpms_ss2(jpms)) {
return 2;
@@ -197,14 +197,14 @@ static uint mysqlnd_mbcharlen_eucjpms(uint jpms)
#define valid_gb2312_tail(c) (0xA1 <= (zend_uchar)(c) && (zend_uchar)(c) <= 0xFE)
-static uint check_mb_gb2312(const char *start, const char *end)
+static unsigned int check_mb_gb2312(const char *start, const char *end)
{
- return (valid_gb2312_head((uint)start[0]) && end - start > 1 &&
- valid_gb2312_tail((uint)start[1])) ? 2 : 0;
+ return (valid_gb2312_head((unsigned int)start[0]) && end - start > 1 &&
+ valid_gb2312_tail((unsigned int)start[1])) ? 2 : 0;
}
-static uint mysqlnd_mbcharlen_gb2312(uint gb)
+static unsigned int mysqlnd_mbcharlen_gb2312(unsigned int gb)
{
return (valid_gb2312_head(gb)) ? 2 : 1;
}
@@ -215,12 +215,12 @@ static uint mysqlnd_mbcharlen_gb2312(uint gb)
#define valid_gbk_head(c) (0x81<=(zend_uchar)(c) && (zend_uchar)(c)<=0xFE)
#define valid_gbk_tail(c) ((0x40<=(zend_uchar)(c) && (zend_uchar)(c)<=0x7E) || (0x80<=(zend_uchar)(c) && (zend_uchar)(c)<=0xFE))
-static uint check_mb_gbk(const char *start, const char *end)
+static unsigned int check_mb_gbk(const char *start, const char *end)
{
return (valid_gbk_head(start[0]) && (end) - (start) > 1 && valid_gbk_tail(start[1])) ? 2 : 0;
}
-static uint mysqlnd_mbcharlen_gbk(uint gbk)
+static unsigned int mysqlnd_mbcharlen_gbk(unsigned int gbk)
{
return (valid_gbk_head(gbk) ? 2 : 1);
}
@@ -234,13 +234,13 @@ static uint mysqlnd_mbcharlen_gbk(uint gbk)
(0x80 <= (c) && (c) <= 0x7C))
-static uint check_mb_sjis(const char *start, const char *end)
+static unsigned int check_mb_sjis(const char *start, const char *end)
{
return (valid_sjis_head((zend_uchar)start[0]) && (end - start) > 1 && valid_sjis_tail((zend_uchar)start[1])) ? 2 : 0;
}
-static uint mysqlnd_mbcharlen_sjis(uint sjis)
+static unsigned int mysqlnd_mbcharlen_sjis(unsigned int sjis)
{
return (valid_sjis_head((zend_uchar)sjis)) ? 2 : 1;
}
@@ -248,12 +248,12 @@ static uint mysqlnd_mbcharlen_sjis(uint sjis)
/* {{{ ucs2 functions */
-static uint check_mb_ucs2(const char *start __attribute((unused)), const char *end __attribute((unused)))
+static unsigned int check_mb_ucs2(const char *start __attribute((unused)), const char *end __attribute((unused)))
{
return 2; /* always 2 */
}
-static uint mysqlnd_mbcharlen_ucs2(uint ucs2 __attribute((unused)))
+static unsigned int mysqlnd_mbcharlen_ucs2(unsigned int ucs2 __attribute((unused)))
{
return 2; /* always 2 */
}
@@ -266,7 +266,7 @@ static uint mysqlnd_mbcharlen_ucs2(uint ucs2 __attribute((unused)))
#define valid_ujis_ss2(c) (((c)&0xFF) == 0x8E)
#define valid_ujis_ss3(c) (((c)&0xFF) == 0x8F)
-static uint check_mb_ujis(const char *start, const char *end)
+static unsigned int check_mb_ujis(const char *start, const char *end)
{
if (*(uchar*)start < 0x80) {
return 0; /* invalid ujis character */
@@ -284,7 +284,7 @@ static uint check_mb_ujis(const char *start, const char *end)
}
-static uint mysqlnd_mbcharlen_ujis(uint ujis)
+static unsigned int mysqlnd_mbcharlen_ujis(unsigned int ujis)
{
return (valid_ujis(ujis)? 2: valid_ujis_ss2(ujis)? 2: valid_ujis_ss3(ujis)? 3: 1);
}
@@ -430,7 +430,7 @@ const MYSQLND_CHARSET mysqlnd_charsets[] =
/* {{{ mysqlnd_find_charset_nr */
-PHPAPI const MYSQLND_CHARSET * mysqlnd_find_charset_nr(uint charsetnr)
+PHPAPI const MYSQLND_CHARSET * mysqlnd_find_charset_nr(unsigned int charsetnr)
{
const MYSQLND_CHARSET * c = mysqlnd_charsets;
@@ -473,7 +473,7 @@ PHPAPI ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, char
DBG_ENTER("mysqlnd_cset_escape_quotes");
for (;escapestr < end; escapestr++) {
- uint len = 0;
+ unsigned int len = 0;
/* check unicode characters */
if (cset->char_maxlen > 1 && (len = cset->mb_valid(escapestr, end))) {
@@ -528,7 +528,7 @@ PHPAPI ulong mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, cha
for (;escapestr < end; escapestr++) {
char esc = '\0';
- uint len = 0;
+ unsigned int len = 0;
/* check unicode characters */
if (cset->char_maxlen > 1 && (len = cset->mb_valid(escapestr, end))) {
diff --git a/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c
index f6eeb695f5..e82935d2a6 100644
--- a/ext/mysqlnd/mysqlnd_debug.c
+++ b/ext/mysqlnd/mysqlnd_debug.c
@@ -89,7 +89,7 @@ MYSQLND_METHOD(mysqlnd_debug, log)(MYSQLND_DEBUG * self,
enum_func_status ret;
int i;
char * message_line;
- uint message_line_len;
+ unsigned int message_line_len;
unsigned int flags = self->flags;
char pid_buffer[10], time_buffer[30], file_buffer[200],
line_buffer[6], level_buffer[7];
@@ -194,7 +194,7 @@ MYSQLND_METHOD(mysqlnd_debug, log_va)(MYSQLND_DEBUG *self,
int i;
enum_func_status ret;
char * message_line, *buffer;
- uint message_line_len;
+ unsigned int message_line_len;
va_list args;
unsigned int flags = self->flags;
char pid_buffer[10], time_buffer[30], file_buffer[200],
@@ -301,7 +301,7 @@ MYSQLND_METHOD(mysqlnd_debug, log_va)(MYSQLND_DEBUG *self,
static zend_bool
MYSQLND_METHOD(mysqlnd_debug, func_enter)(MYSQLND_DEBUG * self,
unsigned int line, const char * const file,
- char * func_name, uint func_name_len)
+ char * func_name, unsigned int func_name_len)
{
#ifdef MYSQLND_THREADED
MYSQLND_ZTS(self);
@@ -422,7 +422,7 @@ enum mysqlnd_debug_parser_state
static void
MYSQLND_METHOD(mysqlnd_debug, set_mode)(MYSQLND_DEBUG * self, const char * const mode)
{
- uint mode_len = strlen(mode), i;
+ unsigned int mode_len = strlen(mode), i;
enum mysqlnd_debug_parser_state state = PARSER_WAIT_MODIFIER;
self->flags = 0;
@@ -487,7 +487,7 @@ MYSQLND_METHOD(mysqlnd_debug, set_mode)(MYSQLND_DEBUG * self, const char * const
if (mode[j] == ',' || mode[j] == ':') {
if (j > i + 2) {
char func_name[1024];
- uint func_name_len = MIN(sizeof(func_name) - 1, j - i - 1);
+ unsigned int func_name_len = MIN(sizeof(func_name) - 1, j - i - 1);
memcpy(func_name, mode + i + 1, func_name_len);
func_name[func_name_len] = '\0';
@@ -719,7 +719,7 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D)
/* {{{ _mysqlnd_ecalloc */
-void * _mysqlnd_ecalloc(uint nmemb, size_t size MYSQLND_MEM_D)
+void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D)
{
void *ret;
DBG_ENTER(mysqlnd_ecalloc_name);
@@ -744,7 +744,7 @@ void * _mysqlnd_ecalloc(uint nmemb, size_t size MYSQLND_MEM_D)
/* {{{ _mysqlnd_pecalloc */
-void * _mysqlnd_pecalloc(uint nmemb, size_t size, zend_bool persistent MYSQLND_MEM_D)
+void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent MYSQLND_MEM_D)
{
void *ret;
DBG_ENTER(mysqlnd_pecalloc_name);
@@ -889,7 +889,7 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D)
/* {{{ _mysqlnd_calloc */
-void * _mysqlnd_calloc(uint nmemb, size_t size MYSQLND_MEM_D)
+void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D)
{
void *ret;
DBG_ENTER(mysqlnd_calloc_name);
diff --git a/ext/mysqlnd/mysqlnd_debug.h b/ext/mysqlnd/mysqlnd_debug.h
index 7b1ba88ae7..789d1fac1a 100644
--- a/ext/mysqlnd/mysqlnd_debug.h
+++ b/ext/mysqlnd/mysqlnd_debug.h
@@ -36,7 +36,7 @@ struct st_mysqlnd_debug_methods
enum_func_status (*log_va)(MYSQLND_DEBUG *self, unsigned int line, const char * const file,
unsigned int level, const char * type, const char *format, ...);
zend_bool (*func_enter)(MYSQLND_DEBUG *self, unsigned int line, const char * const file,
- char * func_name, uint func_name_len);
+ char * func_name, unsigned int func_name_len);
enum_func_status (*func_leave)(MYSQLND_DEBUG *self, unsigned int line, const char * const file);
enum_func_status (*close)(MYSQLND_DEBUG *self);
enum_func_status (*free_handle)(MYSQLND_DEBUG *self);
@@ -65,14 +65,14 @@ MYSQLND_DEBUG *mysqlnd_debug_init(TSRMLS_D);
void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D);
void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D);
-void * _mysqlnd_ecalloc(uint nmemb, size_t size MYSQLND_MEM_D);
-void * _mysqlnd_pecalloc(uint nmemb, size_t size, zend_bool persistent MYSQLND_MEM_D);
+void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D);
+void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent MYSQLND_MEM_D);
void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D);
void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQLND_MEM_D);
void _mysqlnd_efree(void *ptr MYSQLND_MEM_D);
void _mysqlnd_pefree(void *ptr, zend_bool persistent MYSQLND_MEM_D);
void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D);
-void * _mysqlnd_calloc(uint nmemb, size_t size MYSQLND_MEM_D);
+void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D);
void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D);
void _mysqlnd_free(void *ptr MYSQLND_MEM_D);
diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c
index 7f421995ca..b86d5319f0 100644
--- a/ext/mysqlnd/mysqlnd_loaddata.c
+++ b/ext/mysqlnd/mysqlnd_loaddata.c
@@ -86,7 +86,7 @@ int mysqlnd_local_infile_init(void **ptr, char *filename, void **userdata TSRMLS
/* {{{ mysqlnd_local_infile_read */
static
-int mysqlnd_local_infile_read(void *ptr, char *buf, uint buf_len TSRMLS_DC)
+int mysqlnd_local_infile_read(void *ptr, char *buf, unsigned int buf_len TSRMLS_DC)
{
MYSQLND_INFILE_INFO *info = (MYSQLND_INFILE_INFO *)ptr;
int count;
@@ -107,7 +107,7 @@ int mysqlnd_local_infile_read(void *ptr, char *buf, uint buf_len TSRMLS_DC)
/* {{{ mysqlnd_local_infile_error */
static
-int mysqlnd_local_infile_error(void *ptr, char *error_buf, uint error_buf_len TSRMLS_DC)
+int mysqlnd_local_infile_error(void *ptr, char *error_buf, unsigned int error_buf_len TSRMLS_DC)
{
MYSQLND_INFILE_INFO *info = (MYSQLND_INFILE_INFO *)ptr;
@@ -177,7 +177,7 @@ mysqlnd_handle_local_infile(MYSQLND *conn, const char *filename, zend_bool *is_w
char *buf;
char empty_packet[MYSQLND_HEADER_SIZE];
enum_func_status result = FAIL;
- uint buflen = 4096;
+ unsigned int buflen = 4096;
void *info = NULL;
int bufsize;
size_t ret;
diff --git a/ext/mysqlnd/mysqlnd_portability.h b/ext/mysqlnd/mysqlnd_portability.h
index b7f8b93832..cdc6273397 100644
--- a/ext/mysqlnd/mysqlnd_portability.h
+++ b/ext/mysqlnd/mysqlnd_portability.h
@@ -179,10 +179,6 @@ typedef unsigned long long uint64_t;
#endif
-typedef int64_t longlong;
-typedef uint64_t ulonglong;
-
-
#define int1store(T,A) do { *((zend_uchar*) (T)) = (A); } while(0)
#define uint1korr(A) (*(((uint8_t*)(A))))
@@ -198,33 +194,33 @@ typedef uint64_t ulonglong;
(((uint32_t) (((uchar*) (A))[1])) << 16) +\
(((uint32_t) (((uchar*) (A))[0])) << 24)))
-#define bit_uint5korr(A) ((ulonglong)(((uint32_t) ((uchar) (A)[4])) +\
+#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)) +\
- (((ulonglong) ((uchar) (A)[0])) << 32))
+ (((uint64_t) ((uchar) (A)[0])) << 32))
-#define bit_uint6korr(A) ((ulonglong)(((uint32_t) (((uchar*) (A))[5])) +\
+#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)) +\
- (((ulonglong) (((uint32_t) (((uchar*) (A))[1])) +\
+ (((uint64_t) (((uint32_t) (((uchar*) (A))[1])) +\
(((uint32_t) (((uchar*) (A))[0]) << 8)))) << 32))
-#define bit_uint7korr(A) ((ulonglong)(((uint32_t) (((uchar*) (A))[6])) +\
+#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)) +\
- (((ulonglong) (((uint32_t) (((uchar*) (A))[2])) +\
+ (((uint64_t) (((uint32_t) (((uchar*) (A))[2])) +\
(((uint32_t) (((uchar*) (A))[1])) << 8) +\
(((uint32_t) (((uchar*) (A))[0])) << 16))) << 32))
-#define bit_uint8korr(A) ((ulonglong)(((uint32_t) (((uchar*) (A))[7])) +\
+#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)) +\
- (((ulonglong) (((uint32_t) (((uchar*) (A))[3])) +\
+ (((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))
@@ -256,8 +252,8 @@ typedef uint64_t ulonglong;
-#define uint8korr(A) (*((ulonglong *) (A)))
-#define sint8korr(A) (*((longlong *) (A)))
+#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));\
@@ -280,25 +276,23 @@ typedef uint64_t ulonglong;
*(((uchar *)(T))+4))=(uchar) (((A) >> 32)); \
*(((uchar *)(T))+5))=(uchar) (((A) >> 40)); }
-#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
+#define int8store(T,A) *((uint64_t *) (T))= (uint64_t) (A)
typedef union {
double v;
long m[2];
-} doubleget_union;
-#define doubleget(V,M) { ((doubleget_union *)&(V))->m[0] = *((long*) (M)); \
- ((doubleget_union *)&(V))->m[1] = *(((long*) (M))+1); }
-#define doublestore(T,V) { *((long *) (T)) = ((doubleget_union *)&(V))->m[0]; \
- *(((long *) (T))+1) = ((doubleget_union *)&(V))->m[1]; }
+} float8get_union;
+#define float8get(V,M) { ((float8get_union *)&(V))->m[0] = *((long*) (M)); \
+ ((float8get_union *)&(V))->m[1] = *(((long*) (M))+1); }
+#define float8store(T,V) { *((long *) (T)) = ((float8get_union *)&(V))->m[0]; \
+ *(((long *) (T))+1) = ((float8get_union *)&(V))->m[1]; }
#define float4get(V,M) { *((float *) &(V)) = *((float*) (M)); }
-#define float8get(V,M) doubleget((V),(M))
-/* From Andrey Hristov based on doubleget */
+/* From Andrey Hristov based on float8get */
#define floatget(V,M) memcpy((char*) &(V),(char*) (M),sizeof(float))
-#define floatstore float4store
-#define float4store(V,M) memcpy((char*) (V),(char*) (&M),sizeof(float))
-#define float8store(V,M) doublestore((V),(M))
#endif /* __i386__ */
+
+/* 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])) +\
((int16_t) ((int16_t) (A)[1]) << 8))
@@ -315,7 +309,7 @@ typedef union {
(((int32_t) ((uchar) (A)[2]) << 16)) +\
(((int32_t) ((int16_t) (A)[3]) << 24)))
-#define sint8korr(A) (longlong) uint8korr(A)
+#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])) +\
@@ -327,20 +321,20 @@ typedef union {
(((uint32_t) ((uchar) (A)[3])) << 24))
-#define bit_uint8korr(A) ((ulonglong)(((uint32_t) (((uchar*) (A))[7])) +\
+#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)) +\
- (((ulonglong) (((uint32_t) (((uchar*) (A))[3])) +\
+ (((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) ((ulonglong)(((uint32_t) ((uchar) (A)[0])) +\
+#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)) +\
- (((ulonglong) (((uint32_t) ((uchar) (A)[4])) +\
+ (((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))
@@ -378,12 +372,6 @@ typedef union {
int4store((T+4),def_temp2); \
}
#ifdef WORDS_BIGENDIAN
-#define float4store(T,A) do { \
- *(((char *)(T))) = (char) ((char *) &A)[3];\
- *(((char *)(T))+1) = (char) ((char *) &A)[2];\
- *(((char *)(T))+2) = (char) ((char *) &A)[1];\
- *(((char *)(T))+3) = (char) ((char *) &A)[0]; } while (0)
-
#define float4get(V,M) do { float def_temp;\
((char*) &def_temp)[0] = (M)[3];\
((char*) &def_temp)[1] = (M)[2];\
@@ -413,10 +401,9 @@ typedef union {
} while (0)
#else
#define float4get(V,M) memcpy((char*) &(V),(char*) (M),sizeof(float))
-#define float4store(V,M) memcpy((char*) (V),(char*) (&M),sizeof(float))
#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
-#define doublestore(T,V) do { \
+#define float8store(T,V) do { \
*(((char *)(T)))= ((char *) &(V))[4];\
*(((char *)(T))+1)=(char) ((char *) &(V))[5];\
*(((char *)(T))+2)=(char) ((char *) &(V))[6];\
@@ -425,7 +412,7 @@ typedef union {
*(((char *)(T))+5)=(char) ((char *) &(V))[1];\
*(((char *)(T))+6)=(char) ((char *) &(V))[2];\
*(((char *)(T))+7)=(char) ((char *) &(V))[3];} while (0)
-#define doubleget(V,M) do { double def_temp;\
+#define float8get(V,M) do { double def_temp;\
((char*) &def_temp)[0]=(M)[4];\
((char*) &def_temp)[1]=(M)[5];\
((char*) &def_temp)[2]=(M)[6];\
@@ -437,11 +424,11 @@ typedef union {
(V) = def_temp; } while (0)
#endif /* __FLOAT_WORD_ORDER */
-#define float8get(V,M) doubleget((V),(M))
-#define float8store(V,M) doublestore((V),(M))
#endif /* WORDS_BIGENDIAN */
#endif /* sint2korr */
+/* To here if the platform is not x86 or it's WIN64 */
+
/* Define-funktions for reading and storing in machine format from/to
short/long to/from some place in memory V should be a (not
@@ -449,51 +436,15 @@ typedef union {
#ifdef WORDS_BIGENDIAN
-#define ushortget(V,M) { V = (uint16_t) (((uint16_t) ((uchar) (M)[1]))+\
- ((uint16_t) ((uint16_t) (M)[0]) << 8)); }
-#define shortget(V,M) { V = (int16_t) (((int16_t) ((uchar) (M)[1]))+\
- ((int16_t) ((int16_t) (M)[0]) << 8)); }
-#define longget(V,M) do { int32_t def_temp;\
- ((char*) &def_temp)[0]=(M)[0];\
- ((char*) &def_temp)[1]=(M)[1];\
- ((char*) &def_temp)[2]=(M)[2];\
- ((char*) &def_temp)[3]=(M)[3];\
- (V)=def_temp; } while (0)
-#define ulongget(V,M) do { uint32_t def_temp;\
- ((char*) &def_temp)[0]=(M)[0];\
- ((char*) &def_temp)[1]=(M)[1];\
- ((char*) &def_temp)[2]=(M)[2];\
- ((char*) &def_temp)[3]=(M)[3];\
- (V)=def_temp; } while (0)
-#define shortstore(T,A) do { \
- uint32_t def_temp=(uint32_t) (A) ;\
- *(((char *)(T))+1)=(char)(def_temp); \
- *(((char *)(T))+0)=(char)(def_temp >> 8); } while (0)
-#define longstore(T,A) do { \
- *(((char *)(T))+3)=(char)((A));\
- *(((char *)(T))+2)=(char)(((A) >> 8));\
- *(((char *)(T))+1)=(char)(((A) >> 16));\
- *(((char *)(T))+0)=(char)(((A) >> 24)); } while (0)
-
-#define doubleget(V,M) memcpy((char*) &(V),(char*) (M), sizeof(double))
-#define doublestore(T,V) memcpy((char*) (T),(char*) &(V), sizeof(double))
-#define longlongget(V,M) memcpy((char*) &(V),(char*) (M), sizeof(ulonglong))
-#define longlongstore(T,V) memcpy((char*) (T),(char*) &(V), sizeof(ulonglong))
+#define float8get(V,M) memcpy((char*) &(V),(char*) (M), sizeof(double))
+#define float8store(T,V) memcpy((char*) (T),(char*) &(V), sizeof(double))
#else
-#define ushortget(V,M) { V = uint2korr((M)); }
-#define shortget(V,M) { V = sint2korr((M)); }
-#define longget(V,M) { V = sint4korr((M)); }
-#define ulongget(V,M) { V = uint4korr((M)); }
-#define shortstore(T,V) int2store((T),(V))
-#define longstore(T,V) int4store((T),(V))
-#ifndef doubleget
-#define doubleget(V,M) memcpy((char*) &(V),(char*) (M),sizeof(double))
-#define doublestore(T,V) memcpy((char*) (T),(char*) &(V),sizeof(double))
-#endif /* doubleget */
-#define longlongget(V,M) memcpy((char*) &(V),(char*) (M),sizeof(ulonglong))
-#define longlongstore(T,V) memcpy((char*) (T),(char*) &(V),sizeof(ulonglong))
+#ifndef float8get
+#define float8get(V,M) memcpy((char*) &(V),(char*) (M),sizeof(double))
+#define float8store(T,V) memcpy((char*) (T),(char*) &(V),sizeof(double))
+#endif /* float8get */
#endif /* WORDS_BIGENDIAN */
diff --git a/ext/mysqlnd/mysqlnd_priv.h b/ext/mysqlnd/mysqlnd_priv.h
index 26ee7e0fef..8059441a77 100644
--- a/ext/mysqlnd/mysqlnd_priv.h
+++ b/ext/mysqlnd/mysqlnd_priv.h
@@ -150,7 +150,7 @@
/* PS stuff */
typedef void (*ps_field_fetch_func)(zval *zv, const MYSQLND_FIELD * const field,
- uint pack_len, zend_uchar **row,
+ unsigned int pack_len, zend_uchar **row,
zend_bool everything_as_unicode TSRMLS_DC);
struct st_mysqlnd_perm_bind {
ps_field_fetch_func func;
@@ -173,7 +173,7 @@ enum_func_status mysqlnd_handle_local_infile(MYSQLND *conn, const char *filename
void _mysqlnd_init_ps_subsystem();/* This one is private, mysqlnd_library_init() will call it */
void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
- uint pack_len, zend_uchar **row, zend_bool as_unicode,
+ unsigned int pack_len, zend_uchar **row, zend_bool as_unicode,
unsigned int byte_count TSRMLS_DC);
diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c
index 8269d26f83..2f80714e66 100644
--- a/ext/mysqlnd/mysqlnd_ps_codec.c
+++ b/ext/mysqlnd/mysqlnd_ps_codec.c
@@ -54,7 +54,7 @@ struct st_mysqlnd_perm_bind mysqlnd_ps_fetch_functions[MYSQL_TYPE_LAST + 1];
/* {{{ ps_fetch_from_1_to_8_bytes */
void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
- uint pack_len, zend_uchar **row, zend_bool as_unicode,
+ unsigned int pack_len, zend_uchar **row, zend_bool as_unicode,
unsigned int byte_count TSRMLS_DC)
{
char tmp[22];
@@ -137,7 +137,7 @@ void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
/* {{{ ps_fetch_null */
static
void ps_fetch_null(zval *zv, const MYSQLND_FIELD * const field,
- uint pack_len, zend_uchar **row,
+ unsigned int pack_len, zend_uchar **row,
zend_bool as_unicode TSRMLS_DC)
{
ZVAL_NULL(zv);
@@ -148,7 +148,7 @@ void ps_fetch_null(zval *zv, const MYSQLND_FIELD * const field,
/* {{{ ps_fetch_int8 */
static
void ps_fetch_int8(zval *zv, const MYSQLND_FIELD * const field,
- uint pack_len, zend_uchar **row,
+ unsigned int pack_len, zend_uchar **row,
zend_bool as_unicode TSRMLS_DC)
{
ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, 1 TSRMLS_CC);
@@ -159,7 +159,7 @@ void ps_fetch_int8(zval *zv, const MYSQLND_FIELD * const field,
/* {{{ ps_fetch_int16 */
static
void ps_fetch_int16(zval *zv, const MYSQLND_FIELD * const field,
- uint pack_len, zend_uchar **row,
+ unsigned int pack_len, zend_uchar **row,
zend_bool as_unicode TSRMLS_DC)
{
ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, 2 TSRMLS_CC);
@@ -170,7 +170,7 @@ void ps_fetch_int16(zval *zv, const MYSQLND_FIELD * const field,
/* {{{ ps_fetch_int32 */
static
void ps_fetch_int32(zval *zv, const MYSQLND_FIELD * const field,
- uint pack_len, zend_uchar **row,
+ unsigned int pack_len, zend_uchar **row,
zend_bool as_unicode TSRMLS_DC)
{
ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, 4 TSRMLS_CC);
@@ -181,7 +181,7 @@ void ps_fetch_int32(zval *zv, const MYSQLND_FIELD * const field,
/* {{{ ps_fetch_int64 */
static
void ps_fetch_int64(zval *zv, const MYSQLND_FIELD * const field,
- uint pack_len, zend_uchar **row,
+ unsigned int pack_len, zend_uchar **row,
zend_bool as_unicode TSRMLS_DC)
{
ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, 8 TSRMLS_CC);
@@ -192,7 +192,7 @@ void ps_fetch_int64(zval *zv, const MYSQLND_FIELD * const field,
/* {{{ ps_fetch_float */
static
void ps_fetch_float(zval *zv, const MYSQLND_FIELD * const field,
- uint pack_len, zend_uchar **row,
+ unsigned int pack_len, zend_uchar **row,
zend_bool as_unicode TSRMLS_DC)
{
float value;
@@ -209,7 +209,7 @@ void ps_fetch_float(zval *zv, const MYSQLND_FIELD * const field,
/* {{{ ps_fetch_double */
static
void ps_fetch_double(zval *zv, const MYSQLND_FIELD * const field,
- uint pack_len, zend_uchar **row,
+ unsigned int pack_len, zend_uchar **row,
zend_bool as_unicode TSRMLS_DC)
{
double value;
@@ -226,7 +226,7 @@ void ps_fetch_double(zval *zv, const MYSQLND_FIELD * const field,
/* {{{ ps_fetch_time */
static
void ps_fetch_time(zval *zv, const MYSQLND_FIELD * const field,
- uint pack_len, zend_uchar **row,
+ unsigned int pack_len, zend_uchar **row,
zend_bool as_unicode TSRMLS_DC)
{
struct st_mysqlnd_time t;
@@ -284,7 +284,7 @@ void ps_fetch_time(zval *zv, const MYSQLND_FIELD * const field,
/* {{{ ps_fetch_date */
static
void ps_fetch_date(zval *zv, const MYSQLND_FIELD * const field,
- uint pack_len, zend_uchar **row,
+ unsigned int pack_len, zend_uchar **row,
zend_bool as_unicode TSRMLS_DC)
{
struct st_mysqlnd_time t = {0};
@@ -335,7 +335,7 @@ void ps_fetch_date(zval *zv, const MYSQLND_FIELD * const field,
/* {{{ ps_fetch_datetime */
static
void ps_fetch_datetime(zval *zv, const MYSQLND_FIELD * const field,
- uint pack_len, zend_uchar **row,
+ unsigned int pack_len, zend_uchar **row,
zend_bool as_unicode TSRMLS_DC)
{
struct st_mysqlnd_time t;
@@ -394,7 +394,7 @@ void ps_fetch_datetime(zval *zv, const MYSQLND_FIELD * const field,
/* {{{ ps_fetch_string */
static
void ps_fetch_string(zval *zv, const MYSQLND_FIELD * const field,
- uint pack_len, zend_uchar **row,
+ unsigned int pack_len, zend_uchar **row,
zend_bool as_unicode TSRMLS_DC)
{
/*
@@ -424,7 +424,7 @@ void ps_fetch_string(zval *zv, const MYSQLND_FIELD * const field,
/* {{{ ps_fetch_bit */
static
void ps_fetch_bit(zval *zv, const MYSQLND_FIELD * const field,
- uint pack_len, zend_uchar **row,
+ unsigned int pack_len, zend_uchar **row,
zend_bool as_unicode TSRMLS_DC)
{
unsigned long length= php_mysqlnd_net_field_length(row);
@@ -578,7 +578,7 @@ void _mysqlnd_init_ps_subsystem()
/* {{{ mysqlnd_stmt_copy_it */
static void
-mysqlnd_stmt_copy_it(zval *** copies, zval *original, uint param_count, uint current)
+mysqlnd_stmt_copy_it(zval *** copies, zval *original, unsigned int param_count, unsigned int current)
{
if (!*copies) {
*copies = ecalloc(param_count, sizeof(zval *));
diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c
index f6d3991d2c..9af957bc39 100644
--- a/ext/mysqlnd/mysqlnd_result.c
+++ b/ext/mysqlnd/mysqlnd_result.c
@@ -95,11 +95,11 @@ void * mysqlnd_fetch_thread(void *arg)
/* {{{ mysqlnd_res_initialize_result_set_rest */
void mysqlnd_res_initialize_result_set_rest(MYSQLND_RES * const result TSRMLS_DC)
{
- uint i;
+ unsigned int i;
zval **data_cursor = result->stored_data->data;
zval **data_begin = result->stored_data->data;
- uint field_count = result->meta->field_count;
- uint row_count = result->stored_data->row_count;
+ unsigned int field_count = result->meta->field_count;
+ unsigned int row_count = result->stored_data->row_count;
if (!data_cursor || row_count == result->stored_data->initialized_rows) {
return;
}
@@ -1500,7 +1500,7 @@ mysqlnd_background_store_result_fetch_data(MYSQLND_RES *result TSRMLS_DC)
set->data[set->row_count] = row_packet->fields;
if (set->decode_in_foreground == FALSE) {
- uint i;
+ unsigned int i;
result->m.row_decoder(set->row_buffers[set->row_count],
set->data[set->row_count],
result->meta->field_count,
@@ -1902,7 +1902,7 @@ MYSQLND_METHOD(mysqlnd_res, fetch_all)(MYSQLND_RES *result, unsigned int flags,
DBG_VOID_RETURN;
}
- mysqlnd_array_init(return_value, (uint) set->row_count);
+ mysqlnd_array_init(return_value, (unsigned int) set->row_count);
while (set->data_cursor &&
(set->data_cursor - set->data) < (set->row_count * result->meta->field_count))
diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h
index d1bd38c727..f309806487 100644
--- a/ext/mysqlnd/mysqlnd_structs.h
+++ b/ext/mysqlnd/mysqlnd_structs.h
@@ -33,14 +33,14 @@ typedef struct st_mysqlnd_memory_pool_chunk_llist MYSQLND_MEMORY_POOL_CHUNK_LLIS
struct st_mysqlnd_memory_pool
{
zend_uchar *arena;
- uint refcount;
- uint arena_size;
- uint free_size;
+ unsigned int refcount;
+ unsigned int arena_size;
+ unsigned int free_size;
MYSQLND_MEMORY_POOL_CHUNK* free_chunk_list[MYSQLND_MEMORY_POOL_CHUNK_LIST_SIZE];
- uint free_chunk_list_elements;
+ unsigned int free_chunk_list_elements;
- MYSQLND_MEMORY_POOL_CHUNK* (*get_chunk)(MYSQLND_MEMORY_POOL * pool, uint size TSRMLS_DC);
+ MYSQLND_MEMORY_POOL_CHUNK* (*get_chunk)(MYSQLND_MEMORY_POOL * pool, unsigned int size TSRMLS_DC);
};
struct st_mysqlnd_memory_pool_chunk
@@ -48,8 +48,8 @@ struct st_mysqlnd_memory_pool_chunk
uint64_t app;
MYSQLND_MEMORY_POOL *pool;
zend_uchar *ptr;
- uint size;
- void (*resize_chunk)(MYSQLND_MEMORY_POOL_CHUNK * chunk, uint size TSRMLS_DC);
+ unsigned int size;
+ void (*resize_chunk)(MYSQLND_MEMORY_POOL_CHUNK * chunk, unsigned int size TSRMLS_DC);
void (*free_chunk)(MYSQLND_MEMORY_POOL_CHUNK * chunk, zend_bool cache_it TSRMLS_DC);
zend_bool from_pool;
};
@@ -124,14 +124,14 @@ typedef struct st_mysqlnd_infile_info
/* character set information */
typedef struct st_mysqlnd_charset
{
- uint nr;
+ unsigned int nr;
const char *name;
const char *collation;
- uint char_minlen;
- uint char_maxlen;
+ unsigned int char_minlen;
+ unsigned int char_maxlen;
const char *comment;
- uint (*mb_charlen)(uint c);
- uint (*mb_valid)(const char *start, const char *end);
+ unsigned int (*mb_charlen)(unsigned int c);
+ unsigned int (*mb_valid)(const char *start, const char *end);
} MYSQLND_CHARSET;
@@ -139,8 +139,8 @@ typedef struct st_mysqlnd_charset
typedef struct st_mysqlnd_infile
{
int (*local_infile_init)(void **ptr, char *filename, void **userdata TSRMLS_DC);
- int (*local_infile_read)(void *ptr, char *buf, uint buf_len TSRMLS_DC);
- int (*local_infile_error)(void *ptr, char *error_msg, uint error_msg_len TSRMLS_DC);
+ int (*local_infile_read)(void *ptr, char *buf, unsigned int buf_len TSRMLS_DC);
+ int (*local_infile_error)(void *ptr, char *error_msg, unsigned int error_msg_len TSRMLS_DC);
void (*local_infile_end)(void *ptr TSRMLS_DC);
zval *callback;
void *userdata;
@@ -149,14 +149,14 @@ typedef struct st_mysqlnd_infile
typedef struct st_mysqlnd_option
{
/* timeouts */
- uint timeout_connect;
- uint timeout_read;
- uint timeout_write;
+ unsigned int timeout_connect;
+ unsigned int timeout_read;
+ unsigned int timeout_write;
ulong flags;
/* init commands - we need to send them to server directly after connect */
- uint num_commands;
+ unsigned int num_commands;
char **init_commands;
/* configuration file information */
@@ -320,7 +320,7 @@ struct st_mysqlnd_res_methods
void (*free_result_contents)(MYSQLND_RES *result TSRMLS_DC);
/* for decoding - binary or text protocol */
- void (*row_decoder)(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zval ** fields, uint field_count, MYSQLND_FIELD *fields_metadata, MYSQLND *conn TSRMLS_DC);
+ void (*row_decoder)(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zval ** fields, unsigned int field_count, MYSQLND_FIELD *fields_metadata, MYSQLND *conn TSRMLS_DC);
};
@@ -359,7 +359,7 @@ struct st_mysqlnd_stmt_methods
enum_func_status (*refresh_bind_param)(MYSQLND_STMT * const stmt TSRMLS_DC);
void (*set_param_bind_dtor)(MYSQLND_STMT * const stmt, void (*param_bind_dtor)(MYSQLND_PARAM_BIND *) TSRMLS_DC);
enum_func_status (*bind_result)(MYSQLND_STMT * const stmt, MYSQLND_RESULT_BIND * const result_bind TSRMLS_DC);
- enum_func_status (*bind_one_result)(MYSQLND_STMT * const stmt, uint param_no TSRMLS_DC);
+ enum_func_status (*bind_one_result)(MYSQLND_STMT * const stmt, unsigned int param_no TSRMLS_DC);
void (*set_result_bind_dtor)(MYSQLND_STMT * const stmt, void (*result_bind_dtor)(MYSQLND_RESULT_BIND *) TSRMLS_DC);
enum_func_status (*send_long_data)(MYSQLND_STMT * const stmt, unsigned int param_num,
const char * const data, unsigned long length TSRMLS_DC);
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c
index e49c81561a..f25a79ad20 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.c
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.c
@@ -195,7 +195,7 @@ zend_uchar *php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t length)
if (length < (uint64_t) L64(65536)) {
*packet++ = 252;
- int2store(packet,(uint) length);
+ int2store(packet,(unsigned int) length);
return packet + 2;
}
@@ -1356,7 +1356,7 @@ php_mysqlnd_read_row_ex(MYSQLND *conn, MYSQLND_MEMORY_POOL_CHUNK **buffer,
/* {{{ php_mysqlnd_rowp_read_binary_protocol */
void php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zval ** fields,
- uint field_count, MYSQLND_FIELD *fields_metadata,
+ unsigned int field_count, MYSQLND_FIELD *fields_metadata,
MYSQLND *conn TSRMLS_DC)
{
int i;
@@ -1455,7 +1455,7 @@ void php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffe
/* {{{ php_mysqlnd_rowp_read_text_protocol */
void php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zval ** fields,
- uint field_count, MYSQLND_FIELD *fields_metadata,
+ unsigned int field_count, MYSQLND_FIELD *fields_metadata,
MYSQLND *conn TSRMLS_DC)
{
int i;
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.h b/ext/mysqlnd/mysqlnd_wireprotocol.h
index 6cc8bdd263..71af6e11c9 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.h
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.h
@@ -325,10 +325,10 @@ extern char * const mysqlnd_empty_string;
void php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zval ** fields,
- uint field_count, MYSQLND_FIELD *fields_metadata, MYSQLND *conn TSRMLS_DC);
+ unsigned int field_count, MYSQLND_FIELD *fields_metadata, MYSQLND *conn TSRMLS_DC);
void php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zval ** fields,
- uint field_count, MYSQLND_FIELD *fields_metadata, MYSQLND *conn TSRMLS_DC);
+ unsigned int field_count, MYSQLND_FIELD *fields_metadata, MYSQLND *conn TSRMLS_DC);
#endif /* MYSQLND_WIREPROTOCOL_H */