From: Ilia Alshanetsky Date: Mon, 2 Nov 2009 13:33:24 +0000 (+0000) Subject: Fixed compiler warnings X-Git-Tag: php-5.2.12RC1~36 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0b4c25d9163ddef2332c31cc1d51e97098553b25;p=php Fixed compiler warnings --- diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index ad470dd7ea..ffc7eb8ea3 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -363,7 +363,7 @@ static void _php_pgsql_notice_handler(void *resource_id, const char *message) if (PGG(log_notices)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", notice->message); } - zend_hash_index_update(&PGG(notices), (int)resource_id, (void **)¬ice, sizeof(php_pgsql_notice *), NULL); + zend_hash_index_update(&PGG(notices), (ulong)resource_id, (void **)¬ice, sizeof(php_pgsql_notice *), NULL); } } /* }}} */ @@ -761,13 +761,14 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) */ if (!(connect_type & PGSQL_CONNECT_FORCE_NEW) && zend_hash_find(&EG(regular_list),str.c,str.len+1,(void **) &index_ptr)==SUCCESS) { - int type,link; + int type; + ulong link; void *ptr; if (Z_TYPE_P(index_ptr) != le_index_ptr) { RETURN_FALSE; } - link = (int) index_ptr->ptr; + link = (uintptr_t) index_ptr->ptr; ptr = zend_list_find(link,&type); /* check if the link is still there */ if (ptr && (type==le_link || type==le_plink)) { Z_LVAL_P(return_value) = link; @@ -1754,14 +1755,15 @@ PHP_FUNCTION(pg_field_table) if (return_oid) { +#if UINT_MAX > LONG_MAX /* Oid is unsigned int, we don't need this code, where LONG is wider */ if (oid > LONG_MAX) { smart_str oidstr = {0}; smart_str_append_unsigned(&oidstr, oid); smart_str_0(&oidstr); RETURN_STRINGL(oidstr.c, oidstr.len, 0); - } else { + } else +#endif RETURN_LONG((long)oid); - } } /* try to lookup the table name in the resource list */ @@ -1859,7 +1861,7 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ case PHP_PG_FIELD_TYPE_OID: oid = PQftype(pgsql_result, Z_LVAL_PP(field)); - +#if UINT_MAX > LONG_MAX if (oid > LONG_MAX) { smart_str s = {0}; smart_str_append_unsigned(&s, oid); @@ -1867,8 +1869,8 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ Z_STRVAL_P(return_value) = s.c; Z_STRLEN_P(return_value) = s.len; Z_TYPE_P(return_value) = IS_STRING; - } - else + } else +#endif { Z_LVAL_P(return_value) = (long)oid; Z_TYPE_P(return_value) = IS_LONG; @@ -5767,8 +5769,8 @@ PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TS { zval *row; char *field_name, *element, *data; - size_t num_fields, element_len, data_len; - int pg_numrows, pg_row; + size_t num_fields, element_len; + int data_len, pg_numrows, pg_row; uint i; assert(Z_TYPE_P(ret_array) == IS_ARRAY);