[PHP-CVS] cvs: php-src /ext/gd gd.c
felipe Wed Jul 1 12:04:05 2009 UTC Modified files: /php-src/ext/gd gd.c Log: - Fixed memory leak http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.418r2=1.419diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.418 php-src/ext/gd/gd.c:1.419 --- php-src/ext/gd/gd.c:1.418 Fri Jun 19 22:12:20 2009 +++ php-src/ext/gd/gd.c Wed Jul 1 12:04:05 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.418 2009/06/19 22:12:20 kalle Exp $ */ +/* $Id: gd.c,v 1.419 2009/07/01 12:04:05 felipe Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -3347,7 +3347,12 @@ } } - ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, Image, le_gd); + if (!ZEND_FETCH_RESOURCE_NO_RETURN(im, gdImagePtr, IM, -1, Image, le_gd)) { + if (str_type == IS_UNICODE) { + efree(str.s); + RETURN_FALSE; + } + } font = php_find_gd_font(size TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
felipe Wed Jul 1 12:06:27 2009 UTC Modified files: /php-src/ext/gd gd.c Log: - Fixed previous fix http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.419r2=1.420diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.419 php-src/ext/gd/gd.c:1.420 --- php-src/ext/gd/gd.c:1.419 Wed Jul 1 12:04:05 2009 +++ php-src/ext/gd/gd.c Wed Jul 1 12:06:27 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.419 2009/07/01 12:04:05 felipe Exp $ */ +/* $Id: gd.c,v 1.420 2009/07/01 12:06:27 felipe Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -3350,8 +3350,8 @@ if (!ZEND_FETCH_RESOURCE_NO_RETURN(im, gdImagePtr, IM, -1, Image, le_gd)) { if (str_type == IS_UNICODE) { efree(str.s); - RETURN_FALSE; } + RETURN_FALSE; } font = php_find_gd_font(size TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
kalle Fri Jun 19 22:12:20 2009 UTC Modified files: /php-src/ext/gd gd.c Log: Fix memleak http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.417r2=1.418diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.417 php-src/ext/gd/gd.c:1.418 --- php-src/ext/gd/gd.c:1.417 Fri May 29 00:18:53 2009 +++ php-src/ext/gd/gd.c Fri Jun 19 22:12:20 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.417 2009/05/29 00:18:53 kalle Exp $ */ +/* $Id: gd.c,v 1.418 2009/06/19 22:12:20 kalle Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1877,7 +1877,6 @@ pPrintWindow(window, memDC, (UINT) client_area); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, Windows API too old); - RETURN_FALSE; goto clean; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
kalle Thu May 28 20:53:09 2009 UTC Modified files: /php-src/ext/gd gd.c Log: zstr should be used here, this nukes another compiler warning http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.415r2=1.416diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.415 php-src/ext/gd/gd.c:1.416 --- php-src/ext/gd/gd.c:1.415 Wed May 27 08:12:07 2009 +++ php-src/ext/gd/gd.c Thu May 28 20:53:09 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.415 2009/05/27 08:12:07 pajoye Exp $ */ +/* $Id: gd.c,v 1.416 2009/05/28 20:53:09 kalle Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -3624,7 +3624,7 @@ zend_hash_internal_pointer_reset_ex(HASH_OF(EXT), pos); do { zval ** item; - char * key; + zstr key; ulong num_key; if (zend_hash_get_current_key_ex(HASH_OF(EXT), key, NULL, num_key, 0, pos) != HASH_KEY_IS_STRING) { @@ -3635,7 +3635,7 @@ continue; } - if (strcmp(linespacing, key) == 0) { + if (strcmp(linespacing, key.s) == 0) { convert_to_double_ex(item); strex.flags |= gdFTEX_LINESPACE; strex.linespacing = Z_DVAL_PP(item); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
kalle Fri May 29 00:18:53 2009 UTC Modified files: /php-src/ext/gd gd.c Log: * Cast long to float in the T1* functions, we don't loose any data here * Fix min/max redefs http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.416r2=1.417diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.416 php-src/ext/gd/gd.c:1.417 --- php-src/ext/gd/gd.c:1.416 Thu May 28 20:53:09 2009 +++ php-src/ext/gd/gd.c Fri May 29 00:18:53 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.416 2009/05/28 20:53:09 kalle Exp $ */ +/* $Id: gd.c,v 1.417 2009/05/29 00:18:53 kalle Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -3981,7 +3981,7 @@ if (width) { extend = T1_GetExtend(*f_ind); - str_path = T1_GetCharOutline(*f_ind, str[0], size, transform); + str_path = T1_GetCharOutline(*f_ind, str[0], (float) size, transform); if (!str_path) { if (T1_errno) { @@ -3995,15 +3995,15 @@ amount_kern += str[i - 1] == ' ' ? space : 0; add_width = (int) (amount_kern + width) / extend; - char_path = T1_GetMoveOutline(*f_ind, add_width, 0, 0, size, transform); + char_path = T1_GetMoveOutline(*f_ind, add_width, 0, 0, (float) size, transform); str_path = T1_ConcatOutlines(str_path, char_path); - char_path = T1_GetCharOutline(*f_ind, str[i], size, transform); + char_path = T1_GetCharOutline(*f_ind, str[i], (float) size, transform); str_path = T1_ConcatOutlines(str_path, char_path); } str_img = T1_AAFillOutline(str_path, 0); } else { - str_img = T1_AASetString(*f_ind, str, str_len, space, T1_KERNING, size, transform); + str_img = T1_AASetString(*f_ind, str, str_len, space, T1_KERNING, (float) size, transform); } if (T1_errno) { php_error_docref(NULL TSRMLS_CC, E_WARNING, T1Lib Error: %s, T1_StrError(T1_errno)); @@ -4070,8 +4070,13 @@ ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, Type 1 font, le_ps_font); -#define max(a, b) (a b ? a : b) -#define min(a, b) (a b ? a : b) +#ifndef max +# define max(a, b) (a b ? a : b) +#endif +#ifndef min +# define min(a, b) (a b ? a : b) +#endif + #define new_x(a, b) (int) ((a) * cos_a - (b) * sin_a) #define new_y(a, b) (int) ((a) * sin_a + (b) * cos_a) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Tue Apr 7 10:04:52 2009 UTC Modified files: /php-src/ext/gd gd.c Log: - not necessary http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.410r2=1.411diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.410 php-src/ext/gd/gd.c:1.411 --- php-src/ext/gd/gd.c:1.410 Tue Apr 7 09:44:21 2009 +++ php-src/ext/gd/gd.c Tue Apr 7 10:04:52 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.410 2009/04/07 09:44:21 pajoye Exp $ */ +/* $Id: gd.c,v 1.411 2009/04/07 10:04:52 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -74,7 +74,7 @@ #include gdfontl.h /* 4 Large font */ #include gdfontg.h /* 5 Giant font */ #include libgd/wbmp.h -#include gdhelpers.h + #ifdef ENABLE_GD_TTF # ifdef HAVE_LIBFREETYPE # include ft2build.h -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Tue Mar 24 09:42:49 2009 UTC Modified files: /php-src/ext/gd gd.c Log: - MFB: #47757 rename JPG to JPEG in phpinfo http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.408r2=1.409diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.408 php-src/ext/gd/gd.c:1.409 --- php-src/ext/gd/gd.c:1.408 Tue Mar 10 23:39:17 2009 +++ php-src/ext/gd/gd.c Tue Mar 24 09:42:49 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.408 2009/03/10 23:39:17 helly Exp $ */ +/* $Id: gd.c,v 1.409 2009/03/24 09:42:49 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1294,9 +1294,9 @@ add_ascii_assoc_bool(return_value, GIF Create Support, 0); #endif #ifdef HAVE_GD_JPG - add_ascii_assoc_bool(return_value, JPG Support, 1); + add_ascii_assoc_bool(return_value, JPEG Support, 1); #else - add_ascii_assoc_bool(return_value, JPG Support, 0); + add_ascii_assoc_bool(return_value, JPEG Support, 0); #endif #ifdef HAVE_GD_PNG add_ascii_assoc_bool(return_value, PNG Support, 1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
kalle Sat Jan 31 15:27:11 2009 UTC Modified files: /php-src/ext/gd gd.c Log: Fix arginfo for imagefilter() http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.406r2=1.407diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.406 php-src/ext/gd/gd.c:1.407 --- php-src/ext/gd/gd.c:1.406 Mon Jan 19 16:35:40 2009 +++ php-src/ext/gd/gd.c Sat Jan 31 15:27:11 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.406 2009/01/19 16:35:40 tabe Exp $ */ +/* $Id: gd.c,v 1.407 2009/01/31 15:27:11 kalle Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -814,6 +814,7 @@ ZEND_ARG_INFO(0, arg1) ZEND_ARG_INFO(0, arg2) ZEND_ARG_INFO(0, arg3) + ZEND_ARG_INFO(0, arg4) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_imageconvolution, 0) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
tabeMon Jan 19 16:35:41 2009 UTC Modified files: /php-src/ext/gd gd.c Log: bump up and use IMAGE_FILTER_MAX_ARGS instead of a magic number. http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.405r2=1.406diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.405 php-src/ext/gd/gd.c:1.406 --- php-src/ext/gd/gd.c:1.405 Thu Jan 15 07:55:18 2009 +++ php-src/ext/gd/gd.c Mon Jan 19 16:35:40 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.405 2009/01/15 07:55:18 kalle Exp $ */ +/* $Id: gd.c,v 1.406 2009/01/19 16:35:40 tabe Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -114,7 +114,7 @@ #define IMAGE_FILTER_SMOOTH 10 #define IMAGE_FILTER_PIXELATE 11 #define IMAGE_FILTER_MAX11 -#define IMAGE_FILTER_MAX_ARGS 5 +#define IMAGE_FILTER_MAX_ARGS 6 static void php_image_filter_negate(INTERNAL_FUNCTION_PARAMETERS); static void php_image_filter_grayscale(INTERNAL_FUNCTION_PARAMETERS); static void php_image_filter_brightness(INTERNAL_FUNCTION_PARAMETERS); @@ -4658,7 +4658,7 @@ php_image_filter_pixelate }; - if (ZEND_NUM_ARGS() 2 || ZEND_NUM_ARGS() 6) { + if (ZEND_NUM_ARGS() 2 || ZEND_NUM_ARGS() IMAGE_FILTER_MAX_ARGS) { WRONG_PARAM_COUNT; } else if (zend_parse_parameters(2 TSRMLS_CC, rl, tmp, filtertype) == FAILURE) { return; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/gd/tests imagefilter.phpt
kalle Thu Jan 15 07:55:18 2009 UTC Modified files: /php-src/ext/gd gd.c /php-src/ext/gd/tests imagefilter.phpt Log: Change optional parameter for IMG_FILTER_PIXELATE to be a boolean http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.404r2=1.405diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.404 php-src/ext/gd/gd.c:1.405 --- php-src/ext/gd/gd.c:1.404 Wed Jan 14 18:57:51 2009 +++ php-src/ext/gd/gd.c Thu Jan 15 07:55:18 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.404 2009/01/14 18:57:51 tabe Exp $ */ +/* $Id: gd.c,v 1.405 2009/01/15 07:55:18 kalle Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -4613,9 +4613,10 @@ { zval *IM; gdImagePtr im; - long tmp, blocksize, mode = 0; + long tmp, blocksize; + zend_bool mode = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rll|l, IM, tmp, blocksize, mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rll|b, IM, tmp, blocksize, mode) == FAILURE) { RETURN_FALSE; } http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/imagefilter.phpt?r1=1.6r2=1.7diff_format=u Index: php-src/ext/gd/tests/imagefilter.phpt diff -u php-src/ext/gd/tests/imagefilter.phpt:1.6 php-src/ext/gd/tests/imagefilter.phpt:1.7 --- php-src/ext/gd/tests/imagefilter.phpt:1.6 Wed Jan 14 18:57:51 2009 +++ php-src/ext/gd/tests/imagefilter.phpt Thu Jan 15 07:55:18 2009 @@ -75,7 +75,7 @@ $im = imagecreatefrompng($SOURCE_IMG); - if (imagefilter($im, IMG_FILTER_PIXELATE, 5, 1)) { + if (imagefilter($im, IMG_FILTER_PIXELATE, 5, true)) { imagepng($im, $SAVE_DIR . /IMG_FILTER_PIXELATE.png); echo IMG_FILTER_PIXELATE success\n; unlink($SAVE_DIR . /IMG_FILTER_PIXELATE.png); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
felipe Thu Nov 13 11:32:04 2008 UTC Modified files: /php-src/ext/gd gd.c Log: - Fix build http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.399r2=1.400diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.399 php-src/ext/gd/gd.c:1.400 --- php-src/ext/gd/gd.c:1.399 Thu Nov 6 10:23:52 2008 +++ php-src/ext/gd/gd.c Thu Nov 13 11:32:04 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.399 2008/11/06 10:23:52 pajoye Exp $ */ +/* $Id: gd.c,v 1.400 2008/11/13 11:32:04 felipe Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -55,15 +55,6 @@ #if HAVE_LIBGD -#ifdef HAVE_GD_PNG -/* needs to be first */ -# include png.h -#endif - -#ifdef HAVE_GD_JPG -# include jpeglib.h -#endif - static int le_gd, le_gd_font; #if HAVE_LIBT1 #include t1lib.h -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/gd/libgd gd.h gd_jpeg.c gd_png.c
pajoye Thu Nov 6 10:23:52 2008 UTC Modified files: /php-src/ext/gd gd.c /php-src/ext/gd/libgd gd.h gd_jpeg.c gd_png.c Log: - MFH: - Fix linux build (static) - add gd[Format]Version[Int|String] first methods to work around the png header issues http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.398r2=1.399diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.398 php-src/ext/gd/gd.c:1.399 --- php-src/ext/gd/gd.c:1.398 Tue Nov 4 20:24:46 2008 +++ php-src/ext/gd/gd.c Thu Nov 6 10:23:52 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.398 2008/11/04 20:24:46 pajoye Exp $ */ +/* $Id: gd.c,v 1.399 2008/11/06 10:23:52 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -29,11 +29,6 @@ #include config.h #endif -#ifdef HAVE_GD_PNG -/* needs to be first */ -#include png.h -#endif - #include php.h #include php_ini.h #include ext/standard/head.h @@ -60,6 +55,15 @@ #if HAVE_LIBGD +#ifdef HAVE_GD_PNG +/* needs to be first */ +# include png.h +#endif + +#ifdef HAVE_GD_JPG +# include jpeglib.h +#endif + static int le_gd, le_gd_font; #if HAVE_LIBT1 #include t1lib.h @@ -1328,15 +1332,15 @@ #endif #ifdef HAVE_GD_JPG { - char tmp[256]; - snprintf(tmp, sizeof(tmp), %d, JPEG_LIB_VERSION); + char tmp[12]; + snprintf(tmp, sizeof(tmp), %d, gdJpegGetVersionInt()); php_info_print_table_row(2, JPG Support, enabled); php_info_print_table_row(2, libJPEG Version, tmp); } #endif #ifdef HAVE_GD_PNG php_info_print_table_row(2, PNG Support, enabled); - php_info_print_table_row(2, libPNG Version, PNG_LIBPNG_VER_STRING); + php_info_print_table_row(2, libPNG Version, gdPngGetVersionString()); #endif php_info_print_table_row(2, WBMP Support, enabled); #if defined(HAVE_GD_XPM) defined(HAVE_GD_BUNDLED) http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.h?r1=1.34r2=1.35diff_format=u Index: php-src/ext/gd/libgd/gd.h diff -u php-src/ext/gd/libgd/gd.h:1.34 php-src/ext/gd/libgd/gd.h:1.35 --- php-src/ext/gd/libgd/gd.h:1.34 Tue Sep 11 21:31:14 2007 +++ php-src/ext/gd/libgd/gd.h Thu Nov 6 10:23:52 2008 @@ -246,6 +246,9 @@ gdImagePtr gdImageCreateFromJpeg(FILE *infile, int ignore_warning); gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile, int ignore_warning); +int gdJpegGetVersionInt(); +const char * gdPngGetVersionString(); + /* A custom data source. */ /* The source function must return -1 on error, otherwise the number of bytes fetched. 0 is EOF, not an error! */ http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_jpeg.c?r1=1.21r2=1.22diff_format=u Index: php-src/ext/gd/libgd/gd_jpeg.c diff -u php-src/ext/gd/libgd/gd_jpeg.c:1.21 php-src/ext/gd/libgd/gd_jpeg.c:1.22 --- php-src/ext/gd/libgd/gd_jpeg.c:1.21 Sat Feb 4 14:56:58 2006 +++ php-src/ext/gd/libgd/gd_jpeg.c Thu Nov 6 10:23:52 2008 @@ -102,6 +102,11 @@ exit (99); } +int gdJpegGetVersionInt() +{ + return JPEG_LIB_VERSION; +} + /* * Write IM to OUTFILE as a JFIF-formatted JPEG image, using quality * QUALITY. If QUALITY is in the range 0-100, increasing values http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_png.c?r1=1.25r2=1.26diff_format=u Index: php-src/ext/gd/libgd/gd_png.c diff -u php-src/ext/gd/libgd/gd_png.c:1.25 php-src/ext/gd/libgd/gd_png.c:1.26 --- php-src/ext/gd/libgd/gd_png.c:1.25 Thu Jul 31 09:23:59 2008 +++ php-src/ext/gd/libgd/gd_png.c Thu Nov 6 10:23:52 2008 @@ -36,6 +36,11 @@ ---*/ +const char * gdPngGetVersionString() +{ + return PNG_LIBPNG_VER_STRING; +} + #ifndef PNG_SETJMP_NOT_SUPPORTED typedef struct _jmpbuf_wrapper { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Tue Nov 4 20:24:46 2008 UTC Modified files: /php-src/ext/gd gd.c Log: - add png and jpeg version info http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.397r2=1.398diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.397 php-src/ext/gd/gd.c:1.398 --- php-src/ext/gd/gd.c:1.397 Sun Nov 2 21:10:08 2008 +++ php-src/ext/gd/gd.c Tue Nov 4 20:24:46 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.397 2008/11/02 21:10:08 felipe Exp $ */ +/* $Id: gd.c,v 1.398 2008/11/04 20:24:46 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1327,10 +1327,16 @@ php_info_print_table_row(2, GIF Create Support, enabled); #endif #ifdef HAVE_GD_JPG - php_info_print_table_row(2, JPG Support, enabled); + { + char tmp[256]; + snprintf(tmp, sizeof(tmp), %d, JPEG_LIB_VERSION); + php_info_print_table_row(2, JPG Support, enabled); + php_info_print_table_row(2, libJPEG Version, tmp); + } #endif #ifdef HAVE_GD_PNG php_info_print_table_row(2, PNG Support, enabled); + php_info_print_table_row(2, libPNG Version, PNG_LIBPNG_VER_STRING); #endif php_info_print_table_row(2, WBMP Support, enabled); #if defined(HAVE_GD_XPM) defined(HAVE_GD_BUNDLED) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
rrichards Mon Sep 22 15:30:59 2008 UTC Modified files: /php-src/ext/gd gd.c Log: sz is long not zval** http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.393r2=1.394diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.393 php-src/ext/gd/gd.c:1.394 --- php-src/ext/gd/gd.c:1.393 Fri Aug 29 11:09:05 2008 +++ php-src/ext/gd/gd.c Mon Sep 22 15:30:59 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.393 2008/08/29 11:09:05 pajoye Exp $ */ +/* $Id: gd.c,v 1.394 2008/09/22 15:30:59 rrichards Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -4231,10 +4231,10 @@ /* printf(%d %d %d %d\n, str_bbox.llx, str_bbox.lly, str_bbox.urx, str_bbox.ury); */ - add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*Z_LVAL_PP(sz)/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*Z_LVAL_PP(sz)/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*Z_LVAL_PP(sz)/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*Z_LVAL_PP(sz)/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*sz/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*sz/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*sz/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*sz/1000)); } /* }}} */ #endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Fri Aug 29 11:09:05 2008 UTC Modified files: /php-src/ext/gd gd.c Log: - fix warning http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.392r2=1.393diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.392 php-src/ext/gd/gd.c:1.393 --- php-src/ext/gd/gd.c:1.392 Sun Aug 24 04:02:20 2008 +++ php-src/ext/gd/gd.c Fri Aug 29 11:09:05 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.392 2008/08/24 04:02:20 felipe Exp $ */ +/* $Id: gd.c,v 1.393 2008/08/29 11:09:05 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -75,7 +75,7 @@ #include gdfontl.h /* 4 Large font */ #include gdfontg.h /* 5 Giant font */ #include libgd/wbmp.h - +#include gdhelpers.h #ifdef ENABLE_GD_TTF # ifdef HAVE_LIBFREETYPE # include ft2build.h -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/wddx wddx.c
felipe Sun Aug 24 04:02:20 2008 UTC Modified files: /php-src/ext/gd gd.c /php-src/ext/wddx wddx.c Log: - MFB: New parameter parsing API - CS (wddx) http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.391r2=1.392diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.391 php-src/ext/gd/gd.c:1.392 --- php-src/ext/gd/gd.c:1.391 Mon Aug 4 18:22:02 2008 +++ php-src/ext/gd/gd.c Sun Aug 24 04:02:20 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.391 2008/08/04 18:22:02 felipe Exp $ */ +/* $Id: gd.c,v 1.392 2008/08/24 04:02:20 felipe Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -4143,44 +4143,36 @@ Return the bounding box needed by a string if rasterized */ PHP_FUNCTION(imagepsbbox) { - zval **str, **fnt, **sz, **sp, **wd, **ang; - int i, space, add_width = 0, char_width, amount_kern; + zval *fnt; + long sz = 0, sp, wd; + char *str; + int i, space = 0, add_width = 0, char_width, amount_kern; int cur_x, cur_y, dx, dy; int x1, y1, x2, y2, x3, y3, x4, y4; int *f_ind; - int per_char = 0; + int str_len, per_char = 0; + int argc = ZEND_NUM_ARGS(); double angle, sin_a = 0, cos_a = 0; BBox char_bbox, str_bbox = {0, 0, 0, 0}; - switch (ZEND_NUM_ARGS()) { - case 3: - if (zend_get_parameters_ex(3, str, fnt, sz) == FAILURE) { - RETURN_FALSE; - } - space = 0; - break; - case 6: - if (zend_get_parameters_ex(6, str, fnt, sz, sp, wd, ang) == FAILURE) { - RETURN_FALSE; - } - convert_to_long_ex(sp); - convert_to_long_ex(wd); - convert_to_double_ex(ang); - space = Z_LVAL_PP(sp); - add_width = Z_LVAL_PP(wd); - angle = Z_DVAL_PP(ang) * M_PI / 180; - sin_a = sin(angle); - cos_a = cos(angle); - per_char = add_width || angle ? 1 : 0; - break; - default: - ZEND_WRONG_PARAM_COUNT(); + if (argc != 3 argc != 6) { + ZEND_WRONG_PARAM_COUNT(); + } + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, srl|lld, str, str_len, fnt, sz, sp, wd, angle) == FAILURE) { + return; + } + + if (argc == 6) { + space = sp; + add_width = wd; + angle = angle * M_PI / 180; + sin_a = sin(angle); + cos_a = cos(angle); + per_char = add_width || angle ? 1 : 0; } - ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, Type 1 font, le_ps_font); - - convert_to_string_ex(str); - convert_to_long_ex(sz); + ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, Type 1 font, le_ps_font); #define max(a, b) (a b ? a : b) #define min(a, b) (a b ? a : b) @@ -4191,15 +4183,15 @@ space += T1_GetCharWidth(*f_ind, ' '); cur_x = cur_y = 0; - for (i = 0; i Z_STRLEN_PP(str); i++) { - if (Z_STRVAL_PP(str)[i] == ' ') { + for (i = 0; i str_len; i++) { + if (str[i] == ' ') { char_bbox.llx = char_bbox.lly = char_bbox.ury = 0; char_bbox.urx = char_width = space; } else { - char_bbox = T1_GetCharBBox(*f_ind, Z_STRVAL_PP(str)[i]); - char_width = T1_GetCharWidth(*f_ind, Z_STRVAL_PP(str)[i]); + char_bbox = T1_GetCharBBox(*f_ind, str[i]); + char_width = T1_GetCharWidth(*f_ind, str[i]); } - amount_kern = i ? T1_GetKerning(*f_ind, Z_STRVAL_PP(str)[i - 1], Z_STRVAL_PP(str)[i]) : 0; + amount_kern = i ? T1_GetKerning(*f_ind, str[i - 1], str[i]) : 0; /* Transfer character bounding box to right place */ x1 = new_x(char_bbox.llx, char_bbox.lly) + cur_x; @@ -4228,7 +4220,7 @@ } } else { - str_bbox = T1_GetStringBBox(*f_ind, Z_STRVAL_PP(str), Z_STRLEN_PP(str), space, T1_KERNING); + str_bbox = T1_GetStringBBox(*f_ind, str, str_len, space, T1_KERNING); } if (T1_errno) { http://cvs.php.net/viewvc.cgi/php-src/ext/wddx/wddx.c?r1=1.152r2=1.153diff_format=u Index: php-src/ext/wddx/wddx.c diff -u php-src/ext/wddx/wddx.c:1.152
[PHP-CVS] cvs: php-src /ext/gd gd.c gd_ctx.c
felipe Mon Aug 4 18:22:02 2008 UTC Modified files: /php-src/ext/gd gd.c gd_ctx.c Log: - Added new parameter parsing API (part II) http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.390r2=1.391diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.390 php-src/ext/gd/gd.c:1.391 --- php-src/ext/gd/gd.c:1.390 Thu Jul 17 23:28:11 2008 +++ php-src/ext/gd/gd.c Mon Aug 4 18:22:02 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.390 2008/07/17 23:28:11 pajoye Exp $ */ +/* $Id: gd.c,v 1.391 2008/08/04 18:22:02 felipe Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -4528,12 +4528,12 @@ #ifdef HAVE_GD_BUNDLED #define PHP_GD_SINGLE_RES \ - zval **SIM; \ + zval *SIM; \ gdImagePtr im_src; \ - if (zend_get_parameters_ex(1, SIM) == FAILURE) { \ + if (zend_parse_parameters(1 TSRMLS_CC, r, SIM) == FAILURE) { \ RETURN_FALSE; \ } \ - ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, Image, le_gd); \ + ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, Image, le_gd); \ if (im_src == NULL) { \ RETURN_FALSE; \ } http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd_ctx.c?r1=1.33r2=1.34diff_format=u Index: php-src/ext/gd/gd_ctx.c diff -u php-src/ext/gd/gd_ctx.c:1.33 php-src/ext/gd/gd_ctx.c:1.34 --- php-src/ext/gd/gd_ctx.c:1.33Mon Dec 31 07:12:09 2007 +++ php-src/ext/gd/gd_ctx.c Mon Aug 4 18:22:02 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: gd_ctx.c,v 1.33 2007/12/31 07:12:09 sebastian Exp $ */ +/* $Id: gd_ctx.c,v 1.34 2008/08/04 18:22:02 felipe Exp $ */ #include php_gd.h @@ -49,9 +49,11 @@ /* {{{ _php_image_output_ctx */ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)()) { - zval **imgind, **file, **quality, **basefilter; + zval *imgind; + char *file = NULL; + int file_len = 0; + long quality, basefilter; gdImagePtr im; - char *fn = NULL; FILE *fp = NULL; int argc = ZEND_NUM_ARGS(); int q = -1, i; @@ -63,37 +65,37 @@ * from imageytype(). */ - if (argc 2 image_type == PHP_GDIMG_TYPE_XBM) { - WRONG_PARAM_COUNT; - } - if (argc 1 || argc 4 || zend_get_parameters_ex(argc, imgind, file, quality, basefilter) == FAILURE) - { - WRONG_PARAM_COUNT; + if (image_type == PHP_GDIMG_TYPE_XBM) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rs!|ll, imgind, file, file_len, quality, basefilter) == FAILURE) { + return; + } + } else { + /* PHP_GDIMG_TYPE_GIF +* PHP_GDIMG_TYPE_PNG +* PHP_GDIMG_TYPE_JPG +* PHP_GDIMG_TYPE_WBM */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r|s!ll, imgind, file, file_len, quality, basefilter) == FAILURE) { + return; + } } - ZEND_FETCH_RESOURCE(im, gdImagePtr, imgind, -1, Image, phpi_get_le_gd()); + ZEND_FETCH_RESOURCE(im, gdImagePtr, imgind, -1, Image, phpi_get_le_gd()); if (argc 1) { -if (argc = 2 Z_TYPE_PP(file) != IS_NULL) { - convert_to_string_ex(file); - } - fn = Z_STRVAL_PP(file); if (argc = 3) { - convert_to_long_ex(quality); - q = Z_LVAL_PP(quality);/* or colorindex for foreground of BW images (defaults to black) */ + q = quality; /* or colorindex for foreground of BW images (defaults to black) */ if (argc == 4) { - convert_to_long_ex(basefilter); - f = Z_LVAL_PP(basefilter); + f = basefilter; } } } -if (argc 1 (Z_TYPE_PP(file) != IS_NULL ((argc == 2) || (argc 2 Z_STRLEN_PP(file) { - PHP_GD_CHECK_OPEN_BASEDIR(fn, Invalid filename); +if (argc 1 file_len) { + PHP_GD_CHECK_OPEN_BASEDIR(file, Invalid filename); - fp = VCWD_FOPEN(fn, wb); + fp = VCWD_FOPEN(file, wb); if (!fp) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to open '%s' for writing: %s, fn, strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to open '%s' for writing: %s, file, strerror(errno)); RETURN_FALSE; } @@ -125,7 +127,7 @@ q =
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/gd/tests imageloadfont_invalid.phpt
pajoye Thu Jul 17 23:28:11 2008 UTC Modified files: /php-src/ext/gd gd.c /php-src/ext/gd/tests imageloadfont_invalid.phpt Log: - MFB: fix crash when some crafted font are given http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.389r2=1.390diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.389 php-src/ext/gd/gd.c:1.390 --- php-src/ext/gd/gd.c:1.389 Mon Jul 7 08:40:04 2008 +++ php-src/ext/gd/gd.c Thu Jul 17 23:28:11 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.389 2008/07/07 08:40:04 pajoye Exp $ */ +/* $Id: gd.c,v 1.390 2008/07/17 23:28:11 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1483,6 +1483,19 @@ body_size = font-w * font-h * font-nchars; } + if (overflow2(font-nchars, font-h)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Error reading font, invalid font header); + efree(font); + php_stream_close(stream); + RETURN_FALSE; + } + if (overflow2(font-nchars * font-h, font-w )) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Error reading font, invalid font header); + efree(font); + php_stream_close(stream); + RETURN_FALSE; + } + if (body_size != body_size_check) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Error reading font); efree(font); http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/imageloadfont_invalid.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/ext/gd/tests/imageloadfont_invalid.phpt diff -u /dev/null php-src/ext/gd/tests/imageloadfont_invalid.phpt:1.2 --- /dev/null Thu Jul 17 23:28:11 2008 +++ php-src/ext/gd/tests/imageloadfont_invalid.phpt Thu Jul 17 23:28:11 2008 @@ -0,0 +1,25 @@ +--TEST-- +imageloadfont() function crashes +--SKIPIF-- +?php + if (!extension_loaded('gd')) die(skip gd extension not available\n); + if (!GD_BUNDLED) die('skip external GD libraries always fail'); +? +--FILE-- +?php +$filename = dirname(__FILE__) . '/font.gdf'; +$bin = \x41\x41\x41\x41\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00; +$fp = fopen($filename, 'wb'); +fwrite($fp, $bin); +fclose($fp); + +$image = imagecreatetruecolor(50, 20); +$font = imageloadfont($filename); +$black = imagecolorallocate($image, 0, 0, 0); +imagestring($image, $font, 0, 0, Hello, $black); +? +--EXPECTF-- +Warning: imageloadfont(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully + in %simageloadfont_invalid.php on line %d + +Warning: imageloadfont(): Error reading font, invalid font header in %simageloadfont_invalid.php on line %d -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/ldap ldap.c /ext/openssl openssl.c /ext/standard file.c streamsfuncs.c uniqid.c
colder Sun May 4 21:16:22 2008 UTC Modified files: /php-src/ext/gd gd.c /php-src/ext/ldap ldap.c /php-src/ext/opensslopenssl.c /php-src/ext/standard file.c streamsfuncs.c uniqid.c Log: Fix protos http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.385r2=1.386diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.385 php-src/ext/gd/gd.c:1.386 --- php-src/ext/gd/gd.c:1.385 Thu Feb 28 17:43:32 2008 +++ php-src/ext/gd/gd.c Sun May 4 21:16:22 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.385 2008/02/28 17:43:32 felipe Exp $ */ +/* $Id: gd.c,v 1.386 2008/05/04 21:16:22 colder Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -3994,7 +3994,7 @@ } /* }}} */ -/* {{{ proto array imagepstext(resource image, string text, resource font, int size, int foreground, int background, int xcoord, int ycoord [, int space, int tightness, float angle, int antialias]) +/* {{{ proto array imagepstext(resource image, string text, resource font, int size, int foreground, int background, int xcoord, int ycoord [, int space [, int tightness [, float angle [, int antialias) Rasterize a string over an image */ PHP_FUNCTION(imagepstext) { http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.183r2=1.184diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.183 php-src/ext/ldap/ldap.c:1.184 --- php-src/ext/ldap/ldap.c:1.183 Wed Apr 16 13:19:31 2008 +++ php-src/ext/ldap/ldap.c Sun May 4 21:16:22 2008 @@ -23,7 +23,7 @@ +--+ */ -/* $Id: ldap.c,v 1.183 2008/04/16 13:19:31 tony2001 Exp $ */ +/* $Id: ldap.c,v 1.184 2008/05/04 21:16:22 colder Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -237,7 +237,7 @@ php_info_print_table_start(); php_info_print_table_row(2, LDAP Support, enabled); - php_info_print_table_row(2, RCS Version, $Id: ldap.c,v 1.183 2008/04/16 13:19:31 tony2001 Exp $); + php_info_print_table_row(2, RCS Version, $Id: ldap.c,v 1.184 2008/05/04 21:16:22 colder Exp $); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, %ld/unlimited, LDAPG(num_links)); @@ -386,7 +386,7 @@ } /* }}} */ -/* {{{ proto bool ldap_bind(resource link [, string dn, string password]) +/* {{{ proto bool ldap_bind(resource link [, string dn [, string password]]) Bind to LDAP directory */ PHP_FUNCTION(ldap_bind) { @@ -496,7 +496,7 @@ } /* }}} */ -/* {{{ proto bool ldap_sasl_bind(resource link [, string binddn, string password, string sasl_mech, string sasl_realm, string sasl_authc_id, string sasl_authz_id, string props]) +/* {{{ proto bool ldap_sasl_bind(resource link [, string binddn [, string password [, string sasl_mech [, string sasl_realm [, string sasl_authc_id [, string sasl_authz_id [, string props]]]) Bind to LDAP directory using SASL */ PHP_FUNCTION(ldap_sasl_bind) { http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.157r2=1.158diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.157 php-src/ext/openssl/openssl.c:1.158 --- php-src/ext/openssl/openssl.c:1.157 Wed Apr 2 14:35:16 2008 +++ php-src/ext/openssl/openssl.c Sun May 4 21:16:22 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: openssl.c,v 1.157 2008/04/02 14:35:16 tony2001 Exp $ */ +/* $Id: openssl.c,v 1.158 2008/05/04 21:16:22 colder Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -2176,7 +2176,7 @@ } /* }}} */ -/* {{{ proto bool openssl_csr_new(array dn, resource privkey [, array configargs, array extraattribs]) +/* {{{ proto bool openssl_csr_new(array dn, resource privkey [, array configargs [, array extraattribs]]) Generates a privkey and CSR */ PHP_FUNCTION(openssl_csr_new) { http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.517r2=1.518diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.517 php-src/ext/standard/file.c:1.518 --- php-src/ext/standard/file.c:1.517 Mon Mar 31 22:44:38 2008 +++ php-src/ext/standard/file.c Sun May 4 21:16:22 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.517 2008/03/31 22:44:38 iliaa Exp $ */ +/* $Id: file.c,v 1.518 2008/05/04 21:16:22 colder Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1198,7 +1198,7 @@ } /* }}} */ -/* {{{ proto string fgetss(resource fp [, int lengthish, string allowable_tags]) U +/* {{{ proto string fgetss(resource fp [, int lengthish [, string allowable_tags]]) U Get a line from file pointer and strip HTML tags */ PHPAPI PHP_FUNCTION(fgetss) {
[PHP-CVS] cvs: php-src /ext/gd gd.c
felipe Thu Feb 28 17:43:32 2008 UTC Modified files: /php-src/ext/gd gd.c Log: Fixed return value changed previously http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.384r2=1.385diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.384 php-src/ext/gd/gd.c:1.385 --- php-src/ext/gd/gd.c:1.384 Thu Feb 28 14:16:12 2008 +++ php-src/ext/gd/gd.c Thu Feb 28 17:43:32 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.384 2008/02/28 14:16:12 felipe Exp $ */ +/* $Id: gd.c,v 1.385 2008/02/28 17:43:32 felipe Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1351,7 +1351,7 @@ PHP_FUNCTION(gd_info) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_FALSE; } array_init(return_value); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/gd gd.c
felipe Thu Feb 28 17:43:32 2008 UTC Modified files: /php-src/ext/gd gd.c Log: Fixed return value changed previously http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.384r2=1.385diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.384 php-src/ext/gd/gd.c:1.385 --- php-src/ext/gd/gd.c:1.384 Thu Feb 28 14:16:12 2008 +++ php-src/ext/gd/gd.c Thu Feb 28 17:43:32 2008 @@ -1351,7 +1351,7 @@ PHP_FUNCTION(gd_info) { if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_FALSE; } You can leave the 'return;' there, as it's current practice to return NULL when it fails the parameter validation. You may have to tune some tests, though. Nuno -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
janiFri Sep 28 12:52:12 2007 UTC Modified files: /php-src/ext/gd gd.c Log: - Fix compiler warning http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.381r2=1.382diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.381 php-src/ext/gd/gd.c:1.382 --- php-src/ext/gd/gd.c:1.381 Thu Sep 27 18:28:39 2007 +++ php-src/ext/gd/gd.c Fri Sep 28 12:52:12 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.381 2007/09/27 18:28:39 dmitry Exp $ */ +/* $Id: gd.c,v 1.382 2007/09/28 12:52:12 jani Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -2040,7 +2040,7 @@ } } /* }}} */ -#endif PHP_WIN32 +#endif /* PHP_WIN32 */ #ifdef HAVE_GD_BUNDLED /* {{{ proto resource imagerotate(resource src_im, float angle, int bgdcolor [, int ignoretransparent]) U -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Tue Sep 11 21:10:51 2007 UTC Modified files: /php-src/ext/gd gd.c Log: - MFB: alpha support for colorize filter http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.379r2=1.380diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.379 php-src/ext/gd/gd.c:1.380 --- php-src/ext/gd/gd.c:1.379 Mon Jul 30 21:44:53 2007 +++ php-src/ext/gd/gd.c Tue Sep 11 21:10:51 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.379 2007/07/30 21:44:53 pajoye Exp $ */ +/* $Id: gd.c,v 1.380 2007/09/11 21:10:51 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -4601,8 +4601,9 @@ zval *SIM; gdImagePtr im_src; long r,g,b,tmp; + long a = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r, SIM, tmp, r, g, b) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r|l, SIM, tmp, r, g, b, a) == FAILURE) { RETURN_FALSE; } @@ -4612,7 +4613,7 @@ RETURN_FALSE; } - if (gdImageColor(im_src, (int) r, (int) g, (int) b) == 1) { + if (gdImageColor(im_src, (int) r, (int) g, (int) b, (int) a) == 1) { RETURN_TRUE; } @@ -4721,7 +4722,7 @@ php_image_filter_smooth }; - if (ZEND_NUM_ARGS() 2 || ZEND_NUM_ARGS() 5) { + if (ZEND_NUM_ARGS() 2 || ZEND_NUM_ARGS() 6) { WRONG_PARAM_COUNT; } else if (zend_parse_parameters(2 TSRMLS_CC, rl, tmp, filtertype) == FAILURE) { return; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Mon Jul 30 21:44:53 2007 UTC Modified files: /php-src/ext/gd gd.c Log: - MFB: - fix gd bug #102, 0 means that no load are loaded, return false - add error code in the warning http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.378r2=1.379diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.378 php-src/ext/gd/gd.c:1.379 --- php-src/ext/gd/gd.c:1.378 Wed Jun 6 09:43:39 2007 +++ php-src/ext/gd/gd.c Mon Jul 30 21:44:53 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.378 2007/06/06 09:43:39 tony2001 Exp $ */ +/* $Id: gd.c,v 1.379 2007/07/30 21:44:53 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -3825,7 +3825,8 @@ f_ind = T1_AddFont(filename); if (f_ind 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, T1Lib Error: %s, T1_StrError(f_ind)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, T1Lib Error (%i): %s, f_ind, T1_StrError(f_ind)); + RETURN_FALSE; } if (T1_LoadFont(f_ind)) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/gd/libgd gd.c
tony2001Wed Jun 6 09:43:39 2007 UTC Modified files: /php-src/ext/gd/libgd gd.c /php-src/ext/gd gd.c Log: fix several integer overflows in GD http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.104r2=1.105diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.104 php-src/ext/gd/libgd/gd.c:1.105 --- php-src/ext/gd/libgd/gd.c:1.104 Sat Apr 14 17:30:51 2007 +++ php-src/ext/gd/libgd/gd.c Wed Jun 6 09:43:38 2007 @@ -120,6 +120,15 @@ { int i; gdImagePtr im; + + if (overflow2(sx, sy)) { + return NULL; + } + + if (overflow2(sizeof(unsigned char *), sy)) { + return NULL; + } + im = (gdImage *) gdMalloc(sizeof(gdImage)); memset(im, 0, sizeof(gdImage)); /* Row-major ever since gd 1.3 */ @@ -162,6 +171,19 @@ { int i; gdImagePtr im; + + if (overflow2(sx, sy)) { + return NULL; + } + + if (overflow2(sizeof(unsigned char *), sy)) { + return NULL; + } + + if (overflow2(sizeof(int), sx)) { + return NULL; + } + im = (gdImage *) gdMalloc(sizeof(gdImage)); memset(im, 0, sizeof(gdImage)); im-tpixels = (int **) gdMalloc(sizeof(int *) * sy); @@ -2398,6 +2420,14 @@ int *stx, *sty; /* We only need to use floating point to determine the correct stretch vector for one line's worth. */ double accum; + + if (overflow2(sizeof(int), srcW)) { + return; + } + if (overflow2(sizeof(int), srcH)) { + return; + } + stx = (int *) gdMalloc (sizeof (int) * srcW); sty = (int *) gdMalloc (sizeof (int) * srcH); accum = 0; @@ -3189,6 +3219,10 @@ return; } + if (overflow2(sizeof(int), n)) { + return; + } + if (c == gdAntiAliased) { fill_color = im-AA_color; } else { @@ -3203,6 +3237,9 @@ while (im-polyAllocated n) { im-polyAllocated *= 2; } + if (overflow2(sizeof(int), im-polyAllocated)) { + return; + } im-polyInts = (int *) gdRealloc(im-polyInts, sizeof(int) * im-polyAllocated); } miny = p[0].y; http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.377r2=1.378diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.377 php-src/ext/gd/gd.c:1.378 --- php-src/ext/gd/gd.c:1.377 Sun Jun 3 17:43:13 2007 +++ php-src/ext/gd/gd.c Wed Jun 6 09:43:39 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.377 2007/06/03 17:43:13 pajoye Exp $ */ +/* $Id: gd.c,v 1.378 2007/06/06 09:43:39 tony2001 Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1579,6 +1579,10 @@ im = gdImageCreateTrueColor(x_size, y_size); + if (!im) { + RETURN_FALSE; + } + ZEND_REGISTER_RESOURCE(return_value, im, le_gd); } /* }}} */ @@ -2128,6 +2132,10 @@ im = gdImageCreate(x_size, y_size); + if (!im) { + RETURN_FALSE; + } + ZEND_REGISTER_RESOURCE(return_value, im, le_gd); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/gd/libgd gd.h
pajoye Sun Jun 3 17:43:13 2007 UTC Modified files: /php-src/ext/gd gd.c /php-src/ext/gd/libgd gd.h Log: - @DOC add constants GD_MAJOR_VERSION, GD_MINOR_VERSION, GD_RELEASE_VERSION GD_EXTRA_VERSION and GD_VERSION_STRING - fix #ifdef else clause http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.376r2=1.377diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.376 php-src/ext/gd/gd.c:1.377 --- php-src/ext/gd/gd.c:1.376 Sat Jun 2 15:41:02 2007 +++ php-src/ext/gd/gd.c Sun Jun 3 17:43:13 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.376 2007/06/02 15:41:02 pajoye Exp $ */ +/* $Id: gd.c,v 1.377 2007/06/03 17:43:13 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1233,6 +1233,18 @@ REGISTER_LONG_CONSTANT(GD_BUNDLED, 0, CONST_CS | CONST_PERSISTENT); #endif +#ifdef GD_VERSION_STRING + REGISTER_STRING_CONSTANT(GD_VERSION, GD_VERSION_STRING, CONST_CS | CONST_PERSISTENT); +#endif + +#if defined(GD_MAJOR_VERSION) defined(GD_MINOR_VERSION) defined(GD_RELEASE_VERSION) defined(GD_EXTRA_VERSION) + REGISTER_LONG_CONSTANT(GD_MAJOR_VERSION, GD_MAJOR_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(GD_MINOR_VERSION, GD_MINOR_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(GD_RELEASE_VERSION, GD_RELEASE_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_STRING_CONSTANT(GD_EXTRA_VERSION, GD_EXTRA_VERSION, CONST_CS | CONST_PERSISTENT); +#endif + + #ifdef HAVE_GD_PNG /* * cannot include #include png.h http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.h?r1=1.32r2=1.33diff_format=u Index: php-src/ext/gd/libgd/gd.h diff -u php-src/ext/gd/libgd/gd.h:1.32 php-src/ext/gd/libgd/gd.h:1.33 --- php-src/ext/gd/libgd/gd.h:1.32 Mon Apr 23 15:06:13 2007 +++ php-src/ext/gd/libgd/gd.h Sun Jun 3 17:43:13 2007 @@ -7,11 +7,17 @@ #include php_compat.h +#define GD_MAJOR_VERSION 2 +#define GD_MINOR_VERSION 0 +#define GD_RELEASE_VERSION 35 +#define GD_EXTRA_VERSION +#define GD_VERSION_STRING 2.0.35 + #ifdef NETWARE /* default fontpath for netware systems */ #define DEFAULT_FONTPATH sys:/java/nwgfx/lib/x11/fonts/ttf;. #define PATHSEPARATOR ; -#elif WIN32 +#elif defined(WIN32) /* default fontpath for windows systems */ #define DEFAULT_FONTPATH c:\\winnt\\fonts;c:\\windows\\fonts;. #define PATHSEPARATOR ; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Sat Jun 2 15:41:02 2007 UTC Modified files: /php-src/ext/gd gd.c Log: - MFB: sx/sy must be 0 and INT_MAX http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.375r2=1.376diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.375 php-src/ext/gd/gd.c:1.376 --- php-src/ext/gd/gd.c:1.375 Tue May 22 09:44:55 2007 +++ php-src/ext/gd/gd.c Sat Jun 2 15:41:02 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.375 2007/05/22 09:44:55 tony2001 Exp $ */ +/* $Id: gd.c,v 1.376 2007/06/02 15:41:02 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1560,7 +1560,7 @@ return; } - if (x_size = 0 || y_size = 0) { + if (x_size = 0 || y_size = 0 || x_size = INT_MAX || y_size = INT_MAX) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid image dimensions); RETURN_FALSE; } @@ -2109,7 +2109,7 @@ return; } - if (x_size = 0 || y_size = 0) { + if (x_size = 0 || y_size = 0 || x_size = INT_MAX || y_size = INT_MAX) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid image dimensions); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/gd/tests bug41442.phpt
tony2001Tue May 22 09:44:55 2007 UTC Added files: /php-src/ext/gd/tests bug41442.phpt Modified files: /php-src/ext/gd gd.c Log: fix #41442 (imagegd2() under output control) http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.374r2=1.375diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.374 php-src/ext/gd/gd.c:1.375 --- php-src/ext/gd/gd.c:1.374 Mon May 7 14:50:07 2007 +++ php-src/ext/gd/gd.c Tue May 22 09:44:55 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.374 2007/05/07 14:50:07 pajoye Exp $ */ +/* $Id: gd.c,v 1.375 2007/05/22 09:44:55 tony2001 Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -2563,6 +2563,14 @@ } (*func_p)(im, fp); break; +#ifdef HAVE_GD_GD2 + case PHP_GDIMG_TYPE_GD2: + if (quality == -1) { + quality = 128; + } + (*func_p)(im, fp, quality, type); + break; +#endif default: if (quality == -1) { quality = 128; http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/bug41442.phpt?view=markuprev=1.1 Index: php-src/ext/gd/tests/bug41442.phpt +++ php-src/ext/gd/tests/bug41442.phpt --TEST-- Bug #41442 (imagegd2() under output control) --SKIPIF-- ?php if (!extension_loaded('gd')) { die(skip gd extension not available.); } if (!function_exists(imagegd2)) { die(skip GD2 support unavailable); } ? --FILE-- ?php $str = file_get_contents(dirname(__FILE__).'/src.gd2'); $res = imagecreatefromstring($str); /* string */ ob_start(); imagegd2($res); $str2 = ob_get_clean(); var_dump(imagecreatefromstring($str2)); /* file */ $file = dirname(__FILE__)./bug41442.gd2; imagegd2($res, $file); $str2 = file_get_contents($file); var_dump(imagecreatefromstring($str2)); @unlink($file); echo Done\n; ? --EXPECTF-- resource(%d) of type (gd) resource(%d) of type (gd) Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Mon May 7 14:50:07 2007 UTC Modified files: /php-src/ext/gd gd.c Log: - fix build when use with a museum freetype version (1.x) http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.373r2=1.374diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.373 php-src/ext/gd/gd.c:1.374 --- php-src/ext/gd/gd.c:1.373 Tue Apr 17 15:44:25 2007 +++ php-src/ext/gd/gd.c Mon May 7 14:50:07 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.373 2007/04/17 15:44:25 bjori Exp $ */ +/* $Id: gd.c,v 1.374 2007/05/07 14:50:07 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1288,10 +1288,13 @@ php_info_print_table_row(2, FreeType Linkage, with freetype); { char tmp[256]; + #ifdef FREETYPE_PATCH - snprintf(tmp, sizeof(tmp), %d.%d.%d, FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH); +snprintf(tmp, sizeof(tmp), %d.%d.%d, FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH); +#elif defined(FREETYPE_MAJOR) +snprintf(tmp, sizeof(tmp), %d.%d, FREETYPE_MAJOR, FREETYPE_MINOR); #else - snprintf(tmp, sizeof(tmp), %d.%d, FREETYPE_MAJOR, FREETYPE_MINOR); +snprintf(tmp, sizeof(tmp), 1.x); #endif php_info_print_table_row(2, FreeType Version, tmp); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Tue Apr 17 15:24:05 2007 UTC Modified files: /php-src/ext/gd gd.c Log: - fix arginfo http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.370r2=1.371diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.370 php-src/ext/gd/gd.c:1.371 --- php-src/ext/gd/gd.c:1.370 Tue Apr 17 15:11:56 2007 +++ php-src/ext/gd/gd.c Tue Apr 17 15:24:05 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.370 2007/04/17 15:11:56 pajoye Exp $ */ +/* $Id: gd.c,v 1.371 2007/04/17 15:24:05 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -282,8 +282,9 @@ #ifdef PHP_WIN32 static -ZEND_BEGIN_ARG_INFO(arginfo_imagegrabwindow, 0) +ZEND_BEGIN_ARG_INFO(arginfo_imagegrabwindow, 0, 0, 1) ZEND_ARG_INFO(0, handle) + ZEND_ARG_INFO(0, client_area) ZEND_END_ARG_INFO() static -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Tue Apr 17 15:37:26 2007 UTC Modified files: /php-src/ext/gd gd.c Log: - +ZEND_BEGIN_ARG_INFO_EX not _INFO (thx bjori) http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.371r2=1.372diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.371 php-src/ext/gd/gd.c:1.372 --- php-src/ext/gd/gd.c:1.371 Tue Apr 17 15:24:05 2007 +++ php-src/ext/gd/gd.c Tue Apr 17 15:37:26 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.371 2007/04/17 15:24:05 pajoye Exp $ */ +/* $Id: gd.c,v 1.372 2007/04/17 15:37:26 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -282,7 +282,7 @@ #ifdef PHP_WIN32 static -ZEND_BEGIN_ARG_INFO(arginfo_imagegrabwindow, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_imagegrabwindow, 0, 0, 1) ZEND_ARG_INFO(0, handle) ZEND_ARG_INFO(0, client_area) ZEND_END_ARG_INFO() -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
bjori Tue Apr 17 15:44:25 2007 UTC Modified files: /php-src/ext/gd gd.c Log: Fix proto http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.372r2=1.373diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.372 php-src/ext/gd/gd.c:1.373 --- php-src/ext/gd/gd.c:1.372 Tue Apr 17 15:37:26 2007 +++ php-src/ext/gd/gd.c Tue Apr 17 15:44:25 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.372 2007/04/17 15:37:26 pajoye Exp $ */ +/* $Id: gd.c,v 1.373 2007/04/17 15:44:25 bjori Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1965,7 +1965,7 @@ } /* }}} */ -/* {{{ proto resource imagegrabscreen(int window_handle [, int client_area]) +/* {{{ proto resource imagegrabscreen() Grab a screenshot */ PHP_FUNCTION(imagegrabscreen) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
tony2001Thu Apr 5 09:32:58 2007 UTC Modified files: /php-src/ext/gd gd.c Log: fix build without FreeType http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.368r2=1.369diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.368 php-src/ext/gd/gd.c:1.369 --- php-src/ext/gd/gd.c:1.368 Wed Apr 4 01:54:34 2007 +++ php-src/ext/gd/gd.c Thu Apr 5 09:32:58 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.368 2007/04/04 01:54:34 pajoye Exp $ */ +/* $Id: gd.c,v 1.369 2007/04/05 09:32:58 tony2001 Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1084,7 +1084,7 @@ NULL, #endif NULL, -#if HAVE_GD_STRINGFT (HAVE_GD_FONTCACHESHUTDOWN || HAVE_GD_FREEFONTCACHE) +#if HAVE_GD_STRINGFT (HAVE_LIBFREETYPE (HAVE_GD_FONTCACHESHUTDOWN || HAVE_GD_FREEFONTCACHE)) PHP_RSHUTDOWN(gd), #else NULL, @@ -1134,7 +1134,7 @@ #if HAVE_LIBT1 T1_CloseLib(); #endif -#if HAVE_GD_FONTMUTEX +#if HAVE_GD_FONTMUTEX HAVE_LIBFREETYPE gdFontCacheMutexShutdown(); #endif return SUCCESS; @@ -1149,7 +1149,7 @@ { le_gd = zend_register_list_destructors_ex(php_free_gd_image, NULL, gd, module_number); le_gd_font = zend_register_list_destructors_ex(php_free_gd_font, NULL, gd font, module_number); -#if HAVE_GD_FONTMUTEX +#if HAVE_GD_FONTMUTEX HAVE_LIBFREETYPE gdFontCacheMutexSetup(); #endif #if HAVE_LIBT1 @@ -1234,7 +1234,7 @@ /* {{{ PHP_RSHUTDOWN_FUNCTION */ -#if HAVE_GD_STRINGFT (HAVE_GD_FONTCACHESHUTDOWN || HAVE_GD_FREEFONTCACHE) +#if HAVE_GD_STRINGFT (HAVE_LIBFREETYPE (HAVE_GD_FONTCACHESHUTDOWN || HAVE_GD_FREEFONTCACHE)) PHP_RSHUTDOWN_FUNCTION(gd) { #if HAVE_GD_FONTCACHESHUTDOWN -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/gd/libgd gd.h gdft.c
pajoye Wed Apr 4 00:44:38 2007 UTC Modified files: /php-src/ext/gd gd.c /php-src/ext/gd/libgd gd.h gdft.c Log: - remove double lock (tween colors cache is created in each thread, the cache mutex is already locked earlier) - #40858, other TS improvements for gd freetype cache management cache initialization and shutdown is now done in MINIT and MSHUTDOWN. http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.366r2=1.367diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.366 php-src/ext/gd/gd.c:1.367 --- php-src/ext/gd/gd.c:1.366 Sun Feb 11 11:13:40 2007 +++ php-src/ext/gd/gd.c Wed Apr 4 00:44:38 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.366 2007/02/11 11:13:40 pajoye Exp $ */ +/* $Id: gd.c,v 1.367 2007/04/04 00:44:38 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1078,11 +1078,7 @@ gd, gd_functions, PHP_MINIT(gd), -#if HAVE_LIBT1 PHP_MSHUTDOWN(gd), -#else - NULL, -#endif NULL, #if HAVE_GD_STRINGFT (HAVE_GD_FONTCACHESHUTDOWN || HAVE_GD_FREEFONTCACHE) PHP_RSHUTDOWN(gd), @@ -1126,16 +1122,20 @@ } /* }}} */ -#if HAVE_LIBT1 + /* {{{ PHP_MSHUTDOWN_FUNCTION */ PHP_MSHUTDOWN_FUNCTION(gd) { +#if HAVE_LIBT1 T1_CloseLib(); +#endif +#if HAVE_GD_FONTMUTEX + gdFontCacheMutexShutdown(); +#endif return SUCCESS; } /* }}} */ -#endif /* {{{ PHP_MINIT_FUNCTION @@ -1144,6 +1144,9 @@ { le_gd = zend_register_list_destructors_ex(php_free_gd_image, NULL, gd, module_number); le_gd_font = zend_register_list_destructors_ex(php_free_gd_font, NULL, gd font, module_number); +#if HAVE_GD_FONTMUTEX + gdFontCacheMutexSetup(); +#endif #if HAVE_LIBT1 T1_SetBitmapPad(8); T1_InitLib(NO_LOGFILE | IGNORE_CONFIGFILE | IGNORE_FONTDATABASE); http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.h?r1=1.30r2=1.31diff_format=u Index: php-src/ext/gd/libgd/gd.h diff -u php-src/ext/gd/libgd/gd.h:1.30 php-src/ext/gd/libgd/gd.h:1.31 --- php-src/ext/gd/libgd/gd.h:1.30 Sat Sep 16 19:08:21 2006 +++ php-src/ext/gd/libgd/gd.h Wed Apr 4 00:44:38 2007 @@ -297,6 +297,14 @@ void gdImageString16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color); void gdImageStringUp16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color); +/* + * The following functions are required to be called prior to the + * use of any sort of threads in a module load / shutdown function + * respectively. + */ +void gdFontCacheMutexSetup(); +void gdFontCacheMutexShutdown(); + /* 2.0.16: for thread-safe use of gdImageStringFT and friends, * call this before allowing any thread to call gdImageStringFT. * Otherwise it is invoked by the first thread to invoke http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gdft.c?r1=1.42r2=1.43diff_format=u Index: php-src/ext/gd/libgd/gdft.c diff -u php-src/ext/gd/libgd/gdft.c:1.42 php-src/ext/gd/libgd/gdft.c:1.43 --- php-src/ext/gd/libgd/gdft.c:1.42Thu Mar 1 18:41:45 2007 +++ php-src/ext/gd/libgd/gdft.c Wed Apr 4 00:44:38 2007 @@ -698,10 +698,8 @@ } else { /* find antialised color */ tc_key.bgcolor = *pixel; - gdMutexLock(gdFontCacheMutex); tc_elem = (tweencolor_t *) gdCacheGet(tc_cache, tc_key); *pixel = tc_elem-tweencolor; - gdMutexUnlock(gdFontCacheMutex); } } } @@ -722,7 +720,6 @@ gdCacheDelete(fontCache); fontCache = NULL; gdMutexUnlock(gdFontCacheMutex); - gdMutexShutdown(gdFontCacheMutex); FT_Done_FreeType(library); } } @@ -732,15 +729,23 @@ gdFontCacheShutdown(); } +void gdFontCacheMutexSetup() +{ + gdMutexSetup(gdFontCacheMutex); +} + +void gdFontCacheMutexShutdown() +{ + gdMutexShutdown(gdFontCacheMutex); +} + int gdFontCacheSetup(void) { if (fontCache) { /* Already set up */ return 0; } - gdMutexSetup(gdFontCacheMutex); if (FT_Init_FreeType(library)) { - gdMutexShutdown(gdFontCacheMutex); return -1; } fontCache = gdCacheCreate (FONTCACHESIZE, fontTest, fontFetch, fontRelease); @@ -803,15 +808,16 @@ /* initialize font library and font cache on first call **/ + gdMutexLock(gdFontCacheMutex); if (!fontCache) { if (gdFontCacheSetup() != 0) { gdCacheDelete(tc_cache); +
[PHP-CVS] cvs: php-src /ext/gd gd.c php_gd.h /ext/gd/libgd gd_gif_in.c /ext/gd/tests bug37360.phpt
pajoye Wed Apr 4 01:54:34 2007 UTC Modified files: /php-src/ext/gd gd.c php_gd.h /php-src/ext/gd/libgd gd_gif_in.c /php-src/ext/gd/tests bug37360.phpt Log: - fix previous commit (missing #ifdef in shutdown declaration) - MFB: - Sync with gd 2.0.35 (bug #52, #60 and #66) - Improve TS of gif loading code (Roman Nemecek, Nuno, Pierre) - a frame size must be confined to the screen defition (Pierre) - be sure to always read the dimensions in the frame and does not use the screen size (see #66 for a side effect) (Pierre) - Update #37360 test. The frame does not fit the logical screen (specs tell that it must fit) (Pierre) http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.367r2=1.368diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.367 php-src/ext/gd/gd.c:1.368 --- php-src/ext/gd/gd.c:1.367 Wed Apr 4 00:44:38 2007 +++ php-src/ext/gd/gd.c Wed Apr 4 01:54:34 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.367 2007/04/04 00:44:38 pajoye Exp $ */ +/* $Id: gd.c,v 1.368 2007/04/04 01:54:34 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1078,7 +1078,11 @@ gd, gd_functions, PHP_MINIT(gd), +#if HAVE_LIBT1 || HAVE_GD_FONTMUTEX PHP_MSHUTDOWN(gd), +#else + NULL, +#endif NULL, #if HAVE_GD_STRINGFT (HAVE_GD_FONTCACHESHUTDOWN || HAVE_GD_FREEFONTCACHE) PHP_RSHUTDOWN(gd), @@ -1122,9 +1126,9 @@ } /* }}} */ - /* {{{ PHP_MSHUTDOWN_FUNCTION */ +#if HAVE_LIBT1 || HAVE_GD_FONTMUTEX PHP_MSHUTDOWN_FUNCTION(gd) { #if HAVE_LIBT1 @@ -1135,6 +1139,7 @@ #endif return SUCCESS; } +#endif /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/gd/php_gd.h?r1=1.72r2=1.73diff_format=u Index: php-src/ext/gd/php_gd.h diff -u php-src/ext/gd/php_gd.h:1.72 php-src/ext/gd/php_gd.h:1.73 --- php-src/ext/gd/php_gd.h:1.72Mon Jan 8 22:56:26 2007 +++ php-src/ext/gd/php_gd.h Wed Apr 4 01:54:34 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: php_gd.h,v 1.72 2007/01/08 22:56:26 nlopess Exp $ */ +/* $Id: php_gd.h,v 1.73 2007/04/04 01:54:34 pajoye Exp $ */ #ifndef PHP_GD_H #define PHP_GD_H @@ -64,7 +64,7 @@ /* gd.c functions */ PHP_MINFO_FUNCTION(gd); PHP_MINIT_FUNCTION(gd); -#if HAVE_LIBT1 +#if HAVE_LIBT1 || HAVE_GD_FONTMUTEX PHP_MSHUTDOWN_FUNCTION(gd); #endif #if HAVE_GD_STRINGFT http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_gif_in.c?r1=1.14r2=1.15diff_format=u Index: php-src/ext/gd/libgd/gd_gif_in.c diff -u php-src/ext/gd/libgd/gd_gif_in.c:1.14 php-src/ext/gd/libgd/gd_gif_in.c:1.15 --- php-src/ext/gd/libgd/gd_gif_in.c:1.14 Thu Mar 8 20:26:48 2007 +++ php-src/ext/gd/libgd/gd_gif_in.cWed Apr 4 01:54:34 2007 @@ -61,12 +61,14 @@ } GifScreen; #endif +#if 0 static struct { int transparent; int delayTime; int inputFlag; int disposal; } Gif89 = { -1, -1, -1, 0 }; +#endif #define STACK_SIZE ((1(MAX_LWZ_BITS))*2) @@ -87,14 +89,12 @@ } LZW_STATIC_DATA; static int ReadColorMap (gdIOCtx *fd, int number, unsigned char (*buffer)[256]); -static int DoExtension (gdIOCtx *fd, int label, int *Transparent); -static int GetDataBlock (gdIOCtx *fd, unsigned char *buf); -static int GetCode (gdIOCtx *fd, CODE_STATIC_DATA *scd, int code_size, int flag); -static int LWZReadByte (gdIOCtx *fd, LZW_STATIC_DATA *sd, int flag, int input_code_size); +static int DoExtension (gdIOCtx *fd, int label, int *Transparent, int *ZeroDataBlockP); +static int GetDataBlock (gdIOCtx *fd, unsigned char *buf, int *ZeroDataBlockP); +static int GetCode (gdIOCtx *fd, CODE_STATIC_DATA *scd, int code_size, int flag, int *ZeroDataBlockP); +static int LWZReadByte (gdIOCtx *fd, LZW_STATIC_DATA *sd, char flag, int input_code_size, int *ZeroDataBlockP); -static void ReadImage (gdImagePtr im, gdIOCtx *fd, int len, int height, unsigned char (*cmap)[256], int interlace); /*1.4//, int ignore); */ - -int ZeroDataBlock; +static void ReadImage (gdImagePtr im, gdIOCtx *fd, int len, int height, unsigned char (*cmap)[256], int interlace, int *ZeroDataBlockP); /*1.4//, int ignore); */ gdImagePtr gdImageCreateFromGifSource(gdSourcePtr inSource) /* {{{ */ { @@ -126,22 +126,25 @@ { /* 1.4 int imageNumber; */ int BitPixel; +#if 0 int ColorResolution; int Background; int AspectRatio; +#endif int Transparent = (-1); unsigned char buf[16]; unsigned char c; unsigned char ColorMap[3][MAXCOLORMAPSIZE]; unsigned char localColorMap[3][MAXCOLORMAPSIZE]; - int imw, imh; - int useGlobalColormap; + int imw, imh, screen_width, screen_height; + int
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Sun Feb 11 11:13:41 2007 UTC Modified files: /php-src/ext/gd gd.c Log: - MFB: Fixed bug #40428, imagepstext() doesn't accept optional parameter (Pierre) http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.365r2=1.366diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.365 php-src/ext/gd/gd.c:1.366 --- php-src/ext/gd/gd.c:1.365 Mon Jan 8 22:56:25 2007 +++ php-src/ext/gd/gd.c Sun Feb 11 11:13:40 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.365 2007/01/08 22:56:25 nlopess Exp $ */ +/* $Id: gd.c,v 1.366 2007/02/11 11:13:40 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -3807,11 +3807,6 @@ T1_TMATRIX *transform = NULL; char *str; int str_len; - int argc = ZEND_NUM_ARGS(); - - if (argc != 8 argc != 12) { - ZEND_WRONG_PARAM_COUNT(); - } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rsrl|lldl, img, str, str_len, fnt, size, _fg, _bg, x, y, space, width, angle, aa_steps) == FAILURE) { return; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c php_gd.h
nlopess Mon Jan 8 22:56:26 2007 UTC Modified files: /php-src/ext/gd gd.c php_gd.h Log: MFB http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.364r2=1.365diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.364 php-src/ext/gd/gd.c:1.365 --- php-src/ext/gd/gd.c:1.364 Mon Jan 1 09:29:24 2007 +++ php-src/ext/gd/gd.c Mon Jan 8 22:56:25 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.364 2007/01/01 09:29:24 sebastian Exp $ */ +/* $Id: gd.c,v 1.365 2007/01/08 22:56:25 nlopess Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1078,7 +1078,11 @@ gd, gd_functions, PHP_MINIT(gd), +#if HAVE_LIBT1 PHP_MSHUTDOWN(gd), +#else + NULL, +#endif NULL, #if HAVE_GD_STRINGFT (HAVE_GD_FONTCACHESHUTDOWN || HAVE_GD_FREEFONTCACHE) PHP_RSHUTDOWN(gd), @@ -1122,16 +1126,16 @@ } /* }}} */ +#if HAVE_LIBT1 /* {{{ PHP_MSHUTDOWN_FUNCTION */ PHP_MSHUTDOWN_FUNCTION(gd) { -#if HAVE_LIBT1 T1_CloseLib(); -#endif return SUCCESS; } /* }}} */ +#endif /* {{{ PHP_MINIT_FUNCTION http://cvs.php.net/viewvc.cgi/php-src/ext/gd/php_gd.h?r1=1.71r2=1.72diff_format=u Index: php-src/ext/gd/php_gd.h diff -u php-src/ext/gd/php_gd.h:1.71 php-src/ext/gd/php_gd.h:1.72 --- php-src/ext/gd/php_gd.h:1.71Mon Jan 1 09:29:24 2007 +++ php-src/ext/gd/php_gd.h Mon Jan 8 22:56:26 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: php_gd.h,v 1.71 2007/01/01 09:29:24 sebastian Exp $ */ +/* $Id: php_gd.h,v 1.72 2007/01/08 22:56:26 nlopess Exp $ */ #ifndef PHP_GD_H #define PHP_GD_H @@ -64,7 +64,9 @@ /* gd.c functions */ PHP_MINFO_FUNCTION(gd); PHP_MINIT_FUNCTION(gd); +#if HAVE_LIBT1 PHP_MSHUTDOWN_FUNCTION(gd); +#endif #if HAVE_GD_STRINGFT PHP_RSHUTDOWN_FUNCTION(gd); #endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/gd/libgd gd_png.c /ext/gd/tests bug39780.phpt bug39780.png
pajoye Sun Dec 10 01:28:01 2006 UTC Added files: /php-src/ext/gd/tests bug39780.png bug39780.phpt Modified files: /php-src/ext/gd gd.c /php-src/ext/gd/libgd gd_png.c Log: - #39780, PNG image with CRC/data error raises fatal error http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.361r2=1.362diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.361 php-src/ext/gd/gd.c:1.362 --- php-src/ext/gd/gd.c:1.361 Tue Oct 31 22:13:09 2006 +++ php-src/ext/gd/gd.c Sun Dec 10 01:28:01 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.361 2006/10/31 22:13:09 nlopess Exp $ */ +/* $Id: gd.c,v 1.362 2006/12/10 01:28:01 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -2016,6 +2016,7 @@ im = (*ioctx_func_p)(io_ctx); if (!im) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Passed data is not in '%s' format, tn); + io_ctx-gd_free(io_ctx); return NULL; } http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_png.c?r1=1.22r2=1.23diff_format=u Index: php-src/ext/gd/libgd/gd_png.c diff -u php-src/ext/gd/libgd/gd_png.c:1.22 php-src/ext/gd/libgd/gd_png.c:1.23 --- php-src/ext/gd/libgd/gd_png.c:1.22 Sun Nov 5 15:06:50 2006 +++ php-src/ext/gd/libgd/gd_png.c Sun Dec 10 01:28:01 2006 @@ -58,7 +58,7 @@ * been defined. */ - php_gd_error_ex(E_ERROR, gd-png: fatal libpng error: %s, msg); + php_gd_error_ex(E_WARNING, gd-png: fatal libpng error: %s, msg); jmpbuf_ptr = png_get_error_ptr (png_ptr); if (jmpbuf_ptr == NULL) { /* we are completely hosed now */ @@ -128,7 +128,6 @@ /* GRR: isn't sizeof(infile) equal to the size of the pointer? */ memset (sig, 0, sizeof(sig)); - /* first do a quick check that the file really is a PNG image; could * have used slightly more general png_sig_cmp() function instead */ @@ -201,6 +200,23 @@ png_set_packing (png_ptr); /* expand to 1 byte per pixel */ } + /* setjmp() must be called in every non-callback function that calls a +* PNG-reading libpng function +*/ +#ifndef PNG_SETJMP_NOT_SUPPORTED + if (setjmp(gdPngJmpbufStruct.jmpbuf)) { + php_gd_error(gd-png error: setjmp returns error condition); + png_destroy_read_struct(png_ptr, info_ptr, NULL); + gdFree(image_data); + gdFree(row_pointers); + if (im) { + gdImageDestroy(im); + } + return NULL; + } +#endif + + switch (color_type) { case PNG_COLOR_TYPE_PALETTE: png_get_PLTE(png_ptr, info_ptr, palette, num_palette); http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/bug39780.phpt?view=markuprev=1.1 Index: php-src/ext/gd/tests/bug39780.phpt +++ php-src/ext/gd/tests/bug39780.phpt --TEST-- Bug #39780 (PNG image with CRC/data error raises a fatal error) --SKIPIF-- ?php if (!extension_loaded('gd')) die(skip gd extension not available\n); if (!GD_BUNDLED) die('skip external GD libraries always fail'); ? --FILE-- ?php $im = imagecreatefrompng(dirname(__FILE__) . '/bug39780.png'); var_dump($im); ? --EXPECTF-- Warning: imagecreatefrompng(): gd-png: fatal libpng error: IDAT: CRC error in %s on line %d Warning: imagecreatefrompng(): gd-png error: setjmp returns error condition in %s on line %d Warning: imagecreatefrompng(): '%s' is not a valid PNG file in %s on line %d bool(false) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/gd/tests bug38212.phpt bug39286.phpt
pajoye Sun Dec 10 03:03:48 2006 UTC Modified files: /php-src/ext/gd gd.c /php-src/ext/gd/tests bug39286.phpt bug38212.phpt Log: - MFB: #39286, misleading error message when invalid dimensions are given http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.362r2=1.363diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.362 php-src/ext/gd/gd.c:1.363 --- php-src/ext/gd/gd.c:1.362 Sun Dec 10 01:28:01 2006 +++ php-src/ext/gd/gd.c Sun Dec 10 03:03:48 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.362 2006/12/10 01:28:01 pajoye Exp $ */ +/* $Id: gd.c,v 1.363 2006/12/10 03:03:48 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -2125,6 +2125,10 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z, ppfilename, srcx, srcy, width, height) == FAILURE) { return; } + if (width 1 || height 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING,Zero width or height not allowed); + RETURN_FALSE; + } } else { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z, ppfilename) == FAILURE) { return; http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/bug39286.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/ext/gd/tests/bug39286.phpt diff -u /dev/null php-src/ext/gd/tests/bug39286.phpt:1.2 --- /dev/null Sun Dec 10 03:03:48 2006 +++ php-src/ext/gd/tests/bug39286.phpt Sun Dec 10 03:03:48 2006 @@ -0,0 +1,14 @@ +--TEST-- +Bug #39508 (imagefill crashes with small images 3 pixels or less) +--SKIPIF-- +?php + if (!extension_loaded('gd')) die(skip gd extension not available\n); + if (!GD_BUNDLED) die('skip external GD libraries always fail'); +? +--FILE-- +?php +$img =imagecreatefromgd2part(foo.png,0, 100, 0, 100); +? +--EXPECTF-- + +Warning: imagecreatefromgd2part(): Zero width or height not allowed in %s on line %d http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/bug38212.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/ext/gd/tests/bug38212.phpt diff -u php-src/ext/gd/tests/bug38212.phpt:1.1 php-src/ext/gd/tests/bug38212.phpt:1.2 --- php-src/ext/gd/tests/bug38212.phpt:1.1 Wed Jul 26 08:51:53 2006 +++ php-src/ext/gd/tests/bug38212.phpt Sun Dec 10 03:03:48 2006 @@ -1,5 +1,5 @@ --TEST-- -imagecopy doen't copy alpha, palette to truecolor +Bzg #38212 (Seg Fault on invalid imagecreatefromgd2part() parameters) --SKIPIF-- ?php if (!function_exists('imagecopy')) die(skip gd extension not available\n); @@ -14,4 +14,5 @@ unlink($file); ? --EXPECTF-- -Warning: imagecreatefromgd2part(): '%sbug38212.gd2' is not a valid GD2 file in %sbug38212.php on line %d + +Warning: imagecreatefromgd2part(): Zero width or height not allowed in %s on line %d -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
bjori Wed Oct 18 16:04:25 2006 UTC Modified files: /php-src/ext/gd gd.c Log: Fix arginfo for imagepng() and imagejpeg() http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.359r2=1.360diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.359 php-src/ext/gd/gd.c:1.360 --- php-src/ext/gd/gd.c:1.359 Sun Oct 8 15:27:28 2006 +++ php-src/ext/gd/gd.c Wed Oct 18 16:04:25 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.359 2006/10/08 15:27:28 bjori Exp $ */ +/* $Id: gd.c,v 1.360 2006/10/18 16:04:25 bjori Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -396,16 +396,15 @@ #ifdef HAVE_GD_PNG static -ZEND_BEGIN_ARG_INFO_EX(arginfo_imagepng, 0, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_imagepng, 0, 0, 1) ZEND_ARG_INFO(0, im) ZEND_ARG_INFO(0, filename) - ZEND_ARG_INFO(0, quality) ZEND_END_ARG_INFO() #endif #ifdef HAVE_GD_JPG static -ZEND_BEGIN_ARG_INFO_EX(arginfo_imagejpeg, 0, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_imagejpeg, 0, 0, 1) ZEND_ARG_INFO(0, im) ZEND_ARG_INFO(0, filename) ZEND_ARG_INFO(0, quality) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
bjori Sun Oct 8 15:27:28 2006 UTC Modified files: /php-src/ext/gd gd.c Log: Fix wrong param count error message http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.358r2=1.359diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.358 php-src/ext/gd/gd.c:1.359 --- php-src/ext/gd/gd.c:1.358 Sat Oct 7 18:12:04 2006 +++ php-src/ext/gd/gd.c Sun Oct 8 15:27:28 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.358 2006/10/07 18:12:04 iliaa Exp $ */ +/* $Id: gd.c,v 1.359 2006/10/08 15:27:28 bjori Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -4509,8 +4509,10 @@ php_image_filter_smooth }; - if (ZEND_NUM_ARGS() 2 || ZEND_NUM_ARGS() 5 || zend_parse_parameters(2 TSRMLS_CC, rl, tmp, filtertype) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + if (ZEND_NUM_ARGS() 2 || ZEND_NUM_ARGS() 5) { + WRONG_PARAM_COUNT; + } else if (zend_parse_parameters(2 TSRMLS_CC, rl, tmp, filtertype) == FAILURE) { + return; } if (filtertype = 0 filtertype = IMAGE_FILTER_MAX) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pollita Sat Oct 7 17:41:14 2006 UTC Modified files: /php-src/ext/gd gd.c Log: More PHP6 Updates http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.356r2=1.357diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.356 php-src/ext/gd/gd.c:1.357 --- php-src/ext/gd/gd.c:1.356 Sat Oct 7 16:38:23 2006 +++ php-src/ext/gd/gd.c Sat Oct 7 17:41:14 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.356 2006/10/07 16:38:23 pollita Exp $ */ +/* $Id: gd.c,v 1.357 2006/10/07 17:41:14 pollita Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -2976,7 +2976,7 @@ } /* }}} */ -/* {{{ proto int imagecolortransparent(resource im [, int col]) +/* {{{ proto int imagecolortransparent(resource im [, int col]) U Define a color as transparent */ PHP_FUNCTION(imagecolortransparent) { @@ -3205,15 +3205,24 @@ { zval *IM; long size, x, y, col; + zend_uchar str_type; char *str; int str_len, i; gdImagePtr im; gdFontPtr font; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rlllsl, IM, size, x, y, str, str_len, col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rllltl, IM, size, x, y, str, str_len, str_type, col) == FAILURE) { return; } + if (str_type == IS_UNICODE) { + str = zend_unicode_to_ascii((UChar*)str, str_len TSRMLS_CC); + if (!str) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received. Consider using the TTF functions for Unicode output); + RETURN_FALSE; + } + } + ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, Image, le_gd); font = php_find_gd_font(size TSRMLS_CC); @@ -3241,11 +3250,15 @@ } } + if (str_type == IS_UNICODE) { + efree(str); + } + RETURN_TRUE; } /* }}} */ -/* {{{ proto bool imagechar(resource im, int font, int x, int y, string c, int col) +/* {{{ proto bool imagechar(resource im, int font, int x, int y, string c, int col) U Draw a character */ PHP_FUNCTION(imagechar) { @@ -3253,7 +3266,7 @@ } /* }}} */ -/* {{{ proto bool imagecharup(resource im, int font, int x, int y, string c, int col) +/* {{{ proto bool imagecharup(resource im, int font, int x, int y, string c, int col) U Draw a character rotated 90 degrees counter-clockwise */ PHP_FUNCTION(imagecharup) { @@ -3261,7 +3274,7 @@ } /* }}} */ -/* {{{ proto bool imagestring(resource im, int font, int x, int y, string str, int col) +/* {{{ proto bool imagestring(resource im, int font, int x, int y, string str, int col) U Draw a string horizontally */ PHP_FUNCTION(imagestring) { @@ -3269,7 +3282,7 @@ } /* }}} */ -/* {{{ proto bool imagestringup(resource im, int font, int x, int y, string str, int col) +/* {{{ proto bool imagestringup(resource im, int font, int x, int y, string str, int col) U Draw a string vertically - rotated 90 degrees counter-clockwise */ PHP_FUNCTION(imagestringup) { @@ -3404,7 +3417,7 @@ #ifdef ENABLE_GD_TTF #if HAVE_LIBFREETYPE HAVE_GD_STRINGFTEX -/* {{{ proto array imageftbbox(float size, float angle, string font_file, string text [, array extrainfo]) +/* {{{ proto array imageftbbox(float size, float angle, string font_file, string text [, array extrainfo]) U Give the bounding box of a text using fonts via freetype2 */ PHP_FUNCTION(imageftbbox) { @@ -3412,7 +3425,7 @@ } /* }}} */ -/* {{{ proto array imagefttext(resource im, float size, float angle, int x, int y, int col, string font_file, string text [, array extrainfo]) +/* {{{ proto array imagefttext(resource im, float size, float angle, int x, int y, int col, string font_file, string text [, array extrainfo]) U Write text to the image using fonts via freetype2 */ PHP_FUNCTION(imagefttext) { @@ -3421,7 +3434,7 @@ /* }}} */ #endif -/* {{{ proto array imagettfbbox(float size, float angle, string font_file, string text) +/* {{{ proto array imagettfbbox(float size, float angle, string font_file, string text) U Give the bounding box of a text using TrueType fonts */ PHP_FUNCTION(imagettfbbox) { @@ -3429,7 +3442,7 @@ } /* }}} */ -/* {{{ proto array imagettftext(resource im, float size, float angle, int x, int y, int col, string font_file, string text) +/* {{{ proto array imagettftext(resource im, float size, float angle, int x, int y, int col, string font_file, string text) U Write text to the image using a TrueType font */ PHP_FUNCTION(imagettftext) { @@ -3458,15 +3471,21 @@ #endif if (mode == TTFTEXT_BBOX) { + zval **ppfontname; + if (argc 4 || argc ((extended) ? 5 : 4)) {
[PHP-CVS] cvs: php-src /ext/gd gd.c
iliaa Sat Oct 7 18:12:04 2006 UTC Modified files: /php-src/ext/gd gd.c Log: Fixed build http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.357r2=1.358diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.357 php-src/ext/gd/gd.c:1.358 --- php-src/ext/gd/gd.c:1.357 Sat Oct 7 17:41:14 2006 +++ php-src/ext/gd/gd.c Sat Oct 7 18:12:04 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.357 2006/10/07 17:41:14 pollita Exp $ */ +/* $Id: gd.c,v 1.358 2006/10/07 18:12:04 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -3770,7 +3770,7 @@ ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, Type 1 font, le_ps_font); - if (T1_SlantFont(*f_ind, slt) != 0) { + if (T1_SlantFont(*f_ind, slant) != 0) { RETURN_FALSE; } @@ -4179,7 +4179,7 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to open '%s' Not a valid JPEG file, fn_dest); goto convert_done; } -â break; + break; #endif /* HAVE_GD_JPG */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
iliaa Thu Sep 28 23:18:29 2006 UTC Modified files: /php-src/ext/gd gd.c Log: MFB: Fixed a large leak inside _php_image_create_from() http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.354r2=1.355diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.354 php-src/ext/gd/gd.c:1.355 --- php-src/ext/gd/gd.c:1.354 Tue Aug 1 22:41:33 2006 +++ php-src/ext/gd/gd.c Thu Sep 28 23:18:29 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.354 2006/08/01 22:41:33 tony2001 Exp $ */ +/* $Id: gd.c,v 1.355 2006/09/28 23:18:29 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -2212,6 +2212,7 @@ io_ctx = gdNewDynamicCtxEx(buff_size, buff, 0); if (!io_ctx) { + pefree(buff, 1); php_error_docref(NULL TSRMLS_CC, E_WARNING,Cannot allocate GD IO context); goto out_err; } @@ -,6 +2223,7 @@ im = (*ioctx_func_p)(io_ctx); } io_ctx-gd_free(io_ctx); + pefree(buff, 1); } else { /* try and force the stream to be FILE* */ if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO | PHP_STREAM_CAST_TRY_HARD, (void **) fp, REPORT_ERRORS)) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c gd_ctx.c
tony2001Tue Aug 1 22:41:33 2006 UTC Modified files: /php-src/ext/gd gd.c gd_ctx.c Log: implement my own FR #36995 nuke unused variable http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.353r2=1.354diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.353 php-src/ext/gd/gd.c:1.354 --- php-src/ext/gd/gd.c:1.353 Sun Jul 2 00:10:36 2006 +++ php-src/ext/gd/gd.c Tue Aug 1 22:41:33 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.353 2006/07/02 00:10:36 bjori Exp $ */ +/* $Id: gd.c,v 1.354 2006/08/01 22:41:33 tony2001 Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -2167,7 +2167,9 @@ php_stream *stream; FILE * fp = NULL; int argc=ZEND_NUM_ARGS(); +#ifdef HAVE_GD_JPG long ignore_warning; +#endif if ((image_type == PHP_GDIMG_TYPE_GD2PART argc != 5) || (image_type != PHP_GDIMG_TYPE_GD2PART argc != 1) || @@ -4375,7 +4377,9 @@ int int_threshold; int x, y; float x_ratio, y_ratio; +#ifdef HAVE_GD_JPG long ignore_warning; +#endif if (argc != 5 || zend_get_parameters_ex(argc, f_org, f_dest, height, width, threshold) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd_ctx.c?r1=1.29r2=1.30diff_format=u Index: php-src/ext/gd/gd_ctx.c diff -u php-src/ext/gd/gd_ctx.c:1.29 php-src/ext/gd/gd_ctx.c:1.30 --- php-src/ext/gd/gd_ctx.c:1.29Fri Jan 27 01:59:26 2006 +++ php-src/ext/gd/gd_ctx.c Tue Aug 1 22:41:33 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: gd_ctx.c,v 1.29 2006/01/27 01:59:26 pajoye Exp $ */ +/* $Id: gd_ctx.c,v 1.30 2006/08/01 22:41:33 tony2001 Exp $ */ #include php_gd.h @@ -92,7 +92,7 @@ fp = VCWD_FOPEN(fn, wb); if (!fp) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to open '%s' for writing, fn); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to open '%s' for writing: %s, fn, strerror(errno)); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Fri Mar 10 18:15:21 2006 UTC Modified files: /php-src/ext/gd gd.c Log: - MFB: #36686, do not be quiet with the extern GD http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/gd.c?r1=1.348r2=1.349diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.348 php-src/ext/gd/gd.c:1.349 --- php-src/ext/gd/gd.c:1.348 Sun Mar 5 19:20:11 2006 +++ php-src/ext/gd/gd.c Fri Mar 10 18:15:21 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.348 2006/03/05 19:20:11 pajoye Exp $ */ +/* $Id: gd.c,v 1.349 2006/03/10 18:15:21 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1456,7 +1456,11 @@ #ifdef HAVE_GD_JPG case PHP_GDIMG_TYPE_JPG: ignore_warning = INI_INT(gd.jpeg_ignore_warning); +#ifdef HAVE_GD_BUNDLED im = gdImageCreateFromJpeg(fp, ignore_warning); +#else + im = gdImageCreateFromJpeg(fp); +#endif break; #endif @@ -3649,7 +3653,11 @@ #ifdef HAVE_GD_JPG case PHP_GDIMG_TYPE_JPG: ignore_warning = INI_INT(gd.jpeg_ignore_warning); +#ifdef HAVE_GD_BUNDLED im_org = gdImageCreateFromJpeg(org, ignore_warning); +#else + im_org = gdImageCreateFromJpeg(org); +#endif if (im_org == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to open '%s' Not a valid JPEG file, fn_dest); RETURN_FALSE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c php_gd.h
hholzgraSun Mar 5 18:26:12 2006 UTC Modified files: /php-src/ext/gd gd.c php_gd.h Log: - fixed size information for _php_sig_png array - removed extra memcmp step in signature comparison, this seemed to have been inherited from ext/standard/image.c but is not needed here as the provided buffer is big enough from the start http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/gd.c?r1=1.346r2=1.347diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.346 php-src/ext/gd/gd.c:1.347 --- php-src/ext/gd/gd.c:1.346 Sun Mar 5 18:23:47 2006 +++ php-src/ext/gd/gd.c Sun Mar 5 18:26:12 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.346 2006/03/05 18:23:47 hholzgra Exp $ */ +/* $Id: gd.c,v 1.347 2006/03/05 18:26:12 hholzgra Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1254,10 +1254,8 @@ return PHP_GDIMG_TYPE_GD2; } else if (!memcmp(data, php_sig_jpg, 3)) { return PHP_GDIMG_TYPE_JPG; - } else if (!memcmp(data, php_sig_png, 3)) { - if (!memcmp(data, php_sig_png, 8)) { - return PHP_GDIMG_TYPE_PNG; - } + } else if (!memcmp(data, php_sig_png, 8)) { + return PHP_GDIMG_TYPE_PNG; } else if (!memcmp(data, php_sig_gif, 3)) { return PHP_GDIMG_TYPE_GIF; } http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/php_gd.h?r1=1.67r2=1.68diff_format=u Index: php-src/ext/gd/php_gd.h diff -u php-src/ext/gd/php_gd.h:1.67 php-src/ext/gd/php_gd.h:1.68 --- php-src/ext/gd/php_gd.h:1.67Sun Mar 5 18:23:47 2006 +++ php-src/ext/gd/php_gd.h Sun Mar 5 18:26:12 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: php_gd.h,v 1.67 2006/03/05 18:23:47 hholzgra Exp $ */ +/* $Id: php_gd.h,v 1.68 2006/03/05 18:26:12 hholzgra Exp $ */ #ifndef PHP_GD_H #define PHP_GD_H @@ -56,7 +56,7 @@ PHPAPI extern const char php_sig_gif[3]; PHPAPI extern const char php_sig_jpg[3]; -PHPAPI extern const char php_sig_png[3]; +PHPAPI extern const char php_sig_png[8]; extern zend_module_entry gd_module_entry; #define phpext_gd_ptr gd_module_entry -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Sun Feb 5 15:53:02 2006 UTC Modified files: /php-src/ext/gd gd.c Log: - test for jpeg support http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/gd.c?r1=1.343r2=1.344diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.343 php-src/ext/gd/gd.c:1.344 --- php-src/ext/gd/gd.c:1.343 Thu Feb 2 20:30:54 2006 +++ php-src/ext/gd/gd.c Sun Feb 5 15:53:02 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.343 2006/02/02 20:30:54 pajoye Exp $ */ +/* $Id: gd.c,v 1.344 2006/02/05 15:53:02 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1454,10 +1454,13 @@ im = gdImageCreateFromXpm(fn); break; #endif + +#ifdef HAVE_GD_JPG case PHP_GDIMG_TYPE_JPG: ignore_warning = INI_INT(gd.jpeg_ignore_warning); im = gdImageCreateFromJpeg(fp, ignore_warning); break; +#endif default: im = (*func_p)(fp); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Fri Jan 27 18:05:26 2006 UTC Modified files: /php-src/ext/gd gd.c Log: - add PNG filter constants http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/gd.c?r1=1.340r2=1.341diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.340 php-src/ext/gd/gd.c:1.341 --- php-src/ext/gd/gd.c:1.340 Tue Jan 17 23:49:14 2006 +++ php-src/ext/gd/gd.c Fri Jan 27 18:05:26 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.340 2006/01/17 23:49:14 tony2001 Exp $ */ +/* $Id: gd.c,v 1.341 2006/01/27 18:05:26 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -402,6 +402,22 @@ #else REGISTER_LONG_CONSTANT(GD_BUNDLED, 0, CONST_CS | CONST_PERSISTENT); #endif + +#ifdef HAVE_GD_PNG + /* +* cannot include #include png.h +* /usr/include/pngconf.h:310:2: error: #error png.h already includes setjmp.h with some additional fixup. +* as error, use the values for now... +*/ + REGISTER_LONG_CONSTANT(PNG_NO_FILTER, 0x00, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(PNG_FILTER_NONE, 0x08, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(PNG_FILTER_SUB,0x10, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(PNG_FILTER_UP, 0x20, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(PNG_FILTER_AVG,0x40, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(PNG_FILTER_PAETH, 0x80, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(PNG_ALL_FILTERS, 0x08 | 0x10 | 0x20 | 0x40 | 0x80, CONST_CS | CONST_PERSISTENT); +#endif + return SUCCESS; } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
mikeFri Jan 27 20:48:43 2006 UTC Modified files: /php-src/ext/gd gd.c Log: MF5_1: include png.h prior php.h http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/gd.c?r1=1.341r2=1.342diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.341 php-src/ext/gd/gd.c:1.342 --- php-src/ext/gd/gd.c:1.341 Fri Jan 27 18:05:26 2006 +++ php-src/ext/gd/gd.c Fri Jan 27 20:48:42 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.341 2006/01/27 18:05:26 pajoye Exp $ */ +/* $Id: gd.c,v 1.342 2006/01/27 20:48:42 mike Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -29,6 +29,11 @@ #include config.h #endif +#ifdef HAVE_GD_PNG +/* needs to be first */ +#include png.h +#endif + #include php.h #include ext/standard/head.h #include math.h -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
iliaa Thu Dec 29 22:00:09 2005 EDT Modified files: /php-src/ext/gd gd.c Log: MFB51: Not a fatal error. http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/gd.c?r1=1.336r2=1.337diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.336 php-src/ext/gd/gd.c:1.337 --- php-src/ext/gd/gd.c:1.336 Tue Dec 27 00:16:05 2005 +++ php-src/ext/gd/gd.c Thu Dec 29 22:00:09 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.336 2005/12/27 00:16:05 pajoye Exp $ */ +/* $Id: gd.c,v 1.337 2005/12/29 22:00:09 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -3165,7 +3165,7 @@ T1_DeleteAllSizes(*f_ind); if (Z_DVAL_PP(ext) = 0) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, Second parameter %f out of range (must be 0), Z_DVAL_PP(ext)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Second parameter %f out of range (must be 0), Z_DVAL_PP(ext)); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Tue Dec 27 00:11:16 2005 EDT Modified files: /php-src/ext/gd gd.c Log: - silent compile warning introduced by previous commit http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/gd.c?r1=1.334r2=1.335diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.334 php-src/ext/gd/gd.c:1.335 --- php-src/ext/gd/gd.c:1.334 Mon Dec 26 21:46:56 2005 +++ php-src/ext/gd/gd.c Tue Dec 27 00:11:16 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.334 2005/12/26 21:46:56 pajoye Exp $ */ +/* $Id: gd.c,v 1.335 2005/12/27 00:11:16 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -88,8 +88,6 @@ int gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b); #endif -#define gdNewDynamicCtxEx(len, data, val) gdNewDynamicCtx(len, data) - /* Section Filters Declarations */ /* IMPORTANT NOTE FOR NEW FILTER * Do not forget to update: @@ -159,7 +157,6 @@ PHP_FE(imagecopymergegray, NULL) PHP_FE(imagecopyresized, NULL) PHP_FE(imagecreate, NULL) -#if HAVE_LIBGD20 PHP_FE(imagecreatetruecolor,NULL) PHP_FE(imageistruecolor, NULL) PHP_FE(imagetruecolortopalette, NULL) @@ -173,7 +170,6 @@ PHP_FE(imagecolorclosestalpha, NULL) PHP_FE(imagecolorexactalpha,NULL) PHP_FE(imagecopyresampled, NULL) -#endif #ifdef HAVE_GD_BUNDLED PHP_FE(imagerotate, NULL) @@ -245,7 +241,7 @@ #ifdef ENABLE_GD_TTF PHP_FE(imagettfbbox, NULL) PHP_FE(imagettftext, NULL) -#if HAVE_LIBGD20 HAVE_LIBFREETYPE HAVE_GD_STRINGFTEX +#if HAVE_LIBFREETYPE HAVE_GD_STRINGFTEX PHP_FE(imageftbbox, NULL) PHP_FE(imagefttext, NULL) #endif @@ -294,7 +290,7 @@ PHP_MINIT(gd), PHP_MSHUTDOWN(gd), NULL, -#if HAVE_LIBGD20 HAVE_GD_STRINGFT (HAVE_GD_FONTCACHESHUTDOWN || HAVE_GD_FREEFONTCACHE) +#if HAVE_GD_STRINGFT (HAVE_GD_FONTCACHESHUTDOWN || HAVE_GD_FREEFONTCACHE) PHP_RSHUTDOWN(gd), #else NULL, @@ -370,14 +366,13 @@ REGISTER_LONG_CONSTANT(IMG_COLOR_STYLEDBRUSHED, gdStyledBrushed, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(IMG_COLOR_TRANSPARENT, gdTransparent, CONST_CS | CONST_PERSISTENT); #endif -#if HAVE_LIBGD20 /* for imagefilledarc */ REGISTER_LONG_CONSTANT(IMG_ARC_ROUNDED, gdArc, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(IMG_ARC_PIE, gdPie, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(IMG_ARC_CHORD, gdChord, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(IMG_ARC_NOFILL, gdNoFill, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(IMG_ARC_EDGED, gdEdged, CONST_CS | CONST_PERSISTENT); -#endif + /* GD2 image format types */ #ifdef GD2_FMT_RAW REGISTER_LONG_CONSTANT(IMG_GD2_RAW, GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT); @@ -413,7 +408,7 @@ /* {{{ PHP_RSHUTDOWN_FUNCTION */ -#if HAVE_LIBGD20 HAVE_GD_STRINGFT (HAVE_GD_FONTCACHESHUTDOWN || HAVE_GD_FREEFONTCACHE) +#if HAVE_GD_STRINGFT (HAVE_GD_FONTCACHESHUTDOWN || HAVE_GD_FREEFONTCACHE) PHP_RSHUTDOWN_FUNCTION(gd) { #if HAVE_GD_FONTCACHESHUTDOWN @@ -707,7 +702,6 @@ } /* }}} */ -#if HAVE_LIBGD20 /* {{{ proto resource imagecreatetruecolor(int x_size, int y_size) Create a new true color image */ PHP_FUNCTION(imagecreatetruecolor) @@ -921,7 +915,6 @@ } /* }}} */ -#if HAVE_LIBGD20 /* {{{ proto bool imagesavealpha(resource im, bool on) Include alpha channel to a saved image */ PHP_FUNCTION(imagesavealpha) @@ -940,7 +933,6 @@ RETURN_TRUE; } -#endif #if HAVE_GD_BUNDLED /* {{{ proto bool imagelayereffect(resource im, int effect) @@ -1086,7 +1078,6 @@ RETURN_TRUE; } /* }}} */ -#endif #ifdef HAVE_GD_BUNDLED /* {{{ proto resource imagerotate(resource src_im, float angle, int bgdcolor) @@ -1594,14 +1585,12 @@ } (*func_p)(im, i, fp); break; -#if HAVE_LIBGD20 case PHP_GDIMG_TYPE_GD: if (im-trueColor){ gdImageTrueColorToPalette(im,1,256); }
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/gd/libgd gd_topal.c /ext/gd/tests colorexact.phpt colormatch.phpt
pajoye Sun Dec 25 19:21:58 2005 EDT Added files: /php-src/ext/gd/tests colorexact.phpt colormatch.phpt Modified files: /php-src/ext/gd gd.c /php-src/ext/gd/libgd gd_topal.c Log: - fix leak/segfaults in imagecolormatch - add tests for imagecolorexact and imagecolormatch The later is only about the segv http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/gd.c?r1=1.329r2=1.330diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.329 php-src/ext/gd/gd.c:1.330 --- php-src/ext/gd/gd.c:1.329 Thu Dec 22 23:22:26 2005 +++ php-src/ext/gd/gd.c Sun Dec 25 19:21:57 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.329 2005/12/22 23:22:26 pajoye Exp $ */ +/* $Id: gd.c,v 1.330 2005/12/25 19:21:57 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -822,6 +822,10 @@ php_error_docref(NULL TSRMLS_CC, E_ERROR, Image1 and Image2 must be the same size ); RETURN_FALSE; break; + case -4: + php_error_docref(NULL TSRMLS_CC, E_ERROR, Image2 must have at least one color ); + RETURN_FALSE; + break; } RETURN_TRUE; http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/libgd/gd_topal.c?r1=1.17r2=1.18diff_format=u Index: php-src/ext/gd/libgd/gd_topal.c diff -u php-src/ext/gd/libgd/gd_topal.c:1.17 php-src/ext/gd/libgd/gd_topal.c:1.18 --- php-src/ext/gd/libgd/gd_topal.c:1.17Wed Aug 11 23:25:50 2004 +++ php-src/ext/gd/libgd/gd_topal.c Sun Dec 25 19:21:57 2005 @@ -2086,6 +2086,9 @@ if( (im1-sx != im2-sx) || (im1-sy != im2-sy) ) { return -3; /* the images are meant to be the same dimensions */ } + if (im2-colorsTotal1) { + return -4; /* At least 1 color must be allocated */ + } buf = (unsigned long *)safe_emalloc(sizeof(unsigned long), 5 * im2-colorsTotal, 0); memset( buf, 0, sizeof(unsigned long) * 5 * im2-colorsTotal ); http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/tests/colorexact.phpt?view=markuprev=1.1 Index: php-src/ext/gd/tests/colorexact.phpt +++ php-src/ext/gd/tests/colorexact.phpt --TEST-- imagecolorexact --SKIPIF-- ?php if (!function_exists('imagecolorexact')) die(skip gd extension not available\n); ? --FILE-- ?php $im = imagecreatetruecolor(5,5); $c = imagecolorexact($im, 255,0,255); $c2 = imagecolorexactalpha($im, 255,0,255, 100); printf(%X\n, $c); printf(%X\n, $c2); imagedestroy($im); $im = imagecreate(5,5); $c = imagecolorallocate($im, 255,0,255); $c2 = imagecolorallocate($im, 255,200,0); $c3 = imagecolorallocatealpha($im, 255,200,0,100); echo imagecolorexact($im, 255,0,255) . \n; echo imagecolorexact($im, 255,200,0) . \n; echo imagecolorexactalpha($im, 255,200,0,100) . \n; // unallocated index echo imagecolorexact($im, 12,12,12) . \n; imagedestroy($im); ? --EXPECTF-- FF00FF 64FF00FF 0 1 2 -1 http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/tests/colormatch.phpt?view=markuprev=1.1 Index: php-src/ext/gd/tests/colormatch.phpt +++ php-src/ext/gd/tests/colormatch.phpt --TEST-- imagecolormatch --SKIPIF-- ?php if (!function_exists('imagecolormatch')) die(skip gd extension not available\n); ? --FILE-- ?php $im = imagecreatetruecolor(5,5); $im2 = imagecreate(5,5); imagecolormatch($im, $im2); echo ok\n; imagedestroy($im); ? --EXPECTF-- Fatal error: imagecolormatch(): Image2 must have at least one color in %s on line %d -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Sun Dec 25 20:32:25 2005 EDT Modified files: /php-src/ext/gd gd.c Log: - raise warning instread of errors in colormatch http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/gd.c?r1=1.330r2=1.331diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.330 php-src/ext/gd/gd.c:1.331 --- php-src/ext/gd/gd.c:1.330 Sun Dec 25 19:21:57 2005 +++ php-src/ext/gd/gd.c Sun Dec 25 20:32:25 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.330 2005/12/25 19:21:57 pajoye Exp $ */ +/* $Id: gd.c,v 1.331 2005/12/25 20:32:25 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -811,19 +811,19 @@ result = gdImageColorMatch(im1, im2); switch (result) { case -1: - php_error_docref(NULL TSRMLS_CC, E_ERROR, Image1 must be TrueColor ); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Image1 must be TrueColor ); RETURN_FALSE; break; case -2: - php_error_docref(NULL TSRMLS_CC, E_ERROR, Image2 must be Palette ); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Image2 must be Palette ); RETURN_FALSE; break; case -3: - php_error_docref(NULL TSRMLS_CC, E_ERROR, Image1 and Image2 must be the same size ); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Image1 and Image2 must be the same size ); RETURN_FALSE; break; case -4: - php_error_docref(NULL TSRMLS_CC, E_ERROR, Image2 must have at least one color ); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Image2 must have at least one color ); RETURN_FALSE; break; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/gd gd.c /ext/gd/tests copypalette.phpt createfromstring.phpt src.png
On Fri, 16 Dec 2005, Pierre-Alain Joye wrote: pajoye Fri Dec 16 19:02:07 2005 EDT Added files: /php-src/ext/gd/testscopypalette.phpt createfromstring.phpt src.png Modified files: /php-src/ext/gd gd.c Log: - fix leaks and wrong error when invalid/empty string are given to imagecreatefromstring MFH to PHP_5_1? (the fix, tests won't hurt either) --Jani -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/gd/tests copypalette.phpt createfromstring.phpt src.png
pajoye Fri Dec 16 19:02:07 2005 EDT Added files: /php-src/ext/gd/tests copypalette.phpt createfromstring.phpt src.png Modified files: /php-src/ext/gd gd.c Log: - fix leaks and wrong error when invalid/empty string are given to imagecreatefromstring - add test for imagecreatefromstring - add test for palettecopy http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/gd.c?r1=1.326r2=1.327diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.326 php-src/ext/gd/gd.c:1.327 --- php-src/ext/gd/gd.c:1.326 Fri Dec 16 17:02:30 2005 +++ php-src/ext/gd/gd.c Fri Dec 16 19:02:07 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.326 2005/12/16 17:02:30 pajoye Exp $ */ +/* $Id: gd.c,v 1.327 2005/12/16 19:02:07 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1386,6 +1386,11 @@ } convert_to_string_ex(data); + if (Z_STRLEN_PP(data) 8) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty string or invalid image); + RETURN_FALSE; + } + memcpy(sig, Z_STRVAL_PP(data), 8); imtype = _php_image_type(sig); @@ -1427,7 +1432,7 @@ break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, Data is not in a recognized format.); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Data is not in a recognized format); RETURN_FALSE; } http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/tests/copypalette.phpt?view=markuprev=1.1 Index: php-src/ext/gd/tests/copypalette.phpt +++ php-src/ext/gd/tests/copypalette.phpt --TEST-- imagepalettecopy --SKIPIF-- ?php if (!function_exists('imagecolorat')) die(skip gd extension not available\n); ? --FILE-- ?php $im = imagecreate(1,1); for ($i=0; $i256; $i++) { imagecolorallocate($im, $i, $i, $i); } $im2 = imagecreate(1,1); imagepalettecopy($im2, $im); for ($i=0; $i256; $i++) { $c = imagecolorsforindex($im2, $i); if ($c['red']!=$i || $c['green']!=$i || $c['blue']!=$i) { $failed = true; break; } } echo copy palette 255 colors: ; echo $failed ? 'failed' : 'ok'; echo \n; $im = imagecreate(1,1); $im2 = imagecreate(1,1); imagecolorallocatealpha($im, 0,0,0,100); imagepalettecopy($im2, $im); $c = imagecolorsforindex($im2, 0); if ($c['red']!=0 || $c['green']!=0 || $c['blue']!=0 || $c['alpha']!=100) { $failed = true; } echo 'copy palette 1 color and alpha: '; echo $failed ? 'failed' : 'ok'; echo \n; ? --EXPECT-- copy palette 255 colors: ok copy palette 1 color and alpha: ok http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/tests/createfromstring.phpt?view=markuprev=1.1 Index: php-src/ext/gd/tests/createfromstring.phpt +++ php-src/ext/gd/tests/createfromstring.phpt --TEST-- imagecreatefromstring --SKIPIF-- ?php if (!function_exists('imagecreatefromstring')) die(skip gd extension not available\n); ? --FILE-- ?php $dir = dirname(__FILE__); $im = imagecreatetruecolor(5,5); imagefill($im, 0,0, 0xff); imagesetpixel($im, 3,3, 0x0); imagepng($im, $dir . '/tc.png'); $im_string = file_get_contents(dirname(__FILE__) . '/tc.png'); $im = imagecreatefromstring($im_string); echo 'createfromstring truecolor png: '; if (imagecolorat($im, 3,3) != 0x0) { echo 'failed'; } else { echo 'ok'; } echo \n; unlink($dir . '/tc.png'); $im = imagecreate(5,5); $c1 = imagecolorallocate($im, 255,255,255); $c2 = imagecolorallocate($im, 255,0,0); imagefill($im, 0,0, $c1); imagesetpixel($im, 3,3, $c2); imagepng($im, $dir . '/p.png'); $im_string = file_get_contents(dirname(__FILE__) . '/p.png'); $im = imagecreatefromstring($im_string); echo'createfromstring palette png: '; $c = imagecolorsforindex($im, imagecolorat($im, 3,3)); $failed = false; if ($c['red'] != 255 || $c['green'] != 0 || $c['blue'] != 0) { echo 'failed'; } else { echo 'ok'; } echo \n; unlink($dir . '/p.png'); //empty string $im = imagecreatefromstring(''); //random string 8 $im = imagecreatefromstring(' asdf jklp'); ? --EXPECTF-- createfromstring truecolor png: ok createfromstring palette png: ok Warning: imagecreatefromstring(): Empty string or invalid image in %screatefromstring.php on line %d Warning: imagecreatefromstring(): Data is not in a recognized format in %screatefromstring.php on line %d -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
sniper Mon Dec 5 20:21:26 2005 EDT Modified files: /php-src/ext/gd gd.c Log: nuke php3 legacy http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.321r2=1.322ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.321 php-src/ext/gd/gd.c:1.322 --- php-src/ext/gd/gd.c:1.321 Sun Dec 4 18:24:12 2005 +++ php-src/ext/gd/gd.c Mon Dec 5 20:21:25 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.321 2005/12/04 23:24:12 sniper Exp $ */ +/* $Id: gd.c,v 1.322 2005/12/06 01:21:25 sniper Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -2569,7 +2569,7 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) { zval **IM, **POINTS, **NPOINTS, **COL; - pval **var = NULL; + zval **var = NULL; gdImagePtr im; gdPointPtr points; int npoints, col, nelem, i; @@ -4159,7 +4159,7 @@ PHP_FUNCTION(imageconvolution) { zval *SIM, *hash_matrix; - pval **var = NULL, **var2 = NULL; + zval **var = NULL, **var2 = NULL; gdImagePtr im_src = NULL; double div, offset; int nelem, i, j, res; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c gd_ctx.c
sniper Sun Dec 4 18:24:14 2005 EDT Modified files: /php-src/ext/gd gd.c gd_ctx.c Log: php3 is dead http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.320r2=1.321ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.320 php-src/ext/gd/gd.c:1.321 --- php-src/ext/gd/gd.c:1.320 Wed Nov 30 19:36:26 2005 +++ php-src/ext/gd/gd.c Sun Dec 4 18:24:12 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.320 2005/12/01 00:36:26 sniper Exp $ */ +/* $Id: gd.c,v 1.321 2005/12/04 23:24:12 sniper Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -604,7 +604,7 @@ } /* }}} */ -/* Need this for cpdf. See also comment in file.c php3i_get_le_fp() */ +/* Need this for cpdf. See also comment in file.c phpi_get_le_fp() */ PHP_GD_API int phpi_get_le_gd(void) { return le_gd; @@ -1801,12 +1801,6 @@ fseek(tmp, 0, SEEK_SET); -#if APACHE defined(CHARSET_EBCDIC) - /* XXX this is unlikely to work any more [EMAIL PROTECTED] */ - - /* This is a binary file already: avoid EBCDIC-ASCII conversion */ - ap_bsetflag(php3_rqst-connection-client, B_EBCDIC2ASCII, 0); -#endif while ((b = fread(buf, 1, sizeof(buf), tmp)) 0) { php_write(buf, b TSRMLS_CC); } http://cvs.php.net/diff.php/php-src/ext/gd/gd_ctx.c?r1=1.25r2=1.26ty=u Index: php-src/ext/gd/gd_ctx.c diff -u php-src/ext/gd/gd_ctx.c:1.25 php-src/ext/gd/gd_ctx.c:1.26 --- php-src/ext/gd/gd_ctx.c:1.25Tue Nov 1 12:04:29 2005 +++ php-src/ext/gd/gd_ctx.c Sun Dec 4 18:24:14 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: gd_ctx.c,v 1.25 2005/11/01 17:04:29 sniper Exp $ */ +/* $Id: gd_ctx.c,v 1.26 2005/12/04 23:24:14 sniper Exp $ */ #include php_gd.h @@ -101,11 +101,6 @@ ctx-free = _php_image_output_ctxfree; #endif -#if APACHE defined(CHARSET_EBCDIC) - /* XXX this is unlikely to work any more [EMAIL PROTECTED] */ - /* This is a binary file already: avoid EBCDIC-ASCII conversion */ - ap_bsetflag(php3_rqst-connection-client, B_EBCDIC2ASCII, 0); -#endif } switch(image_type) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c gd_ctx.c php_gd.h
sniper Tue Nov 1 12:04:32 2005 EDT Modified files: /php-src/ext/gd gd.c gd_ctx.c php_gd.h Log: http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.318r2=1.319ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.318 php-src/ext/gd/gd.c:1.319 --- php-src/ext/gd/gd.c:1.318 Thu Oct 27 07:07:39 2005 +++ php-src/ext/gd/gd.c Tue Nov 1 12:04:27 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.318 2005/10/27 11:07:39 pajoye Exp $ */ +/* $Id: gd.c,v 1.319 2005/11/01 17:04:27 sniper Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -692,7 +692,7 @@ convert_to_string_ex(file); - stream = php_stream_open_wrapper(Z_STRVAL_PP(file), rb, IGNORE_PATH | IGNORE_URL_WIN | REPORT_ERRORS, NULL); + stream = php_stream_open_wrapper(Z_STRVAL_PP(file), rb, ENFORCE_SAFE_MODE | IGNORE_PATH | IGNORE_URL_WIN | REPORT_ERRORS, NULL); if (stream == NULL) { RETURN_FALSE; } @@ -1505,7 +1505,7 @@ fn = Z_STRVAL_PP(file); - stream = php_stream_open_wrapper(fn, rb, REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL); + stream = php_stream_open_wrapper(fn, rb, ENFORCE_SAFE_MODE|REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL); if (stream == NULL) { RETURN_FALSE; } @@ -1713,10 +1713,7 @@ } if ((argc == 2) || (argc 2 Z_STRLEN_PP(file))) { - if (!fn || php_check_open_basedir(fn TSRMLS_CC) || (PG(safe_mode) !php_checkuid(fn, rb+, CHECKUID_CHECK_FILE_AND_DIR))) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid filename '%s', fn); - RETURN_FALSE; - } + PHP_GD_CHECK_OPEN_BASEDIR(fn, Invalid filename); fp = VCWD_FOPEN(fn, wb); if (!fp) { @@ -3809,16 +3806,10 @@ } /* Check origin file */ - if (!fn_org || php_check_open_basedir(fn_org TSRMLS_CC)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid origin filename '%s', fn_org); - RETURN_FALSE; - } + PHP_GD_CHECK_OPEN_BASEDIR(fn_org, Invalid origin filename); /* Check destination file */ - if (!fn_dest || php_check_open_basedir(fn_dest TSRMLS_CC)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid destination filename '%s', fn_dest); - RETURN_FALSE; - } + PHP_GD_CHECK_OPEN_BASEDIR(fn_dest, Invalid destination filename); /* Open origin file */ org = VCWD_FOPEN(fn_org, rb); http://cvs.php.net/diff.php/php-src/ext/gd/gd_ctx.c?r1=1.24r2=1.25ty=u Index: php-src/ext/gd/gd_ctx.c diff -u php-src/ext/gd/gd_ctx.c:1.24 php-src/ext/gd/gd_ctx.c:1.25 --- php-src/ext/gd/gd_ctx.c:1.24Sat Oct 8 15:29:04 2005 +++ php-src/ext/gd/gd_ctx.c Tue Nov 1 12:04:29 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: gd_ctx.c,v 1.24 2005/10/08 19:29:04 pajoye Exp $ */ +/* $Id: gd_ctx.c,v 1.25 2005/11/01 17:04:29 sniper Exp $ */ #include php_gd.h @@ -81,10 +81,8 @@ } } if ((argc == 2) || (argc 2 Z_STRLEN_PP(file))) { - if (!fn || php_check_open_basedir(fn TSRMLS_CC) || (PG(safe_mode) !php_checkuid(fn, rb+, CHECKUID_CHECK_FILE_AND_DIR))) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid filename '%s', fn); - RETURN_FALSE; - } + + PHP_GD_CHECK_OPEN_BASEDIR(fn, Invalid filename); fp = VCWD_FOPEN(fn, wb); if (!fp) { http://cvs.php.net/diff.php/php-src/ext/gd/php_gd.h?r1=1.60r2=1.61ty=u Index: php-src/ext/gd/php_gd.h diff -u php-src/ext/gd/php_gd.h:1.60 php-src/ext/gd/php_gd.h:1.61 --- php-src/ext/gd/php_gd.h:1.60Sun Oct 2 14:01:50 2005 +++ php-src/ext/gd/php_gd.h Tue Nov 1 12:04:29 2005 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: php_gd.h,v 1.60 2005/10/02 18:01:50 pajoye Exp $ */ +/* $Id: php_gd.h,v 1.61 2005/11/01 17:04:29 sniper Exp $ */ #ifndef PHP_GD_H #define PHP_GD_H @@ -30,6 +30,15 @@ #if HAVE_LIBGD +/* open_basedir and safe_mode checks */ +#define PHP_GD_CHECK_OPEN_BASEDIR(filename, errormsg) \ + if (!filename || php_check_open_basedir(filename TSRMLS_CC) || \ + (PG(safe_mode) !php_checkuid(filename, rb+, CHECKUID_CHECK_FILE_AND_DIR)) \ + ) { \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, errormsg); \ + RETURN_FALSE; \ +
[PHP-CVS] cvs: php-src /ext/gd gd.c
pajoye Thu Oct 27 07:07:40 2005 EDT Modified files: /php-src/ext/gd gd.c Log: - MFB #34980, divisor and offset never passed correctly (s/float/double/) http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.317r2=1.318ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.317 php-src/ext/gd/gd.c:1.318 --- php-src/ext/gd/gd.c:1.317 Wed Oct 26 17:35:56 2005 +++ php-src/ext/gd/gd.c Thu Oct 27 07:07:39 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.317 2005/10/26 21:35:56 tony2001 Exp $ */ +/* $Id: gd.c,v 1.318 2005/10/27 11:07:39 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -4184,7 +4184,7 @@ zval *SIM, *hash_matrix; pval **var = NULL, **var2 = NULL; gdImagePtr im_src = NULL; - float div, offset; + double div, offset; int nelem, i, j, res; float matrix[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}}; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
tony2001Wed Oct 26 17:35:57 2005 EDT Modified files: /php-src/ext/gd gd.c Log: fix #34996 (ImageTrueColorToPalette() crashes when ncolors is zero) http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.316r2=1.317ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.316 php-src/ext/gd/gd.c:1.317 --- php-src/ext/gd/gd.c:1.316 Sat Oct 8 15:29:04 2005 +++ php-src/ext/gd/gd.c Wed Oct 26 17:35:56 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.316 2005/10/08 19:29:04 pajoye Exp $ */ +/* $Id: gd.c,v 1.317 2005/10/26 21:35:56 tony2001 Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -876,6 +876,10 @@ convert_to_boolean_ex(dither); convert_to_long_ex(ncolors); + if (Z_LVAL_PP(ncolors) = 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Number of colors has to be greater than zero); + RETURN_FALSE; + } gdImageTrueColorToPalette(im, Z_LVAL_PP(dither), Z_LVAL_PP(ncolors)); RETURN_TRUE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c gd_ctx.c
pajoye Sat Oct 8 15:29:05 2005 EDT Modified files: /php-src/ext/gd gd.c gd_ctx.c Log: - add compression mode argument to imagepng (MFH to 5.1?) http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.315r2=1.316ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.315 php-src/ext/gd/gd.c:1.316 --- php-src/ext/gd/gd.c:1.315 Thu Oct 6 16:37:22 2005 +++ php-src/ext/gd/gd.c Sat Oct 8 15:29:04 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.315 2005/10/06 20:37:22 iliaa Exp $ */ +/* $Id: gd.c,v 1.316 2005/10/08 19:29:04 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1851,12 +1851,12 @@ #endif /* HAVE_GD_GIF_CREATE */ #ifdef HAVE_GD_PNG -/* {{{ proto bool imagepng(resource im [, string filename]) +/* {{{ proto bool imagepng(resource im [, string filename [, int quality]]) Output PNG image to browser or file */ PHP_FUNCTION(imagepng) { #ifdef USE_GD_IOCTX - _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, PNG, gdImagePngCtx); + _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, PNG, gdImagePngCtxEx); #else _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, PNG, gdImagePng); #endif http://cvs.php.net/diff.php/php-src/ext/gd/gd_ctx.c?r1=1.23r2=1.24ty=u Index: php-src/ext/gd/gd_ctx.c diff -u php-src/ext/gd/gd_ctx.c:1.23 php-src/ext/gd/gd_ctx.c:1.24 --- php-src/ext/gd/gd_ctx.c:1.23Thu Oct 6 16:37:22 2005 +++ php-src/ext/gd/gd_ctx.c Sat Oct 8 15:29:04 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: gd_ctx.c,v 1.23 2005/10/06 20:37:22 iliaa Exp $ */ +/* $Id: gd_ctx.c,v 1.24 2005/10/08 19:29:04 pajoye Exp $ */ #include php_gd.h @@ -80,7 +80,6 @@ q = Z_LVAL_PP(quality);/* or colorindex for foreground of BW images (defaults to black) */ } } - if ((argc == 2) || (argc 2 Z_STRLEN_PP(file))) { if (!fn || php_check_open_basedir(fn TSRMLS_CC) || (PG(safe_mode) !php_checkuid(fn, rb+, CHECKUID_CHECK_FILE_AND_DIR))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid filename '%s', fn); @@ -117,6 +116,7 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid threshold value '%d'. It must be between 0 and 255, q); } case PHP_GDIMG_TYPE_JPG: + case PHP_GDIMG_TYPE_PNG: (*func_p)(im, ctx, q); break; case PHP_GDIMG_TYPE_XBM: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c gdttf.c gdttf.h
pajoye Sun Oct 2 14:06:13 2005 EDT Removed files: /php-src/ext/gd gdttf.c gdttf.h Modified files: /php-src/ext/gd gd.c Log: - ft1 support remove, #2, gdttf.* http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.313r2=1.314ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.313 php-src/ext/gd/gd.c:1.314 --- php-src/ext/gd/gd.c:1.313 Sun Oct 2 14:01:49 2005 +++ php-src/ext/gd/gd.c Sun Oct 2 14:06:12 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.313 2005/10/02 18:01:49 pajoye Exp $ */ +/* $Id: gd.c,v 1.314 2005/10/02 18:06:12 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -73,7 +73,6 @@ # include FT_FREETYPE_H # else # endif -# include gdttf.h #endif #ifndef M_PI @@ -3181,9 +3180,6 @@ # elif HAVE_GD_STRINGTTF error = gdImageStringTTF(im, brect, col, fontname, ptsize, angle, x, y, str); # endif - -#else /* !USE_GD_IMGSTRTTF */ - error = gdttf(im, brect, col, fontname, ptsize, angle, x, y, str); #endif if (error) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c /main php_open_temporary_file.c
tony2001Fri May 6 12:48:30 2005 EDT Modified files: /php-src/main php_open_temporary_file.c /php-src/ext/gd gd.c Log: fix off-by-one in _php_image_output() and prevent such errors in php_do_open_temporary_file() http://cvs.php.net/diff.php/php-src/main/php_open_temporary_file.c?r1=1.32r2=1.33ty=u Index: php-src/main/php_open_temporary_file.c diff -u php-src/main/php_open_temporary_file.c:1.32 php-src/main/php_open_temporary_file.c:1.33 --- php-src/main/php_open_temporary_file.c:1.32 Wed Feb 23 05:54:06 2005 +++ php-src/main/php_open_temporary_file.c Fri May 6 12:48:30 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_open_temporary_file.c,v 1.32 2005/02/23 10:54:06 hyanantha Exp $ */ +/* $Id: php_open_temporary_file.c,v 1.33 2005/05/06 16:48:30 tony2001 Exp $ */ #include php.h @@ -98,6 +98,7 @@ { char *trailing_slash; char *opened_path; + int path_len = 0; int fd = -1; #ifndef HAVE_MKSTEMP int open_flags = O_CREAT | O_TRUNC | O_RDWR @@ -111,11 +112,13 @@ return -1; } + path_len = strlen(path); + if (!(opened_path = emalloc(MAXPATHLEN))) { return -1; } - if (IS_SLASH(path[strlen(path)-1])) { + if (!path_len || IS_SLASH(path[path_len - 1])) { trailing_slash = ; } else { trailing_slash = /; http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.310r2=1.311ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.310 php-src/ext/gd/gd.c:1.311 --- php-src/ext/gd/gd.c:1.310 Sun Apr 17 06:17:03 2005 +++ php-src/ext/gd/gd.c Fri May 6 12:48:30 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.310 2005/04/17 10:17:03 derick Exp $ */ +/* $Id: gd.c,v 1.311 2005/05/06 16:48:30 tony2001 Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1778,7 +1778,7 @@ char buf[4096]; char *path; - tmp = php_open_temporary_file(, , path TSRMLS_CC); + tmp = php_open_temporary_file(NULL, NULL, path TSRMLS_CC); if (tmp == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to open temporary file); RETURN_FALSE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c php_gd.h
pajoye Sat Apr 16 08:12:27 2005 EDT Modified files: /php-src/ext/gd gd.c php_gd.h Log: - export imageconvolution to userland, making people happy to do not use the predefined ones :) http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.308r2=1.309ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.308 php-src/ext/gd/gd.c:1.309 --- php-src/ext/gd/gd.c:1.308 Sun Apr 10 17:37:16 2005 +++ php-src/ext/gd/gd.c Sat Apr 16 08:12:24 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.308 2005/04/10 21:37:16 andrey Exp $ */ +/* $Id: gd.c,v 1.309 2005/04/16 12:12:24 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -324,6 +324,7 @@ /* gd filters */ #ifdef HAVE_GD_BUNDLED PHP_FE(imagefilter, NULL) + PHP_FE(imageconvolution, NULL) #endif {NULL, NULL, NULL} @@ -4188,6 +4189,60 @@ } } /* }}} */ + +/* {{{ proto resource imageconvolution(resource src_im, array matrix3x3, double div, double offset) + Apply a 3x3 convolution matrix, using coefficient div and offset */ +PHP_FUNCTION(imageconvolution) +{ + zval *SIM, *hash_matrix; + pval **var = NULL, **var2 = NULL; + gdImagePtr im_src = NULL; + float div, offset; + int nelem, i, j, res; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, radd, SIM, hash_matrix, div, offset) == FAILURE) { + RETURN_FALSE; + } + + ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, Image, le_gd); + + nelem = zend_hash_num_elements(Z_ARRVAL_P(hash_matrix)); + if (nelem != 3) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, You must have 3x3 array); + RETURN_FALSE; + } + + float matrix[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}}; + + for (i=0; i3; i++) { + if (zend_hash_index_find(Z_ARRVAL_P(hash_matrix), (i), (void **) var) == SUCCESS) { + if (Z_TYPE_PP(var) != IS_ARRAY || zend_hash_num_elements(Z_ARRVAL_PP(var)) != 3 ) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, You must have 3x3 array); + RETURN_FALSE; + } + + for (j=0; j3; j++) { + if (zend_hash_index_find(Z_ARRVAL_PP(var), (j), (void **) var2) == SUCCESS) { + SEPARATE_ZVAL(var2); + convert_to_double(*var2); + matrix[i][j] = Z_DVAL_PP(var2); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, You must have a 3x3 matrix); + RETURN_FALSE; + } + } + } + } + res = gdImageConvolution(im_src, matrix, div, offset); + + if (res) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } +} +/* }}} */ + /* End section: Filters */ /* {{{ proto bool imageantialias(resource im, bool on) http://cvs.php.net/diff.php/php-src/ext/gd/php_gd.h?r1=1.57r2=1.58ty=u Index: php-src/ext/gd/php_gd.h diff -u php-src/ext/gd/php_gd.h:1.57 php-src/ext/gd/php_gd.h:1.58 --- php-src/ext/gd/php_gd.h:1.57Thu Jan 8 12:32:08 2004 +++ php-src/ext/gd/php_gd.h Sat Apr 16 08:12:24 2005 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: php_gd.h,v 1.57 2004/01/08 17:32:08 sniper Exp $ */ +/* $Id: php_gd.h,v 1.58 2005/04/16 12:12:24 pajoye Exp $ */ #ifndef PHP_GD_H #define PHP_GD_H @@ -175,6 +175,7 @@ PHP_FUNCTION(imagelayereffect); PHP_FUNCTION(imagecolormatch); PHP_FUNCTION(imagefilter); +PHP_FUNCTION(imageconvolution); PHP_FUNCTION(imagexbm); #endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/gd/libgd gd.c gd.h
pajoye Sun Mar 27 18:43:52 2005 EDT Modified files: /php-src/ext/gd gd.c /php-src/ext/gd/libgd gd.c gd.h Log: - allow to keep or ignore the transparent color in imagerotate (thx Ken Coar to report this bug) - be sure to restore alphablending in imagefill - use zend_parse_parameter in imagerotate http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.306r2=1.307ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.306 php-src/ext/gd/gd.c:1.307 --- php-src/ext/gd/gd.c:1.306 Mon Jan 17 12:07:28 2005 +++ php-src/ext/gd/gd.c Sun Mar 27 18:43:51 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.306 2005/01/17 17:07:28 sniper Exp $ */ +/* $Id: gd.c,v 1.307 2005/03/27 23:43:51 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1208,23 +1208,19 @@ Rotate an image using a custom angle */ PHP_FUNCTION(imagerotate) { - zval **SIM, **ANGLE, **BGDCOLOR; + zval *SIM; gdImagePtr im_dst, im_src; double degrees; long color; + long ignoretransparent = 0; - if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, SIM, ANGLE, BGDCOLOR) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rdl|l, SIM, degrees, color, ignoretransparent) == FAILURE) { + RETURN_FALSE; } - ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, Image, le_gd); - - convert_to_long_ex(BGDCOLOR); - color = Z_LVAL_PP(BGDCOLOR); + ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, Image, le_gd); - convert_to_double_ex(ANGLE); - degrees = Z_DVAL_PP(ANGLE); - im_dst = gdImageRotate(im_src, degrees, color); + im_dst = gdImageRotate(im_src, degrees, color, ignoretransparent); if (im_dst != NULL) { ZEND_REGISTER_RESOURCE(return_value, im_dst, le_gd); http://cvs.php.net/diff.php/php-src/ext/gd/libgd/gd.c?r1=1.83r2=1.84ty=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.83 php-src/ext/gd/libgd/gd.c:1.84 --- php-src/ext/gd/libgd/gd.c:1.83 Wed Nov 17 15:19:35 2004 +++ php-src/ext/gd/libgd/gd.c Sun Mar 27 18:43:52 2005 @@ -1890,6 +1890,7 @@ if (nc==gdTiled){ _gdImageFillTiled(im,x,y,nc); + im-alphaBlendingFlag = alphablending_bak; return; } @@ -2192,7 +2193,7 @@ int tox, toy; int ncR, ncG, ncB; toy = dstY; - +printf(srccpopy:%X, src-transparent); for (y = srcY; y (srcY + h); y++) { tox = dstX; for (x = srcX; x (srcX + w); x++) { @@ -2493,7 +2494,7 @@ #endif /* ROTATE_PI */ #define ROTATE_DEG2RAD 3.1415926535897932384626433832795/180 -void gdImageSkewX (gdImagePtr dst, gdImagePtr src, int uRow, int iOffset, double dWeight, int clrBack) +void gdImageSkewX (gdImagePtr dst, gdImagePtr src, int uRow, int iOffset, double dWeight, int clrBack, int ignoretransparent) { typedef int (*FuncPtr)(gdImagePtr, int, int); int i, r, g, b, a, clrBackR, clrBackG, clrBackB, clrBackA; @@ -2558,10 +2559,14 @@ a = 127; } - pxlSrc = gdImageColorAllocateAlpha(dst, r, g, b, a); + if (ignoretransparent pxlSrc == dst-transparent) { + pxlSrc = dst-transparent; + } else { + pxlSrc = gdImageColorAllocateAlpha(dst, r, g, b, a); - if (pxlSrc == -1) { - pxlSrc = gdImageColorClosestAlpha(dst, r, g, b, a); + if (pxlSrc == -1) { + pxlSrc = gdImageColorClosestAlpha(dst, r, g, b, a); + } } if ((i + iOffset = 0) (i + iOffset dst-sx)) { @@ -2586,7 +2591,7 @@ } } -void gdImageSkewY (gdImagePtr dst, gdImagePtr src, int uCol, int iOffset, double dWeight, int clrBack) +void gdImageSkewY (gdImagePtr dst, gdImagePtr src, int uCol, int iOffset, double dWeight, int clrBack, int ignoretransparent) { typedef int (*FuncPtr)(gdImagePtr, int, int); int i, iYPos=0, r, g, b, a; @@ -2645,10 +2650,14 @@ a = 127; } - pxlSrc = gdImageColorAllocateAlpha(dst, r, g, b, a); + if (ignoretransparent pxlSrc == dst-transparent) { + pxlSrc = dst-transparent; + } else { + pxlSrc = gdImageColorAllocateAlpha(dst, r, g, b, a); - if (pxlSrc == -1) { - pxlSrc = gdImageColorClosestAlpha(dst, r, g, b, a); + if (pxlSrc == -1) { + pxlSrc = gdImageColorClosestAlpha(dst, r, g, b, a); + }
[PHP-CVS] cvs: php-src /ext/gd gd.c
sniper Mon Jan 17 12:07:31 2005 EDT Modified files: /php-src/ext/gd gd.c Log: - Added some sanity checks by changing to the parameter parsing API http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.305r2=1.306ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.305 php-src/ext/gd/gd.c:1.306 --- php-src/ext/gd/gd.c:1.305 Fri Jan 14 23:34:30 2005 +++ php-src/ext/gd/gd.c Mon Jan 17 12:07:28 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.305 2005/01/15 04:34:30 sniper Exp $ */ +/* $Id: gd.c,v 1.306 2005/01/17 17:07:28 sniper Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -3107,13 +3107,13 @@ */ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int extended) { - zval **IM, **PTSIZE, **ANGLE, **X, **Y, **C, **FONTNAME, **COL, **EXT = NULL; + zval *IM, *EXT = NULL; gdImagePtr im=NULL; - int col, x, y, l=0, i, brect[8]; + int col = -1, x = -1, y = -1, str_len, fontname_len, i, brect[8]; double ptsize, angle; unsigned char *str = NULL, *fontname = NULL; char *error = NULL; - int argc; + int argc = ZEND_NUM_ARGS(); #if HAVE_GD_STRINGFTEX gdFTStringExtra strex = {0}; #endif @@ -3122,84 +3122,65 @@ assert(!extended); #endif - argc = ZEND_NUM_ARGS(); - if (mode == TTFTEXT_BBOX) { - if (argc 4 || argc ((extended) ? 5 : 4) || zend_get_parameters_ex(argc, PTSIZE, ANGLE, FONTNAME, C, EXT) == FAILURE) { + if (argc 4 || argc ((extended) ? 5 : 4)) { ZEND_WRONG_PARAM_COUNT(); + } else if (zend_parse_parameters(argc TSRMLS_CC, ddss|a, ptsize, angle, fontname, fontname_len, str, str_len, EXT) == FAILURE) { + RETURN_FALSE; } } else { - if (argc 8 || argc ((extended) ? 9 : 8) || zend_get_parameters_ex(argc, IM, PTSIZE, ANGLE, X, Y, COL, FONTNAME, C, EXT) == FAILURE) { + if (argc 8 || argc ((extended) ? 9 : 8)) { ZEND_WRONG_PARAM_COUNT(); + } else if (zend_parse_parameters(argc TSRMLS_CC, rddlllss|a, IM, ptsize, angle, x, y, col, fontname, fontname_len, str, str_len, EXT) == FAILURE) { + RETURN_FALSE; } - ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, Image, le_gd); + ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, Image, le_gd); } - convert_to_double_ex(PTSIZE); - convert_to_double_ex(ANGLE); - convert_to_string_ex(FONTNAME); - convert_to_string_ex(C); - - if (mode == TTFTEXT_BBOX) { - im = NULL; - col = x = y = -1; - } else { - convert_to_long_ex(X); - convert_to_long_ex(Y); - convert_to_long_ex(COL); - col = Z_LVAL_PP(COL); - y = Z_LVAL_PP(Y); - x = Z_LVAL_PP(X); - } + /* convert angle to radians */ + angle = angle * (M_PI/180); #if HAVE_GD_STRINGFTEX - if (extended EXT) { - /* parse extended info */ - + if (extended EXT) { /* parse extended info */ HashPosition pos; - convert_to_array_ex(EXT); - /* walk the assoc array */ - zend_hash_internal_pointer_reset_ex(HASH_OF(*EXT), pos); + zend_hash_internal_pointer_reset_ex(HASH_OF(EXT), pos); do { zval ** item; char * key; ulong num_key; - if (zend_hash_get_current_key_ex(HASH_OF(*EXT), key, NULL, num_key, 0, pos) != HASH_KEY_IS_STRING) { + if (zend_hash_get_current_key_ex(HASH_OF(EXT), key, NULL, num_key, 0, pos) != HASH_KEY_IS_STRING) { continue; } - if (zend_hash_get_current_data_ex(HASH_OF(*EXT), (void **) item, pos) == FAILURE) { + if (zend_hash_get_current_data_ex(HASH_OF(EXT), (void **) item, pos) == FAILURE) { continue; } - - if (strcmp(linespacing, key) == 0){ + + if (strcmp(linespacing, key) == 0) { convert_to_double_ex(item); strex.flags |= gdFTEX_LINESPACE; strex.linespacing = Z_DVAL_PP(item); } - } while (zend_hash_move_forward_ex(HASH_OF(*EXT), pos) == SUCCESS); + } while (zend_hash_move_forward_ex(HASH_OF(EXT), pos) == SUCCESS); } #endif - ptsize = Z_DVAL_PP(PTSIZE); - angle = Z_DVAL_PP(ANGLE)
[PHP-CVS] cvs: php-src /ext/gd gd.c
sniper Fri Jan 14 23:34:30 2005 EDT Modified files: /php-src/ext/gd gd.c Log: ws fix http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.304r2=1.305ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.304 php-src/ext/gd/gd.c:1.305 --- php-src/ext/gd/gd.c:1.304 Fri Jan 14 18:07:46 2005 +++ php-src/ext/gd/gd.c Fri Jan 14 23:34:30 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.304 2005/01/14 23:07:46 sniper Exp $ */ +/* $Id: gd.c,v 1.305 2005/01/15 04:34:30 sniper Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -3070,7 +3070,7 @@ #ifdef ENABLE_GD_TTF #if HAVE_LIBGD20 HAVE_LIBFREETYPE HAVE_GD_STRINGFTEX -/* {{{ proto array imageftbbox(int size, int angle, string font_file, string text[, array extrainfo]) +/* {{{ proto array imageftbbox(float size, float angle, string font_file, string text [, array extrainfo]) Give the bounding box of a text using fonts via freetype2 */ PHP_FUNCTION(imageftbbox) { @@ -3078,7 +3078,7 @@ } /* }}} */ -/* {{{ proto array imagefttext(resource im, int size, int angle, int x, int y, int col, string font_file, string text, [array extrainfo]) +/* {{{ proto array imagefttext(resource im, float size, float angle, int x, int y, int col, string font_file, string text [, array extrainfo]) Write text to the image using fonts via freetype2 */ PHP_FUNCTION(imagefttext) { @@ -3087,7 +3087,7 @@ /* }}} */ #endif -/* {{{ proto array imagettfbbox(int size, int angle, string font_file, string text) +/* {{{ proto array imagettfbbox(float size, float angle, string font_file, string text) Give the bounding box of a text using TrueType fonts */ PHP_FUNCTION(imagettfbbox) { @@ -3095,7 +3095,7 @@ } /* }}} */ -/* {{{ proto array imagettftext(resource im, int size, int angle, int x, int y, int col, string font_file, string text) +/* {{{ proto array imagettftext(resource im, float size, float angle, int x, int y, int col, string font_file, string text) Write text to the image using a TrueType font */ PHP_FUNCTION(imagettftext) { @@ -3153,36 +3153,36 @@ } #if HAVE_GD_STRINGFTEX - if (extended EXT) { - /* parse extended info */ + if (extended EXT) { + /* parse extended info */ - HashPosition pos; + HashPosition pos; - convert_to_array_ex(EXT); + convert_to_array_ex(EXT); - /* walk the assoc array */ - zend_hash_internal_pointer_reset_ex(HASH_OF(*EXT), pos); - do { - zval ** item; - char * key; - ulong num_key; + /* walk the assoc array */ + zend_hash_internal_pointer_reset_ex(HASH_OF(*EXT), pos); + do { + zval ** item; + char * key; + ulong num_key; - if (zend_hash_get_current_key_ex(HASH_OF(*EXT), key, NULL, num_key, 0, pos) != HASH_KEY_IS_STRING) { - continue; - } + if (zend_hash_get_current_key_ex(HASH_OF(*EXT), key, NULL, num_key, 0, pos) != HASH_KEY_IS_STRING) { + continue; + } - if (zend_hash_get_current_data_ex(HASH_OF(*EXT), (void **) item, pos) == FAILURE) { - continue; - } + if (zend_hash_get_current_data_ex(HASH_OF(*EXT), (void **) item, pos) == FAILURE) { + continue; + } - if (strcmp(linespacing, key) == 0){ - convert_to_double_ex(item); - strex.flags |= gdFTEX_LINESPACE; - strex.linespacing = Z_DVAL_PP(item); - } + if (strcmp(linespacing, key) == 0){ + convert_to_double_ex(item); + strex.flags |= gdFTEX_LINESPACE; + strex.linespacing = Z_DVAL_PP(item); + } - } while (zend_hash_move_forward_ex(HASH_OF(*EXT), pos) == SUCCESS); - } + } while (zend_hash_move_forward_ex(HASH_OF(*EXT), pos) == SUCCESS); + } #endif ptsize = Z_DVAL_PP(PTSIZE); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
iliaa Wed Dec 29 16:07:59 2004 EDT Modified files: /php-src/ext/gd gd.c Log: Don't forget to unload t1lib. http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.299r2=1.300ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.299 php-src/ext/gd/gd.c:1.300 --- php-src/ext/gd/gd.c:1.299 Tue Nov 2 11:41:41 2004 +++ php-src/ext/gd/gd.c Wed Dec 29 16:07:59 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.299 2004/11/02 16:41:41 iliaa Exp $ */ +/* $Id: gd.c,v 1.300 2004/12/29 21:07:59 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -335,7 +335,7 @@ gd, gd_functions, PHP_MINIT(gd), - NULL, + PHP_MSHUTDOWN(gd), NULL, #if HAVE_LIBGD20 HAVE_GD_STRINGFT PHP_RSHUTDOWN(gd), @@ -373,6 +373,18 @@ } /* }}} */ +/* {{{ PHP_MSHUTDOWN_FUNCTION + */ +PHP_MSHUTDOWN_FUNCTION(gd) +{ +#if HAVE_LIBT1 + T1_CloseLib(); +#endif + return SUCCESS; +} +/* }}} */ + + /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(gd) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
iliaa Wed Dec 29 16:40:34 2004 EDT Modified files: /php-src/ext/gd gd.c Log: Fixed compiler warnings. http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.300r2=1.301ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.300 php-src/ext/gd/gd.c:1.301 --- php-src/ext/gd/gd.c:1.300 Wed Dec 29 16:07:59 2004 +++ php-src/ext/gd/gd.c Wed Dec 29 16:40:34 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.300 2004/12/29 21:07:59 iliaa Exp $ */ +/* $Id: gd.c,v 1.301 2004/12/29 21:40:34 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -3491,7 +3491,7 @@ #else if (_fg 0 || _fg gdImageColorsTotal(bg_img)) { #endif - php_error_docref(NULL TSRMLS_CC, E_WARNING, Foreground color index %d out of range, _fg); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Foreground color index %ld out of range, _fg); RETURN_FALSE; } @@ -3500,7 +3500,7 @@ #else if (_bg 0 || _bg gdImageColorsTotal(bg_img)) { #endif - php_error_docref(NULL TSRMLS_CC, E_WARNING, Background color index %d out of range, _bg); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Background color index %ld out of range, _bg); RETURN_FALSE; } @@ -3542,7 +3542,7 @@ T1_AASetLevel(T1_AA_HIGH); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid value %d as number of steps for antialiasing, aa_steps); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid value %ld as number of steps for antialiasing, aa_steps); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
iliaa Tue Nov 2 11:41:41 2004 EDT Modified files: /php-src/ext/gd gd.c Log: MFB: Fixed bug #30658 (Ensure that temporary files created by GD are removed). http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.298r2=1.299ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.298 php-src/ext/gd/gd.c:1.299 --- php-src/ext/gd/gd.c:1.298 Mon Aug 16 19:07:42 2004 +++ php-src/ext/gd/gd.c Tue Nov 2 11:41:41 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.298 2004/08/16 23:07:42 iliaa Exp $ */ +/* $Id: gd.c,v 1.299 2004/11/02 16:41:41 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1767,8 +1767,9 @@ int b; FILE *tmp; char buf[4096]; + char *path; - tmp = php_open_temporary_file(, , NULL TSRMLS_CC); + tmp = php_open_temporary_file(, , path TSRMLS_CC); if (tmp == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to open temporary file); RETURN_FALSE; @@ -1823,7 +1824,8 @@ } fclose(tmp); - /* the temporary file is automatically deleted */ + VCWD_UNLINK((const char *)path); /* make sure that the temporary file is removed */ + efree(path); } RETURN_TRUE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
iliaa Mon Aug 16 19:07:43 2004 EDT Modified files: /php-src/ext/gd gd.c Log: Fixed bug #29594 (Use PHP's own tmpfile() implementation). http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.297r2=1.298ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.297 php-src/ext/gd/gd.c:1.298 --- php-src/ext/gd/gd.c:1.297 Mon Jul 26 20:27:06 2004 +++ php-src/ext/gd/gd.c Mon Aug 16 19:07:42 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.297 2004/07/27 00:27:06 iliaa Exp $ */ +/* $Id: gd.c,v 1.298 2004/08/16 23:07:42 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -35,6 +35,7 @@ #include SAPI.h #include php_gd.h #include ext/standard/info.h +#include php_open_temporary_file.h #if HAVE_SYS_WAIT_H # include sys/wait.h @@ -1767,7 +1768,7 @@ FILE *tmp; char buf[4096]; - tmp = tmpfile(); + tmp = php_open_temporary_file(, , NULL TSRMLS_CC); if (tmp == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to open temporary file); RETURN_FALSE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
edink Thu Jul 22 22:28:18 2004 EDT Modified files: /php-src/ext/gd gd.c Log: Updated version number http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.295r2=1.296ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.295 php-src/ext/gd/gd.c:1.296 --- php-src/ext/gd/gd.c:1.295 Mon Jul 19 03:19:37 2004 +++ php-src/ext/gd/gd.c Thu Jul 22 22:28:18 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.295 2004/07/19 07:19:37 andi Exp $ */ +/* $Id: gd.c,v 1.296 2004/07/23 02:28:18 edink Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -453,7 +453,7 @@ /* }}} */ #if HAVE_GD_BUNDLED -#define PHP_GD_VERSION_STRING bundled (2.0.23 compatible) +#define PHP_GD_VERSION_STRING bundled (2.0.28 compatible) #elif HAVE_LIBGD20 #define PHP_GD_VERSION_STRING 2.0 or higher #elif HAVE_GDIMAGECOLORRESOLVE -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
iliaa Thu May 20 19:38:00 2004 EDT Modified files: /php-src/ext/gd gd.c Log: Fixed stream leak on error. http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.293r2=1.294ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.293 php-src/ext/gd/gd.c:1.294 --- php-src/ext/gd/gd.c:1.293 Sun May 9 13:39:20 2004 +++ php-src/ext/gd/gd.c Thu May 20 19:37:59 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.293 2004/05/09 17:39:20 iliaa Exp $ */ +/* $Id: gd.c,v 1.294 2004/05/20 23:37:59 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -737,6 +737,7 @@ if (body_size != body_size_check) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Error reading font); efree(font); + php_stream_close(stream); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/gd/libgd gdft.c
iliaa Sun May 9 13:33:50 2004 EDT Modified files: /php-src/ext/gd gd.c /php-src/ext/gd/libgd gdft.c Log: Upgrade bundled GD library to 2.0.23. Fixed bug #28175 (build problem for people using FreeType 2.1.0-2.1.2). http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.291r2=1.292ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.291 php-src/ext/gd/gd.c:1.292 --- php-src/ext/gd/gd.c:1.291 Wed Apr 7 18:27:32 2004 +++ php-src/ext/gd/gd.c Sun May 9 13:33:50 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.291 2004/04/07 22:27:32 edink Exp $ */ +/* $Id: gd.c,v 1.292 2004/05/09 17:33:50 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -453,7 +453,7 @@ /* }}} */ #if HAVE_GD_BUNDLED -#define PHP_GD_VERSION_STRING bundled (2.0.22 compatible) +#define PHP_GD_VERSION_STRING bundled (2.0.23 compatible) #elif HAVE_LIBGD20 #define PHP_GD_VERSION_STRING 2.0 or higher #elif HAVE_GDIMAGECOLORRESOLVE http://cvs.php.net/diff.php/php-src/ext/gd/libgd/gdft.c?r1=1.33r2=1.34ty=u Index: php-src/ext/gd/libgd/gdft.c diff -u php-src/ext/gd/libgd/gdft.c:1.33 php-src/ext/gd/libgd/gdft.c:1.34 --- php-src/ext/gd/libgd/gdft.c:1.33Mon Mar 29 13:20:33 2004 +++ php-src/ext/gd/libgd/gdft.c Sun May 9 13:33:50 2004 @@ -434,7 +434,7 @@ encoding = charmap-encoding_id; /* EAM DEBUG - Newer versions of libfree2 make it easier by defining encodings */ -#if (defined(FREETYPE_MAJOR) (FREETYPE_MAJOR =2 ) (FREETYPE_MINOR = 1)) +#if (defined(FREETYPE_MAJOR) ((FREETYPE_MAJOR == 2 ((FREETYPE_MINOR == 1 FREETYPE_PATCH = 3) || FREETYPE_MINOR 1) || FREETYPE_MAJOR 2))) if (charmap-encoding == FT_ENCODING_MS_SYMBOL || charmap-encoding == FT_ENCODING_ADOBE_CUSTOM || charmap-encoding == FT_ENCODING_ADOBE_STANDARD) { @@ -443,7 +443,7 @@ a-face-charmap = charmap; return (void *)a; } -#endif /* Freetype 2.1 or better */ +#endif /* Freetype 2.1.3 or better */ /* EAM DEBUG */ if ((platform == 3 encoding == 1)/* Windows Unicode */ @@ -773,6 +773,8 @@ * colorindexes. -- 27.06.2001 [EMAIL PROTECTED] */ gdCache_head_t *tc_cache; + /* Tuneable horizontal and vertical resolution in dots per inch */ + int hdpi, vdpi; if (strex ((strex-flags gdFTEX_LINESPACE) == gdFTEX_LINESPACE)) { linespace = strex-linespacing; @@ -802,7 +804,19 @@ face = font-face; /* shortcut */ slot = face-glyph; /* shortcut */ - if (FT_Set_Char_Size (face, 0, (FT_F26Dot6) (ptsize * 64), GD_RESOLUTION, GD_RESOLUTION)) { + /* +* Added hdpi and vdpi to support images at non-screen resolutions, i.e. 300 dpi TIFF, +* or 100h x 50v dpi FAX format. 2.0.23. +* 2004/02/27 Mark Shackelford, [EMAIL PROTECTED] +*/ + hdpi = GD_RESOLUTION; + vdpi = GD_RESOLUTION; + if (strex (strex-flags gdFTEX_RESOLUTION)) { + hdpi = strex-hdpi; + vdpi = strex-vdpi; + } + + if (FT_Set_Char_Size(face, 0, (FT_F26Dot6) (ptsize * 64), hdpi, vdpi)) { gdCacheDelete(tc_cache); gdMutexUnlock(gdFontCacheMutex); return Could not set character size; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
iliaa Sun May 9 13:39:20 2004 EDT Modified files: /php-src/ext/gd gd.c Log: Fixed bug #28267 (php_image_filter_contrast calls gdImageBrightness). http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.292r2=1.293ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.292 php-src/ext/gd/gd.c:1.293 --- php-src/ext/gd/gd.c:1.292 Sun May 9 13:33:50 2004 +++ php-src/ext/gd/gd.c Sun May 9 13:39:20 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.292 2004/05/09 17:33:50 iliaa Exp $ */ +/* $Id: gd.c,v 1.293 2004/05/09 17:39:20 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -3978,20 +3978,20 @@ /* Section Filters */ #ifdef HAVE_GD_BUNDLED -static void php_image_filter_negate(INTERNAL_FUNCTION_PARAMETERS) -{ - zval **SIM; - gdImagePtr im_src; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(1, SIM) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); +#define PHP_GD_SINGLE_RES \ + zval **SIM; \ + gdImagePtr im_src; \ + if (zend_get_parameters_ex(1, SIM) == FAILURE) { \ + RETURN_FALSE; \ + } \ + ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, Image, le_gd); \ + if (im_src == NULL) { \ + RETURN_FALSE; \ } - ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, Image, le_gd); - - if (im_src == NULL) { - RETURN_FALSE; - } +static void php_image_filter_negate(INTERNAL_FUNCTION_PARAMETERS) +{ + PHP_GD_SINGLE_RES if (gdImageNegate(im_src) == 1) { RETURN_TRUE; @@ -4002,18 +4002,7 @@ static void php_image_filter_grayscale(INTERNAL_FUNCTION_PARAMETERS) { - zval **SIM; - gdImagePtr im_src; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(1, SIM) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - - ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, Image, le_gd); - - if (im_src == NULL) { - RETURN_FALSE; - } + PHP_GD_SINGLE_RES if (gdImageGrayScale(im_src) == 1) { RETURN_TRUE; @@ -4028,8 +4017,8 @@ gdImagePtr im_src; long brightness, tmp; - if (ZEND_NUM_ARGS() != 3 || zend_parse_parameters(3 TSRMLS_CC, zll, SIM, tmp, brightness) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, zll, SIM, tmp, brightness) == FAILURE) { + RETURN_FALSE; } ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, Image, le_gd); @@ -4051,8 +4040,8 @@ gdImagePtr im_src; long contrast, tmp; - if (ZEND_NUM_ARGS() != 3 || zend_parse_parameters(3 TSRMLS_CC, rll, SIM, tmp, contrast) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rll, SIM, tmp, contrast) == FAILURE) { + RETURN_FALSE; } ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, Image, le_gd); @@ -4061,7 +4050,7 @@ RETURN_FALSE; } - if (gdImageBrightness(im_src, (int)contrast) == 1) { + if (gdImageContrast(im_src, (int)contrast) == 1) { RETURN_TRUE; } @@ -4074,8 +4063,8 @@ gdImagePtr im_src; long r,g,b,tmp; - if (ZEND_NUM_ARGS() != 5 || zend_parse_parameters(5 TSRMLS_CC, r, SIM, tmp, r, g, b) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r, SIM, tmp, r, g, b) == FAILURE) { + RETURN_FALSE; } ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, Image, le_gd); @@ -4093,18 +4082,7 @@ static void php_image_filter_edgedetect(INTERNAL_FUNCTION_PARAMETERS) { - zval **SIM; - gdImagePtr im_src; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(1, SIM) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - - ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, Image, le_gd); - - if (im_src == NULL) { - RETURN_FALSE; - } + PHP_GD_SINGLE_RES if (gdImageEdgeDetectQuick(im_src) == 1) { RETURN_TRUE; @@ -4115,18 +4093,7 @@ static void php_image_filter_emboss(INTERNAL_FUNCTION_PARAMETERS) { - zval **SIM; - gdImagePtr im_src; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(1, SIM) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } - - ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, Image, le_gd); - - if (im_src == NULL) { - RETURN_FALSE; - } + PHP_GD_SINGLE_RES if (gdImageEmboss(im_src) == 1) { RETURN_TRUE; @@ -4137,18 +4104,7 @@ static void
[PHP-CVS] cvs: php-src /ext/gd gd.c
iliaa Sun Apr 4 13:59:09 2004 EDT Modified files: /php-src/ext/gd gd.c Log: Fixed a bug that prevented building of gd extension against external GD lib 1.X. http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.289r2=1.290ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.289 php-src/ext/gd/gd.c:1.290 --- php-src/ext/gd/gd.c:1.289 Mon Mar 29 13:20:32 2004 +++ php-src/ext/gd/gd.c Sun Apr 4 13:59:08 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.289 2004/03/29 18:20:32 iliaa Exp $ */ +/* $Id: gd.c,v 1.290 2004/04/04 17:59:08 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1720,6 +1720,7 @@ } switch (image_type) { +#ifdef HAVE_GD_WBMP case PHP_GDIMG_CONVERT_WBM: if (q == -1) { q = 0; @@ -1729,6 +1730,7 @@ } gdImageWBMP(im, q, fp); break; +#endif case PHP_GDIMG_TYPE_JPG: (*func_p)(im, fp, q); break; @@ -1767,6 +1769,7 @@ } switch (image_type) { +#ifdef HAVE_GD_WBMP case PHP_GDIMG_CONVERT_WBM: if (q == -1) { q = 0; @@ -1776,6 +1779,7 @@ } gdImageWBMP(im, q, tmp); break; +#endif case PHP_GDIMG_TYPE_JPG: (*func_p)(im, tmp, q); break; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c /ext/gd/libgd gd.c gd.h gd_gd.c gd_gd2.c gd_io_dp.c gd_jpeg.c gd_png.c gd_wbmp.c gdfontg.c gdfontg.h gdfontl.c gdfontl.h gdfontmb.c gdfontmb.h gdfonts.c gdfonts.h gdfontt.c gdfontt.h gdft.c
iliaa Mon Mar 29 13:20:33 2004 EDT Modified files: /php-src/ext/gd gd.c /php-src/ext/gd/libgd gd.c gd.h gd_gd.c gd_gd2.c gd_io_dp.c gd_jpeg.c gd_png.c gd_wbmp.c gdfontg.c gdfontg.h gdfontl.c gdfontl.h gdfontmb.c gdfontmb.h gdfonts.c gdfonts.h gdfontt.c gdfontt.h gdft.c Log: Synchronized bundled GD library with GD 2.0.22. http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.288r2=1.289ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.288 php-src/ext/gd/gd.c:1.289 --- php-src/ext/gd/gd.c:1.288 Sun Feb 22 13:03:09 2004 +++ php-src/ext/gd/gd.c Mon Mar 29 13:20:32 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.288 2004/02/22 18:03:09 iliaa Exp $ */ +/* $Id: gd.c,v 1.289 2004/03/29 18:20:32 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -453,7 +453,7 @@ /* }}} */ #if HAVE_GD_BUNDLED -#define PHP_GD_VERSION_STRING bundled (2.0.17 compatible) +#define PHP_GD_VERSION_STRING bundled (2.0.22 compatible) #elif HAVE_LIBGD20 #define PHP_GD_VERSION_STRING 2.0 or higher #elif HAVE_GDIMAGECOLORRESOLVE http://cvs.php.net/diff.php/php-src/ext/gd/libgd/gd.c?r1=1.76r2=1.77ty=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.76 php-src/ext/gd/libgd/gd.c:1.77 --- php-src/ext/gd/libgd/gd.c:1.76 Mon Mar 22 12:26:03 2004 +++ php-src/ext/gd/libgd/gd.c Mon Mar 29 13:20:33 2004 @@ -2300,7 +2300,8 @@ int tmp = gdImageGetPixel (src, x, y); mapTo = gdImageGetTrueColorPixel (src, x, y); if (gdImageGetTransparent (src) == tmp) { - tox++; + /* 2.0.21, TK: not tox++ */ + tox += stx[x - srcX]; continue; } } else { @@ -2308,7 +2309,8 @@ mapTo = gdImageGetTrueColorPixel (src, x, y); /* Added 7/24/95: support transparent copies */ if (gdImageGetTransparent (src) == mapTo) { - tox++; + /* 2.0.21, TK: not tox++ */ + tox += stx[x - srcX]; continue; } } @@ -2364,22 +2366,24 @@ void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH) { int x, y; + double sy1, sy2, sx1, sx2; if (!dst-trueColor) { gdImageCopyResized (dst, src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH); return; } for (y = dstY; (y dstY + dstH); y++) { + sy1 = ((double) y - (double) dstY) * (double) srcH / (double) dstH; + sy2 = ((double) (y + 1) - (double) dstY) * (double) srcH / (double) dstH; for (x = dstX; (x dstX + dstW); x++) { - float sy1, sy2, sx1, sx2; - float sx, sy; - float spixels = 0.0f; - float red = 0.0f, green = 0.0f, blue = 0.0f, alpha = 0.0f; - float alpha_factor, alpha_sum = 0.0f, contrib_sum = 0.0f; - sy1 = ((float)(y - dstY)) * (float)srcH / (float)dstH; - sy2 = ((float)(y + 1 - dstY)) * (float) srcH / (float) dstH; + double sx, sy; + double spixels = 0; + double red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0; + double alpha_factor, alpha_sum = 0.0, contrib_sum = 0.0; + sx1 = ((double) x - (double) dstX) * (double) srcW / dstW; + sx2 = ((double) (x + 1) - (double) dstX) * (double) srcW / dstW; sy = sy1; do { - float yportion; + double yportion; if (floor_cast(sy) == floor_cast(sy1)) { yportion = 1.0f - (sy - floor_cast(sy)); if (yportion sy2 - sy1) { @@ -2391,12 +2395,10 @@
[PHP-CVS] cvs: php-src /ext/gd gd.c
iliaa Sun Feb 22 13:03:10 2004 EDT Modified files: /php-src/ext/gd gd.c Log: wbmp conversion warning fix. http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.287r2=1.288ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.287 php-src/ext/gd/gd.c:1.288 --- php-src/ext/gd/gd.c:1.287 Sat Feb 21 11:49:39 2004 +++ php-src/ext/gd/gd.c Sun Feb 22 13:03:09 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.287 2004/02/21 16:49:39 iliaa Exp $ */ +/* $Id: gd.c,v 1.288 2004/02/22 18:03:09 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1721,7 +1721,9 @@ switch (image_type) { case PHP_GDIMG_CONVERT_WBM: - if (q 0 || q 255) { + if (q == -1) { + q = 0; + } else if (q 0 || q 255) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid threshold value '%d'. It must be between 0 and 255, q); q = 0; } @@ -1766,9 +1768,12 @@ switch (image_type) { case PHP_GDIMG_CONVERT_WBM: - if (q 0 || q 255) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid threshold value '%d'. It must be between 0 and 255, q); - } + if (q == -1) { + q = 0; + } else if (q 0 || q 255) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid threshold value '%d'. It must be between 0 and 255, q); + q = 0; + } gdImageWBMP(im, q, tmp); break; case PHP_GDIMG_TYPE_JPG: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
iliaa Sat Feb 21 11:49:40 2004 EDT Modified files: /php-src/ext/gd gd.c Log: Set correct default threshold for image2wbmp(). http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.286r2=1.287ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.286 php-src/ext/gd/gd.c:1.287 --- php-src/ext/gd/gd.c:1.286 Tue Feb 17 16:30:00 2004 +++ php-src/ext/gd/gd.c Sat Feb 21 11:49:39 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.286 2004/02/17 21:30:00 iliaa Exp $ */ +/* $Id: gd.c,v 1.287 2004/02/21 16:49:39 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1723,6 +1723,7 @@ case PHP_GDIMG_CONVERT_WBM: if (q 0 || q 255) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid threshold value '%d'. It must be between 0 and 255, q); + q = 0; } gdImageWBMP(im, q, fp); break; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
iliaa Tue Feb 17 16:30:02 2004 EDT Modified files: /php-src/ext/gd gd.c Log: Fixed bug #27293 (two crashes inside image2wbmp()). http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.285r2=1.286ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.285 php-src/ext/gd/gd.c:1.286 --- php-src/ext/gd/gd.c:1.285 Tue Jan 27 20:36:53 2004 +++ php-src/ext/gd/gd.c Tue Feb 17 16:30:00 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.285 2004/01/28 01:36:53 iliaa Exp $ */ +/* $Id: gd.c,v 1.286 2004/02/17 21:30:00 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1724,6 +1724,8 @@ if (q 0 || q 255) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid threshold value '%d'. It must be between 0 and 255, q); } + gdImageWBMP(im, q, fp); + break; case PHP_GDIMG_TYPE_JPG: (*func_p)(im, fp, q); break; @@ -1766,6 +1768,8 @@ if (q 0 || q 255) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid threshold value '%d'. It must be between 0 and 255, q); } + gdImageWBMP(im, q, tmp); + break; case PHP_GDIMG_TYPE_JPG: (*func_p)(im, tmp, q); break; @@ -3741,6 +3745,10 @@ return; } + if (im_org-trueColor) { + gdImageTrueColorToPalette(im_org, 1, 256); + } + for (y = 0; y dest_height; y++) { for (x = 0; x dest_width; x++) { color_org = gdImageGetPixel(im_org, x, y); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
iliaa Tue Jan 27 20:36:54 2004 EDT Modified files: /php-src/ext/gd gd.c Log: Fixed bug #27056 (ints used instead of longs inside some GD functions). http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.284r2=1.285ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.284 php-src/ext/gd/gd.c:1.285 --- php-src/ext/gd/gd.c:1.284 Thu Jan 8 03:15:29 2004 +++ php-src/ext/gd/gd.c Tue Jan 27 20:36:53 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.284 2004/01/08 08:15:29 andi Exp $ */ +/* $Id: gd.c,v 1.285 2004/01/28 01:36:53 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1066,7 +1066,7 @@ PHP_FUNCTION(imagecolorallocatealpha) { zval *IM; - int red, green, blue, alpha; + long red, green, blue, alpha; gdImagePtr im; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, IM, red, green, blue, alpha) == FAILURE) { @@ -3421,7 +3421,7 @@ { zval *img, *fnt; int i, j; - int _fg, _bg, x, y, size, space = 0, aa_steps = 4, width = 0; + long _fg, _bg, x, y, size, space = 0, aa_steps = 4, width = 0; int *f_ind; int h_lines, v_lines, c_ind; int rd, gr, bl, fg_rd, fg_gr, fg_bl, bg_rd, bg_gr, bg_bl; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c gd_ctx.c gdcache.c gdcache.h gdttf.c
iliaa Sun Dec 28 16:08:47 2003 EDT Modified files: /php-src/ext/gd gd.c gd_ctx.c gdcache.c gdcache.h gdttf.c Log: Last bit of CS fixes. Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.282 php-src/ext/gd/gd.c:1.283 --- php-src/ext/gd/gd.c:1.282 Thu Dec 25 17:12:08 2003 +++ php-src/ext/gd/gd.c Sun Dec 28 16:08:45 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.282 2003/12/25 22:12:08 iliaa Exp $ */ +/* $Id: gd.c,v 1.283 2003/12/28 21:08:45 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -444,7 +444,7 @@ { #if defined(HAVE_GD_THREAD_SAFE) || defined(HAVE_GD_BUNDLED) gdFontCacheShutdown(); -#else +#else gdFreeFontCache(); #endif return SUCCESS; @@ -831,7 +831,7 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid image dimensions); RETURN_FALSE; } - + im = gdImageCreateTrueColor(Z_LVAL_PP(x_size), Z_LVAL_PP(y_size)); ZEND_REGISTER_RESOURCE(return_value, im, le_gd); @@ -2390,12 +2390,12 @@ if (e 0) { e %= 360; } - + st = Z_LVAL_PP(ST); if (st 0) { st %= 360; } - + gdImageArc(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), st, e, Z_LVAL_PP(col)); RETURN_TRUE; } @@ -2983,7 +2983,7 @@ dstY = Z_LVAL_PP(DY); dstH = Z_LVAL_PP(DH); dstW = Z_LVAL_PP(DW); - + if (dstW = 0 || dstH = 0 || srcW = 0 || srcH = 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid image dimensions); RETURN_FALSE; Index: php-src/ext/gd/gd_ctx.c diff -u php-src/ext/gd/gd_ctx.c:1.17 php-src/ext/gd/gd_ctx.c:1.18 --- php-src/ext/gd/gd_ctx.c:1.17Sun Jun 15 16:00:08 2003 +++ php-src/ext/gd/gd_ctx.c Sun Dec 28 16:08:46 2003 @@ -16,12 +16,12 @@ +--+ */ -/* $Id: gd_ctx.c,v 1.17 2003/06/15 20:00:08 helly Exp $ */ +/* $Id: gd_ctx.c,v 1.18 2003/12/28 21:08:46 iliaa Exp $ */ #include php_gd.h #define CTX_PUTC(c,ctx) ctx-putC(ctx, c) - + static void _php_image_output_putc(struct gdIOCtx *ctx, int c) { TSRMLS_FETCH(); @@ -41,8 +41,8 @@ } } -/* {{{ _php_image_output_ctx */ -static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)()) +/* {{{ _php_image_output_ctx */ +static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)()) { zval **imgind, **file, **quality; gdImagePtr im; @@ -56,11 +56,11 @@ * The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when called * from imageytype(). */ - + if (argc 2 image_type == PHP_GDIMG_TYPE_XBM) { WRONG_PARAM_COUNT; } - if (argc 1 || argc 3 || zend_get_parameters_ex(argc, imgind, file, quality) == FAILURE) + if (argc 1 || argc 3 || zend_get_parameters_ex(argc, imgind, file, quality) == FAILURE) { WRONG_PARAM_COUNT; } @@ -97,7 +97,7 @@ ctx-gd_free = _php_image_output_ctxfree; #else ctx-free = _php_image_output_ctxfree; -#endif +#endif #if APACHE defined(CHARSET_EBCDIC) /* XXX this is unlikely to work any more [EMAIL PROTECTED] */ @@ -133,17 +133,17 @@ break; } -#if HAVE_LIBGD204 +#if HAVE_LIBGD204 ctx-gd_free(ctx); #else ctx-free(ctx); -#endif +#endif if(fp) { fflush(fp); fclose(fp); } - + RETURN_TRUE; } /* }}} */ Index: php-src/ext/gd/gdcache.c diff -u php-src/ext/gd/gdcache.c:1.8 php-src/ext/gd/gdcache.c:1.9 --- php-src/ext/gd/gdcache.c:1.8Mon Mar 17 21:13:49 2003 +++ php-src/ext/gd/gdcache.cSun Dec 28 16:08:46 2003 @@ -1,8 +1,8 @@ -/* - * $Id: gdcache.c,v 1.8 2003/03/18 02:13:49 sniper Exp $ +/* + * $Id: gdcache.c,v 1.9 2003/12/28 21:08:46 iliaa Exp $ * - * Caches of pointers to user structs in which the least-recently-used - * element is replaced in the event of a cache miss after the cache has + * Caches of pointers to user structs in which the least-recently-used + * element is replaced in the event of a cache miss after the cache has * reached a given size. * * John Ellson ([EMAIL PROTECTED]) Oct 31, 1997 @@ -17,17 +17,17 @@ * The head structure has a pointer to the most-recently-used * element, and elements are moved to this position in the list each * time they are used. The head also contains pointers to three - * user defined functions: - * - a function to test if a cached userdata matches some keydata
[PHP-CVS] cvs: php-src /ext/gd gd.c
rasmus Thu Dec 18 03:17:46 2003 EDT Modified files: /php-src/ext/gd gd.c Log: Fix remaining gd build issue Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.280 php-src/ext/gd/gd.c:1.281 --- php-src/ext/gd/gd.c:1.280 Wed Nov 19 10:49:55 2003 +++ php-src/ext/gd/gd.c Thu Dec 18 03:17:45 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.280 2003/11/19 15:49:55 iliaa Exp $ */ +/* $Id: gd.c,v 1.281 2003/12/18 08:17:45 rasmus Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -68,7 +68,8 @@ #endif #ifdef ENABLE_GD_TTF # ifdef HAVE_LIBFREETYPE -# include freetype/freetype.h +# include ft2build.h +# include FT_FREETYPE_H # else # ifdef HAVE_LIBTTF # include freetype.h -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
iliaa Wed Nov 19 10:49:56 2003 EDT Modified files: /php-src/ext/gd gd.c Log: Fixed bug #26309 (Fixed argument parsing for imageftbbox()). Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.279 php-src/ext/gd/gd.c:1.280 --- php-src/ext/gd/gd.c:1.279 Mon Sep 15 03:27:18 2003 +++ php-src/ext/gd/gd.c Wed Nov 19 10:49:55 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.279 2003/09/15 07:27:18 moriyoshi Exp $ */ +/* $Id: gd.c,v 1.280 2003/11/19 15:49:55 iliaa Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -3086,13 +3086,11 @@ argc = ZEND_NUM_ARGS(); if (mode == TTFTEXT_BBOX) { - if ((extended argc != 5) || (!extended argc != 4) || - zend_get_parameters_ex(argc, PTSIZE, ANGLE, FONTNAME, C, EXT) == FAILURE) { + if (argc 4 || argc 5 || zend_get_parameters_ex(argc, PTSIZE, ANGLE, FONTNAME, C, EXT) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); } } else { - if ((extended argc != 9) || (!extended argc != 8) || - zend_get_parameters_ex(argc, IM, PTSIZE, ANGLE, X, Y, COL, FONTNAME, C, EXT) == FAILURE) { + if (argc 8 || argc 9 || zend_get_parameters_ex(argc, IM, PTSIZE, ANGLE, X, Y, COL, FONTNAME, C, EXT) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, Image, le_gd); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/gd gd.c
moriyoshi Mon Sep 15 03:27:19 2003 EDT Modified files: /php-src/ext/gd gd.c Log: FREETYPE_PATCH is not always defined. # will likely fix Sebastian's build :) Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.278 php-src/ext/gd/gd.c:1.279 --- php-src/ext/gd/gd.c:1.278 Tue Sep 9 15:08:30 2003 +++ php-src/ext/gd/gd.c Mon Sep 15 03:27:18 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: gd.c,v 1.278 2003/09/09 19:08:30 moriyoshi Exp $ */ +/* $Id: gd.c,v 1.279 2003/09/15 07:27:18 moriyoshi Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -476,7 +476,11 @@ php_info_print_table_row(2, FreeType Linkage, with freetype); { char tmp[256]; +#ifdef FREETYPE_PATCH snprintf(tmp, sizeof(tmp), %d.%d.%d, FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH); +#else + snprintf(tmp, sizeof(tmp), %d.%d, FREETYPE_MAJOR, FREETYPE_MINOR); +#endif php_info_print_table_row(2, FreeType Version, tmp); } #elif HAVE_LIBTTF -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php