andrey                                   Tue, 06 Apr 2010 18:14:23 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=297586

Log:
Fix the Windows build (void* arithmetic) as well as --disable-zlib
build.

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c	2010-04-06 16:40:05 UTC (rev 297585)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c	2010-04-06 18:14:23 UTC (rev 297586)
@@ -757,7 +757,7 @@
 {
 	void *ret;
 	zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
-	size_t old_size = collect_memory_statistics && ptr? *(size_t *) (ptr - sizeof(size_t)) : 0;
+	size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0;
 	DBG_ENTER(mysqlnd_erealloc_name);
 	DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);
 	DBG_INF_FMT("ptr=%p old_size=%lu, new_size=%lu", ptr, old_size, new_size);
@@ -779,7 +779,7 @@
 {
 	void *ret;
 	zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
-	size_t old_size = collect_memory_statistics && ptr? *(size_t *) (ptr - sizeof(size_t)) : 0;
+	size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0;
 	DBG_ENTER(mysqlnd_perealloc_name);
 	DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);
 	DBG_INF_FMT("ptr=%p old_size=%lu new_size=%lu persist=%d", ptr, old_size, new_size, persistent);
@@ -810,8 +810,8 @@

 	if (ptr) {
 		if (collect_memory_statistics) {
-			free_amount = *(size_t *)(ptr - sizeof(size_t));
-			DBG_INF_FMT("ptr=%p size=%u", ptr - sizeof(size_t), (unsigned int) free_amount);
+			free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t));
+			DBG_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount);
 		}
 		efree(REAL_PTR(ptr));
 	}
@@ -835,8 +835,8 @@

 	if (ptr) {
 		if (collect_memory_statistics) {
-			free_amount = *(size_t *)(ptr - sizeof(size_t));
-			DBG_INF_FMT("ptr=%p size=%u", ptr - sizeof(size_t), (unsigned int) free_amount);
+			free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t));
+			DBG_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount);
 		}
 		pefree(REAL_PTR(ptr), persistent);
 	}
@@ -923,8 +923,8 @@

 	if (ptr) {
 		if (collect_memory_statistics) {
-			free_amount = *(size_t *)(ptr - sizeof(size_t));
-			DBG_INF_FMT("ptr=%p size=%u", ptr - sizeof(size_t), (unsigned int) free_amount);
+			free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t));
+			DBG_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount);
 		}
 		free(REAL_PTR(ptr));
 	}
@@ -976,7 +976,7 @@
 {
 	char * ret;
 	smart_str tmp_str = {0, 0, 0};
-	char * p = ptr;
+	const char * p = ptr;
 	zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
 	DBG_ENTER(mysqlnd_pestrdup_name);
 	DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c	2010-04-06 16:40:05 UTC (rev 297585)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c	2010-04-06 18:14:23 UTC (rev 297586)
@@ -448,6 +448,7 @@
 MYSQLND_METHOD(mysqlnd_net, decode)(zend_uchar * uncompressed_data, size_t uncompressed_data_len,
 									const zend_uchar * const compressed_data, size_t compressed_data_len TSRMLS_DC)
 {
+#ifdef MYSQLND_COMPRESSION_ENABLED
 	int error;
 	uLongf tmp_complen = uncompressed_data_len;
 	DBG_ENTER("mysqlnd_net::decode");
@@ -458,6 +459,10 @@
 		DBG_INF_FMT("decompression NOT successful. error=%d Z_OK=%d Z_BUF_ERROR=%d Z_MEM_ERROR=%d", error, Z_OK, Z_BUF_ERROR, Z_MEM_ERROR);
 	}
 	DBG_RETURN(error == Z_OK? PASS:FAIL);
+#else
+	DBG_ENTER("mysqlnd_net::decode");
+	DBG_RETURN(FAIL);
+#endif
 }
 /* }}} */

@@ -467,6 +472,7 @@
 MYSQLND_METHOD(mysqlnd_net, encode)(zend_uchar * compress_buffer, size_t compress_buffer_len,
 									const zend_uchar * const uncompressed_data, size_t uncompressed_data_len TSRMLS_DC)
 {
+#ifdef MYSQLND_COMPRESSION_ENABLED
 	int error;
 	uLongf tmp_complen = compress_buffer_len;
 	DBG_ENTER("mysqlnd_net::encode");
@@ -478,6 +484,10 @@
 		DBG_INF_FMT("compression successful. compressed size=%d", tmp_complen);
 	}
 	DBG_RETURN(error == Z_OK? PASS:FAIL);
+#else
+	DBG_ENTER("mysqlnd_net::encode");
+	DBG_RETURN(FAIL);
+#endif
 }
 /* }}} */


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c	2010-04-06 16:40:05 UTC (rev 297585)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c	2010-04-06 18:14:23 UTC (rev 297586)
@@ -757,14 +757,14 @@
 {
 	void *ret;
 	zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
-	size_t old_size = collect_memory_statistics && ptr? *(size_t *) (ptr - sizeof(size_t)) : 0;
+	size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0;
 	DBG_ENTER(mysqlnd_erealloc_name);
 	DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);
 	DBG_INF_FMT("ptr=%p old_size=%lu, new_size=%lu", ptr, old_size, new_size);

 	ret = erealloc(REAL_PTR(ptr), REAL_SIZE(new_size));

-	DBG_INF_FMT("new_ptr=%p", ret);
+	DBG_INF_FMT("new_ptr=%p", (char*)ret);
 	if (collect_memory_statistics) {
 		*(size_t *) ret = new_size;
 		MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EREALLOC_COUNT, 1, STAT_MEM_EREALLOC_AMOUNT, new_size);
@@ -779,14 +779,14 @@
 {
 	void *ret;
 	zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
-	size_t old_size = collect_memory_statistics && ptr? *(size_t *) (ptr - sizeof(size_t)) : 0;
+	size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0;
 	DBG_ENTER(mysqlnd_perealloc_name);
 	DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);
 	DBG_INF_FMT("ptr=%p old_size=%lu new_size=%lu persist=%d", ptr, old_size, new_size, persistent);

 	ret = perealloc(REAL_PTR(ptr), REAL_SIZE(new_size), persistent);

-	DBG_INF_FMT("new_ptr=%p", ret);
+	DBG_INF_FMT("new_ptr=%p", (char*)ret);

 	if (collect_memory_statistics) {
 		enum mysqlnd_collected_stats s1 = persistent? STAT_MEM_REALLOC_COUNT:STAT_MEM_EREALLOC_COUNT;
@@ -810,8 +810,8 @@

 	if (ptr) {
 		if (collect_memory_statistics) {
-			free_amount = *(size_t *)(ptr - sizeof(size_t));
-			DBG_INF_FMT("ptr=%p size=%u", ptr - sizeof(size_t), (unsigned int) free_amount);
+			free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t));
+			DBG_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount);
 		}
 		efree(REAL_PTR(ptr));
 	}
@@ -835,8 +835,8 @@

 	if (ptr) {
 		if (collect_memory_statistics) {
-			free_amount = *(size_t *)(ptr - sizeof(size_t));
-			DBG_INF_FMT("ptr=%p size=%u", ptr - sizeof(size_t), (unsigned int) free_amount);
+			free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t));
+			DBG_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount);
 		}
 		pefree(REAL_PTR(ptr), persistent);
 	}
@@ -901,7 +901,7 @@

 	ret = realloc(REAL_PTR(ptr), REAL_SIZE(new_size));

-	DBG_INF_FMT("new_ptr=%p", ret);
+	DBG_INF_FMT("new_ptr=%p", (char*)ret);

 	if (collect_memory_statistics) {
 		*(size_t *) ret = new_size;
@@ -923,8 +923,8 @@

 	if (ptr) {
 		if (collect_memory_statistics) {
-			free_amount = *(size_t *)(ptr - sizeof(size_t));
-			DBG_INF_FMT("ptr=%p size=%u", ptr - sizeof(size_t), (unsigned int) free_amount);
+			free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t));
+			DBG_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount);
 		}
 		free(REAL_PTR(ptr));
 	}
@@ -976,7 +976,7 @@
 {
 	char * ret;
 	smart_str tmp_str = {0, 0, 0};
-	char * p = ptr;
+	const char * p = ptr;
 	zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
 	DBG_ENTER(mysqlnd_pestrdup_name);
 	DBG_INF_FMT("file=%-15s line=%4d", strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c	2010-04-06 16:40:05 UTC (rev 297585)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c	2010-04-06 18:14:23 UTC (rev 297586)
@@ -448,6 +448,7 @@
 MYSQLND_METHOD(mysqlnd_net, decode)(zend_uchar * uncompressed_data, size_t uncompressed_data_len,
 									const zend_uchar * const compressed_data, size_t compressed_data_len TSRMLS_DC)
 {
+#ifdef MYSQLND_COMPRESSION_ENABLED
 	int error;
 	uLongf tmp_complen = uncompressed_data_len;
 	DBG_ENTER("mysqlnd_net::decode");
@@ -458,6 +459,10 @@
 		DBG_INF_FMT("decompression NOT successful. error=%d Z_OK=%d Z_BUF_ERROR=%d Z_MEM_ERROR=%d", error, Z_OK, Z_BUF_ERROR, Z_MEM_ERROR);
 	}
 	DBG_RETURN(error == Z_OK? PASS:FAIL);
+#else
+	DBG_ENTER("mysqlnd_net::decode");
+	DBG_RETURN(FAIL);
+#endif
 }
 /* }}} */

@@ -467,6 +472,7 @@
 MYSQLND_METHOD(mysqlnd_net, encode)(zend_uchar * compress_buffer, size_t compress_buffer_len,
 									const zend_uchar * const uncompressed_data, size_t uncompressed_data_len TSRMLS_DC)
 {
+#ifdef MYSQLND_COMPRESSION_ENABLED
 	int error;
 	uLongf tmp_complen = compress_buffer_len;
 	DBG_ENTER("mysqlnd_net::encode");
@@ -478,6 +484,10 @@
 		DBG_INF_FMT("compression successful. compressed size=%d", tmp_complen);
 	}
 	DBG_RETURN(error == Z_OK? PASS:FAIL);
+#else
+	DBG_ENTER("mysqlnd_net::encode");
+	DBG_RETURN(FAIL);
+#endif
 }
 /* }}} */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to