com php-src: basic fixes to ext/pdo_firebird: ext/pdo_f irebird/firebird_driver.c ext/pdo_firebird/firebird_s tatement.c
ext/pdo_firebird/pdo_firebird.c ext/pdo _firebird/php_pdo_firebird_int.h
| From: | Anatol Belski | Date: | Tue, 03 Dec 2013 10:18:12 +0000 |
| Subject: | com php-src: basic fixes to ext/pdo_firebird: ext/pdo_f irebird/firebird_driver.c ext/pdo_firebird/firebird_s tatement.c ext/pdo_firebird/pdo_firebird.c ext/pdo _firebird/php_pdo_firebird_int.h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74221@lists.php.net to get a copy of this message | ||
Commit: 0ee45382cdcab259494f941d9719647b83ccb3dc
Author: Anatol Belski <ab@php.net> Tue, 3 Dec 2013 11:18:12 +0100
Parents: 71be6bc5ecfa829482ef3df4c14bcb68f9c4cf5d
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0ee45382cdcab259494f941d9719647b83ccb3dc
Log:
basic fixes to ext/pdo_firebird
Changed paths:
M ext/pdo_firebird/firebird_driver.c
M ext/pdo_firebird/firebird_statement.c
M ext/pdo_firebird/pdo_firebird.c
M ext/pdo_firebird/php_pdo_firebird_int.h
diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index bda6d23..656751b 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -35,11 +35,11 @@ #include "php_pdo_firebird.h" #include "php_pdo_firebird_int.h" -static int firebird_alloc_prepare_stmt(pdo_dbh_t*, const char*, long, XSQLDA*, isc_stmt_handle*, +static int firebird_alloc_prepare_stmt(pdo_dbh_t*, const char*, php_int_t, XSQLDA*, isc_stmt_handle*, HashTable* TSRMLS_DC); /* map driver specific error message to PDO error */ -void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, long line TSRMLS_DC) /* {{{ */ +void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, php_int_t line TSRMLS_DC) /* {{{ */ { #if 0 pdo_firebird_db_handle *H = stmt ? ((pdo_firebird_stmt *)stmt->driver_data)->H @@ -134,7 +134,7 @@ static int firebird_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ /* }}} */ /* called by PDO to prepare an SQL query */ -static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, /* {{{ */ +static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_str_size sql_len, /* {{{ */ pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; @@ -220,7 +220,7 @@ static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_le /* }}} */ /* called by PDO to execute a statement that doesn't produce a result set */ -static long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC) /* {{{ */ +static php_int_t firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC) /* {{{ */ { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; isc_stmt_handle stmt = NULL; @@ -393,12 +393,12 @@ static int firebird_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ /* }}} */ /* used by prepare and exec to allocate a statement handle and prepare the SQL */ -static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, long sql_len, /* {{{ */ +static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, zend_str_size sql_len, /* {{{ */ XSQLDA *out_sqlda, isc_stmt_handle *s, HashTable *named_params TSRMLS_DC) { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; char *c, *new_sql, in_quote, in_param, pname[64], *ppname; - long l, pindex = -1; + php_int_t l, pindex = -1; /* Firebird allows SQL statements up to 64k, so bail if it doesn't fit */ if (sql_len > 65536) { @@ -471,7 +471,7 @@ static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, long sql /* }}} */ /* called by PDO to set a driver-specific dbh attribute */ -static int firebird_handle_set_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_handle_set_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; @@ -546,7 +546,7 @@ static void firebird_info_cb(void *arg, char const *s) /* {{{ */ /* }}} */ /* called by PDO to get a driver-specific dbh attribute */ -static int firebird_handle_get_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_handle_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; @@ -609,7 +609,7 @@ static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; ISC_STATUS *s = H->isc_status; char buf[400]; - long i = 0, l, sqlcode = isc_sqlcode(s); + php_int_t i = 0, l, sqlcode = isc_sqlcode(s); if (sqlcode) { add_next_index_long(info, sqlcode); diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index 2b57cd8..0e92c6d 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -90,7 +90,7 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; - unsigned long affected_rows = 0; + php_uint_t affected_rows = 0; static char info_count[] = {isc_info_sql_records}; char result[64]; @@ -155,7 +155,7 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ /* called by PDO to fetch the next row from a statement */ static int firebird_stmt_fetch(pdo_stmt_t *stmt, /* {{{ */ - enum pdo_fetch_orientation ori, long offset TSRMLS_DC) + enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC) { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; @@ -221,7 +221,7 @@ static int firebird_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) /* {{{ /* fetch a blob into a fetch buffer */ static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ */ - unsigned long *len, ISC_QUAD *blob_id TSRMLS_DC) + php_uint_t *len, ISC_QUAD *blob_id TSRMLS_DC) { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; @@ -265,7 +265,7 @@ static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ * /* we've found the blob's length, now fetch! */ if (*len) { - unsigned long cur_len; + php_uint_t cur_len; unsigned short seg_len; ISC_STATUS stat; @@ -298,7 +298,7 @@ fetch_blob_end: /* }}} */ static int firebird_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ */ - unsigned long *len, int *caller_frees TSRMLS_DC) + php_uint_t *len, int *caller_frees TSRMLS_DC) { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; XSQLVAR const *var = &S->out_sqlda.sqlvar[colno]; @@ -415,7 +415,7 @@ static int firebird_bind_blob(pdo_stmt_t *stmt, ISC_QUAD *blob_id, zval *param T pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; isc_blob_handle h = NULL; - unsigned long put_cnt = 0, rem_cnt; + php_uint_t put_cnt = 0, rem_cnt; unsigned short chunk_size; int result = 1; @@ -428,7 +428,7 @@ static int firebird_bind_blob(pdo_stmt_t *stmt, ISC_QUAD *blob_id, zval *param T convert_to_string_ex(¶m); - for (rem_cnt = Z_STRLEN_P(param); rem_cnt > 0; rem_cnt -= chunk_size) { + for (rem_cnt = Z_STRSIZE_P(param); rem_cnt > 0; rem_cnt -= chunk_size) { chunk_size = rem_cnt > USHRT_MAX ? USHRT_MAX : (unsigned short)rem_cnt; @@ -466,7 +466,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat return 0; } if (param->is_param && param->paramno == -1) { - long *index; + php_int_t *index; /* try to determine the index by looking in the named_params hash */ if (SUCCESS == zend_hash_find(S->named_params, param->name, param->namelen+1, (void*)&index)) { @@ -498,7 +498,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat switch (event_type) { char *value; - unsigned long value_len; + php_uint_t value_len; int caller_frees; case PDO_PARAM_EVT_ALLOC: @@ -536,9 +536,9 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat case IS_LONG: /* keep the allow-NULL flag */ - var->sqltype = (sizeof(long) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1); + var->sqltype = (sizeof(php_int_t) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1); var->sqldata = (void*)&Z_LVAL_P(param->parameter); - var->sqllen = sizeof(long); + var->sqllen = sizeof(php_int_t); break; case IS_DOUBLE: /* keep the allow-NULL flag */ @@ -559,13 +559,13 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat case SQL_TIMESTAMP: case SQL_TYPE_DATE: case SQL_TYPE_TIME: - force_null = (Z_STRLEN_P(param->parameter) == 0); + force_null = (Z_STRSIZE_P(param->parameter) == 0); } if (!force_null) { /* keep the allow-NULL flag */ var->sqltype = SQL_TEXT | (var->sqltype & 1); var->sqldata = Z_STRVAL_P(param->parameter); - var->sqllen = Z_STRLEN_P(param->parameter); + var->sqllen = Z_STRSIZE_P(param->parameter); break; } case IS_NULL: @@ -604,7 +604,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat } case PDO_PARAM_INT: if (value) { - ZVAL_LONG(param->parameter, *(long*)value); + ZVAL_LONG(param->parameter, *(php_int_t*)value); break; } case PDO_PARAM_EVT_NORMALIZE: @@ -632,7 +632,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat } /* }}} */ -static int firebird_stmt_set_attribute(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_stmt_set_attribute(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; @@ -653,7 +653,7 @@ static int firebird_stmt_set_attribute(pdo_stmt_t *stmt, long attr, zval *val TS } /* }}} */ -static int firebird_stmt_get_attribute(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_stmt_get_attribute(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; diff --git a/ext/pdo_firebird/pdo_firebird.c b/ext/pdo_firebird/pdo_firebird.c index 1f14b55..02dfdc0 100644 --- a/ext/pdo_firebird/pdo_firebird.c +++ b/ext/pdo_firebird/pdo_firebird.c @@ -70,9 +70,9 @@ ZEND_GET_MODULE(pdo_firebird) PHP_MINIT_FUNCTION(pdo_firebird) /* {{{ */ { - REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_DATE_FORMAT", (long) PDO_FB_ATTR_DATE_FORMAT); - REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIME_FORMAT", (long) PDO_FB_ATTR_TIME_FORMAT); - REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIMESTAMP_FORMAT", (long) PDO_FB_ATTR_TIMESTAMP_FORMAT); + REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_DATE_FORMAT", (php_int_t) PDO_FB_ATTR_DATE_FORMAT); + REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIME_FORMAT", (php_int_t) PDO_FB_ATTR_TIME_FORMAT); + REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIMESTAMP_FORMAT", (php_int_t) PDO_FB_ATTR_TIMESTAMP_FORMAT); php_pdo_register_driver(&pdo_firebird_driver); diff --git a/ext/pdo_firebird/php_pdo_firebird_int.h b/ext/pdo_firebird/php_pdo_firebird_int.h index 9632edc..431ba28 100644 --- a/ext/pdo_firebird/php_pdo_firebird_int.h +++ b/ext/pdo_firebird/php_pdo_firebird_int.h @@ -37,7 +37,7 @@ #define SHORT_MAX (1 << (8*sizeof(short)-1)) -#if SIZEOF_LONG == 8 +#if SIZEOF_ZEND_INT == 8 && !defined(PHP_WIN32) # define LL_MASK "l" # define LL_LIT(lit) lit ## L #else @@ -130,7 +130,7 @@ extern pdo_driver_t pdo_firebird_driver; extern struct pdo_stmt_methods firebird_stmt_methods; -void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, long line TSRMLS_DC); +void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, php_int_t line TSRMLS_DC); enum { PDO_FB_ATTR_DATE_FORMAT = PDO_ATTR_DRIVER_SPECIFIC,
diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index bda6d23..656751b 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -35,11 +35,11 @@ #include "php_pdo_firebird.h" #include "php_pdo_firebird_int.h" -static int firebird_alloc_prepare_stmt(pdo_dbh_t*, const char*, long, XSQLDA*, isc_stmt_handle*, +static int firebird_alloc_prepare_stmt(pdo_dbh_t*, const char*, php_int_t, XSQLDA*, isc_stmt_handle*, HashTable* TSRMLS_DC); /* map driver specific error message to PDO error */ -void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, long line TSRMLS_DC) /* {{{ */ +void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, php_int_t line TSRMLS_DC) /* {{{ */ { #if 0 pdo_firebird_db_handle *H = stmt ? ((pdo_firebird_stmt *)stmt->driver_data)->H @@ -134,7 +134,7 @@ static int firebird_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ /* }}} */ /* called by PDO to prepare an SQL query */ -static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, /* {{{ */ +static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_str_size sql_len, /* {{{ */ pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; @@ -220,7 +220,7 @@ static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_le /* }}} */ /* called by PDO to execute a statement that doesn't produce a result set */ -static long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC) /* {{{ */ +static php_int_t firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC) /* {{{ */ { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; isc_stmt_handle stmt = NULL; @@ -393,12 +393,12 @@ static int firebird_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ /* }}} */ /* used by prepare and exec to allocate a statement handle and prepare the SQL */ -static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, long sql_len, /* {{{ */ +static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, zend_str_size sql_len, /* {{{ */ XSQLDA *out_sqlda, isc_stmt_handle *s, HashTable *named_params TSRMLS_DC) { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; char *c, *new_sql, in_quote, in_param, pname[64], *ppname; - long l, pindex = -1; + php_int_t l, pindex = -1; /* Firebird allows SQL statements up to 64k, so bail if it doesn't fit */ if (sql_len > 65536) { @@ -471,7 +471,7 @@ static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, long sql /* }}} */ /* called by PDO to set a driver-specific dbh attribute */ -static int firebird_handle_set_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_handle_set_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; @@ -546,7 +546,7 @@ static void firebird_info_cb(void *arg, char const *s) /* {{{ */ /* }}} */ /* called by PDO to get a driver-specific dbh attribute */ -static int firebird_handle_get_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_handle_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; @@ -609,7 +609,7 @@ static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; ISC_STATUS *s = H->isc_status; char buf[400]; - long i = 0, l, sqlcode = isc_sqlcode(s); + php_int_t i = 0, l, sqlcode = isc_sqlcode(s); if (sqlcode) { add_next_index_long(info, sqlcode); diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index 2b57cd8..0e92c6d 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -90,7 +90,7 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; - unsigned long affected_rows = 0; + php_uint_t affected_rows = 0; static char info_count[] = {isc_info_sql_records}; char result[64]; @@ -155,7 +155,7 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ /* called by PDO to fetch the next row from a statement */ static int firebird_stmt_fetch(pdo_stmt_t *stmt, /* {{{ */ - enum pdo_fetch_orientation ori, long offset TSRMLS_DC) + enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC) { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; @@ -221,7 +221,7 @@ static int firebird_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) /* {{{ /* fetch a blob into a fetch buffer */ static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ */ - unsigned long *len, ISC_QUAD *blob_id TSRMLS_DC) + php_uint_t *len, ISC_QUAD *blob_id TSRMLS_DC) { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; @@ -265,7 +265,7 @@ static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ * /* we've found the blob's length, now fetch! */ if (*len) { - unsigned long cur_len; + php_uint_t cur_len; unsigned short seg_len; ISC_STATUS stat; @@ -298,7 +298,7 @@ fetch_blob_end: /* }}} */ static int firebird_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ */ - unsigned long *len, int *caller_frees TSRMLS_DC) + php_uint_t *len, int *caller_frees TSRMLS_DC) { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; XSQLVAR const *var = &S->out_sqlda.sqlvar[colno]; @@ -415,7 +415,7 @@ static int firebird_bind_blob(pdo_stmt_t *stmt, ISC_QUAD *blob_id, zval *param T pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; isc_blob_handle h = NULL; - unsigned long put_cnt = 0, rem_cnt; + php_uint_t put_cnt = 0, rem_cnt; unsigned short chunk_size; int result = 1; @@ -428,7 +428,7 @@ static int firebird_bind_blob(pdo_stmt_t *stmt, ISC_QUAD *blob_id, zval *param T convert_to_string_ex(¶m); - for (rem_cnt = Z_STRLEN_P(param); rem_cnt > 0; rem_cnt -= chunk_size) { + for (rem_cnt = Z_STRSIZE_P(param); rem_cnt > 0; rem_cnt -= chunk_size) { chunk_size = rem_cnt > USHRT_MAX ? USHRT_MAX : (unsigned short)rem_cnt; @@ -466,7 +466,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat return 0; } if (param->is_param && param->paramno == -1) { - long *index; + php_int_t *index; /* try to determine the index by looking in the named_params hash */ if (SUCCESS == zend_hash_find(S->named_params, param->name, param->namelen+1, (void*)&index)) { @@ -498,7 +498,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat switch (event_type) { char *value; - unsigned long value_len; + php_uint_t value_len; int caller_frees; case PDO_PARAM_EVT_ALLOC: @@ -536,9 +536,9 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat case IS_LONG: /* keep the allow-NULL flag */ - var->sqltype = (sizeof(long) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1); + var->sqltype = (sizeof(php_int_t) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1); var->sqldata = (void*)&Z_LVAL_P(param->parameter); - var->sqllen = sizeof(long); + var->sqllen = sizeof(php_int_t); break; case IS_DOUBLE: /* keep the allow-NULL flag */ @@ -559,13 +559,13 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat case SQL_TIMESTAMP: case SQL_TYPE_DATE: case SQL_TYPE_TIME: - force_null = (Z_STRLEN_P(param->parameter) == 0); + force_null = (Z_STRSIZE_P(param->parameter) == 0); } if (!force_null) { /* keep the allow-NULL flag */ var->sqltype = SQL_TEXT | (var->sqltype & 1); var->sqldata = Z_STRVAL_P(param->parameter); - var->sqllen = Z_STRLEN_P(param->parameter); + var->sqllen = Z_STRSIZE_P(param->parameter); break; } case IS_NULL: @@ -604,7 +604,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat } case PDO_PARAM_INT: if (value) { - ZVAL_LONG(param->parameter, *(long*)value); + ZVAL_LONG(param->parameter, *(php_int_t*)value); break; } case PDO_PARAM_EVT_NORMALIZE: @@ -632,7 +632,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat } /* }}} */ -static int firebird_stmt_set_attribute(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_stmt_set_attribute(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; @@ -653,7 +653,7 @@ static int firebird_stmt_set_attribute(pdo_stmt_t *stmt, long attr, zval *val TS } /* }}} */ -static int firebird_stmt_get_attribute(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_stmt_get_attribute(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; diff --git a/ext/pdo_firebird/pdo_firebird.c b/ext/pdo_firebird/pdo_firebird.c index 1f14b55..02dfdc0 100644 --- a/ext/pdo_firebird/pdo_firebird.c +++ b/ext/pdo_firebird/pdo_firebird.c @@ -70,9 +70,9 @@ ZEND_GET_MODULE(pdo_firebird) PHP_MINIT_FUNCTION(pdo_firebird) /* {{{ */ { - REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_DATE_FORMAT", (long) PDO_FB_ATTR_DATE_FORMAT); - REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIME_FORMAT", (long) PDO_FB_ATTR_TIME_FORMAT); - REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIMESTAMP_FORMAT", (long) PDO_FB_ATTR_TIMESTAMP_FORMAT); + REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_DATE_FORMAT", (php_int_t) PDO_FB_ATTR_DATE_FORMAT); + REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIME_FORMAT", (php_int_t) PDO_FB_ATTR_TIME_FORMAT); + REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIMESTAMP_FORMAT", (php_int_t) PDO_FB_ATTR_TIMESTAMP_FORMAT); php_pdo_register_driver(&pdo_firebird_driver); diff --git a/ext/pdo_firebird/php_pdo_firebird_int.h b/ext/pdo_firebird/php_pdo_firebird_int.h index 9632edc..431ba28 100644 --- a/ext/pdo_firebird/php_pdo_firebird_int.h +++ b/ext/pdo_firebird/php_pdo_firebird_int.h @@ -37,7 +37,7 @@ #define SHORT_MAX (1 << (8*sizeof(short)-1)) -#if SIZEOF_LONG == 8 +#if SIZEOF_ZEND_INT == 8 && !defined(PHP_WIN32) # define LL_MASK "l" # define LL_LIT(lit) lit ## L #else @@ -130,7 +130,7 @@ extern pdo_driver_t pdo_firebird_driver; extern struct pdo_stmt_methods firebird_stmt_methods; -void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, long line TSRMLS_DC); +void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, php_int_t line TSRMLS_DC); enum { PDO_FB_ATTR_DATE_FORMAT = PDO_ATTR_DRIVER_SPECIFIC,