com php-src: Fixes to ext/oci8: ext/oci8/oci8.c ext/oci8/oci 8_interface.c ext/oci8/oci8_lob.c ext/oci8/ oci8_statement.c
| From: | Anatol Belski | Date: | Wed, 22 Jan 2014 23:25:55 +0000 |
| Subject: | com php-src: Fixes to ext/oci8: ext/oci8/oci8.c ext/oci8/oci 8_interface.c ext/oci8/oci8_lob.c ext/oci8/ oci8_statement.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75764@lists.php.net to get a copy of this message | ||
Commit: ab5405e800e3fa00a5e2bfb4f8cfcb7dfca14a19
Author: Christopher Jones <sixd@php.net> Thu, 23 Jan 2014 00:25:55 +0100
Committer: Anatol Belski <ab@php.net> Thu, 23 Jan 2014 00:25:55 +0100
Parents: 2741cf56a401ba4d8ef6cee79acb74643de6ff29
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ab5405e800e3fa00a5e2bfb4f8cfcb7dfca14a19
Log:
Fixes to ext/oci8
Changed paths:
M ext/oci8/oci8.c
M ext/oci8/oci8_interface.c
M ext/oci8/oci8_lob.c
M ext/oci8/oci8_statement.c
Diff:
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 3567130..69e62b7 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -1379,9 +1379,9 @@ PHP_MINFO_FUNCTION(oci)
php_info_print_table_start();
php_info_print_table_header(2, "Statistics", "");
- snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent));
+ snprintf(buf, sizeof(buf), ZEND_INT_FMT, OCI_G(num_persistent));
php_info_print_table_row(2, "Active Persistent Connections", buf);
- snprintf(buf, sizeof(buf), "%ld", OCI_G(num_links));
+ snprintf(buf, sizeof(buf), ZEND_INT_FMT, OCI_G(num_links));
php_info_print_table_row(2, "Active Connections", buf);
php_info_print_table_end();
}
@@ -1807,7 +1807,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, php_size_t
username_le
ub2 charsetid_nls_lang = 0;
if (session_mode & ~(OCI_SYSOPER | OCI_SYSDBA | PHP_OCI_CRED_EXT)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid session mode specified (%ld)",
session_mode);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid session mode specified ("
ZEND_INT_FMT ")", session_mode);
return NULL;
}
if (session_mode & (OCI_SYSOPER | OCI_SYSDBA | PHP_OCI_CRED_EXT)) {
@@ -2070,7 +2070,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, php_size_t
username_le
if (OCI_G(max_persistent) != -1 && OCI_G(num_persistent) >= OCI_G(max_persistent)) {
/* all persistent connactions are in use, fallback to non-persistent connection creation */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Too many open persistent connections
(%ld)", OCI_G(num_persistent));
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Too many open persistent connections ("
ZEND_INT_FMT ")", OCI_G(num_persistent));
alloc_non_persistent = 1;
}
}
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index 2a09490..21259f6 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -529,7 +529,7 @@ PHP_FUNCTION(oci_lob_write)
}
if (ZEND_NUM_ARGS() == 2) {
- data_len = MIN(data_len, write_len);
+ data_len = write_len <= 0 ? 0 : MIN(data_len, (php_size_t)write_len);
}
}
else {
@@ -538,7 +538,7 @@ PHP_FUNCTION(oci_lob_write)
}
if (ZEND_NUM_ARGS() == 3) {
- data_len = MIN(data_len, write_len);
+ data_len = write_len <= 0 ? 0 : MIN(data_len, (php_size_t)write_len);
}
}
@@ -549,7 +549,7 @@ PHP_FUNCTION(oci_lob_write)
PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
- if (data_len <= 0) {
+ if (data_len == 0) {
RETURN_INT(0);
}
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index 3f300dc..9f2547d 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -63,7 +63,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, php_int_
/* these three are allowed */
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown descriptor type %ld", type);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown descriptor type " ZEND_INT_FMT,
type);
return NULL;
break;
}
@@ -634,7 +634,7 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, php_int_t flush_flag TSRML
/* only these two are allowed */
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid flag value: %ld", flush_flag);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid flag value: " ZEND_INT_FMT,
flush_flag);
return 1;
break;
}
@@ -918,7 +918,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, php_int_t type, char
/* only these two are allowed */
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid temporary lob type: %ld", type);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid temporary lob type: "
ZEND_INT_FMT, type);
return 1;
break;
}
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index e0aa538..1cbdf66 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -1454,7 +1454,7 @@ php_oci_out_column
*php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME
convert_to_int(&tmp);
column = php_oci_statement_get_column(statement, Z_IVAL(tmp), NULL, 0 TSRMLS_CC);
if (!column) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%pd\"",
Z_IVAL(tmp));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \""
ZEND_INT_FMT "\"", Z_IVAL(tmp));
zval_dtor(&tmp);
return NULL;
}
@@ -1520,7 +1520,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name,
php_siz
convert_to_array(var);
if (maxlength < -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid max length value (%pu)",
maxlength);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid max length value (" ZEND_INT_FMT
")", maxlength);
return 1;
}
@@ -1551,7 +1551,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name,
php_siz
bind = php_oci_bind_array_helper_date(var, max_table_length, statement->connection
TSRMLS_CC);
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or unsupported datatype given:
%ld", type);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or unsupported datatype given: "
ZEND_INT_FMT, type);
return 1;
break;
}
@@ -1627,7 +1627,7 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, php_int_t
max_table_le
zend_hash_internal_pointer_reset(hash);
while (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) {
convert_to_string_ex(entry);
- if (Z_STRSIZE_PP(entry) > maxlength) {
+ if (maxlength < 0 || (maxlength >= 0 && Z_STRSIZE_PP(entry) > maxlength)) {
maxlength = Z_STRSIZE_PP(entry) + 1;
}
zend_hash_move_forward(hash);