summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_ps_codec.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-08-25 19:24:55 +0200
committerAnatol Belski <ab@php.net>2014-08-25 19:24:55 +0200
commitc3e3c98ec666812daaaca896cf5ef758a8a6df14 (patch)
treed82a76de5c8d117d1cf2dcca19bb30a283621870 /ext/mysqlnd/mysqlnd_ps_codec.c
parent0cf2dbdf58645b52cb6582b1b2571c5cd9e9e6b3 (diff)
downloadphp-git-c3e3c98ec666812daaaca896cf5ef758a8a6df14.tar.gz
master renames phase 1
Diffstat (limited to 'ext/mysqlnd/mysqlnd_ps_codec.c')
-rw-r--r--ext/mysqlnd/mysqlnd_ps_codec.c52
1 files changed, 26 insertions, 26 deletions
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);