summaryrefslogtreecommitdiff
path: root/ext/interbase/ibase_blobs.c
diff options
context:
space:
mode:
authorAaron Piotrowski <aaron@trowski.com>2016-06-10 22:02:23 -0500
committerAaron Piotrowski <aaron@trowski.com>2016-06-10 22:02:23 -0500
commite3c681aa5cc71122a8d2fae42e6513fc413ccac8 (patch)
tree5f1df62f7b666028edb0ee1adf083a52d63df45a /ext/interbase/ibase_blobs.c
parentfb4e3085cbaa76eb8f28eebf848a81d1c0190067 (diff)
parent792e89385ca6fc722a03590722eb7745a2374720 (diff)
downloadphp-git-e3c681aa5cc71122a8d2fae42e6513fc413ccac8.tar.gz
Merge branch 'master' into throw-error-in-extensions
Diffstat (limited to 'ext/interbase/ibase_blobs.c')
-rw-r--r--ext/interbase/ibase_blobs.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/ext/interbase/ibase_blobs.c b/ext/interbase/ibase_blobs.c
index ba384f8cd2..3cd649dbf9 100644
--- a/ext/interbase/ibase_blobs.c
+++ b/ext/interbase/ibase_blobs.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -36,7 +36,7 @@ static void _php_ibase_free_blob(zend_resource *rsrc) /* {{{ */
{
ibase_blob *ib_blob = (ibase_blob *)rsrc->ptr;
- if (ib_blob->bl_handle != NULL) { /* blob open*/
+ if (ib_blob->bl_handle != 0) { /* blob open*/
if (isc_cancel_blob(IB_STATUS, &ib_blob->bl_handle)) {
_php_ibase_module_error("You can lose data. Close any blob after reading from or "
"writing to it. Use ibase_blob_close() before calling ibase_close()");
@@ -90,16 +90,16 @@ typedef struct { /* {{{ */
/* }}} */
} IBASE_BLOBINFO;
-int _php_ibase_blob_get(zval *return_value, ibase_blob *ib_blob, unsigned long max_len) /* {{{ */
+int _php_ibase_blob_get(zval *return_value, ibase_blob *ib_blob, zend_ulong max_len) /* {{{ */
{
if (ib_blob->bl_qd.gds_quad_high || ib_blob->bl_qd.gds_quad_low) { /*not null ?*/
ISC_STATUS stat;
zend_string *bl_data;
- unsigned long cur_len;
+ zend_ulong cur_len;
unsigned short seg_len;
- bl_data = zend_string_alloc(max_len, 0);
+ bl_data = zend_string_safe_alloc(1, max_len, 0, 0);
for (cur_len = stat = 0; (stat == 0 || stat == isc_segment) && cur_len < max_len; cur_len += seg_len) {
@@ -126,7 +126,7 @@ int _php_ibase_blob_get(zval *return_value, ibase_blob *ib_blob, unsigned long m
int _php_ibase_blob_add(zval *string_arg, ibase_blob *ib_blob) /* {{{ */
{
- unsigned long put_cnt = 0, rem_cnt;
+ zend_ulong put_cnt = 0, rem_cnt;
unsigned short chunk_size;
convert_to_string_ex(string_arg);
@@ -154,7 +154,7 @@ static int _php_ibase_blob_info(isc_blob_handle bl_handle, IBASE_BLOBINFO *bl_in
isc_info_blob_type
};
- char bl_inf[sizeof(long)*8], *p;
+ char bl_inf[sizeof(zend_long)*8], *p;
bl_info->max_segment = 0;
bl_info->num_segments = 0;
@@ -216,7 +216,7 @@ PHP_FUNCTION(ibase_blob_create)
PHP_IBASE_LINK_TRANS(link, ib_link, trans);
ib_blob = (ibase_blob *) emalloc(sizeof(ibase_blob));
- ib_blob->bl_handle = NULL;
+ ib_blob->bl_handle = 0;
ib_blob->type = BLOB_INPUT;
if (isc_create_blob(IB_STATUS, &ib_link->handle, &trans->handle, &ib_blob->bl_handle, &ib_blob->bl_qd)) {
@@ -261,7 +261,7 @@ PHP_FUNCTION(ibase_blob_open)
PHP_IBASE_LINK_TRANS(link, ib_link, trans);
ib_blob = (ibase_blob *) emalloc(sizeof(ibase_blob));
- ib_blob->bl_handle = NULL;
+ ib_blob->bl_handle = 0;
ib_blob->type = BLOB_OUTPUT;
do {
@@ -296,7 +296,7 @@ PHP_FUNCTION(ibase_blob_add)
RESET_ERRMSG;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &blob_arg, &string_arg)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &blob_arg, &string_arg)) {
return;
}
@@ -318,7 +318,7 @@ PHP_FUNCTION(ibase_blob_add)
PHP_FUNCTION(ibase_blob_get)
{
zval *blob_arg;
- unsigned long len_arg;
+ zend_ulong len_arg;
ibase_blob *ib_blob;
RESET_ERRMSG;
@@ -361,7 +361,7 @@ static void _php_ibase_blob_end(INTERNAL_FUNCTION_PARAMETERS, int bl_end) /* {{{
RETURN_FALSE;
}
}
- ib_blob->bl_handle = NULL;
+ ib_blob->bl_handle = 0;
RETVAL_NEW_STR(_php_ibase_quad_to_string(ib_blob->bl_qd));
} else { /* discard created blob */
@@ -369,7 +369,7 @@ static void _php_ibase_blob_end(INTERNAL_FUNCTION_PARAMETERS, int bl_end) /* {{{
_php_ibase_error();
RETURN_FALSE;
}
- ib_blob->bl_handle = NULL;
+ ib_blob->bl_handle = 0;
RETVAL_TRUE;
}
zend_list_delete(Z_RES_P(blob_arg));
@@ -401,7 +401,7 @@ PHP_FUNCTION(ibase_blob_info)
zval *link = NULL;
ibase_db_link *ib_link;
ibase_trans *trans = NULL;
- ibase_blob ib_blob = { NULL, BLOB_INPUT };
+ ibase_blob ib_blob = { 0, BLOB_INPUT };
IBASE_BLOBINFO bl_info;
RESET_ERRMSG;
@@ -477,7 +477,7 @@ PHP_FUNCTION(ibase_blob_echo)
zval *link = NULL;
ibase_db_link *ib_link;
ibase_trans *trans = NULL;
- ibase_blob ib_blob_id = { NULL, BLOB_OUTPUT };
+ ibase_blob ib_blob_id = { 0, BLOB_OUTPUT };
char bl_data[IBASE_BLOB_SEG];
unsigned short seg_len;
@@ -538,7 +538,7 @@ PHP_FUNCTION(ibase_blob_import)
zval *link = NULL, *file;
int size;
unsigned short b;
- ibase_blob ib_blob = { NULL, 0 };
+ ibase_blob ib_blob = { 0, 0 };
ibase_db_link *ib_link;
ibase_trans *trans = NULL;
char bl_data[IBASE_BLOB_SEG];