Fix compiler warnings, and some unicode stuff

This commit is contained in:
Kalle Sommer Nielsen 2009-05-19 16:03:23 +00:00
parent 696b664caa
commit c00b3c7fd8
3 changed files with 17 additions and 14 deletions

View file

@ -2636,7 +2636,7 @@ PHP_FUNCTION(pg_fetch_all_columns)
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 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC)
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 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
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_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
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 @@ static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, ulong opt T
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 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var
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,22 +5927,22 @@ PHP_FUNCTION(pg_insert)
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)) {

View file

@ -472,7 +472,8 @@ static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
{
int read_bytes=0, tmp_read_bytes;
uint read_bytes = 0;
int tmp_read_bytes;
count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes));
while (read_bytes < count_bytes) {

View file

@ -746,7 +746,7 @@ static int fcgi_read_request(fcgi_request *req)
} else if (hdr.type == FCGI_GET_VALUES) {
unsigned char *p = buf + sizeof(fcgi_header);
HashPosition pos;
char * str_index;
zstr key;
uint str_length;
ulong num_index;
int key_type;
@ -763,13 +763,13 @@ static int fcgi_read_request(fcgi_request *req)
}
zend_hash_internal_pointer_reset_ex(req->env, &pos);
while ((key_type = zend_hash_get_current_key_ex(req->env, &str_index, &str_length, &num_index, 0, &pos)) != HASH_KEY_NON_EXISTANT) {
while ((key_type = zend_hash_get_current_key_ex(req->env, &key, &str_length, &num_index, 0, &pos)) != HASH_KEY_NON_EXISTANT) {
int zlen;
zend_hash_move_forward_ex(req->env, &pos);
if (key_type != HASH_KEY_IS_STRING) {
continue;
}
if (zend_hash_find(&fcgi_mgmt_vars, str_index, str_length, (void**) &value) != SUCCESS) {
if (zend_hash_find(&fcgi_mgmt_vars, key.s, str_length, (void**) &value) != SUCCESS) {
continue;
}
--str_length;
@ -793,7 +793,7 @@ static int fcgi_read_request(fcgi_request *req)
*p++ = (zlen >> 8) & 0xff;
*p++ = zlen & 0xff;
}
memcpy(p, str_index, str_length);
memcpy(p, key.s, str_length);
p += str_length;
memcpy(p, Z_STRVAL_PP(value), zlen);
p += zlen;