kalle Tue May 19 16:03:23 2009 UTC Modified files: /php-src/ext/pgsql pgsql.c Log: Fix compiler warnings, and some unicode stuff http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.400&r2=1.401&diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.400 php-src/ext/pgsql/pgsql.c:1.401 --- php-src/ext/pgsql/pgsql.c:1.400 Thu Mar 12 22:53:37 2009 +++ php-src/ext/pgsql/pgsql.c Tue May 19 16:03:23 2009 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pgsql.c,v 1.400 2009/03/12 22:53:37 iliaa Exp $ */ +/* $Id: pgsql.c,v 1.401 2009/05/19 16:03:23 kalle Exp $ */ #include <stdlib.h> @@ -2636,7 +2636,7 @@ zval *result; PGresult *pgsql_result; pgsql_result_handle *pg_result; - long colno=0; + unsigned long colno=0; int pg_numrows, pg_row; size_t num_fields; @@ -5095,6 +5095,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, ulong opt TSRMLS_DC) { HashPosition pos; + zstr zfield; char *field = NULL; uint field_len = -1; ulong num_idx = -1; @@ -5122,7 +5123,7 @@ skip_field = 0; new_val = NULL; - if ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &field, &field_len, &num_idx, 0, &pos)) == HASH_KEY_NON_EXISTANT) { + if ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &zfield, &field_len, &num_idx, 0, &pos)) == HASH_KEY_NON_EXISTANT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to get array key type"); err = 1; } @@ -5134,6 +5135,7 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Accepts only string key for values"); err = 1; } + field = zfield.s; if (!err && zend_hash_find(Z_ARRVAL_P(meta), field, field_len, (void **)&def) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid field name (%s) in values", field); err = 1; @@ -5784,8 +5786,8 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, ulong opt, char **sql TSRMLS_DC) { zval **val, *converted = NULL; + zstr zfld; char buf[256]; - char *fld; smart_str querystr = {0}; int key_type, ret = FAILURE; uint fld_len; @@ -5819,13 +5821,13 @@ smart_str_appends(&querystr, " ("); zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(var_array), &pos); - while ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(var_array), &fld, + while ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(var_array), &zfld, &fld_len, &num_idx, 0, &pos)) != HASH_KEY_NON_EXISTANT) { if (key_type == HASH_KEY_IS_LONG) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects associative array for values to be inserted"); goto cleanup; } - smart_str_appendl(&querystr, fld, fld_len - 1); + smart_str_appendl(&querystr, zfld.s, fld_len - 1); smart_str_appendc(&querystr, ','); zend_hash_move_forward_ex(Z_ARRVAL_P(var_array), &pos); } @@ -5925,24 +5927,24 @@ static inline int build_assignment_string(smart_str *querystr, HashTable *ht, const char *pad, int pad_len TSRMLS_DC) { HashPosition pos; + zstr zfld; uint fld_len; int key_type; ulong num_idx; - char *fld; char buf[256]; zval **val; for (zend_hash_internal_pointer_reset_ex(ht, &pos); zend_hash_get_current_data_ex(ht, (void **)&val, &pos) == SUCCESS; zend_hash_move_forward_ex(ht, &pos)) { - key_type = zend_hash_get_current_key_ex(ht, &fld, &fld_len, &num_idx, 0, &pos); + key_type = zend_hash_get_current_key_ex(ht, &zfld, &fld_len, &num_idx, 0, &pos); if (key_type == HASH_KEY_IS_LONG) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects associative array for values to be inserted"); return -1; } - smart_str_appendl(querystr, fld, fld_len - 1); + smart_str_appendl(querystr, zfld.s, fld_len - 1); smart_str_appendc(querystr, '='); - + switch(Z_TYPE_PP(val)) { case IS_STRING: smart_str_appendl(querystr, Z_STRVAL_PP(val), Z_STRLEN_PP(val));
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php