summaryrefslogtreecommitdiff
path: root/ext/pdo_pgsql/pgsql_driver.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2015-01-26 13:53:16 -0800
committerStanislav Malyshev <stas@php.net>2015-01-26 16:16:02 -0800
commitdfe6aea9cab6df556049ec2c9867d97a97e0fe09 (patch)
tree3c8d0b36eb0465854095fbc8efca30f399d6e2bc /ext/pdo_pgsql/pgsql_driver.c
parent5845f2c0c116accac6bdd60a6b35ff05aa604ca5 (diff)
downloadphp-git-dfe6aea9cab6df556049ec2c9867d97a97e0fe09.tar.gz
size_t cleanup for PDO
Diffstat (limited to 'ext/pdo_pgsql/pgsql_driver.c')
-rw-r--r--ext/pdo_pgsql/pgsql_driver.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index a581fecfcf..e4e202c9f9 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -214,14 +214,14 @@ static int pgsql_handle_closer(pdo_dbh_t *dbh) /* {{{ */
}
/* }}} */
-static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options)
+static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len, pdo_stmt_t *stmt, zval *driver_options)
{
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
pdo_pgsql_stmt *S = ecalloc(1, sizeof(pdo_pgsql_stmt));
int scrollable;
int ret;
char *nsql = NULL;
- int nsql_len = 0;
+ size_t nsql_len = 0;
int emulate = 0;
int execute_only = 0;
@@ -287,7 +287,7 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_
return 1;
}
-static zend_long pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len)
+static zend_long pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sql_len)
{
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
PGresult *res;
@@ -316,7 +316,7 @@ static zend_long pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sq
return ret;
}
-static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype)
+static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unquotedlen, char **quoted, size_t *quotedlen, enum pdo_param_type paramtype)
{
unsigned char *escaped;
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
@@ -325,8 +325,8 @@ static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquote
switch (paramtype) {
case PDO_PARAM_LOB:
/* escapedlen returned by PQescapeBytea() accounts for trailing 0 */
- escaped = PQescapeByteaConn(H->server, (unsigned char *)unquoted, (size_t)unquotedlen, &tmp_len);
- *quotedlen = (int)tmp_len + 1;
+ escaped = PQescapeByteaConn(H->server, (unsigned char *)unquoted, unquotedlen, &tmp_len);
+ *quotedlen = tmp_len + 1;
*quoted = emalloc(*quotedlen + 1);
memcpy((*quoted)+1, escaped, *quotedlen-2);
(*quoted)[0] = '\'';
@@ -337,7 +337,7 @@ static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquote
default:
*quoted = safe_emalloc(2, unquotedlen, 3);
(*quoted)[0] = '\'';
- *quotedlen = PQescapeStringConn(H->server, *quoted + 1, unquoted, (size_t)unquotedlen, NULL);
+ *quotedlen = PQescapeStringConn(H->server, *quoted + 1, unquoted, unquotedlen, NULL);
(*quoted)[*quotedlen + 1] = '\'';
(*quoted)[*quotedlen + 2] = '\0';
*quotedlen += 2;
@@ -345,7 +345,7 @@ static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquote
return 1;
}
-static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned int *len)
+static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, size_t *len)
{
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
char *id = NULL;
@@ -590,12 +590,12 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray)
if (status == PGRES_COPY_IN && pgsql_result) {
int command_failed = 0;
- int buffer_len = 0;
+ size_t buffer_len = 0;
zval *tmp;
PQclear(pgsql_result);
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), tmp) {
- int query_len;
+ size_t query_len;
convert_to_string_ex(tmp);
if (buffer_len < Z_STRLEN_P(tmp)) {