diff options
author | Christopher Jones <sixd@php.net> | 2011-07-25 23:40:57 +0000 |
---|---|---|
committer | Christopher Jones <sixd@php.net> | 2011-07-25 23:40:57 +0000 |
commit | 987db5f747d10b900653c544325fa5f7f7047b9a (patch) | |
tree | db98a89f18ad754e5737aeea9305c9fba4142ff7 /ext/oci8 | |
parent | 2df7afeb1c25fce70273995825e0e62dd28bf82b (diff) | |
download | php-git-987db5f747d10b900653c544325fa5f7f7047b9a.tar.gz |
Fix cast warning seen on some platforms
Diffstat (limited to 'ext/oci8')
-rw-r--r-- | ext/oci8/oci8.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 4512c1f848..d5abe1b9de 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -37,6 +37,13 @@ #include "php_ini.h" #include "ext/standard/php_smart_str.h" +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif +#ifdef PHP_WIN32 +#include "win32/php_stdint.h" +#endif + #if HAVE_OCI8 #if PHP_MAJOR_VERSION > 5 @@ -51,6 +58,14 @@ #include "php_oci8_int.h" #include "zend_hash.h" +#if defined(HAVE_STDINT_H) || defined(PHP_WIN32) +#define OCI8_INT_TO_PTR(I) ((void *)(intptr_t)(I)) +#define OCI8_PTR_TO_INT(P) ((int)(intptr_t)(P)) +#else +#define OCI8_INT_TO_PTR(I) ((void *)(I)) +#define OCI8_PTR_TO_INT(P) ((int)(P)) +#endif + ZEND_DECLARE_MODULE_GLOBALS(oci) #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) /* This "if" allows PECL builds from this file to be portable to older PHP releases */ @@ -1877,7 +1892,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char int type, link; void *ptr; - link = (int) le->ptr; + link = OCI8_PTR_TO_INT(le->ptr); ptr = zend_list_find(link,&type); if (ptr && (type == le_connection)) { connection = (php_oci_connection *)ptr; @@ -2116,7 +2131,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char #else connection->rsrc_id = zend_list_insert(connection, le_connection); #endif - new_le.ptr = (void *)connection->rsrc_id; + new_le.ptr = OCI8_INT_TO_PTR(connection->rsrc_id); new_le.type = le_index_ptr; zend_hash_update(&EG(regular_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL); OCI_G(num_links)++; |