diff options
Diffstat (limited to 'ext/mysqlnd')
| -rw-r--r-- | ext/mysqlnd/mysqlnd.c | 22 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd.h | 24 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_alloc.c | 18 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_auth.c | 10 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_charset.c | 4 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_charset.h | 8 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_enum_n_def.h | 2 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_net.c | 4 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_portability.h | 16 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_priv.h | 2 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_ps.c | 18 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_ps_codec.c | 52 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_result.c | 42 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_result_meta.c | 6 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_structs.h | 38 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_wireprotocol.c | 50 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_wireprotocol.h | 8 | ||||
| -rw-r--r-- | ext/mysqlnd/php_mysqlnd.c | 2 |
18 files changed, 163 insertions, 163 deletions
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 65752d74a8..c05d8af8b1 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -440,7 +440,7 @@ mysqlnd_switch_to_ssl_if_needed( MYSQLND_CONN_DATA * conn, const MYSQLND_PACKET_GREET * const greet_packet, const MYSQLND_OPTIONS * const options, - php_uint_t mysql_flags + zend_ulong mysql_flags TSRMLS_DC ) { @@ -546,7 +546,7 @@ mysqlnd_run_authentication( const char * const auth_protocol, unsigned int charset_no, const MYSQLND_OPTIONS * const options, - php_uint_t mysql_flags, + zend_ulong mysql_flags, zend_bool silent, zend_bool is_change_user TSRMLS_DC) @@ -678,7 +678,7 @@ mysqlnd_connect_run_authentication( size_t passwd_len, const MYSQLND_PACKET_GREET * const greet_packet, const MYSQLND_OPTIONS * const options, - php_uint_t mysql_flags + zend_ulong mysql_flags TSRMLS_DC) { enum_func_status ret = FAIL; @@ -1588,7 +1588,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, sqlstate)(const MYSQLND_CONN_DATA * const conn /* {{{ mysqlnd_old_escape_string */ -PHPAPI php_uint_t +PHPAPI zend_ulong mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC) { DBG_ENTER("mysqlnd_old_escape_string"); @@ -1622,11 +1622,11 @@ MYSQLND_METHOD(mysqlnd_conn_data, ssl_set)(MYSQLND_CONN_DATA * const conn, const /* {{{ mysqlnd_conn_data::escape_string */ -static php_uint_t +static zend_ulong MYSQLND_METHOD(mysqlnd_conn_data, escape_string)(MYSQLND_CONN_DATA * const conn, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC) { size_t this_func = STRUCT_OFFSET(struct st_mysqlnd_conn_data_methods, escape_string); - php_uint_t ret = FAIL; + zend_ulong ret = FAIL; DBG_ENTER("mysqlnd_conn_data::escape_string"); DBG_INF_FMT("conn=%llu", conn->thread_id); @@ -1750,7 +1750,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, statistic)(MYSQLND_CONN_DATA * conn, zend_stri if (PASS == (ret = PACKET_READ(stats_header, conn))) { /* will be freed by Zend, thus don't use the mnd_ allocator */ - *message = STR_INIT(stats_header->message, stats_header->message_len, 0); + *message = zend_string_init(stats_header->message, stats_header->message_len, 0); DBG_INF((*message)->val); } PACKET_FREE(stats_header); @@ -2114,10 +2114,10 @@ MYSQLND_METHOD(mysqlnd_conn_data, thread_id)(const MYSQLND_CONN_DATA * const con /* {{{ mysqlnd_conn_data::get_server_version */ -static php_uint_t +static zend_ulong MYSQLND_METHOD(mysqlnd_conn_data, get_server_version)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC) { - php_int_t major, minor, patch; + zend_long major, minor, patch; char *p; if (!(p = conn->server_version)) { @@ -2130,7 +2130,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, get_server_version)(const MYSQLND_CONN_DATA * p += 1; /* consume the dot */ patch = ZEND_STRTOI(p, &p, 10); - return (php_uint_t)(major * Z_I(10000) + (php_uint_t)(minor * Z_I(100) + patch)); + return (zend_ulong)(major * Z_I(10000) + (zend_ulong)(minor * Z_I(100) + patch)); } /* }}} */ @@ -2496,7 +2496,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option_2d)(MYSQLND_CONN_DATA * cons DBG_INF_FMT("Adding [%s][%s]", key, value); { zval attrz; - ZVAL_STR(&attrz, STR_INIT(value, strlen(value), 1)); + ZVAL_STR(&attrz, zend_string_init(value, strlen(value), 1)); zend_hash_str_update(conn->options->connect_attr, key, strlen(key), &attrz); } break; diff --git a/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h index f79dc37a3e..c70934be4d 100644 --- a/ext/mysqlnd/mysqlnd.h +++ b/ext/mysqlnd/mysqlnd.h @@ -219,7 +219,7 @@ void mysqlnd_local_infile_default(MYSQLND_CONN_DATA * conn); #define mysqlnd_escape_string(newstr, escapestr, escapestr_len) \ mysqlnd_old_escape_string((newstr), (escapestr), (escapestr_len) TSRMLS_CC) -PHPAPI php_uint_t mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); +PHPAPI zend_ulong mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); /* PS */ @@ -270,17 +270,17 @@ ZEND_BEGIN_MODULE_GLOBALS(mysqlnd) char * trace_alloc_settings; /* The actual string */ MYSQLND_DEBUG * dbg; /* The DBG object for standard tracing */ MYSQLND_DEBUG * trace_alloc; /* The DBG object for allocation tracing */ - php_int_t net_cmd_buffer_size; - php_int_t net_read_buffer_size; - php_int_t log_mask; - php_int_t net_read_timeout; - php_int_t mempool_default_size; - php_int_t debug_emalloc_fail_threshold; - php_int_t debug_ecalloc_fail_threshold; - php_int_t debug_erealloc_fail_threshold; - php_int_t debug_malloc_fail_threshold; - php_int_t debug_calloc_fail_threshold; - php_int_t debug_realloc_fail_threshold; + zend_long net_cmd_buffer_size; + zend_long net_read_buffer_size; + zend_long log_mask; + zend_long net_read_timeout; + zend_long mempool_default_size; + zend_long debug_emalloc_fail_threshold; + zend_long debug_ecalloc_fail_threshold; + zend_long debug_erealloc_fail_threshold; + zend_long debug_malloc_fail_threshold; + zend_long debug_calloc_fail_threshold; + zend_long debug_realloc_fail_threshold; char * sha256_server_public_key; zend_bool fetch_data_copy; ZEND_END_MODULE_GLOBALS(mysqlnd) diff --git a/ext/mysqlnd/mysqlnd_alloc.c b/ext/mysqlnd/mysqlnd_alloc.c index 903753ef89..9cc46dba4a 100644 --- a/ext/mysqlnd/mysqlnd_alloc.c +++ b/ext/mysqlnd/mysqlnd_alloc.c @@ -79,7 +79,7 @@ void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - php_int_t * threshold = &MYSQLND_G(debug_emalloc_fail_threshold); + zend_long * threshold = &MYSQLND_G(debug_emalloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_emalloc_name); @@ -119,7 +119,7 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - php_int_t * threshold = persistent? &MYSQLND_G(debug_malloc_fail_threshold):&MYSQLND_G(debug_emalloc_fail_threshold); + zend_long * threshold = persistent? &MYSQLND_G(debug_malloc_fail_threshold):&MYSQLND_G(debug_emalloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_pemalloc_name); @@ -162,7 +162,7 @@ void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - php_int_t * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold); + zend_long * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_ecalloc_name); @@ -203,7 +203,7 @@ void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent M void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - php_int_t * threshold = persistent? &MYSQLND_G(debug_calloc_fail_threshold):&MYSQLND_G(debug_ecalloc_fail_threshold); + zend_long * threshold = persistent? &MYSQLND_G(debug_calloc_fail_threshold):&MYSQLND_G(debug_ecalloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_pecalloc_name); #if PHP_DEBUG @@ -246,7 +246,7 @@ void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D) zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0; #if PHP_DEBUG - php_int_t * threshold = &MYSQLND_G(debug_erealloc_fail_threshold); + zend_long * threshold = &MYSQLND_G(debug_erealloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_erealloc_name); @@ -287,7 +287,7 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0; #if PHP_DEBUG - php_int_t * threshold = persistent? &MYSQLND_G(debug_realloc_fail_threshold):&MYSQLND_G(debug_erealloc_fail_threshold); + zend_long * threshold = persistent? &MYSQLND_G(debug_realloc_fail_threshold):&MYSQLND_G(debug_erealloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_perealloc_name); @@ -393,7 +393,7 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - php_int_t * threshold = &MYSQLND_G(debug_malloc_fail_threshold); + zend_long * threshold = &MYSQLND_G(debug_malloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_malloc_name); @@ -432,7 +432,7 @@ void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - php_int_t * threshold = &MYSQLND_G(debug_calloc_fail_threshold); + zend_long * threshold = &MYSQLND_G(debug_calloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_calloc_name); @@ -471,7 +471,7 @@ void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - php_int_t * threshold = &MYSQLND_G(debug_realloc_fail_threshold); + zend_long * threshold = &MYSQLND_G(debug_realloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_realloc_name); diff --git a/ext/mysqlnd/mysqlnd_auth.c b/ext/mysqlnd/mysqlnd_auth.c index 76d4a56f38..985357e3bc 100644 --- a/ext/mysqlnd/mysqlnd_auth.c +++ b/ext/mysqlnd/mysqlnd_auth.c @@ -37,7 +37,7 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn, const char * const db, const size_t db_len, const MYSQLND_OPTIONS * const options, - php_uint_t mysql_flags, + zend_ulong mysql_flags, unsigned int server_charset_no, zend_bool use_full_blown_auth_packet, const char * const auth_protocol, @@ -361,7 +361,7 @@ mysqlnd_native_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len, const MYSQLND_OPTIONS * const options, const MYSQLND_NET_OPTIONS * const net_options, - php_uint_t mysql_flags + zend_ulong mysql_flags TSRMLS_DC) { zend_uchar * ret = NULL; @@ -421,7 +421,7 @@ mysqlnd_pam_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self, const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len, const MYSQLND_OPTIONS * const options, const MYSQLND_NET_OPTIONS * const net_options, - php_uint_t mysql_flags + zend_ulong mysql_flags TSRMLS_DC) { zend_uchar * ret = NULL; @@ -553,7 +553,7 @@ mysqlnd_sha256_get_rsa_key(MYSQLND_CONN_DATA * conn, BIO_free(bio); DBG_INF("Successfully loaded"); DBG_INF_FMT("Public key:%*.s", key_str->len, key_str->val); - STR_RELEASE(key_str); + zend_string_release(key_str); } php_stream_free(stream, PHP_STREAM_FREE_CLOSE); } @@ -571,7 +571,7 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len, const MYSQLND_OPTIONS * const options, const MYSQLND_NET_OPTIONS * const net_options, - php_uint_t mysql_flags + zend_ulong mysql_flags TSRMLS_DC) { RSA * server_public_key; diff --git a/ext/mysqlnd/mysqlnd_charset.c b/ext/mysqlnd/mysqlnd_charset.c index fa97b877e5..bf67498eea 100644 --- a/ext/mysqlnd/mysqlnd_charset.c +++ b/ext/mysqlnd/mysqlnd_charset.c @@ -726,7 +726,7 @@ PHPAPI const MYSQLND_CHARSET * mysqlnd_find_charset_name(const char * const name /* {{{ mysqlnd_cset_escape_quotes */ -PHPAPI php_uint_t mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, char *newstr, +PHPAPI zend_ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, char *newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC) { const char *newstr_s = newstr; @@ -780,7 +780,7 @@ PHPAPI php_uint_t mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, /* {{{ mysqlnd_cset_escape_slashes */ -PHPAPI php_uint_t mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr, +PHPAPI zend_ulong mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC) { const char *newstr_s = newstr; diff --git a/ext/mysqlnd/mysqlnd_charset.h b/ext/mysqlnd/mysqlnd_charset.h index 0a7ced68aa..87f30d8ba5 100644 --- a/ext/mysqlnd/mysqlnd_charset.h +++ b/ext/mysqlnd/mysqlnd_charset.h @@ -21,10 +21,10 @@ #ifndef MYSQLND_CHARSET_H #define MYSQLND_CHARSET_H -PHPAPI php_uint_t mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const charset, char *newstr, +PHPAPI zend_ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const charset, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC); -PHPAPI php_uint_t mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr, +PHPAPI zend_ulong mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC); struct st_mysqlnd_plugin_charsets @@ -34,8 +34,8 @@ struct st_mysqlnd_plugin_charsets { const MYSQLND_CHARSET * (*const find_charset_by_nr)(unsigned int charsetnr); const MYSQLND_CHARSET * (*const find_charset_by_name)(const char * const name); - php_uint_t (*const escape_quotes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); - php_uint_t (*const escape_slashes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); + zend_ulong (*const escape_quotes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); + zend_ulong (*const escape_slashes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); } methods; }; diff --git a/ext/mysqlnd/mysqlnd_enum_n_def.h b/ext/mysqlnd/mysqlnd_enum_n_def.h index 81be117277..0d6a25a419 100644 --- a/ext/mysqlnd/mysqlnd_enum_n_def.h +++ b/ext/mysqlnd/mysqlnd_enum_n_def.h @@ -606,7 +606,7 @@ enum php_mysqlnd_server_command }; -#define MYSQLND_DEFAULT_PREFETCH_ROWS (php_uint_t) 1 +#define MYSQLND_DEFAULT_PREFETCH_ROWS (zend_ulong) 1 #define MYSQLND_REFRESH_GRANT 1 /* Refresh grant tables */ #define MYSQLND_REFRESH_LOG 2 /* Start on new log file */ diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c index e014f86390..6a243d5315 100644 --- a/ext/mysqlnd/mysqlnd_net.c +++ b/ext/mysqlnd/mysqlnd_net.c @@ -193,7 +193,7 @@ MYSQLND_METHOD(mysqlnd_net, open_tcp_or_unix)(MYSQLND_NET * const net, const cha SET_CLIENT_ERROR(*error_info, errcode? errcode:CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, errstr->val); if (errstr) { /* no mnd_ since we don't allocate it */ - STR_RELEASE(errstr); + zend_string_release(errstr); } DBG_RETURN(NULL); } @@ -676,7 +676,7 @@ MYSQLND_METHOD(mysqlnd_net, receive_ex)(MYSQLND_NET * const net, zend_uchar * co } net->compressed_envelope_packet_no++; #ifdef MYSQLND_DUMP_HEADER_N_BODY - DBG_INF_FMT("HEADER: hwd_packet_no=%u size=%3u", packet_no, (php_uint_t) net_payload_size); + DBG_INF_FMT("HEADER: hwd_packet_no=%u size=%3u", packet_no, (zend_ulong) net_payload_size); #endif /* Now let's read from the wire, decompress it and fill the read buffer */ net->data->m.read_compressed_packet_from_stream_and_fill_read_buffer(net, net_payload_size, conn_stats, error_info TSRMLS_CC); diff --git a/ext/mysqlnd/mysqlnd_portability.h b/ext/mysqlnd/mysqlnd_portability.h index d9936e0425..424f52d1e6 100644 --- a/ext/mysqlnd/mysqlnd_portability.h +++ b/ext/mysqlnd/mysqlnd_portability.h @@ -194,13 +194,13 @@ This file is public domain and comes with NO WARRANTY of any kind */ (((uint32_t) (zend_uchar) (A)[2]) << 16) |\ (((uint32_t) (zend_uchar) (A)[1]) << 8) | \ ((uint32_t) (zend_uchar) (A)[0]))) -#define sint4korr(A) (*((php_int_t *) (A))) +#define sint4korr(A) (*((zend_long *) (A))) #define uint2korr(A) (*((uint16_t *) (A))) #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) (*((php_uint_t *) (A))) +#define uint4korr(A) (*((zend_ulong *) (A))) @@ -211,7 +211,7 @@ This file is public domain and comes with NO WARRANTY of any kind */ *(T)= (zend_uchar) ((A));\ *(T+1)=(zend_uchar) (((uint32_t) (A) >> 8));\ *(T+2)=(zend_uchar) (((A) >> 16)); } -#define int4store(T,A) *((php_int_t *) (T))= (php_int_t) (A) +#define int4store(T,A) *((zend_long *) (T))= (zend_long) (A) #define int5store(T,A) { \ *((zend_uchar *)(T))= (zend_uchar)((A));\ *(((zend_uchar *)(T))+1)=(zend_uchar) (((A) >> 8));\ @@ -232,12 +232,12 @@ This file is public domain and comes with NO WARRANTY of any kind */ typedef union { double v; - php_int_t m[2]; + zend_long m[2]; } float8get_union; -#define float8get(V,M) { ((float8get_union *)&(V))->m[0] = *((php_int_t*) (M)); \ - ((float8get_union *)&(V))->m[1] = *(((php_int_t*) (M))+1); } -#define float8store(T,V) { *((php_int_t *) (T)) = ((float8get_union *)&(V))->m[0]; \ - *(((php_int_t *) (T))+1) = ((float8get_union *)&(V))->m[1]; } +#define float8get(V,M) { ((float8get_union *)&(V))->m[0] = *((zend_long*) (M)); \ + ((float8get_union *)&(V))->m[1] = *(((zend_long*) (M))+1); } +#define float8store(T,V) { *((zend_long *) (T)) = ((float8get_union *)&(V))->m[0]; \ + *(((zend_long *) (T))+1) = ((float8get_union *)&(V))->m[1]; } #define float4get(V,M) { *((float *) &(V)) = *((float*) (M)); } /* From Andrey Hristov based on float8get */ #define floatget(V,M) memcpy((char*) &(V),(char*) (M),sizeof(float)) diff --git a/ext/mysqlnd/mysqlnd_priv.h b/ext/mysqlnd/mysqlnd_priv.h index 475a33d38e..79e67da464 100644 --- a/ext/mysqlnd/mysqlnd_priv.h +++ b/ext/mysqlnd/mysqlnd_priv.h @@ -209,7 +209,7 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn, const char * const db, const size_t db_len, const MYSQLND_OPTIONS * const options, - php_uint_t mysql_flags, + zend_ulong mysql_flags, unsigned int server_charset_no, zend_bool use_full_blown_auth_packet, const char * const auth_protocol, diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c index c47da0262a..e2745d8729 100644 --- a/ext/mysqlnd/mysqlnd_ps.c +++ b/ext/mysqlnd/mysqlnd_ps.c @@ -776,7 +776,7 @@ mysqlnd_stmt_fetch_row_buffered(MYSQLND_RES * result, void * param, unsigned int Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - php_uint_t len = Z_STRSIZE(current_row[i]); + zend_ulong len = Z_STRLEN(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -905,8 +905,8 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, unsigned i #endif if (!Z_ISNULL_P(data)) { if ((Z_TYPE_P(data) == IS_STRING) && - (meta->fields[i].max_length < (unsigned long) Z_STRSIZE_P(data))) { - meta->fields[i].max_length = Z_STRSIZE_P(data); + (meta->fields[i].max_length < (unsigned long) Z_STRLEN_P(data))) { + meta->fields[i].max_length = Z_STRLEN_P(data); } ZVAL_COPY_VALUE(result, data); /* copied data, thus also the ownership. Thus null data */ @@ -1093,8 +1093,8 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, void * param, unsigned int f if (!Z_ISNULL_P(data)) { if ((Z_TYPE_P(data) == IS_STRING) && - (meta->fields[i].max_length < (unsigned long) Z_STRSIZE_P(data))) { - meta->fields[i].max_length = Z_STRSIZE_P(data); + (meta->fields[i].max_length < (unsigned long) Z_STRLEN_P(data))) { + meta->fields[i].max_length = Z_STRLEN_P(data); } ZVAL_COPY_VALUE(result, data); /* copied data, thus also the ownership. Thus null data */ @@ -1302,7 +1302,7 @@ MYSQLND_METHOD(mysqlnd_stmt, flush)(MYSQLND_STMT * const s TSRMLS_DC) /* {{{ mysqlnd_stmt::send_long_data */ static enum_func_status MYSQLND_METHOD(mysqlnd_stmt, send_long_data)(MYSQLND_STMT * const s, unsigned int param_no, - const char * const data, php_uint_t length TSRMLS_DC) + const char * const data, zend_ulong length TSRMLS_DC) { MYSQLND_STMT_DATA * stmt = s? s->data:NULL; enum_func_status ret = FAIL; @@ -1879,7 +1879,7 @@ MYSQLND_METHOD(mysqlnd_stmt, attr_set)(MYSQLND_STMT * const s, } case STMT_ATTR_CURSOR_TYPE: { unsigned int ival = *(unsigned int *) value; - if (ival > (php_uint_t) CURSOR_TYPE_READ_ONLY) { + if (ival > (zend_ulong) CURSOR_TYPE_READ_ONLY) { SET_STMT_ERROR(stmt, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "Not implemented"); DBG_INF("FAIL"); DBG_RETURN(FAIL); @@ -1927,10 +1927,10 @@ MYSQLND_METHOD(mysqlnd_stmt, attr_get)(const MYSQLND_STMT * const s, *(zend_bool *) value= stmt->update_max_length; break; case STMT_ATTR_CURSOR_TYPE: - *(php_uint_t *) value= stmt->flags; + *(zend_ulong *) value= stmt->flags; break; case STMT_ATTR_PREFETCH_ROWS: - *(php_uint_t *) value= stmt->prefetch_rows; + *(zend_ulong *) value= stmt->prefetch_rows; break; default: DBG_RETURN(FAIL); diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c index 8b59d918ba..c669706917 100644 --- a/ext/mysqlnd/mysqlnd_ps_codec.c +++ b/ext/mysqlnd/mysqlnd_ps_codec.c @@ -41,7 +41,7 @@ enum mysqlnd_timestamp_type struct st_mysqlnd_time { unsigned int year, month, day, hour, minute, second; - php_uint_t second_part; + zend_ulong second_part; zend_bool neg; enum mysqlnd_timestamp_type time_type; }; @@ -84,7 +84,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne #endif /* #if SIZEOF_LONG==4 */ { if (byte_count < 8 || uval <= L64(9223372036854775807)) { - ZVAL_INT(zv, (php_int_t) uval); /* the cast is safe, we are in the range */ + ZVAL_LONG(zv, (zend_long) uval); /* the cast is safe, we are in the range */ } else { DBG_INF("stringify"); tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, uval); @@ -112,7 +112,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne } else #endif /* SIZEOF */ { - ZVAL_INT(zv, (php_int_t) lval); /* the cast is safe, we are in the range */ + ZVAL_LONG(zv, (zend_long) lval); /* the cast is safe, we are in the range */ } } @@ -246,7 +246,7 @@ static void ps_fetch_time(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC) { struct st_mysqlnd_time t; - php_uint_t length; /* First byte encodes the length*/ + zend_ulong length; /* First byte encodes the length*/ char * value; DBG_ENTER("ps_fetch_time"); @@ -256,11 +256,11 @@ ps_fetch_time(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_le t.time_type = MYSQLND_TIMESTAMP_TIME; t.neg = (zend_bool) to[0]; - t.day = (php_uint_t) sint4korr(to+1); + t.day = (zend_ulong) sint4korr(to+1); t.hour = (unsigned int) to[5]; t.minute = (unsigned int) to[6]; t.second = (unsigned int) to[7]; - t.second_part = (length > 8) ? (php_uint_t) sint4korr(to+8) : 0; + t.second_part = (length > 8) ? (zend_ulong) sint4korr(to+8) : 0; t.year = t.month= 0; if (t.day) { /* Convert days to hours at once */ @@ -289,7 +289,7 @@ static void ps_fetch_date(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC) { struct st_mysqlnd_time t = {0}; - php_uint_t length; /* First byte encodes the length*/ + zend_ulong length; /* First byte encodes the length*/ char * value; DBG_ENTER("ps_fetch_date"); @@ -326,7 +326,7 @@ static void ps_fetch_datetime(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC) { struct st_mysqlnd_time t; - php_uint_t length; /* First byte encodes the length*/ + zend_ulong length; /* First byte encodes the length*/ char * value; DBG_ENTER("ps_fetch_datetime"); @@ -347,7 +347,7 @@ ps_fetch_datetime(zval * zv, const MYSQLND_FIELD * const field, unsigned int pac } else { t.hour = t.minute = t.second= 0; } - t.second_part = (length > 7) ? (php_uint_t) sint4korr(to+7) : 0; + t.second_part = (length > 7) ? (zend_ulong) sint4korr(to+7) : 0; (*row)+= length; } else { @@ -373,7 +373,7 @@ ps_fetch_string(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_ For now just copy, before we make it possible to write \0 to the row buffer */ - const php_uint_t length = php_mysqlnd_net_field_length(row); + const zend_ulong length = php_mysqlnd_net_field_length(row); DBG_ENTER("ps_fetch_string"); DBG_INF_FMT("len = %lu", length); DBG_INF("copying from the row buffer"); @@ -389,7 +389,7 @@ ps_fetch_string(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_ static void ps_fetch_bit(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC) { - php_uint_t length = php_mysqlnd_net_field_length(row); + zend_ulong length = php_mysqlnd_net_field_length(row); ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, length TSRMLS_CC); } /* }}} */ @@ -406,32 +406,32 @@ void _mysqlnd_init_ps_fetch_subsystem() mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].func = ps_fetch_int8; mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].pack_len = 1; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].php_type = IS_INT; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].php_type = IS_LONG; mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].func = ps_fetch_int16; mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].pack_len = 2; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].php_type = IS_INT; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].php_type = IS_LONG; mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].func = ps_fetch_int16; mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].pack_len = 2; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].php_type = IS_INT; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].php_type = IS_LONG; mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].func = ps_fetch_int32; mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].pack_len = 4; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].php_type = IS_INT; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].php_type = IS_LONG; mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].func = ps_fetch_int32; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].pack_len = 4; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].php_type = IS_INT; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].php_type = IS_LONG; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].func = ps_fetch_int64; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].pack_len= 8; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].php_type= IS_INT; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].php_type= IS_LONG; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_FLOAT].func = ps_fetch_float; @@ -495,7 +495,7 @@ void _mysqlnd_init_ps_fetch_subsystem() mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].func = ps_fetch_bit; mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].pack_len = 8; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].php_type = IS_INT; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].php_type = IS_LONG; mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_VAR_STRING].func = ps_fetch_string; @@ -610,7 +610,7 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie ZVAL_DEREF(parameter); if (!Z_ISNULL_P(parameter) && (current_type == MYSQL_TYPE_LONG || current_type == MYSQL_TYPE_LONGLONG)) { /* always copy the var, because we do many conversions */ - if (Z_TYPE_P(parameter) != IS_INT && + if (Z_TYPE_P(parameter) != IS_LONG && PASS != mysqlnd_stmt_copy_it(copies_param, parameter, stmt->param_count, i TSRMLS_CC)) { SET_OOM_ERROR(*stmt->error_info); @@ -620,7 +620,7 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie if it doesn't fit in a long send it as a string. Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX */ - if (Z_TYPE_P(parameter) != IS_INT) { + if (Z_TYPE_P(parameter) != IS_LONG) { zval *tmp_data = (*copies_param && !Z_ISUNDEF((*copies_param)[i]))? &(*copies_param)[i]: parameter; /* Because converting to double and back to long can lead @@ -674,10 +674,10 @@ mysqlnd_stmt_execute_store_types(MYSQLND_STMT_DATA * stmt, zval * copies, zend_u if it doesn't fit in a long send it as a string. Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX */ - if (Z_TYPE_P(parameter) != IS_INT) { + if (Z_TYPE_P(parameter) != IS_LONG) { const zval *tmp_data = (copies && !Z_ISUNDEF(copies[i]))? &copies[i] : parameter; /* - In case of IS_INT we do nothing, it is ok, in case of string, we just need to set current_type. + In case of IS_LONG we do nothing, it is ok, in case of string, we just need to set current_type. The actual transformation has been performed several dozens line above. */ if (Z_TYPE_P(tmp_data) == IS_STRING) { @@ -778,7 +778,7 @@ use_string: the_var = &((*copies_param)[i]); } convert_to_string_ex(the_var); - *data_size += Z_STRSIZE_P(the_var); + *data_size += Z_STRLEN_P(the_var); break; } } @@ -814,7 +814,7 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies, goto send_string; } /* data has alreade been converted to long */ - int8store(*p, Z_IVAL_P(data)); + int8store(*p, Z_LVAL_P(data)); (*p) += 8; break; case MYSQL_TYPE_LONG: @@ -822,7 +822,7 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies, goto send_string; } /* data has alreade been converted to long */ - int4store(*p, Z_IVAL_P(data)); + int4store(*p, Z_LVAL_P(data)); (*p) += 4; break; case MYSQL_TYPE_LONG_BLOB: @@ -836,7 +836,7 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies, case MYSQL_TYPE_VAR_STRING: send_string: { - size_t len = Z_STRSIZE_P(data); + size_t len = Z_STRLEN_P(data); /* to is after p. The latter hasn't been moved */ *p = php_mysqlnd_net_store_length(*p, len); memcpy(*p, Z_STRVAL_P(data), len); diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index 65ad1099b6..ea275be192 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -71,7 +71,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, initialize_result_set_rest)(MYSQLND Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(data_cursor[i]) == IS_STRING) { - php_uint_t len = Z_STRSIZE(data_cursor[i]); + zend_ulong len = Z_STRLEN(data_cursor[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -126,7 +126,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, initialize_result_set_rest)(MYSQLND_RE Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - php_uint_t len = Z_STRSIZE(current_row[i]); + zend_ulong len = Z_STRLEN(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -599,7 +599,7 @@ mysqlnd_query_read_result_set_header(MYSQLND_CONN_DATA * conn, MYSQLND_STMT * s of PHP, to be called as separate function. But let's have it for completeness. */ -static php_uint_t * +static zend_ulong * MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC) { const MYSQLND_RES_BUFFERED_ZVAL * set = (MYSQLND_RES_BUFFERED_ZVAL *) result; @@ -631,7 +631,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_lengths)(MYSQLND_RES_BUFFERED of PHP, to be called as separate function. But let's have it for completeness. */ -static php_uint_t * +static zend_ulong * MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC) { const MYSQLND_RES_BUFFERED_C * set = (MYSQLND_RES_BUFFERED_C *) result; @@ -648,7 +648,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_lengths)(MYSQLND_RES_BUFFERED * /* {{{ mysqlnd_result_unbuffered::fetch_lengths */ -static php_uint_t * +static zend_ulong * MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_lengths)(MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC) { /* simulate output of libmysql */ @@ -658,10 +658,10 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_lengths)(MYSQLND_RES_UNBUFFERED /* {{{ mysqlnd_res::fetch_lengths */ -static php_uint_t * +static zend_ulong * MYSQLND_METHOD(mysqlnd_res, fetch_lengths)(MYSQLND_RES * const result TSRMLS_DC) { - php_uint_t * ret; + zend_ulong * ret; DBG_ENTER("mysqlnd_res::fetch_lengths"); ret = result->stored_data && result->stored_data->m.fetch_lengths ? result->stored_data->m.fetch_lengths(result->stored_data TSRMLS_CC) : @@ -731,11 +731,11 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row_c)(MYSQLND_RES * result, voi *row = mnd_malloc(field_count * sizeof(char *)); if (*row) { MYSQLND_FIELD * field = meta->fields; - php_uint_t * lengths = result->unbuf->lengths; + zend_ulong * lengths = result->unbuf->lengths; for (i = 0; i < field_count; i++, field++) { zval * data = &result->unbuf->last_row_data[i]; - unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; + unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; /* BEGIN difference between normal normal fetch and _c */ if (Z_TYPE_P(data) != IS_NULL) { @@ -849,11 +849,11 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row)(MYSQLND_RES * result, void { HashTable * row_ht = Z_ARRVAL_P(row); MYSQLND_FIELD * field = meta->fields; - php_uint_t * lengths = result->unbuf->lengths; + zend_ulong * lengths = result->unbuf->lengths; for (i = 0; i < field_count; i++, field++) { zval * data = &result->unbuf->last_row_data[i]; - unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; + unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; if (flags & MYSQLND_FETCH_NUM) { Z_TRY_ADDREF_P(data); @@ -1002,7 +1002,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered, fetch_row_c)(MYSQLND_RES * result, void Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - php_uint_t len = Z_STRSIZE(current_row[i]); + zend_ulong len = Z_STRLEN(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -1017,7 +1017,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered, fetch_row_c)(MYSQLND_RES * result, void for (i = 0; i < field_count; i++) { zval * data = ¤t_row[i]; - set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; + set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; if (Z_TYPE_P(data) != IS_NULL) { convert_to_string(data); @@ -1093,7 +1093,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_row)(MYSQLND_RES * result, vo Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - php_uint_t len = Z_STRSIZE(current_row[i]); + zend_ulong len = Z_STRLEN(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -1104,7 +1104,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_row)(MYSQLND_RES * result, vo for (i = 0; i < field_count; i++) { zval * data = ¤t_row[i]; - set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; + set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; if (flags & MYSQLND_FETCH_NUM) { Z_TRY_ADDREF_P(data); @@ -1188,7 +1188,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_row)(MYSQLND_RES * result, void Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - php_uint_t len = Z_STRSIZE(current_row[i]); + zend_ulong len = Z_STRLEN(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -1199,7 +1199,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_row)(MYSQLND_RES * result, void for (i = 0; i < field_count; i++) { zval * data = ¤t_row[i]; - set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; + set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; if (flags & MYSQLND_FETCH_NUM) { Z_TRY_ADDREF_P(data); @@ -1776,7 +1776,7 @@ static void MYSQLND_METHOD(mysqlnd_res, fetch_all)(MYSQLND_RES * result, const unsigned int flags, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC) { zval row; - php_uint_t i = 0; + zend_ulong i = 0; MYSQLND_RES_BUFFERED *set = result->stored_data; DBG_ENTER("mysqlnd_res::fetch_all"); @@ -1927,7 +1927,7 @@ mysqlnd_result_unbuffered_init(unsigned int field_count, zend_bool ps, zend_bool DBG_RETURN(NULL); } - if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(php_uint_t), persistent))) { + if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(zend_ulong), persistent))) { mnd_pefree(ret, persistent); DBG_RETURN(NULL); } @@ -1967,7 +1967,7 @@ mysqlnd_result_buffered_zval_init(unsigned int field_count, zend_bool ps, zend_b if (!ret) { DBG_RETURN(NULL); } - if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(php_uint_t), persistent))) { + if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(zend_ulong), persistent))) { mnd_pefree(ret, persistent); DBG_RETURN(NULL); } @@ -2010,7 +2010,7 @@ mysqlnd_result_buffered_c_init(unsigned int field_count, zend_bool ps, zend_bool if (!ret) { DBG_RETURN(NULL); } - if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(php_uint_t), persistent))) { + if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(zend_ulong), persistent))) { mnd_pefree(ret, persistent); DBG_RETURN(NULL); } diff --git a/ext/mysqlnd/mysqlnd_result_meta.c b/ext/mysqlnd/mysqlnd_result_meta.c index ac7526d22d..e29c077602 100644 --- a/ext/mysqlnd/mysqlnd_result_meta.c +++ b/ext/mysqlnd/mysqlnd_result_meta.c @@ -42,7 +42,7 @@ php_mysqlnd_free_field_metadata(MYSQLND_FIELD *meta, zend_bool persistent TSRMLS meta->def = NULL; } if (meta->sname) { - STR_RELEASE(meta->sname); + zend_string_release(meta->sname); } } } @@ -64,7 +64,7 @@ MYSQLND_METHOD(mysqlnd_res_meta, read_metadata)(MYSQLND_RES_METADATA * const met } field_packet->persistent_alloc = meta->persistent; for (;i < meta->field_count; i++) { - php_int_t idx; + zend_long idx; if (meta->fields[i].root) { /* We re-read metadata for PS */ @@ -226,7 +226,7 @@ MYSQLND_METHOD(mysqlnd_res_meta, clone_metadata)(const MYSQLND_RES_METADATA * co memcpy(new_fields[i].root, orig_fields[i].root, new_fields[i].root_len); if (orig_fields[i].sname) { - new_fields[i].sname = STR_COPY(orig_fields[i].sname); + new_fields[i].sname = zend_string_copy(orig_fields[i].sname); new_fields[i].name = new_fields[i].sname->val; new_fields[i].name_length = new_fields[i].sname->len; } diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h index 87270a93c8..85e20a2c35 100644 --- a/ext/mysqlnd/mysqlnd_structs.h +++ b/ext/mysqlnd/mysqlnd_structs.h @@ -80,8 +80,8 @@ typedef struct st_mysqlnd_field const char *db; /* Database for table */ const char *catalog; /* Catalog for table */ char *def; /* Default value (set by mysql_list_fields) */ - php_uint_t length; /* Width of column (create length) */ - php_uint_t max_length; /* Max width for selected set */ + zend_ulong length; /* Width of column (create length) */ + zend_ulong max_length; /* Max width for selected set */ unsigned int name_length; unsigned int org_name_length; unsigned int table_length; @@ -414,7 +414,7 @@ struct st_mysqlnd_object_factory_methods typedef enum_func_status (*func_mysqlnd_conn_data__init)(MYSQLND_CONN_DATA * conn TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__connect)(MYSQLND_CONN_DATA * conn, const char * host, const char * user, const char * passwd, unsigned int passwd_len, const char * db, unsigned int db_len, unsigned int port, const char * socket_or_pipe, unsigned int mysql_flags TSRMLS_DC); -typedef php_int_t (*func_mysqlnd_conn_data__escape_string)(MYSQLND_CONN_DATA * const conn, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC); +typedef zend_long (*func_mysqlnd_conn_data__escape_string)(MYSQLND_CONN_DATA * const conn, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__set_charset)(MYSQLND_CONN_DATA * const conn, const char * const charset TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__query)(MYSQLND_CONN_DATA * conn, const char * query, unsigned int query_len TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__send_query)(MYSQLND_CONN_DATA * conn, const char *query, unsigned int query_len TSRMLS_DC); @@ -441,7 +441,7 @@ typedef const char * (*func_mysqlnd_conn_data__get_sqlstate)(const MYSQLND_CONN typedef uint64_t (*func_mysqlnd_conn_data__get_thread_id)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC); typedef void (*func_mysqlnd_conn_data__get_statistics)(const MYSQLND_CONN_DATA * const conn, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC); -typedef php_uint_t (*func_mysqlnd_conn_data__get_server_version)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC); +typedef zend_ulong (*func_mysqlnd_conn_data__get_server_version)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC); typedef const char * (*func_mysqlnd_conn_data__get_server_information)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__get_server_statistics)(MYSQLND_CONN_DATA * conn, zend_string **message TSRMLS_DC); typedef const char * (*func_mysqlnd_conn_data__get_host_information)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC); @@ -639,7 +639,7 @@ typedef const MYSQLND_FIELD *(*func_mysqlnd_res__fetch_field_direct)(MYSQLND_RES typedef const MYSQLND_FIELD *(*func_mysqlnd_res__fetch_fields)(MYSQLND_RES * const result TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_res__read_result_metadata)(MYSQLND_RES * result, MYSQLND_CONN_DATA * conn TSRMLS_DC); -typedef php_uint_t * (*func_mysqlnd_res__fetch_lengths)(MYSQLND_RES * const result TSRMLS_DC); +typedef zend_ulong * (*func_mysqlnd_res__fetch_lengths)(MYSQLND_RES * const result TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_res__store_result_fetch_data)(MYSQLND_CONN_DATA * const conn, MYSQLND_RES * result, MYSQLND_RES_METADATA * meta, MYSQLND_MEMORY_POOL_CHUNK *** row_buffers, zend_bool binary_protocol TSRMLS_DC); typedef void (*func_mysqlnd_res__free_result_buffers)(MYSQLND_RES * result TSRMLS_DC); /* private */ @@ -690,7 +690,7 @@ struct st_mysqlnd_res_methods typedef uint64_t (*func_mysqlnd_result_unbuffered__num_rows)(const MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC); -typedef php_uint_t * (*func_mysqlnd_result_unbuffered__fetch_lengths)(MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC); +typedef zend_ulong * (*func_mysqlnd_result_unbuffered__fetch_lengths)(MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC); typedef void (*func_mysqlnd_result_unbuffered__free_last_data)(MYSQLND_RES_UNBUFFERED * result, MYSQLND_STATS * const global_stats TSRMLS_DC); typedef void (*func_mysqlnd_result_unbuffered__free_result)(MYSQLND_RES_UNBUFFERED * const result, MYSQLND_STATS * const global_stats TSRMLS_DC); @@ -707,7 +707,7 @@ struct st_mysqlnd_result_unbuffered_methods typedef uint64_t (*func_mysqlnd_result_buffered__num_rows)(const MYSQLND_RES_BUFFERED * const result TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_result_buffered__initialize_result_set_rest)(MYSQLND_RES_BUFFERED * const result, MYSQLND_RES_METADATA * const meta, MYSQLND_STATS * stats, zend_bool int_and_float_native TSRMLS_DC); -typedef php_uint_t * (*func_mysqlnd_result_buffered__fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC); +typedef zend_ulong * (*func_mysqlnd_result_buffered__fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_result_buffered__data_seek)(MYSQLND_RES_BUFFERED * const result, const uint64_t row TSRMLS_DC); typedef void (*func_mysqlnd_result_buffered__free_result)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC); @@ -763,7 +763,7 @@ typedef enum_func_status (*func_mysqlnd_stmt__bind_one_parameter)(MYSQLND_STMT * typedef enum_func_status (*func_mysqlnd_stmt__refresh_bind_param)(MYSQLND_STMT * const stmt TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_stmt__bind_result)(MYSQLND_STMT * const stmt, MYSQLND_RESULT_BIND * const result_bind TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_stmt__bind_one_result)(MYSQLND_STMT * const stmt, unsigned int param_no TSRMLS_DC); -typedef enum_func_status (*func_mysqlnd_stmt__send_long_data)(MYSQLND_STMT * const stmt, unsigned int param_num, const char * const data, php_uint_t length TSRMLS_DC); +typedef enum_func_status (*func_mysqlnd_stmt__send_long_data)(MYSQLND_STMT * const stmt, unsigned int param_num, const char * const data, zend_ulong length TSRMLS_DC); typedef MYSQLND_RES * (*func_mysqlnd_stmt__get_parameter_metadata)(MYSQLND_STMT * const stmt TSRMLS_DC); typedef MYSQLND_RES * (*func_mysqlnd_stmt__get_result_metadata)(MYSQLND_STMT * const stmt TSRMLS_DC); typedef uint64_t (*func_mysqlnd_stmt__get_last_insert_id)(const MYSQLND_STMT * const stmt TSRMLS_DC); @@ -923,10 +923,10 @@ struct st_mysqlnd_connection_data unsigned int connect_or_select_db_len; MYSQLND_INFILE infile; unsigned int protocol_version; - php_uint_t max_packet_size; + zend_ulong max_packet_size; unsigned int port; - php_uint_t client_flag; - php_uint_t server_capabilities; + zend_ulong client_flag; + zend_ulong server_capabilities; /* For UPSERT queries */ MYSQLND_UPSERT_STATUS * upsert_status; @@ -986,7 +986,7 @@ struct st_mysqlnd_connection struct mysqlnd_field_hash_key { zend_bool is_numeric; - php_uint_t key; + zend_ulong key; }; @@ -1011,7 +1011,7 @@ struct st_mysqlnd_result_metadata uint64_t initialized_rows; \ \ /* Column lengths of current row - both buffered and unbuffered. For buffered results it duplicates the data found in **data */ \ - php_uint_t *lengths; \ + zend_ulong *lengths; \ \ MYSQLND_MEMORY_POOL *result_set_memory_pool; \ \ @@ -1064,7 +1064,7 @@ struct st_mysqlnd_unbuffered_result Column lengths of current row - both buffered and unbuffered. For buffered results it duplicates the data found in **data */ - php_uint_t *lengths; + zend_ulong *lengths; MYSQLND_MEMORY_POOL *result_set_memory_pool; @@ -1117,8 +1117,8 @@ struct st_mysqlnd_result_bind struct st_mysqlnd_stmt_data { MYSQLND_CONN_DATA *conn; - php_uint_t stmt_id; - php_uint_t flags;/* cursor is set here */ + zend_ulong stmt_id; + zend_ulong flags;/* cursor is set here */ enum_mysqlnd_stmt_state state; unsigned int warning_count; MYSQLND_RES *result; @@ -1137,7 +1137,7 @@ struct st_mysqlnd_stmt_data MYSQLND_ERROR_INFO error_info_impl; zend_bool update_max_length; - php_uint_t prefetch_rows; + zend_ulong prefetch_rows; zend_bool cursor_exists; mysqlnd_stmt_use_or_store_func default_rset_handler; @@ -1166,7 +1166,7 @@ struct st_mysqlnd_plugin_header { unsigned int plugin_api_version; const char * plugin_name; - php_uint_t plugin_version; + zend_ulong plugin_version; const char * plugin_string_version; const char * plugin_license; const char * plugin_author; @@ -1203,7 +1203,7 @@ typedef zend_uchar * (*func_auth_plugin__get_auth_data)(struct st_mysqlnd_authen MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd, const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len, const MYSQLND_OPTIONS * const options, - const MYSQLND_NET_OPTIONS * const net_options, php_uint_t mysql_flags + const MYSQLND_NET_OPTIONS * const net_options, zend_ulong mysql_flags TSRMLS_DC); struct st_mysqlnd_authentication_plugin diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index 2acccf3f43..c42059c641 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -126,14 +126,14 @@ static enum_mysqlnd_collected_stats packet_type_to_statistic_packet_count[PROT_L /* {{{ php_mysqlnd_net_field_length Get next field's length */ -php_uint_t +zend_ulong php_mysqlnd_net_field_length(zend_uchar **packet) { register zend_uchar *p= (zend_uchar *)*packet; if (*p < 251) { (*packet)++; - return (php_uint_t) *p; + return (zend_ulong) *p; } switch (*p) { @@ -142,13 +142,13 @@ php_mysqlnd_net_field_length(zend_uchar **packet) return MYSQLND_NULL_LENGTH; case 252: (*packet) += 3; - return (php_uint_t) uint2korr(p+1); + return (zend_ulong) uint2korr(p+1); case 253: (*packet) += 4; - return (php_uint_t) uint3korr(p+1); + return (zend_ulong) uint3korr(p+1); default: (*packet) += 9; - return (php_uint_t) uint4korr(p+1); + return (zend_ulong) uint4korr(p+1); } } /* }}} */ @@ -201,7 +201,7 @@ php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t length) if (length < (uint64_t) L64(16777216)) { *packet++ = 253; - int3store(packet,(php_uint_t) length); + int3store(packet,(zend_ulong) length); return packet + 3; } *packet++ = 254; @@ -567,7 +567,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) { char *s_key; unsigned int s_len; - php_uint_t num_key; + zend_ulong num_key; size_t value_len = strlen(*entry_value); if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) { @@ -582,11 +582,11 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC { zend_string * key; - php_uint_t unused_num_key; + zend_ulong unused_num_key; zval * entry_value; ZEND_HASH_FOREACH_KEY_VAL(packet->connect_attr, unused_num_key, key, entry_value) { if (key) { /* HASH_KEY_IS_STRING */ - size_t value_len = Z_STRSIZE_P(entry_value); + size_t value_len = Z_STRLEN_P(entry_value); ca_payload_len += php_mysqlnd_net_store_length_size(key->len); ca_payload_len += key->len; @@ -604,7 +604,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) { char *s_key; unsigned int s_len; - php_uint_t num_key; + zend_ulong num_key; size_t value_len = strlen(*entry_value); if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) { /* copy key */ @@ -621,11 +621,11 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC #else { zend_string * key; - php_uint_t unused_num_key; + zend_ulong unused_num_key; zval * entry_value; ZEND_HASH_FOREACH_KEY_VAL(packet->connect_attr, unused_num_key, key, entry_value) { if (key) { /* HASH_KEY_IS_STRING */ - size_t value_len = Z_STRSIZE_P(entry_value); + size_t value_len = Z_STRLEN_P(entry_value); /* copy key */ p = php_mysqlnd_net_store_length(p, key->len); @@ -685,7 +685,7 @@ php_mysqlnd_auth_response_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_D zend_uchar *buf = conn->net->cmd_buffer.buffer? (zend_uchar *) conn->net->cmd_buffer.buffer : local_buf; zend_uchar *p = buf; zend_uchar *begin = buf; - php_uint_t i; + zend_ulong i; register MYSQLND_PACKET_AUTH_RESPONSE * packet= (MYSQLND_PACKET_AUTH_RESPONSE *) _packet; DBG_ENTER("php_mysqlnd_auth_response_read"); @@ -848,7 +848,7 @@ php_mysqlnd_ok_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC) zend_uchar *buf = conn->net->cmd_buffer.buffer? (zend_uchar *) conn->net->cmd_buffer.buffer : local_buf; zend_uchar *p = buf; zend_uchar *begin = buf; - php_uint_t i; + zend_ulong i; register MYSQLND_PACKET_OK *packet= (MYSQLND_PACKET_OK *) _packet; DBG_ENTER("php_mysqlnd_ok_read"); @@ -1230,7 +1230,7 @@ php_mysqlnd_rset_field_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC) zend_uchar *p = buf; zend_uchar *begin = buf; char *root_ptr; - php_uint_t len; + zend_ulong len; MYSQLND_FIELD *meta; unsigned int i, field_count = sizeof(rset_field_offsets)/sizeof(size_t); @@ -1356,7 +1356,7 @@ php_mysqlnd_rset_field_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC) meta->root_len = total_len; if (meta->name != mysqlnd_empty_string) { - meta->sname = STR_INIT(meta->name, meta->name_length, packet->persistent_alloc); + meta->sname = zend_string_init(meta->name, meta->name_length, packet->persistent_alloc); } else { meta->sname = STR_EMPTY_ALLOC(); } @@ -1587,7 +1587,7 @@ php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zv MYSQLND_INC_CONN_STATISTIC_W_VALUE2(stats, statistic, 1, STAT_BYTES_RECEIVED_PURE_DATA_PS, (Z_TYPE_P(current_field) == IS_STRING)? - Z_STRSIZE_P(current_field) : (p - orig_p)); + Z_STRLEN_P(current_field) : (p - orig_p)); if (!((bit<<=1) & 255)) { bit = 1; /* to the following byte */ @@ -1622,7 +1622,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, for (i = 0, current_field = start_field; current_field < end_field; current_field++, i++) { /* php_mysqlnd_net_field_length() call should be after *this_field_len_pos = p; */ - php_uint_t len = php_mysqlnd_net_field_length(&p); + zend_ulong len = php_mysqlnd_net_field_length(&p); /* NULL or NOT NULL, this is the question! */ if (len == MYSQLND_NULL_LENGTH) { @@ -1667,7 +1667,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, MYSQLND_INC_CONN_STATISTIC_W_VALUE2(stats, statistic, 1, STAT_BYTES_RECEIVED_PURE_DATA_TEXT, len); } #ifdef MYSQLND_STRING_TO_INT_CONVERSION - if (as_int_or_float && perm_bind.php_type == IS_INT) { + if (as_int_or_float && perm_bind.php_type == IS_LONG) { zend_uchar save = *(p + len); /* We have to make it ASCIIZ temporarily */ *(p + len) = '\0'; @@ -1679,7 +1679,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, #else _atoi64((char *) p); #endif - ZVAL_INT(current_field, (php_int_t) v); /* the cast is safe */ + ZVAL_LONG(current_field, (zend_long) v); /* the cast is safe */ } else { uint64_t v = #ifndef PHP_WIN32 @@ -1701,7 +1701,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, { ZVAL_STRINGL(current_field, (char *)p, len); } else { - ZVAL_INT(current_field, (php_int_t) v); /* the cast is safe */ + ZVAL_LONG(current_field, (zend_long) v); /* the cast is safe */ } } *(p + len) = save; @@ -1730,12 +1730,12 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, later in this function there will be an advancement. */ p -= len; - if (Z_TYPE_P(current_field) == IS_INT) { - bit_area += 1 + sprintf((char *)start, ZEND_INT_FMT, Z_IVAL_P(current_field)); + if (Z_TYPE_P(current_field) == IS_LONG) { + bit_area += 1 + sprintf((char *)start, ZEND_INT_FMT, Z_LVAL_P(current_field)); ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1); } else if (Z_TYPE_P(current_field) == IS_STRING){ - memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRSIZE_P(current_field)); - bit_area += Z_STRSIZE_P(current_field); + memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRLEN_P(current_field)); + bit_area += Z_STRLEN_P(current_field); *bit_area++ = '\0'; zval_dtor(current_field); ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1); diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.h b/ext/mysqlnd/mysqlnd_wireprotocol.h index 059cfb2416..b40808d595 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.h +++ b/ext/mysqlnd/mysqlnd_wireprotocol.h @@ -28,7 +28,7 @@ #define MYSQLND_HEADER_SIZE 4 #define COMPRESSED_HEADER_SIZE 3 -#define MYSQLND_NULL_LENGTH (php_uint_t) ~0 +#define MYSQLND_NULL_LENGTH (zend_ulong) ~0 /* Used in mysqlnd_debug.c */ PHPAPI extern const char mysqlnd_read_header_name[]; @@ -185,7 +185,7 @@ typedef struct st_mysqlnd_packet_rset_header { error_no != 0 => error others => result set -> Read res_field packets up to field_count */ - php_uint_t field_count; + zend_ulong field_count; /* These are filled if no SELECT query. For SELECT warning_count and server status are in the last row packet, the EOF packet. @@ -258,7 +258,7 @@ typedef struct st_mysqlnd_packet_prepare_response { MYSQLND_PACKET_HEADER header; /* also known as field_count 0x00=OK , 0xFF=error */ unsigned char error_code; - php_uint_t stmt_id; + zend_ulong stmt_id; unsigned int field_count; unsigned int param_count; unsigned int warning_count; @@ -300,7 +300,7 @@ typedef struct st_mysqlnd_packet_sha256_pk_request_response { PHPAPI void php_mysqlnd_scramble(zend_uchar * const buffer, const zend_uchar * const scramble, const zend_uchar * const pass, size_t pass_len); -php_uint_t php_mysqlnd_net_field_length(zend_uchar **packet); +zend_ulong php_mysqlnd_net_field_length(zend_uchar **packet); zend_uchar * php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t length); size_t php_mysqlnd_net_store_length_size(uint64_t length); diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c index 76bf1e256f..ff532a6105 100644 --- a/ext/mysqlnd/php_mysqlnd.c +++ b/ext/mysqlnd/php_mysqlnd.c @@ -206,7 +206,7 @@ static PHP_GINIT_FUNCTION(mysqlnd) */ static PHP_INI_MH(OnUpdateNetCmdBufferSize) { - php_int_t long_value; + zend_long long_value; ZEND_ATOI(long_value, new_value); if (long_value < MYSQLND_NET_CMD_BUFFER_MIN_SIZE) { |
