com php-src: Remove dead code: ext/gd/gd.c ext/gd/gd_ctx.c
| From: | Christoph Michael Becker | Date: | Thu, 28 Feb 2019 12:11:41 +0000 |
| Subject: | com php-src: Remove dead code: ext/gd/gd.c ext/gd/gd_ctx.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-104896@lists.php.net to get a copy of this message | ||
Commit: 345a75f5419c5ec37086ede199a1a8b9623ff407
Author: Christoph M. Becker <cmbecker69@gmx.de> Thu, 28 Feb 2019 13:11:41 +0100
Parents: 7be0e06b482e5bf14eaf4fe9a882d8b72d644038
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=345a75f5419c5ec37086ede199a1a8b9623ff407
Log:
Remove dead code
_php_image_output() is only ever called for PHP_GDIMG_CONVERT_WBM,
PHP_GDIMG_TYPE_GD and PHP_GDIMG_TYPE_GD2. All other image types
solely use the more flexible _php_image_output_ctx().
Changed paths:
M ext/gd/gd.c
M ext/gd/gd_ctx.c
Diff:
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index aa70be9..6849be1 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -2595,7 +2595,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type,
char
int q = -1, i, t = 1;
/* The quality parameter for Wbmp stands for the foreground when called from image2wbmp() */
- /* When called from imagewbmp() the quality parameter stands for the foreground color. Default:
black. */
/* The quality parameter for gd2 stands for chunk size */
if (zend_parse_parameters(argc, "r|pll", &imgind, &file, &file_len,
&quality, &type) == FAILURE) {
@@ -2635,15 +2634,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type,
char
}
gdImageWBMP(im, q, fp);
break;
- case PHP_GDIMG_TYPE_JPG:
- (*func_p)(im, fp, q);
- break;
- case PHP_GDIMG_TYPE_WBM:
- for (i = 0; i < gdImageColorsTotal(im); i++) {
- if (gdImageRed(im, i) == 0) break;
- }
- (*func_p)(im, i, fp);
- break;
case PHP_GDIMG_TYPE_GD:
(*func_p)(im, fp);
break;
@@ -2654,11 +2644,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type,
char
(*func_p)(im, fp, q, t);
break;
default:
- if (q == -1) {
- q = 128;
- }
- (*func_p)(im, fp, q, t);
- break;
+ ZEND_ASSERT(0);
}
fflush(fp);
fclose(fp);
@@ -2684,17 +2670,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type,
char
}
gdImageWBMP(im, q, tmp);
break;
- case PHP_GDIMG_TYPE_JPG:
- (*func_p)(im, tmp, q);
- break;
- case PHP_GDIMG_TYPE_WBM:
- for (i = 0; i < gdImageColorsTotal(im); i++) {
- if (gdImageRed(im, i) == 0) {
- break;
- }
- }
- (*func_p)(im, q, tmp);
- break;
case PHP_GDIMG_TYPE_GD:
(*func_p)(im, tmp);
break;
@@ -2705,8 +2680,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type,
char
(*func_p)(im, tmp, q, t);
break;
default:
- (*func_p)(im, tmp);
- break;
+ ZEND_ASSERT(0);
}
fseek(tmp, 0, SEEK_SET);
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
index 6c0b97f..03700eb 100644
--- a/ext/gd/gd_ctx.c
+++ b/ext/gd/gd_ctx.c
@@ -93,9 +93,8 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
php_stream *stream;
int close_stream = 1;
- /* The third (quality) parameter for Wbmp stands for the foreground when called from image2wbmp().
- * The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when
called
- * from imagey<type>().
+ /* The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when
called
+ * from image<type>().
*/
switch (image_type) {
case PHP_GDIMG_TYPE_XBM:
@@ -177,10 +176,6 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
}
switch(image_type) {
- case PHP_GDIMG_CONVERT_WBM:
- if(q<0||q>255) {
- php_error_docref(NULL, E_WARNING, "Invalid threshold value '%d'. It must be
between 0 and 255", q);
- }
case PHP_GDIMG_TYPE_JPG:
(*func_p)(im, ctx, q);
break;