com php-src: fix some types and unnecessary casts: ext/pgsql/pgsql.c
| From: | Anatol Belski | Date: | Thu, 28 Aug 2014 09:38:22 +0000 |
| Subject: | com php-src: fix some types and unnecessary casts: ext/pgsql/pgsql.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81254@lists.php.net to get a copy of this message | ||
Commit: e831de3024c2722895088ccfd08ab56884ddee03
Author: Anatol Belski <ab@php.net> Thu, 28 Aug 2014 11:32:24 +0200
Parents: 0b048435736171732a57268899d7bdb14379cd90
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e831de3024c2722895088ccfd08ab56884ddee03
Log:
fix some types and unnecessary casts
Changed paths:
M ext/pgsql/pgsql.c
Diff:
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 21d02be..4e1ce50 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -2741,7 +2741,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long
result_
} else {
char *element = PQgetvalue(pgsql_result, pgsql_row, i);
if (element) {
- const uint element_len = strlen(element);
+ const size_t element_len = strlen(element);
if (result_type & PGSQL_NUM) {
add_index_stringl(return_value, i, element, element_len);
@@ -3481,7 +3481,7 @@ PHP_FUNCTION(pg_lo_write)
char *str;
zend_long z_len;
size_t str_len, nbytes;
- int len;
+ size_t len;
pgLofp *pgsql;
int argc = ZEND_NUM_ARGS();
@@ -4284,11 +4284,11 @@ PHP_FUNCTION(pg_escape_string)
#ifdef HAVE_PQESCAPE_CONN
if (pgsql_link != NULL || id != -1) {
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link,
le_plink);
- to->len = (int) PQescapeStringConn(pgsql, to->val, from->val, (size_t)from->len,
NULL);
+ to->len = PQescapeStringConn(pgsql, to->val, from->val, from->len, NULL);
} else
#endif
{
- to->len = (int) PQescapeString(to->val, from->val, (size_t)from->len);
+ to->len = PQescapeString(to->val, from->val, from->len);
}
to = zend_string_realloc(to, to->len, 0);
@@ -5641,7 +5641,7 @@ static int php_pgsql_convert_match(const char *str, size_t str_len, const char
*
regmatch_t *subs;
int regopt = REG_EXTENDED;
int regerr, ret = SUCCESS;
- int i;
+ size_t i;
/* Check invalid chars for POSIX regex */
for (i = 0; i < str_len; i++) {
@@ -5969,7 +5969,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name,
con
/* PostgreSQL ignores \0 */
str = zend_string_alloc(Z_STRLEN_P(val) * 2, 0);
/* better to use PGSQLescapeLiteral since PGescapeStringConn does not handle special \ */
- str->len = (int)PQescapeStringConn(pg_link, str->val, Z_STRVAL_P(val),
Z_STRLEN_P(val), NULL);
+ str->len = PQescapeStringConn(pg_link, str->val, Z_STRVAL_P(val), Z_STRLEN_P(val),
NULL);
str = zend_string_realloc(str, str->len, 0);
ZVAL_STR(&new_val, str);
php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);