sixd Mon, 25 Jul 2011 23:40:57 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=313688
Log:
Fix cast warning seen on some platforms
Changed paths:
U php/php-src/branches/PHP_5_3/ext/oci8/oci8.c
U php/php-src/branches/PHP_5_4/ext/oci8/oci8.c
U php/php-src/trunk/ext/oci8/oci8.c
Modified: php/php-src/branches/PHP_5_3/ext/oci8/oci8.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/oci8/oci8.c 2011-07-25 21:39:53 UTC
(rev 313687)
+++ php/php-src/branches/PHP_5_3/ext/oci8/oci8.c 2011-07-25 23:40:57 UTC
(rev 313688)
@@ -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 @@
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 @@
#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)++;
Modified: php/php-src/branches/PHP_5_4/ext/oci8/oci8.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/oci8/oci8.c 2011-07-25 21:39:53 UTC
(rev 313687)
+++ php/php-src/branches/PHP_5_4/ext/oci8/oci8.c 2011-07-25 23:40:57 UTC
(rev 313688)
@@ -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 @@
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 @@
#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)++;
Modified: php/php-src/trunk/ext/oci8/oci8.c
===================================================================
--- php/php-src/trunk/ext/oci8/oci8.c 2011-07-25 21:39:53 UTC (rev 313687)
+++ php/php-src/trunk/ext/oci8/oci8.c 2011-07-25 23:40:57 UTC (rev 313688)
@@ -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 @@
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 @@
#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)++;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php