cellog Sun, 26 Jul 2009 01:03:47 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=286338
Log: re-organize slightly, fix more php6-only compile warnings in php_stream_copy_to_mem Changed paths: U pecl/phar/trunk/phar.c U pecl/phar/trunk/phar_internal.h U pecl/phar/trunk/phar_object.c U pecl/phar/trunk/tar.c U pecl/phar/trunk/zip.c U php/php-src/branches/PHP_5_3/ext/phar/phar.c U php/php-src/branches/PHP_5_3/ext/phar/phar_internal.h U php/php-src/branches/PHP_5_3/ext/phar/phar_object.c U php/php-src/branches/PHP_5_3/ext/phar/tar.c U php/php-src/branches/PHP_5_3/ext/phar/zip.c U php/php-src/trunk/ext/phar/phar.c U php/php-src/trunk/ext/phar/phar_internal.h U php/php-src/trunk/ext/phar/phar_object.c U php/php-src/trunk/ext/phar/tar.c U php/php-src/trunk/ext/phar/zip.c
Modified: pecl/phar/trunk/phar.c =================================================================== --- pecl/phar/trunk/phar.c 2009-07-26 00:39:40 UTC (rev 286337) +++ pecl/phar/trunk/phar.c 2009-07-26 01:03:47 UTC (rev 286338) @@ -2647,7 +2647,11 @@ len = -len; } user_stub = 0; +#if PHP_MAJOR_VERSION >= 6 + if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) { +#else if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) { +#endif if (closeoldfile) { php_stream_close(oldfile); } Modified: pecl/phar/trunk/phar_internal.h =================================================================== --- pecl/phar/trunk/phar_internal.h 2009-07-26 00:39:40 UTC (rev 286337) +++ pecl/phar/trunk/phar_internal.h 2009-07-26 01:03:47 UTC (rev 286338) @@ -546,6 +546,38 @@ b = ZSTR(a); #define PHAR_STR_FREE(a) \ efree(a); +static inline int phar_make_unicode(zstr *c_var, char *arKey, uint nKeyLength TSRMLS_DC) +{ + int c_var_len; + UConverter *conv = ZEND_U_CONVERTER(UG(runtime_encoding_conv)); + + c_var->u = NULL; + if (zend_string_to_unicode(conv, &c_var->u, &c_var_len, arKey, nKeyLength TSRMLS_CC) == FAILURE) { + + if (c_var->u) { + efree(c_var->u); + } + return 0; + + } + return c_var_len; +} +static inline int phar_find_key(HashTable *_SERVER, char *key, int len, void **stuff TSRMLS_DC) +{ + if (SUCCESS == zend_hash_find(_SERVER, key, len, stuff)) { + return 1; + } else { + int s = len; + zstr var; + s = phar_make_unicode(&var, key, len TSRMLS_CC); + if (SUCCESS == zend_u_hash_find(_SERVER, IS_UNICODE, var, s, stuff)) { + efree(var.u); + return 1; + } + efree(var.u); + return 0; + } +} #else typedef char *phar_zstr; #define PHAR_STR(a, b) \ Modified: pecl/phar/trunk/phar_object.c =================================================================== --- pecl/phar/trunk/phar_object.c 2009-07-26 00:39:40 UTC (rev 286337) +++ pecl/phar/trunk/phar_object.c 2009-07-26 01:03:47 UTC (rev 286338) @@ -56,40 +56,6 @@ } /* }}} */ -#if PHP_MAJOR_VERSION >= 6 -static inline int phar_make_unicode(zstr *c_var, char *arKey, uint nKeyLength TSRMLS_DC) -{ - int c_var_len; - UConverter *conv = ZEND_U_CONVERTER(UG(runtime_encoding_conv)); - - c_var->u = NULL; - if (zend_string_to_unicode(conv, &c_var->u, &c_var_len, arKey, nKeyLength TSRMLS_CC) == FAILURE) { - - if (c_var->u) { - efree(c_var->u); - } - return 0; - - } - return c_var_len; -} -static inline int phar_find_key(HashTable *_SERVER, char *key, int len, void **stuff TSRMLS_DC) -{ - if (SUCCESS == zend_hash_find(_SERVER, key, len, stuff)) { - return 1; - } else { - int s = len; - zstr var; - s = phar_make_unicode(&var, key, len TSRMLS_CC); - if (SUCCESS == zend_u_hash_find(_SERVER, IS_UNICODE, var, s, stuff)) { - efree(var.u); - return 1; - } - efree(var.u); - return 0; - } -} -#endif static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char *basename, int request_uri_len TSRMLS_DC) /* {{{ */ { #if PHP_MAJOR_VERSION >= 6 Modified: pecl/phar/trunk/tar.c =================================================================== --- pecl/phar/trunk/tar.c 2009-07-26 00:39:40 UTC (rev 286337) +++ pecl/phar/trunk/tar.c 2009-07-26 01:03:47 UTC (rev 286338) @@ -928,7 +928,11 @@ len = -len; } user_stub = 0; +#if PHP_MAJOR_VERSION >= 6 + if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) { +#else if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) { +#endif if (error) { spprintf(error, 0, "unable to read resource to copy stub to new tar-based phar \"%s\"", phar->fname); } Modified: pecl/phar/trunk/zip.c =================================================================== --- pecl/phar/trunk/zip.c 2009-07-26 00:39:40 UTC (rev 286337) +++ pecl/phar/trunk/zip.c 2009-07-26 01:03:47 UTC (rev 286338) @@ -600,7 +600,11 @@ php_stream_filter_append(&fp->readfilters, filter); +#if PHP_MAJOR_VERSION >= 6 + if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#else if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#endif pefree(entry.filename, entry.is_persistent); #if PHP_VERSION_ID < 50207 PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)"); @@ -621,7 +625,11 @@ php_stream_filter_append(&fp->readfilters, filter); +#if PHP_MAJOR_VERSION >= 6 + if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#else if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#endif pefree(entry.filename, entry.is_persistent); #if PHP_VERSION_ID < 50207 PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)"); @@ -632,7 +640,11 @@ php_stream_filter_flush(filter, 1); php_stream_filter_remove(filter, 1 TSRMLS_CC); } else { +#if PHP_MAJOR_VERSION >= 6 + if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#else if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#endif pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL("unable to read in alias, truncated"); } @@ -1234,7 +1246,11 @@ user_stub = 0; +#if PHP_MAJOR_VERSION >= 6 + if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) { +#else if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) { +#endif if (error) { spprintf(error, 0, "unable to read resource to copy stub to new zip-based phar \"%s\"", phar->fname); } Modified: php/php-src/branches/PHP_5_3/ext/phar/phar.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/phar/phar.c 2009-07-26 00:39:40 UTC (rev 286337) +++ php/php-src/branches/PHP_5_3/ext/phar/phar.c 2009-07-26 01:03:47 UTC (rev 286338) @@ -2647,7 +2647,11 @@ len = -len; } user_stub = 0; +#if PHP_MAJOR_VERSION >= 6 + if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) { +#else if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) { +#endif if (closeoldfile) { php_stream_close(oldfile); } Modified: php/php-src/branches/PHP_5_3/ext/phar/phar_internal.h =================================================================== --- php/php-src/branches/PHP_5_3/ext/phar/phar_internal.h 2009-07-26 00:39:40 UTC (rev 286337) +++ php/php-src/branches/PHP_5_3/ext/phar/phar_internal.h 2009-07-26 01:03:47 UTC (rev 286338) @@ -546,6 +546,38 @@ b = ZSTR(a); #define PHAR_STR_FREE(a) \ efree(a); +static inline int phar_make_unicode(zstr *c_var, char *arKey, uint nKeyLength TSRMLS_DC) +{ + int c_var_len; + UConverter *conv = ZEND_U_CONVERTER(UG(runtime_encoding_conv)); + + c_var->u = NULL; + if (zend_string_to_unicode(conv, &c_var->u, &c_var_len, arKey, nKeyLength TSRMLS_CC) == FAILURE) { + + if (c_var->u) { + efree(c_var->u); + } + return 0; + + } + return c_var_len; +} +static inline int phar_find_key(HashTable *_SERVER, char *key, int len, void **stuff TSRMLS_DC) +{ + if (SUCCESS == zend_hash_find(_SERVER, key, len, stuff)) { + return 1; + } else { + int s = len; + zstr var; + s = phar_make_unicode(&var, key, len TSRMLS_CC); + if (SUCCESS == zend_u_hash_find(_SERVER, IS_UNICODE, var, s, stuff)) { + efree(var.u); + return 1; + } + efree(var.u); + return 0; + } +} #else typedef char *phar_zstr; #define PHAR_STR(a, b) \ Modified: php/php-src/branches/PHP_5_3/ext/phar/phar_object.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2009-07-26 00:39:40 UTC (rev 286337) +++ php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2009-07-26 01:03:47 UTC (rev 286338) @@ -56,40 +56,6 @@ } /* }}} */ -#if PHP_MAJOR_VERSION >= 6 -static inline int phar_make_unicode(zstr *c_var, char *arKey, uint nKeyLength TSRMLS_DC) -{ - int c_var_len; - UConverter *conv = ZEND_U_CONVERTER(UG(runtime_encoding_conv)); - - c_var->u = NULL; - if (zend_string_to_unicode(conv, &c_var->u, &c_var_len, arKey, nKeyLength TSRMLS_CC) == FAILURE) { - - if (c_var->u) { - efree(c_var->u); - } - return 0; - - } - return c_var_len; -} -static inline int phar_find_key(HashTable *_SERVER, char *key, int len, void **stuff TSRMLS_DC) -{ - if (SUCCESS == zend_hash_find(_SERVER, key, len, stuff)) { - return 1; - } else { - int s = len; - zstr var; - s = phar_make_unicode(&var, key, len TSRMLS_CC); - if (SUCCESS == zend_u_hash_find(_SERVER, IS_UNICODE, var, s, stuff)) { - efree(var.u); - return 1; - } - efree(var.u); - return 0; - } -} -#endif static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char *basename, int request_uri_len TSRMLS_DC) /* {{{ */ { #if PHP_MAJOR_VERSION >= 6 Modified: php/php-src/branches/PHP_5_3/ext/phar/tar.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/phar/tar.c 2009-07-26 00:39:40 UTC (rev 286337) +++ php/php-src/branches/PHP_5_3/ext/phar/tar.c 2009-07-26 01:03:47 UTC (rev 286338) @@ -928,7 +928,11 @@ len = -len; } user_stub = 0; +#if PHP_MAJOR_VERSION >= 6 + if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) { +#else if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) { +#endif if (error) { spprintf(error, 0, "unable to read resource to copy stub to new tar-based phar \"%s\"", phar->fname); } Modified: php/php-src/branches/PHP_5_3/ext/phar/zip.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/phar/zip.c 2009-07-26 00:39:40 UTC (rev 286337) +++ php/php-src/branches/PHP_5_3/ext/phar/zip.c 2009-07-26 01:03:47 UTC (rev 286338) @@ -600,7 +600,11 @@ php_stream_filter_append(&fp->readfilters, filter); +#if PHP_MAJOR_VERSION >= 6 + if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#else if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#endif pefree(entry.filename, entry.is_persistent); #if PHP_VERSION_ID < 50207 PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)"); @@ -621,7 +625,11 @@ php_stream_filter_append(&fp->readfilters, filter); +#if PHP_MAJOR_VERSION >= 6 + if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#else if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#endif pefree(entry.filename, entry.is_persistent); #if PHP_VERSION_ID < 50207 PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)"); @@ -632,7 +640,11 @@ php_stream_filter_flush(filter, 1); php_stream_filter_remove(filter, 1 TSRMLS_CC); } else { +#if PHP_MAJOR_VERSION >= 6 + if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#else if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#endif pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL("unable to read in alias, truncated"); } @@ -1234,7 +1246,11 @@ user_stub = 0; +#if PHP_MAJOR_VERSION >= 6 + if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) { +#else if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) { +#endif if (error) { spprintf(error, 0, "unable to read resource to copy stub to new zip-based phar \"%s\"", phar->fname); } Modified: php/php-src/trunk/ext/phar/phar.c =================================================================== --- php/php-src/trunk/ext/phar/phar.c 2009-07-26 00:39:40 UTC (rev 286337) +++ php/php-src/trunk/ext/phar/phar.c 2009-07-26 01:03:47 UTC (rev 286338) @@ -2647,7 +2647,11 @@ len = -len; } user_stub = 0; +#if PHP_MAJOR_VERSION >= 6 + if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) { +#else if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) { +#endif if (closeoldfile) { php_stream_close(oldfile); } Modified: php/php-src/trunk/ext/phar/phar_internal.h =================================================================== --- php/php-src/trunk/ext/phar/phar_internal.h 2009-07-26 00:39:40 UTC (rev 286337) +++ php/php-src/trunk/ext/phar/phar_internal.h 2009-07-26 01:03:47 UTC (rev 286338) @@ -546,6 +546,38 @@ b = ZSTR(a); #define PHAR_STR_FREE(a) \ efree(a); +static inline int phar_make_unicode(zstr *c_var, char *arKey, uint nKeyLength TSRMLS_DC) +{ + int c_var_len; + UConverter *conv = ZEND_U_CONVERTER(UG(runtime_encoding_conv)); + + c_var->u = NULL; + if (zend_string_to_unicode(conv, &c_var->u, &c_var_len, arKey, nKeyLength TSRMLS_CC) == FAILURE) { + + if (c_var->u) { + efree(c_var->u); + } + return 0; + + } + return c_var_len; +} +static inline int phar_find_key(HashTable *_SERVER, char *key, int len, void **stuff TSRMLS_DC) +{ + if (SUCCESS == zend_hash_find(_SERVER, key, len, stuff)) { + return 1; + } else { + int s = len; + zstr var; + s = phar_make_unicode(&var, key, len TSRMLS_CC); + if (SUCCESS == zend_u_hash_find(_SERVER, IS_UNICODE, var, s, stuff)) { + efree(var.u); + return 1; + } + efree(var.u); + return 0; + } +} #else typedef char *phar_zstr; #define PHAR_STR(a, b) \ Modified: php/php-src/trunk/ext/phar/phar_object.c =================================================================== --- php/php-src/trunk/ext/phar/phar_object.c 2009-07-26 00:39:40 UTC (rev 286337) +++ php/php-src/trunk/ext/phar/phar_object.c 2009-07-26 01:03:47 UTC (rev 286338) @@ -56,40 +56,6 @@ } /* }}} */ -#if PHP_MAJOR_VERSION >= 6 -static inline int phar_make_unicode(zstr *c_var, char *arKey, uint nKeyLength TSRMLS_DC) -{ - int c_var_len; - UConverter *conv = ZEND_U_CONVERTER(UG(runtime_encoding_conv)); - - c_var->u = NULL; - if (zend_string_to_unicode(conv, &c_var->u, &c_var_len, arKey, nKeyLength TSRMLS_CC) == FAILURE) { - - if (c_var->u) { - efree(c_var->u); - } - return 0; - - } - return c_var_len; -} -static inline int phar_find_key(HashTable *_SERVER, char *key, int len, void **stuff TSRMLS_DC) -{ - if (SUCCESS == zend_hash_find(_SERVER, key, len, stuff)) { - return 1; - } else { - int s = len; - zstr var; - s = phar_make_unicode(&var, key, len TSRMLS_CC); - if (SUCCESS == zend_u_hash_find(_SERVER, IS_UNICODE, var, s, stuff)) { - efree(var.u); - return 1; - } - efree(var.u); - return 0; - } -} -#endif static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char *basename, int request_uri_len TSRMLS_DC) /* {{{ */ { #if PHP_MAJOR_VERSION >= 6 Modified: php/php-src/trunk/ext/phar/tar.c =================================================================== --- php/php-src/trunk/ext/phar/tar.c 2009-07-26 00:39:40 UTC (rev 286337) +++ php/php-src/trunk/ext/phar/tar.c 2009-07-26 01:03:47 UTC (rev 286338) @@ -928,7 +928,11 @@ len = -len; } user_stub = 0; +#if PHP_MAJOR_VERSION >= 6 + if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) { +#else if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) { +#endif if (error) { spprintf(error, 0, "unable to read resource to copy stub to new tar-based phar \"%s\"", phar->fname); } Modified: php/php-src/trunk/ext/phar/zip.c =================================================================== --- php/php-src/trunk/ext/phar/zip.c 2009-07-26 00:39:40 UTC (rev 286337) +++ php/php-src/trunk/ext/phar/zip.c 2009-07-26 01:03:47 UTC (rev 286338) @@ -600,7 +600,11 @@ php_stream_filter_append(&fp->readfilters, filter); +#if PHP_MAJOR_VERSION >= 6 + if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#else if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#endif pefree(entry.filename, entry.is_persistent); #if PHP_VERSION_ID < 50207 PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)"); @@ -621,7 +625,11 @@ php_stream_filter_append(&fp->readfilters, filter); +#if PHP_MAJOR_VERSION >= 6 + if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#else if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#endif pefree(entry.filename, entry.is_persistent); #if PHP_VERSION_ID < 50207 PHAR_ZIP_FAIL("unable to read in alias, truncated (PHP 5.2.7 and newer has a potential fix for this problem)"); @@ -632,7 +640,11 @@ php_stream_filter_flush(filter, 1); php_stream_filter_remove(filter, 1 TSRMLS_CC); } else { +#if PHP_MAJOR_VERSION >= 6 + if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, (void **) &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#else if (!(entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)) || !actual_alias) { +#endif pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL("unable to read in alias, truncated"); } @@ -1234,7 +1246,11 @@ user_stub = 0; +#if PHP_MAJOR_VERSION >= 6 + if (!(len = php_stream_copy_to_mem(stubfile, (void **) &user_stub, len, 0)) || !user_stub) { +#else if (!(len = php_stream_copy_to_mem(stubfile, &user_stub, len, 0)) || !user_stub) { +#endif if (error) { spprintf(error, 0, "unable to read resource to copy stub to new zip-based phar \"%s\"", phar->fname); }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php