1 --- imlib2.c 2004-01-01 18:57:55.000000000 -0500
2 +++ imlib2.c 2015-04-09 12:48:55.000000000 -0400
7 +#include "ext/standard/head.h"
8 #include "ext/standard/info.h"
9 #include "php_imlib2.h"
12 static int le_imlib2_img;
13 static int le_imlib2_poly;
15 +ZEND_BEGIN_ARG_INFO(second_arg_force_ref, 0)
16 + ZEND_ARG_PASS_INFO(0)
17 + ZEND_ARG_PASS_INFO(1)
18 + ZEND_END_ARG_INFO();
20 -function_entry imlib2_functions[] = {
21 +zend_function_entry imlib2_functions[] = {
22 PHP_FE(imlib2_image_modify_gamma,NULL)
23 PHP_FE(imlib2_image_modify_contrast,NULL)
24 PHP_FE(imlib2_image_modify_brightness,NULL)
26 *four = Z_LVAL_PP(zfour);
29 -static int _php_handle_cliprect_array(zval **dbox, char *func_name,
30 - int *x, int *y, int *w, int *h)
31 +static int _php_handle_cliprect_array(zval **dbox, const char *func_name,
32 + int *x, int *y, int *w, int *h TSRMLS_DC)
34 zval **element, ***box_coords;
40 -static void _php_imlib2_draw_something(INTERNAL_FUNCTION_PARAMETERS, void (*func)(), char *func_name)
41 +static void _php_imlib2_draw_something(INTERNAL_FUNCTION_PARAMETERS, void (*func)(), const char *func_name)
43 zval **img, **d1, **d2, **d3, **d4, **dr, **dg, **db, **da, **dbox;
44 int x,y,w,h,r,g,b,a,cx,cy,cw,ch,argc;
49 - if (!_php_handle_cliprect_array(dbox, func_name, &cx,&cy,&cw,&ch))
50 + if (!_php_handle_cliprect_array(dbox, func_name, &cx,&cy,&cw,&ch TSRMLS_CC))
52 imlib_context_set_cliprect(cx,cy,cw,ch);
57 Imlib_Color_Modifier cm;
62 if (ZEND_NUM_ARGS() != 2 | zend_get_parameters_ex(2, &img, &gamma) == FAILURE) {
66 ng = Z_DVAL_PP(gamma);
68 - if(cm = imlib_create_color_modifier()){
69 + if ((cm = imlib_create_color_modifier())) {
70 imlib_context_set_color_modifier(cm);
71 imlib_context_set_image(im);
72 imlib_modify_color_modifier_gamma(ng);
74 zval **img, **contrast;
76 Imlib_Color_Modifier cm;
81 if (ZEND_NUM_ARGS() != 2 | zend_get_parameters_ex(2, &img, &contrast) == FAILURE) {
85 nc = Z_DVAL_PP(contrast);
87 - if(cm = imlib_create_color_modifier()){
88 + if ((cm = imlib_create_color_modifier())) {
89 imlib_context_set_color_modifier(cm);
90 imlib_context_set_image(im);
91 imlib_modify_color_modifier_contrast(nc);
95 Imlib_Color_Modifier cm;
100 if (ZEND_NUM_ARGS() != 2 | zend_get_parameters_ex(2, &img, &bv) == FAILURE) {
106 - if(cm = imlib_create_color_modifier()){
107 + if ((cm = imlib_create_color_modifier())) {
108 imlib_context_set_color_modifier(cm);
109 imlib_context_set_image(im);
110 imlib_modify_color_modifier_brightness(nbv);
114 double rot_angle, rads, pi;
116 Imlib_Image src_img, dst_img;
120 if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2, &img, &angle) == FAILURE) {
123 tmpfile = estrdup("/tmp/phpimlib.XXXXXX");
125 if ((fd = mkstemp(tmpfile)) < 0) {
126 - php_error(E_WARNING, "%s: unable to open temporary file", get_active_function_name());
127 + php_error(E_WARNING, "%s: unable to open temporary file", get_active_function_name(TSRMLS_C));
132 /* TODO: notify in case of errors? */
133 retval = fchmod(fd, S_IRUSR|S_IWUSR);
135 - php_error(E_WARNING, "%s: could not change permissions on temporary file", get_active_function_name());
136 + php_error(E_WARNING, "%s: could not change permissions on temporary file", get_active_function_name(TSRMLS_C));
141 /* fseek or something, then read the file and dump it out. */
142 lseek(fd, 0, SEEK_SET);
144 - output = php_header();
145 + output = php_header(TSRMLS_C);
150 ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0);
152 while ((retval = read(fd, buf, sizeof(buf))) > 0) {
153 - php_write(buf, retval);
154 + php_write(buf, retval TSRMLS_CC);
158 @@ -1254,7 +1259,7 @@
162 - if (!_php_handle_cliprect_array(dbox, "imlib_image_draw_polygon", &cx, &cy, &cw, &ch))
163 + if (!_php_handle_cliprect_array(dbox, "imlib_image_draw_polygon", &cx, &cy, &cw, &ch TSRMLS_CC))
165 imlib_context_set_cliprect(cx,cy,cw,ch);
167 @@ -1303,7 +1308,7 @@
171 - if (!_php_handle_cliprect_array(fbox, "imlib_image_fill_color_range_rectangle", &cx,&cy,&cw,&ch))
172 + if (!_php_handle_cliprect_array(fbox, "imlib_image_fill_color_range_rectangle", &cx,&cy,&cw,&ch TSRMLS_CC))
174 imlib_context_set_cliprect(cx,cy,cw,ch);
176 @@ -1350,7 +1355,7 @@
180 - if (!_php_handle_cliprect_array(dbox, "imlib_image_fill_polygon", &cx, &cy, &cw, &ch))
181 + if (!_php_handle_cliprect_array(dbox, "imlib_image_fill_polygon", &cx, &cy, &cw, &ch TSRMLS_CC))
183 imlib_context_set_cliprect(cx,cy,cw,ch);