fmk Mon Jul 19 17:10:14 2004 EDT
Modified files:
/php-src/ext/ming ming.c
Log:
Sync. with the API of libMing 0.3b1
http://cvs.php.net/diff.php/php-src/ext/ming/ming.c?r1=1.68&r2=1.69&ty=u
Index: php-src/ext/ming/ming.c
diff -u php-src/ext/ming/ming.c:1.68 php-src/ext/ming/ming.c:1.69
--- php-src/ext/ming/ming.c:1.68 Sun May 30 11:11:57 2004
+++ php-src/ext/ming/ming.c Mon Jul 19 17:10:09 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ming.c,v 1.68 2004/05/30 15:11:57 zeev Exp $ */
+/* $Id: ming.c,v 1.69 2004/07/19 21:10:09 fmk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -2015,6 +2015,8 @@
#ifdef HAVE_MING_ZLIB
zval **zlimit = NULL;
int limit = -1;
+ int oldval = INT_MIN;
+ long out;
if (zend_get_parameters_ex(1, &zlimit) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -2027,13 +2029,16 @@
php_error(E_WARNING,"compression level must be within 0..9");
RETURN_FALSE;
}
-#endif
-
-#ifdef HAVE_NEW_MING
- RETURN_LONG(SWFMovie_output(movie, &phpByteOutputMethod, NULL, limit));
+ oldval = Ming_setSWFCompression(limit);
+ out = SWFMovie_output(movie, &phpByteOutputMethod, NULL);
+ if (oldval >= -1 && oldval <= 9)
+ Ming_setSWFCompression(oldval);
+
+ RETURN_LONG(out);
#else
RETURN_LONG(SWFMovie_output(movie, &phpByteOutputMethod, NULL));
#endif
+
}
/* }}} */
@@ -2052,6 +2057,8 @@
#ifdef HAVE_MING_ZLIB
zval **zlimit = NULL;
int limit = -1;
+ int oldval = INT_MIN;
+ long out;
#endif
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
php_stream *what;
@@ -2071,6 +2078,7 @@
php_error(E_WARNING,"compression level must be within 0..9");
RETURN_FALSE;
}
+ oldval = Ming_setSWFCompression(limit);
#endif
break;
default:
@@ -2078,8 +2086,11 @@
}
ZEND_FETCH_RESOURCE(what, php_stream *, x,
-1,"File-Handle",php_file_le_stream());
-#ifdef HAVE_NEW_MING
- RETURN_LONG(SWFMovie_output(movie, &phpStreamOutputMethod, what, limit));
+#ifdef HAVE_MING_ZLIB
+ out = SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod,
what);
+ if (oldval >= -1 && oldval <=9)
+ Ming_setSWFCompression(oldval);
+ RETURN_LONG(out);
#else
RETURN_LONG(SWFMovie_output(movie, &phpStreamOutputMethod, what));
#endif
@@ -2094,6 +2105,7 @@
#ifdef HAVE_MING_ZLIB
zval **zlimit = NULL;
int limit = -1;
+ int oldval = INT_MIN;
#endif
long retval;
php_stream *stream;
@@ -2115,6 +2127,7 @@
php_error(E_WARNING,"compression level must be within 0..9");
RETURN_FALSE;
}
+ oldval = Ming_setSWFCompression(limit);
#endif
break;
default:
@@ -2123,11 +2136,7 @@
if (Z_TYPE_PP(x) == IS_RESOURCE) {
ZEND_FETCH_RESOURCE(stream, php_stream *, x,
-1,"File-Handle",php_file_le_stream());
-#ifdef HAVE_NEW_MING
- RETURN_LONG(SWFMovie_output(getMovie(getThis() TSRMLS_CC),
&phpStreamOutputMethod, stream, limit));
-#else
RETURN_LONG(SWFMovie_output(getMovie(getThis() TSRMLS_CC),
&phpStreamOutputMethod, stream));
-#endif
}
convert_to_string_ex(x);
@@ -2137,12 +2146,11 @@
RETURN_FALSE;
}
-#ifdef HAVE_NEW_MING
- 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(oldval >= -1 && oldval <=9)
+ Ming_setSWFCompression(oldval);
+
RETURN_LONG(retval);
}
/* }}} */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php