Skip to content

Commit 0345ffc

Browse files
committed
Drop now superfluous checks for zero width/height
These have been introduced as fix for bug 72337[1], while the same issue had a simpler fix for upstream[2], because the helper functions already were internal. [1] <https://bugs.php.net/72337> [2] <libgd/libgd@77309c4>
1 parent 77faf6d commit 0345ffc

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

ext/gd/libgd/gd_interpolation.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,10 +1069,6 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_width, const un
10691069
gdImagePtr dst;
10701070
int scale_pass_res;
10711071

1072-
if (new_width == 0 || new_height == 0) {
1073-
return NULL;
1074-
}
1075-
10761072
/* Convert to truecolor if it isn't; this code requires it. */
10771073
if (!src->trueColor) {
10781074
gdImagePaletteToTrueColor(src);
@@ -1127,10 +1123,6 @@ gdImageScaleNearestNeighbour(gdImagePtr im, const unsigned int width, const unsi
11271123
unsigned long dst_offset_y = 0;
11281124
unsigned int i;
11291125

1130-
if (new_width == 0 || new_height == 0) {
1131-
return NULL;
1132-
}
1133-
11341126
dst_img = gdImageCreateTrueColor(new_width, new_height);
11351127

11361128
if (dst_img == NULL) {
@@ -1184,10 +1176,6 @@ static gdImagePtr gdImageScaleBilinearPalette(gdImagePtr im, const unsigned int
11841176
gdImagePtr new_img;
11851177
const int transparent = im->transparent;
11861178

1187-
if (new_width == 0 || new_height == 0) {
1188-
return NULL;
1189-
}
1190-
11911179
new_img = gdImageCreateTrueColor(new_width, new_height);
11921180
if (new_img == NULL) {
11931181
return NULL;
@@ -1285,10 +1273,6 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w
12851273
long i;
12861274
gdImagePtr new_img;
12871275

1288-
if (new_width == 0 || new_height == 0) {
1289-
return NULL;
1290-
}
1291-
12921276
new_img = gdImageCreateTrueColor(new_width, new_height);
12931277
if (!new_img){
12941278
return NULL;
@@ -1389,10 +1373,6 @@ gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, const unsigne
13891373
unsigned int dst_offset_y = 0;
13901374
long i;
13911375

1392-
if (new_width == 0 || new_height == 0) {
1393-
return NULL;
1394-
}
1395-
13961376
/* impact perf a bit, but not that much. Implementation for palette
13971377
images can be done at a later point.
13981378
*/
@@ -1672,10 +1652,6 @@ gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, const int bgC
16721652
new_width = bbox.width;
16731653
new_height = bbox.height;
16741654

1675-
if (new_width == 0 || new_height == 0) {
1676-
return NULL;
1677-
}
1678-
16791655
dst = gdImageCreateTrueColor(new_width, new_height);
16801656
if (!dst) {
16811657
return NULL;

0 commit comments

Comments
 (0)