cvs: php-src /ext/ming config.m4 ming.c

From: Date: Wed, 21 Dec 2005 21:43:25 +0000
Subject: cvs: php-src /ext/ming config.m4 ming.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-36123@lists.php.net to get a copy of this message
sniper Wed Dec 21 21:43:25 2005 EDT Modified files: /php-src/ext/ming config.m4 ming.c Log: - Fixed bug #35461 (Ming extension fails to compile with ming 0.3beta1) http://cvs.php.net/viewcvs.cgi/php-src/ext/ming/config.m4?r1=1.25&r2=1.26&diff_format=u Index: php-src/ext/ming/config.m4 diff -u php-src/ext/ming/config.m4:1.25 php-src/ext/ming/config.m4:1.26 --- php-src/ext/ming/config.m4:1.25 Wed Dec 21 21:15:36 2005 +++ php-src/ext/ming/config.m4 Wed Dec 21 21:43:25 2005 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.25 2005/12/21 21:15:36 sniper Exp $ +dnl $Id: config.m4,v 1.26 2005/12/21 21:43:25 sniper Exp $ dnl PHP_ARG_WITH(ming, for MING support, @@ -40,6 +40,10 @@ PHP_ADD_INCLUDE($MING_INC_DIR) PHP_ADD_LIBRARY_WITH_PATH(ming, $MING_DIR/$PHP_LIBDIR, MING_SHARED_LIBADD) + PHP_CHECK_LIBRARY(ming, SWFPrebuiltClip, [ AC_DEFINE(HAVE_SWFPREBUILTCLIP, 1, [ ]) ], [], []) + + old_CPPFLAGS=$CPPFLAGS + CPPFLAGS=-I$MING_INC_DIR AC_MSG_CHECKING([for destroySWFBlock]) AC_TRY_RUN([ #include "ming.h" @@ -58,11 +62,7 @@ AC_MSG_RESULT([unknown]) ]) - PHP_CHECK_LIBRARY(ming, SWFPrebuiltClip, [ AC_DEFINE(HAVE_SWFPREBUILTCLIP, 1, [ ]) ], [], []) - dnl Check Ming version (FIXME: if/when ming has some better way to detect the version..) - old_CPPFLAGS=$CPPFLAGS - CPPFLAGS=-I$MING_INC_DIR AC_EGREP_CPP(yes, [ #include <ming.h> #ifdef SWF_SOUND_COMPRESSION @@ -73,6 +73,15 @@ dnl FIXME: This is now unconditional..better check coming later. AC_DEFINE(HAVE_MING_ZLIB, 1, [ ]) ]) + + dnl Check if SWFMovie_output() accepts the 4th parameter + AC_TRY_COMPILE([ +#include <ming.h> + ], [ +int main(void) { SWFMovie_output(NULL, NULL, NULL, 0); return 0; } + ], [ + AC_DEFINE(HAVE_MING_MOVIE_LEVEL, 1, [ ]) + ], []) CPPFLAGS=$old_CPPFLAGS PHP_NEW_EXTENSION(ming, ming.c, $ext_shared) http://cvs.php.net/viewcvs.cgi/php-src/ext/ming/ming.c?r1=1.79&r2=1.80&diff_format=u Index: php-src/ext/ming/ming.c diff -u php-src/ext/ming/ming.c:1.79 php-src/ext/ming/ming.c:1.80 --- php-src/ext/ming/ming.c:1.79 Sat Aug 6 05:30:17 2005 +++ php-src/ext/ming/ming.c Wed Dec 21 21:43:25 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ming.c,v 1.79 2005/08/06 05:30:17 fmk Exp $ */ +/* $Id: ming.c,v 1.80 2005/12/21 21:43:25 sniper Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2218,7 +2218,7 @@ PHP_METHOD(swfmovie, output) { SWFMovie movie = getMovie(getThis() TSRMLS_CC); -#if defined(HAVE_MING_ZLIB) && defined(HAVE_NEW_MING) +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING) zval **zlimit = NULL; int limit = -1; int argc = ZEND_NUM_ARGS(); @@ -2244,6 +2244,25 @@ Ming_setSWFCompression(oldval); } RETURN_LONG(out); +#elif defined(HAVE_NEW_MING) && defined(HAVE_MING_MOVIE_LEVEL) + zval **zlimit = NULL; + int limit = -1; + int argc = ZEND_NUM_ARGS(); + + if(argc) { + if (zend_get_parameters_ex(1, &zlimit) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long_ex(zlimit); + limit = Z_LVAL_PP(zlimit); + + if ((limit < 0) || (limit > 9)) { + php_error(E_WARNING,"compression level must be within 0..9"); + RETURN_FALSE; + } + } + RETURN_LONG(SWFMovie_output(movie, &phpByteOutputMethod, NULL, limit)); #else RETURN_LONG(SWFMovie_output(movie, &phpByteOutputMethod, NULL)); #endif @@ -2263,9 +2282,11 @@ PHP_METHOD(swfmovie, saveToFile) { zval **x; -#if defined(HAVE_MING_ZLIB) && defined(HAVE_NEW_MING) +#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING) zval **zlimit = NULL; int limit = -1; +#endif +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING) int oldval = INT_MIN; long out; #endif @@ -2278,7 +2299,7 @@ WRONG_PARAM_COUNT; break; case 2: -#if defined(HAVE_MING_ZLIB) && defined(HAVE_NEW_MING) +#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING) if (zend_get_parameters_ex(2, &x, &zlimit) == FAILURE) WRONG_PARAM_COUNT; convert_to_long_ex(zlimit); @@ -2287,6 +2308,8 @@ php_error(E_WARNING,"compression level must be within 0..9"); RETURN_FALSE; } +#endif +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING) oldval = Ming_setSWFCompression(limit); #endif break; @@ -2295,11 +2318,13 @@ } ZEND_FETCH_RESOURCE(what, php_stream *, x, -1,"File-Handle",php_file_le_stream()); -#if defined(HAVE_MING_ZLIB) && defined(HAVE_NEW_MING) +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING) out = SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, what); if (oldval >= -1 && oldval <=9) Ming_setSWFCompression(oldval); RETURN_LONG(out); +#elif defined(HAVE_NEW_MING) && defined(HAVE_MING_MOVIE_LEVEL) + RETURN_LONG(SWFMovie_output(movie, &phpStreamOutputMethod, what, limit)); #else RETURN_LONG(SWFMovie_output(movie, &phpStreamOutputMethod, what)); #endif @@ -2311,9 +2336,11 @@ PHP_METHOD(swfmovie, save) { zval **x; -#if defined(HAVE_MING_ZLIB) && defined(HAVE_NEW_MING) +#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING) zval **zlimit = NULL; int limit = -1; +#endif +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING) int oldval = INT_MIN; #endif long retval; @@ -2326,7 +2353,7 @@ } break; case 2: -#if defined(HAVE_MING_ZLIB) && defined(HAVE_NEW_MING) +#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING) if (zend_get_parameters_ex(2, &x, &zlimit) == FAILURE) { WRONG_PARAM_COUNT; } @@ -2336,6 +2363,8 @@ php_error(E_WARNING,"compression level must be within 0..9"); RETURN_FALSE; } +#endif +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING) oldval = Ming_setSWFCompression(limit); #endif break; @@ -2345,12 +2374,16 @@ if (Z_TYPE_PP(x) == IS_RESOURCE) { ZEND_FETCH_RESOURCE(stream, php_stream *, x, -1,"File-Handle",php_file_le_stream()); +#if defined(HAVE_NEW_MING) && defined(HAVE_MING_MOVIE_LEVEL) + RETURN_LONG(SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, stream, limit)); +#else RETVAL_LONG(SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, stream)); -#if defined(HAVE_MING_ZLIB) && defined(HAVE_NEW_MING) +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING) if(oldval >= -1 && oldval <=9) Ming_setSWFCompression(oldval); #endif return; +#endif } convert_to_string_ex(x); @@ -2360,9 +2393,13 @@ RETURN_FALSE; } +#if defined(HAVE_NEW_MING) && defined(HAVE_MING_MOVIE_LEVEL) + retval = SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, (void *)stream, limit); +#else retval = SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, (void *)stream); +#endif php_stream_close(stream); -#if defined(HAVE_MING_ZLIB) && defined(HAVE_NEW_MING) +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING) if(oldval >= -1 && oldval <=9) Ming_setSWFCompression(oldval); #endif

« previous php.cvs (#36123) next »