diff options
author | Remi Collet <fedora@famillecollet.com> | 2013-01-04 09:42:41 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2013-01-04 09:42:41 +0100 |
commit | 172868adf958db18fc79d34c3e085c149d4cd77c (patch) | |
tree | 8d7add181325b50323cf33a4db54b4e22061b1d4 | |
parent | 9887d67ecca12b28f301d3b5a8ceb77931f3a35e (diff) |
php-shout: modernize: remove deprecated calls, add arginfo for reflection, fix build warnings
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | php-shout-modernize.patch | 334 | ||||
-rw-r--r-- | php-shout.spec | 27 |
3 files changed, 349 insertions, 14 deletions
@@ -1,4 +1,4 @@ SRCDIR := $(shell pwd) NAME := $(shell basename $(SRCDIR)) -include ../common/Makefile +include ../../common/Makefile diff --git a/php-shout-modernize.patch b/php-shout-modernize.patch new file mode 100644 index 0000000..23385d8 --- /dev/null +++ b/php-shout-modernize.patch @@ -0,0 +1,334 @@ +--- phpShout-0.9.2/php_shout.h 2013-01-04 07:42:00.767187630 +0100 ++++ phpShout-0.9.2/php_shout.h 2013-01-04 09:17:02.462257549 +0100 +@@ -29,6 +29,37 @@ + + #define SHOUT_PORT 8000 + ++ZEND_BEGIN_ARG_INFO_EX(shout_create_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) ++ ZEND_ARG_INFO(0, host) ++ ZEND_ARG_INFO(0, user) ++ ZEND_ARG_INFO(0, password) ++ ZEND_ARG_INFO(0, format) ++ ZEND_ARG_INFO(0, protocol) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(shout_none_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(shout_onlylink_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) ++ ZEND_ARG_INFO(0, link) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(shout_linkvalue_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) ++ ZEND_ARG_INFO(0, link) ++ ZEND_ARG_INFO(0, value) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(shout_linkname_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) ++ ZEND_ARG_INFO(0, link) ++ ZEND_ARG_INFO(0, name) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(shout_linknamevalue_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) ++ ZEND_ARG_INFO(0, link) ++ ZEND_ARG_INFO(0, name) ++ ZEND_ARG_INFO(0, value) ++ZEND_END_ARG_INFO() ++ + extern zend_module_entry shout_module_entry; + + PHP_MINIT_FUNCTION(shout); +--- phpShout-0.9.2/shout.c 2013-01-04 07:42:00.767187630 +0100 ++++ phpShout-0.9.2/shout.c 2013-01-04 09:16:53.365225161 +0100 +@@ -81,54 +81,54 @@ + * Every user visible function must have an entry in shout_functions[]. + */ + zend_function_entry shout_functions[] = { +- PHP_FE(shout_get_all_persistent, NULL) ++ PHP_FE(shout_get_all_persistent, shout_none_arg_info) + +- PHP_FE(shout_create, NULL) +- PHP_FE(shout_pcreate, NULL) +- PHP_FE(shout_connect, NULL) +- PHP_FALIAS(shout_open, shout_connect, NULL) // Alias for shout_connect +- PHP_FE(shout_close, NULL) +- PHP_FE(shout_send, NULL) +- PHP_FE(shout_sync, NULL) +- +- PHP_FE(shout_get_connected, NULL) +- PHP_FE(shout_get_errno, NULL) +- PHP_FE(shout_get_error, NULL) +- +- PHP_FE(shout_get_host, NULL) +- PHP_FE(shout_get_port, NULL) +- PHP_FE(shout_get_password, NULL) +- PHP_FE(shout_get_mount, NULL) +- PHP_FE(shout_get_name, NULL) +- PHP_FE(shout_get_url, NULL) +- PHP_FE(shout_get_genre, NULL) +- PHP_FE(shout_get_user, NULL) +- PHP_FE(shout_get_agent, NULL) +- PHP_FE(shout_get_description, NULL) +- PHP_FE(shout_get_public, NULL) +- PHP_FE(shout_get_format, NULL) +- PHP_FE(shout_get_protocol, NULL) +- PHP_FE(shout_get_nonblocking, NULL) +- +- PHP_FE(shout_get_audio_info, NULL) +- +- PHP_FE(shout_set_host, NULL) +- PHP_FE(shout_set_port, NULL) +- PHP_FE(shout_set_password, NULL) +- PHP_FE(shout_set_mount, NULL) +- PHP_FE(shout_set_name, NULL) +- PHP_FE(shout_set_url, NULL) +- PHP_FE(shout_set_genre, NULL) +- PHP_FE(shout_set_user, NULL) +- PHP_FE(shout_set_agent, NULL) +- PHP_FE(shout_set_description, NULL) +- PHP_FE(shout_set_public, NULL) +- PHP_FE(shout_set_format, NULL) +- PHP_FE(shout_set_protocol, NULL) +- PHP_FE(shout_set_nonblocking, NULL) ++ PHP_FE(shout_create, shout_create_arg_info) ++ PHP_FE(shout_pcreate, shout_create_arg_info) ++ PHP_FE(shout_connect, shout_onlylink_arg_info) ++ PHP_FALIAS(shout_open, shout_connect, shout_onlylink_arg_info) // Alias for shout_connect ++ PHP_FE(shout_close, shout_onlylink_arg_info) ++ PHP_FE(shout_send, shout_linkvalue_arg_info) ++ PHP_FE(shout_sync, shout_onlylink_arg_info) ++ ++ PHP_FE(shout_get_connected, shout_onlylink_arg_info) ++ PHP_FE(shout_get_errno, shout_onlylink_arg_info) ++ PHP_FE(shout_get_error, shout_onlylink_arg_info) ++ ++ PHP_FE(shout_get_host, shout_onlylink_arg_info) ++ PHP_FE(shout_get_port, shout_onlylink_arg_info) ++ PHP_FE(shout_get_password, shout_onlylink_arg_info) ++ PHP_FE(shout_get_mount, shout_onlylink_arg_info) ++ PHP_FE(shout_get_name, shout_onlylink_arg_info) ++ PHP_FE(shout_get_url, shout_onlylink_arg_info) ++ PHP_FE(shout_get_genre, shout_onlylink_arg_info) ++ PHP_FE(shout_get_user, shout_onlylink_arg_info) ++ PHP_FE(shout_get_agent, shout_onlylink_arg_info) ++ PHP_FE(shout_get_description, shout_onlylink_arg_info) ++ PHP_FE(shout_get_public, shout_onlylink_arg_info) ++ PHP_FE(shout_get_format, shout_onlylink_arg_info) ++ PHP_FE(shout_get_protocol, shout_onlylink_arg_info) ++ PHP_FE(shout_get_nonblocking, shout_onlylink_arg_info) ++ ++ PHP_FE(shout_get_audio_info, shout_linkname_arg_info) ++ ++ PHP_FE(shout_set_host, shout_linkvalue_arg_info) ++ PHP_FE(shout_set_port, shout_linkvalue_arg_info) ++ PHP_FE(shout_set_password, shout_linkvalue_arg_info) ++ PHP_FE(shout_set_mount, shout_linkvalue_arg_info) ++ PHP_FE(shout_set_name, shout_linkvalue_arg_info) ++ PHP_FE(shout_set_url, shout_linkvalue_arg_info) ++ PHP_FE(shout_set_genre, shout_linkvalue_arg_info) ++ PHP_FE(shout_set_user, shout_linkvalue_arg_info) ++ PHP_FE(shout_set_agent, shout_linkvalue_arg_info) ++ PHP_FE(shout_set_description, shout_linkvalue_arg_info) ++ PHP_FE(shout_set_public, shout_linkvalue_arg_info) ++ PHP_FE(shout_set_format, shout_linkvalue_arg_info) ++ PHP_FE(shout_set_protocol, shout_linkvalue_arg_info) ++ PHP_FE(shout_set_nonblocking, shout_linkvalue_arg_info) + +- PHP_FE(shout_set_metadata, NULL) +- PHP_FE(shout_set_audio_info, NULL) ++ PHP_FE(shout_set_metadata, shout_linknamevalue_arg_info) ++ PHP_FE(shout_set_audio_info, shout_linknamevalue_arg_info) + {NULL, NULL, NULL} + }; + /* }}} */ +@@ -362,13 +362,9 @@ + char *hashed_details=NULL; + int hashed_details_length, port = SHOUT_PORT; + int format = 0, protocol = 0; ++ int hostlen, userlen, passlen; + php_shout_conn *shout=NULL; +-// void (*handler) (int); +- zval **z_host=NULL, **z_user=NULL, **z_password=NULL, **z_format=NULL, **z_protocol=NULL; + zend_bool free_host=0, free_host_port_mount=0; +- long connect_timeout; +- +- connect_timeout = MySG(connect_timeout); + + if (MySG(default_port) < 0) { + #if !defined(PHP_WIN32) && !defined(NETWARE) +@@ -397,82 +393,9 @@ + password = MySG(default_password); + format = MySG(default_format); + protocol = MySG(default_protocol); +- switch(ZEND_NUM_ARGS()) { +- case 1: { +- if (zend_get_parameters_ex(1, &z_host)==FAILURE) { +- SHOUT_CREATE_RETURN_FALSE(); +- } +- } +- break; +- case 2: { +- if (zend_get_parameters_ex(2, &z_host, &z_user) == FAILURE) { +- SHOUT_CREATE_RETURN_FALSE(); +- } +- convert_to_string_ex(z_user); +- user = Z_STRVAL_PP(z_user); +- } +- break; +- case 3: { +- if (zend_get_parameters_ex(3, &z_host, &z_user, &z_password) == FAILURE) { +- SHOUT_CREATE_RETURN_FALSE(); +- } +- convert_to_string_ex(z_user); +- convert_to_string_ex(z_password); +- user = Z_STRVAL_PP(z_user); +- password = Z_STRVAL_PP(z_password); +- } +- break; +- case 4: { +- if (zend_get_parameters_ex(4, &z_host, &z_user, &z_password, &z_format) == FAILURE) { +- SHOUT_CREATE_RETURN_FALSE(); +- } +- convert_to_string_ex(z_user); +- convert_to_string_ex(z_password); +- convert_to_long_ex(z_format); +- user = Z_STRVAL_PP(z_user); +- password = Z_STRVAL_PP(z_password); +- format = Z_LVAL_PP(z_format); +- } +- break; +- case 5: { +- if (zend_get_parameters_ex(5, &z_host, &z_user, &z_password, &z_format, &z_protocol) == FAILURE) { +- SHOUT_CREATE_RETURN_FALSE(); +- } +- convert_to_string_ex(z_user); +- convert_to_string_ex(z_password); +- convert_to_long_ex(z_format); +- convert_to_long_ex(z_protocol); +- user = Z_STRVAL_PP(z_user); +- password = Z_STRVAL_PP(z_password); +- format = Z_LVAL_PP(z_format); +- protocol = Z_LVAL_PP(z_protocol); +- } +- break; +- default: +- WRONG_PARAM_COUNT; +- break; +- } +- +- if (z_host) { +- SEPARATE_ZVAL(z_host); // We may modify z_host if it contains a port, separate +- convert_to_string_ex(z_host); +- host_port_mount = Z_STRVAL_PP(z_host); +- if (z_user) { +- convert_to_string_ex(z_user); +- user = Z_STRVAL_PP(z_user); +- if (z_password) { +- convert_to_string_ex(z_password); +- password = Z_STRVAL_PP(z_password); +- if (z_format) { +- convert_to_long_ex(z_format); +- format = Z_LVAL_PP(z_format); +- if (z_protocol) { +- convert_to_long_ex(z_protocol); +- protocol = Z_LVAL_PP(z_protocol); +- } +- } +- } +- } ++ ++ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ssll", &host_port_mount, &hostlen, &user, &userlen, &password, &passlen, &format, &protocol) == FAILURE) { ++ SHOUT_CREATE_RETURN_FALSE(); + } + #ifdef SHOUT_DEBUG + php_printf("Parsing host_port_mount='%s'\n", host_port_mount); +@@ -753,16 +676,16 @@ + + ZEND_FETCH_RESOURCE2(shout, php_shout_conn *, &shout_link, id, "Shout Connection", le_link, le_plink); + +- if (name == "host") value = shout_get_host(shout->conn); +- else if (name == "password") value = shout_get_password(shout->conn); +- else if (name == "mount") value = shout_get_mount(shout->conn); +- else if (name == "name") value = shout_get_name(shout->conn); +- else if (name == "url") value = shout_get_url(shout->conn); +- else if (name == "genre") value = shout_get_genre(shout->conn); +- else if (name == "user") value = shout_get_user(shout->conn); +- else if (name == "agent") value = shout_get_agent(shout->conn); +- else if (name == "description") value = shout_get_description(shout->conn); +- else if (name == "error") value = shout_get_error(shout->conn); ++ if (!strcmp(name, "host")) value = shout_get_host(shout->conn); ++ else if (!strcmp(name, "password")) value = shout_get_password(shout->conn); ++ else if (!strcmp(name, "mount")) value = shout_get_mount(shout->conn); ++ else if (!strcmp(name, "name")) value = shout_get_name(shout->conn); ++ else if (!strcmp(name, "url")) value = shout_get_url(shout->conn); ++ else if (!strcmp(name, "genre")) value = shout_get_genre(shout->conn); ++ else if (!strcmp(name, "user")) value = shout_get_user(shout->conn); ++ else if (!strcmp(name, "agent")) value = shout_get_agent(shout->conn); ++ else if (!strcmp(name, "description")) value = shout_get_description(shout->conn); ++ else if (!strcmp(name, "error")) value = shout_get_error(shout->conn); + else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown string property '%s'", name); + } +@@ -788,13 +711,13 @@ + + ZEND_FETCH_RESOURCE2(shout, php_shout_conn *, &shout_link, id, "Shout Connection", le_link, le_plink); + +- if (name == "connected") value = shout_get_connected(shout->conn); +- else if (name == "port") value = shout_get_port(shout->conn); +- else if (name == "public") value = shout_get_public(shout->conn); +- else if (name == "format") value = shout_get_format(shout->conn); +- else if (name == "protocol") value = shout_get_protocol(shout->conn); +- else if (name == "nonblocking") value = shout_get_nonblocking(shout->conn); +- else if (name == "errno") value = shout_get_errno(shout->conn); ++ if (!strcmp(name, "connected")) value = shout_get_connected(shout->conn); ++ else if (!strcmp(name, "port")) value = shout_get_port(shout->conn); ++ else if (!strcmp(name, "public")) value = shout_get_public(shout->conn); ++ else if (!strcmp(name, "format")) value = shout_get_format(shout->conn); ++ else if (!strcmp(name, "protocol")) value = shout_get_protocol(shout->conn); ++ else if (!strcmp(name, "nonblocking")) value = shout_get_nonblocking(shout->conn); ++ else if (!strcmp(name, "errno")) value = shout_get_errno(shout->conn); + + #ifdef SHOUT_DEBUG + php_printf("In get_int_param(), returning '%s'='%ld'\n", name, value); +@@ -820,15 +743,15 @@ + } + ZEND_FETCH_RESOURCE2(shout, php_shout_conn *, &shout_link, id, "Shout Connection", le_link, le_plink); + +- if (name == "host") retval = shout_set_host(shout->conn, setVal); +- else if (name == "password") retval = shout_set_password(shout->conn, setVal); +- else if (name == "mount") retval = shout_set_mount(shout->conn, setVal); +- else if (name == "name") retval = shout_set_name(shout->conn, setVal); +- else if (name == "url") retval = shout_set_url(shout->conn, setVal); +- else if (name == "genre") retval = shout_set_genre(shout->conn, setVal); +- else if (name == "user") retval = shout_set_user(shout->conn, setVal); +- else if (name == "agent") retval = shout_set_agent(shout->conn, setVal); +- else if (name == "description") retval = shout_set_description(shout->conn, setVal); ++ if (!strcmp(name, "host")) retval = shout_set_host(shout->conn, setVal); ++ else if (!strcmp(name, "password")) retval = shout_set_password(shout->conn, setVal); ++ else if (!strcmp(name, "mount")) retval = shout_set_mount(shout->conn, setVal); ++ else if (!strcmp(name, "name")) retval = shout_set_name(shout->conn, setVal); ++ else if (!strcmp(name, "url")) retval = shout_set_url(shout->conn, setVal); ++ else if (!strcmp(name, "genre")) retval = shout_set_genre(shout->conn, setVal); ++ else if (!strcmp(name, "user")) retval = shout_set_user(shout->conn, setVal); ++ else if (!strcmp(name, "agent")) retval = shout_set_agent(shout->conn, setVal); ++ else if (!strcmp(name, "description")) retval = shout_set_description(shout->conn, setVal); + + #ifdef SHOUT_DEBUG + php_printf("In set_string_param(), setting '%s'='%s'\n", name, SAFE_STRING(setVal)); +@@ -856,11 +779,11 @@ + + ZEND_FETCH_RESOURCE2(shout, php_shout_conn *, &shout_link, id, "Shout Connection", le_link, le_plink); + +- if (name == "port") retval = shout_set_port(shout->conn, setVal); +- else if (name == "public") retval = shout_set_public(shout->conn, setVal); +- else if (name == "format") retval = shout_set_format(shout->conn, setVal); +- else if (name == "protocol") retval = shout_set_protocol(shout->conn, setVal); +- else if (name == "nonblocking") retval = shout_set_nonblocking(shout->conn, setVal); ++ if (!strcmp(name, "port")) retval = shout_set_port(shout->conn, setVal); ++ else if (!strcmp(name, "public")) retval = shout_set_public(shout->conn, setVal); ++ else if (!strcmp(name, "format")) retval = shout_set_format(shout->conn, setVal); ++ else if (!strcmp(name, "protocol")) retval = shout_set_protocol(shout->conn, setVal); ++ else if (!strcmp(name, "nonblocking")) retval = shout_set_nonblocking(shout->conn, setVal); + + if (retval != SHOUTERR_SUCCESS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter '%s': %s", name, shout_get_error(shout->conn)); diff --git a/php-shout.spec b/php-shout.spec index d6b53b7..c6be56e 100644 --- a/php-shout.spec +++ b/php-shout.spec @@ -1,9 +1,6 @@ -%global php_apiver %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1) -%global php_extdi %(php-config --extension-dir 2>/dev/null || echo "undefined") - Name: php-shout Version: 0.9.2 -Release: 9%{?dist} +Release: 12%{?dist} Summary: PHP module for communicating with Icecast servers Group: Development/Languages @@ -11,24 +8,23 @@ License: LGPLv2+ URL: http://phpshout.sourceforge.net/ Source0: http://downloads.sourceforge.net/phpshout/phpShout-%{version}.tar.gz + +# Fix build warnings, Remove deprecated call, define arginfo for reflection +# https://sourceforge.net/tracker/?func=detail&aid=3599428&group_id=157641&atid=804644 +Patch0: %{name}-modernize.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: php-devel # Will hopefully go away once libogg-devel and/or libshout-devel specify this BR: BuildRequires: pkgconfig BuildRequires: libshout-devel >= 2.1 -%if 0%{?php_zend_api:1} Requires: php(zend-abi) = %{php_zend_api} Requires: php(api) = %{php_core_api} -%else -Requires: php-api = %{php_apiver} -%endif -# RPM 4.8 +# Filter private provides %{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} %{?filter_setup} -# RPM 4.9 -%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}%{_libdir}/.*\\.so$ %description @@ -47,11 +43,13 @@ details of the server communication. %prep %setup -q -c -cp -r phpShout-%{version} phpShout-zts - cd phpShout-%{version} +%patch0 -p1 -b .modernize + chmod a-x *.[ch] TODO README INSTALL LICENSE +cd .. +cp -r phpShout-%{version} phpShout-zts %build @@ -106,6 +104,9 @@ rm -rf %{buildroot} %changelog +* Fri Jan 4 2013 Remi Collet <remi@fedoraproject.org> - 0.9.2-12 +- modernize: remove deprecated calls, add arginfo for reflection + * Sat Nov 26 2011 Remi Collet <Fedora@FamilleCollet.com> - 0.9.2-9 - php 5.4 + zts build |