]> git.pld-linux.org Git - packages/php4.git/blob - php4-ming.patch
- rel 28; openssl 1.0.0 fix
[packages/php4.git] / php4-ming.patch
1 diff -ur php/ext/ming.org/ming.c php/ext/ming/ming.c
2 --- php/ext/ming.org/ming.c     2007-01-01 10:46:44.000000000 +0100
3 +++ php/ext/ming/ming.c 2007-02-19 10:04:43.770623000 +0100
4 @@ -289,6 +289,7 @@
5  {
6         zval **zfile, **zmask = NULL;
7         SWFBitmap bitmap;
8 +       SWFJpegWithAlpha bitmap_alpha;
9         SWFInput input, maskinput;
10         int ret;
11  
12 @@ -320,15 +321,21 @@
13                 } else {
14                         maskinput = getInput(zmask TSRMLS_CC);
15                 }
16 -               bitmap = newSWFJpegWithAlpha_fromInput(input, maskinput);
17 +               bitmap_alpha = newSWFJpegWithAlpha_fromInput(input, maskinput);
18 +               if(bitmap_alpha) {
19 +                       ret = zend_list_insert(bitmap_alpha, le_swfbitmapp);
20 +                       object_init_ex(getThis(), &bitmap_class_entry);
21 +                       add_property_resource(getThis(), "bitmap", ret);
22 +                       zend_list_addref(ret);
23 +               }
24         } else {
25                 bitmap = newSWFBitmap_fromInput(input);
26 -       }
27  
28 -       ret = zend_list_insert(bitmap, le_swfbitmapp);
29 -       object_init_ex(getThis(), &bitmap_class_entry);
30 -       add_property_resource(getThis(), "bitmap", ret);
31 -       zend_list_addref(ret);
32 +               ret = zend_list_insert(bitmap, le_swfbitmapp);
33 +               object_init_ex(getThis(), &bitmap_class_entry);
34 +               add_property_resource(getThis(), "bitmap", ret);
35 +               zend_list_addref(ret);
36 +       }
37  }
38  
39  static void destroy_SWFBitmap_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
40 @@ -1441,7 +1448,7 @@
41  PHP_FUNCTION(swfmovie_output)
42  {
43         SWFMovie movie = getMovie(getThis() TSRMLS_CC);
44 -#ifdef HAVE_MING_ZLIB
45 +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
46         zval **zlimit = NULL;
47         int limit = -1;
48         int argc = ZEND_NUM_ARGS();
49 @@ -1461,10 +1468,25 @@
50                         RETURN_FALSE;
51                 }
52         }
53 -#endif
54 -
55 -#ifdef HAVE_NEW_MING
56 -       RETURN_LONG(SWFMovie_output(movie, &phpByteOutputMethod, NULL, limit));
57 +#elif defined(HAVE_NEW_MING) && defined(HAVE_MING_MOVIE_LEVEL)
58 +    zval **zlimit = NULL;
59 +    int limit = -1;
60 +    int argc = ZEND_NUM_ARGS();
61 +
62 +    if(argc) {
63 +        if (zend_get_parameters_ex(1, &zlimit) == FAILURE) {
64 +            WRONG_PARAM_COUNT;
65 +        }
66 +
67 +        convert_to_long_ex(zlimit);
68 +        limit = Z_LVAL_PP(zlimit);
69 +
70 +        if ((limit < 0) || (limit > 9)) {
71 +            php_error(E_WARNING,"compression level must be within 0..9");
72 +            RETURN_FALSE;
73 +        }
74 +    }
75 +    RETURN_LONG(SWFMovie_output(movie, &phpByteOutputMethod, NULL, limit));
76  #else
77         RETURN_LONG(SWFMovie_output(movie, &phpByteOutputMethod, NULL));
78  #endif
79 @@ -1483,9 +1505,13 @@
80  PHP_FUNCTION(swfmovie_saveToFile)
81  {
82         zval **x;
83 -#ifdef HAVE_MING_ZLIB
84 -       zval **zlimit = NULL;
85 -       int limit = -1;
86 +#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING)
87 +    zval **zlimit = NULL;
88 +    int limit = -1;
89 +#endif
90 +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
91 +    int oldval = INT_MIN;
92 +    long out;
93  #endif
94         SWFMovie movie = getMovie(getThis() TSRMLS_CC);
95         php_stream *what;
96 @@ -1496,7 +1522,7 @@
97                         WRONG_PARAM_COUNT;
98                 break;
99         case 2:
100 -#ifdef HAVE_MING_ZLIB
101 +#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING)
102                 if (zend_get_parameters_ex(2, &x, &zlimit) == FAILURE)
103                         WRONG_PARAM_COUNT;
104                 convert_to_long_ex(zlimit);
105 @@ -1506,13 +1532,21 @@
106                         RETURN_FALSE;
107                 }
108  #endif
109 +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
110 +        oldval = Ming_setSWFCompression(limit);
111 +#endif
112                 break;
113         default:
114                 WRONG_PARAM_COUNT;
115         }
116  
117         ZEND_FETCH_RESOURCE(what, php_stream *, x, -1,"File-Handle",php_file_le_stream());
118 -#ifdef HAVE_NEW_MING
119 +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
120 +    out = SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, what);
121 +    if (oldval >= -1 && oldval <=9)
122 +        Ming_setSWFCompression(oldval);
123 +    RETURN_LONG(out);
124 +#elif defined(HAVE_NEW_MING) && defined(HAVE_MING_MOVIE_LEVEL)
125         RETURN_LONG(SWFMovie_output(movie, &phpStreamOutputMethod, what, limit));
126  #else
127         RETURN_LONG(SWFMovie_output(movie, &phpStreamOutputMethod, what));
128 @@ -1525,10 +1559,14 @@
129  PHP_FUNCTION(swfmovie_save)
130  {
131         zval **x;
132 -#ifdef HAVE_MING_ZLIB
133 +#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING)
134         zval **zlimit = NULL;
135         int limit = -1;
136  #endif
137 +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
138 +       int oldval = INT_MIN;
139 +       long out;
140 +#endif
141         long retval;
142         php_stream *stream;
143  
144 @@ -1539,7 +1577,7 @@
145                 }
146                 break;
147         case 2:
148 -#ifdef HAVE_MING_ZLIB
149 +#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING)
150                 if (zend_get_parameters_ex(2, &x, &zlimit) == FAILURE) {
151                         WRONG_PARAM_COUNT;
152                 }
153 @@ -1550,6 +1588,9 @@
154                         RETURN_FALSE;
155                 }
156  #endif
157 +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
158 +               oldval = Ming_setSWFCompression(limit);
159 +#endif
160                 break;
161         default:
162                 WRONG_PARAM_COUNT;
163 @@ -1557,7 +1598,12 @@
164                   
165         if (Z_TYPE_PP(x) == IS_RESOURCE) {
166                 ZEND_FETCH_RESOURCE(stream, php_stream *, x, -1,"File-Handle",php_file_le_stream());
167 -#ifdef HAVE_NEW_MING
168 +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
169 +               out = SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, what);
170 +               if (oldval >= -1 && oldval <=9)
171 +                       Ming_setSWFCompression(oldval);
172 +               RETURN_LONG(out);
173 +#elif defined(HAVE_NEW_MING) && defined(HAVE_MING_MOVIE_LEVEL)
174                 RETURN_LONG(SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, stream, limit));
175  #else
176                 RETURN_LONG(SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, stream));
177 @@ -1570,8 +1616,12 @@
178         if (stream == NULL) {
179                 RETURN_FALSE;
180         }
181 -       
182 -#ifdef HAVE_NEW_MING
183 +#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
184 +       out = SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, (void *)stream);
185 +       if (oldval >= -1 && oldval <=9)
186 +               Ming_setSWFCompression(oldval);
187 +       RETURN_LONG(out);
188 +#elif defined(HAVE_NEW_MING) && defined(HAVE_MING_MOVIE_LEVEL)
189         retval = SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, (void *)stream, limit);
190  #else
191         retval = SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, (void *)stream);
This page took 0.041744 seconds and 3 git commands to generate.