Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Nov 2016 19:28:33 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org
Subject:   svn commit: r425439 - branches/2016Q4/multimedia/php-pHash/files
Message-ID:  <201611051928.uA5JSXHs048439@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Sat Nov  5 19:28:33 2016
New Revision: 425439
URL: https://svnweb.freebsd.org/changeset/ports/425439

Log:
  MFH: r425436
  
  multimedia/php-pHash: unbreak build with lang/php70
  
  In file included from bindings/php/pHash.cpp:17:
  In file included from ./php_pHash.h:28:
  In file included from /usr/local/include/php/main/php.h:35:
  In file included from /usr/local/include/php/Zend/zend.h:36:
  bindings/php/pHash.cpp:51:36: error:
        unknown type name 'zend_rsrc_list_entry'
  extern "C" void ph_video_hash_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
                                     ^
  bindings/php/pHash.cpp:260:18: error: use of
        undeclared identifier 'ZEND_REGISTER_RESOURCE'
          return_res_id = ZEND_REGISTER_RESOURCE(return_value, return_res, le_ph_video_hash);
                          ^
  bindings/php/pHash.cpp:397:26: error:
        unexpected type name 'ulong64': expected expression
          ZEND_FETCH_RESOURCE(h1, ulong64 *, &h1_res, h1_resid, "ph_image_hash", le_ph_image_hash);
                                  ^
  [...]
  
  PR:		213213
  Submitted by:	Naram Qashat <cyberbotx@cyberbotx.com> (maintainer)
  Approved by:	ports-secteam blanket

Added:
  branches/2016Q4/multimedia/php-pHash/files/patch-php__pHash.h
     - copied unchanged from r425436, head/multimedia/php-pHash/files/patch-php__pHash.h
Modified:
  branches/2016Q4/multimedia/php-pHash/files/patch-pHash.cpp
Directory Properties:
  branches/2016Q4/   (props changed)

Modified: branches/2016Q4/multimedia/php-pHash/files/patch-pHash.cpp
==============================================================================
--- branches/2016Q4/multimedia/php-pHash/files/patch-pHash.cpp	Sat Nov  5 19:27:10 2016	(r425438)
+++ branches/2016Q4/multimedia/php-pHash/files/patch-pHash.cpp	Sat Nov  5 19:28:33 2016	(r425439)
@@ -1,6 +1,6 @@
 --- pHash.cpp.orig	2013-04-23 18:54:02 UTC
 +++ pHash.cpp
-@@ -36,12 +36,14 @@ struct ph_text_hash
+@@ -36,17 +36,23 @@ struct ph_text_hash
  
  /* {{{ phpinfo logo definitions */
  
@@ -15,7 +15,52 @@
  /* }}} */
  
  /* {{{ Resource destructors */
-@@ -145,7 +147,9 @@ ZEND_GET_MODULE(pHash)
+ int le_ph_video_hash;
++#if PHP_VERSION_ID >= 70000
++extern "C" void ph_video_hash_dtor(zend_resource *rsrc TSRMLS_DC)
++#else
+ extern "C" void ph_video_hash_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
++#endif
+ {
+ 	ph_video_hash * resource = (ph_video_hash *)(rsrc->ptr);
+ 
+@@ -58,7 +64,11 @@ extern "C" void ph_video_hash_dtor(zend_
+ }
+ 
+ int le_ph_image_hash;
++#if PHP_VERSION_ID >= 70000
++extern "C" void ph_image_hash_dtor(zend_resource *rsrc TSRMLS_DC)
++#else
+ extern "C" void ph_image_hash_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
++#endif
+ {
+ 	ulong64 * resource = (ulong64 *)(rsrc->ptr);
+ 
+@@ -67,7 +77,11 @@ extern "C" void ph_image_hash_dtor(zend_
+ }
+ 
+ int le_ph_audio_hash;
++#if PHP_VERSION_ID >= 70000
++extern "C" void ph_audio_hash_dtor(zend_resource *rsrc TSRMLS_DC)
++#else
+ extern "C" void ph_audio_hash_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
++#endif
+ {
+ 	ph_audio_hash * resource = (ph_audio_hash *)(rsrc->ptr);
+ 
+@@ -79,7 +93,11 @@ extern "C" void ph_audio_hash_dtor(zend_
+ }
+ 
+ int le_ph_txt_hash;
++#if PHP_VERSION_ID >= 70000
++extern "C" void ph_txt_hash_dtor(zend_resource *rsrc TSRMLS_DC)
++#else
+ extern "C" void ph_txt_hash_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
++#endif
+ {
+ 	ph_text_hash * resource = (ph_text_hash *)(rsrc->ptr);
+ 
+@@ -145,7 +163,9 @@ ZEND_GET_MODULE(pHash)
  /* {{{ PHP_MINIT_FUNCTION */
  PHP_MINIT_FUNCTION(pHash)
  {
@@ -25,7 +70,7 @@
  	le_ph_video_hash = zend_register_list_destructors_ex(ph_video_hash_dtor, 
  						   NULL, "ph_video_hash", module_number);
  	le_ph_image_hash = zend_register_list_destructors_ex(ph_image_hash_dtor, 
-@@ -165,7 +169,9 @@ PHP_MINIT_FUNCTION(pHash)
+@@ -165,7 +185,9 @@ PHP_MINIT_FUNCTION(pHash)
  /* {{{ PHP_MSHUTDOWN_FUNCTION */
  PHP_MSHUTDOWN_FUNCTION(pHash)
  {
@@ -35,7 +80,7 @@
  
  	/* add your stuff here */
  
-@@ -203,7 +209,9 @@ PHP_MINFO_FUNCTION(pHash)
+@@ -203,7 +225,9 @@ PHP_MINFO_FUNCTION(pHash)
  	if (SG(request_info).request_uri) {
  		php_printf("%s", (SG(request_info).request_uri));
  	}   
@@ -45,3 +90,223 @@
  	php_printf("' align='right' alt='image' border='0'>\n");
  
  	php_printf("pHash\n");
+@@ -225,10 +249,12 @@ PHP_MINFO_FUNCTION(pHash)
+ PHP_FUNCTION(ph_dct_videohash)
+ {
+ 	ph_video_hash * return_res;
++#if PHP_VERSION_ID < 70000
+ 	long return_res_id = -1;
++#endif
+ 
+ 	const char * file = NULL;
+-	int file_len = 0;
++	SIZETorINT file_len = 0;
+ 
+ 
+ 
+@@ -249,7 +275,11 @@ PHP_FUNCTION(ph_dct_videohash)
+ 	else
+ 		RETURN_FALSE;
+ 
++#if PHP_VERSION_ID >= 70000
++	RETURN_RES(zend_register_resource(return_res, le_ph_video_hash));
++#else
+ 	return_res_id = ZEND_REGISTER_RESOURCE(return_value, return_res, le_ph_video_hash);
++#endif
+ }
+ /* }}} ph_dct_videohash */
+ 
+@@ -261,10 +291,12 @@ PHP_FUNCTION(ph_dct_videohash)
+ PHP_FUNCTION(ph_dct_imagehash)
+ {
+ 	ulong64 * return_res;
++#if PHP_VERSION_ID < 70000
+ 	long return_res_id = -1;
++#endif
+ 
+ 	const char * file = NULL;
+-	int file_len = 0;
++	SIZETorINT file_len = 0;
+ 
+ 
+ 
+@@ -282,7 +314,11 @@ PHP_FUNCTION(ph_dct_imagehash)
+ 	else
+ 		return_res = hash;
+ 
++#if PHP_VERSION_ID >= 70000
++	RETURN_RES(zend_register_resource(return_res, le_ph_image_hash));
++#else
+ 	return_res_id = ZEND_REGISTER_RESOURCE(return_value, return_res, le_ph_image_hash);
++#endif
+ }
+ /* }}} ph_dct_imagehash */
+ 
+@@ -293,10 +329,12 @@ PHP_FUNCTION(ph_dct_imagehash)
+ PHP_FUNCTION(ph_texthash)
+ {
+ 	ph_text_hash * return_res;
++#if PHP_VERSION_ID < 70000
+ 	long return_res_id = -1;
++#endif
+ 
+ 	const char * file = NULL;
+-	int file_len = 0;
++	SIZETorINT file_len = 0;
+ 
+ 
+ 
+@@ -316,7 +354,11 @@ PHP_FUNCTION(ph_texthash)
+ 	else
+ 		RETURN_FALSE;
+ 
++#if PHP_VERSION_ID >= 70000
++	RETURN_RES(zend_register_resource(return_res, le_ph_txt_hash));
++#else
+ 	return_res_id = ZEND_REGISTER_RESOURCE(return_value, return_res, le_ph_txt_hash);
++#endif
+ }
+ /* }}} ph_texthash */
+ 
+@@ -327,12 +369,14 @@ PHP_FUNCTION(ph_texthash)
+ PHP_FUNCTION(ph_audiohash)
+ {
+ 	ph_audio_hash * return_res;
++#if PHP_VERSION_ID < 70000
+ 	long return_res_id = -1;
++#endif
+ 
+ 	const char * file = NULL;
+-	int file_len = 0;
+-	long sample_rate = 5512;
+-	long channels = 1;
++	SIZETorINT file_len = 0;
++	zppLONG sample_rate = 5512;
++	zppLONG channels = 1;
+ 
+ 
+ 
+@@ -362,7 +406,11 @@ PHP_FUNCTION(ph_audiohash)
+ 	else
+ 		RETURN_FALSE;
+ 
++#if PHP_VERSION_ID >= 70000
++	RETURN_RES(zend_register_resource(return_res, le_ph_audio_hash));
++#else
+ 	return_res_id = ZEND_REGISTER_RESOURCE(return_value, return_res, le_ph_audio_hash);
++#endif
+ }
+ /* }}} ph_audiohash */
+ 
+@@ -386,8 +434,17 @@ PHP_FUNCTION(ph_image_dist)
+ 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &h1_res, &h2_res) == FAILURE) {
+ 		return;
+ 	}
++#if PHP_VERSION_ID >= 70000
++	if ((h1 = (ulong64 *)zend_fetch_resource2(Z_RES_P(h1_res), "ph_image_hash", h1_resid, le_ph_image_hash)) == NULL) {
++		RETURN_FALSE;
++	}
++	if ((h2 = (ulong64 *)zend_fetch_resource2(Z_RES_P(h2_res), "ph_image_hash", h2_resid, le_ph_image_hash)) == NULL) {
++		RETURN_FALSE;
++	}
++#else
+ 	ZEND_FETCH_RESOURCE(h1, ulong64 *, &h1_res, h1_resid, "ph_image_hash", le_ph_image_hash);
+ 	ZEND_FETCH_RESOURCE(h2, ulong64 *, &h2_res, h2_resid, "ph_image_hash", le_ph_image_hash);
++#endif
+ 
+ 
+ 
+@@ -415,15 +472,24 @@ PHP_FUNCTION(ph_video_dist)
+ 	int h2_resid = -1;
+ 	ph_video_hash * h2;
+ 
+-	long thresh = 21;
++	zppLONG thresh = 21;
+ 
+ 
+ 
+ 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &h1_res, &h2_res, &thresh) == FAILURE) {
+ 		return;
+ 	}
++#if PHP_VERSION_ID >= 70000
++	if ((h1 = (ph_video_hash *)zend_fetch_resource2(Z_RES_P(h1_res), "ph_video_hash", h1_resid, le_ph_video_hash)) == NULL) {
++		RETURN_FALSE;
++	}
++	if ((h2 = (ph_video_hash *)zend_fetch_resource2(Z_RES_P(h2_res), "ph_video_hash", h2_resid, le_ph_video_hash)) == NULL) {
++		RETURN_FALSE;
++	}
++#else
+ 	ZEND_FETCH_RESOURCE(h1, ph_video_hash *, &h1_res, h1_resid, "ph_video_hash", le_ph_video_hash);
+ 	ZEND_FETCH_RESOURCE(h2, ph_video_hash *, &h2_res, h2_resid, "ph_video_hash", le_ph_video_hash);
++#endif
+ 
+ 
+ 
+@@ -452,7 +518,7 @@ PHP_FUNCTION(ph_audio_dist)
+ 	int h2_resid = -1;
+ 	ph_audio_hash * h2;
+ 
+-	long block_size = 256;
++	zppLONG block_size = 256;
+ 	double thresh = 0.30;
+ 
+ 
+@@ -460,8 +526,17 @@ PHP_FUNCTION(ph_audio_dist)
+ 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|ld", &h1_res, &h2_res, &block_size, &thresh) == FAILURE) {
+ 		return;
+ 	}
++#if PHP_VERSION_ID >= 70000
++	if ((h1 = (ph_audio_hash *)zend_fetch_resource2(Z_RES_P(h1_res), "ph_audio_hash", h1_resid, le_ph_audio_hash)) == NULL) {
++		RETURN_FALSE;
++	}
++	if ((h2 = (ph_audio_hash *)zend_fetch_resource2(Z_RES_P(h2_res), "ph_audio_hash", h2_resid, le_ph_audio_hash)) == NULL) {
++		RETURN_FALSE;
++	}
++#else
+ 	ZEND_FETCH_RESOURCE(h1, ph_audio_hash *, &h1_res, h1_resid, "ph_audio_hash", le_ph_audio_hash);
+ 	ZEND_FETCH_RESOURCE(h2, ph_audio_hash *, &h2_res, h2_resid, "ph_audio_hash", le_ph_audio_hash);
++#endif
+ 
+ 
+ 
+@@ -510,8 +585,17 @@ PHP_FUNCTION(ph_compare_text_hashes)
+ 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &h1_res, &h2_res) == FAILURE) {
+ 		return;
+ 	}
++#if PHP_VERSION_ID >= 70000
++	if ((h1 = (ph_text_hash *)zend_fetch_resource2(Z_RES_P(h1_res), "ph_txt_hash", h1_resid, le_ph_txt_hash)) == NULL) {
++		RETURN_FALSE;
++	}
++	if ((h2 = (ph_text_hash *)zend_fetch_resource2(Z_RES_P(h2_res), "ph_txt_hash", h2_resid, le_ph_txt_hash)) == NULL) {
++		RETURN_FALSE;
++	}
++#else
+ 	ZEND_FETCH_RESOURCE(h1, ph_text_hash *, &h1_res, h1_resid, "ph_txt_hash", le_ph_txt_hash);
+ 	ZEND_FETCH_RESOURCE(h2, ph_text_hash *, &h2_res, h2_resid, "ph_txt_hash", le_ph_txt_hash);
++#endif
+ 
+ 
+ 
+@@ -525,6 +609,14 @@ PHP_FUNCTION(ph_compare_text_hashes)
+ 		{
+ 			for(int i = 0; i < count; ++i)
+ 			{
++#if PHP_VERSION_ID >= 70000
++				zval array;
++				array_init(&array);
++				add_assoc_long(&array, "begin", m[i].first_index);
++				add_assoc_long(&array, "end", m[i].second_index);
++				add_assoc_long(&array, "length", m[i].length);
++				add_next_index_zval(return_value, &array);
++#else
+ 				zval *array;
+ 				MAKE_STD_ZVAL(array);
+ 				array_init(array);
+@@ -532,6 +624,7 @@ PHP_FUNCTION(ph_compare_text_hashes)
+ 				add_assoc_long(array, "end", m[i].second_index);
+ 				add_assoc_long(array, "length", m[i].length);
+ 				add_next_index_zval(return_value, array);
++#endif
+ 			}
+ 			free(m);
+ 		}

Copied: branches/2016Q4/multimedia/php-pHash/files/patch-php__pHash.h (from r425436, head/multimedia/php-pHash/files/patch-php__pHash.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2016Q4/multimedia/php-pHash/files/patch-php__pHash.h	Sat Nov  5 19:28:33 2016	(r425439, copy of r425436, head/multimedia/php-pHash/files/patch-php__pHash.h)
@@ -0,0 +1,17 @@
+--- php_pHash.h.orig	2013-04-23 18:53:42 UTC
++++ php_pHash.h
+@@ -170,6 +170,14 @@ ZEND_END_ARG_INFO()
+ #define ph_compare_text_hashes_arg_info NULL
+ #endif
+ 
++#if PHP_VERSION_ID >= 70000
++#define SIZETorINT size_t
++#define zppLONG zend_long
++#else
++#define SIZETorINT int
++#define zppLONG long
++#endif
++
+ #ifdef  __cplusplus
+ } // extern "C" 
+ #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611051928.uA5JSXHs048439>