Skip to content

Commit 1c208ad

Browse files
committed
Fix [-Wimplicit-fallthrough] warnings in GD extension
And fix indentation issue
1 parent 8295b72 commit 1c208ad

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

ext/gd/libgd/gd_interpolation.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,6 +2465,7 @@ int gdImageSetInterpolationMethod(gdImagePtr im, gdInterpolationMethod id)
24652465
switch (id) {
24662466
case GD_DEFAULT:
24672467
id = GD_BILINEAR_FIXED;
2468+
fallthrough;
24682469
/* Optimized versions */
24692470
case GD_BILINEAR_FIXED:
24702471
case GD_BICUBIC_FIXED:

ext/gd/libgd/gd_png.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -309,26 +309,26 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile)
309309

310310
case PNG_COLOR_TYPE_GRAY_ALPHA:
311311
png_set_gray_to_rgb(png_ptr);
312-
313-
case PNG_COLOR_TYPE_RGB:
314-
case PNG_COLOR_TYPE_RGB_ALPHA:
315-
/* gd 2.0: we now support truecolor. See the comment above
316-
* for a rare situation in which the transparent pixel may not
317-
* work properly with 16-bit channels.
318-
*/
319-
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
320-
png_get_tRNS(png_ptr, info_ptr, NULL, NULL, &trans_color_rgb);
321-
if (bit_depth == 16) { /* png_set_strip_16() not yet in effect */
322-
transparent = gdTrueColor(trans_color_rgb->red >> 8,
323-
trans_color_rgb->green >> 8,
324-
trans_color_rgb->blue >> 8);
325-
} else {
326-
transparent = gdTrueColor(trans_color_rgb->red,
327-
trans_color_rgb->green,
328-
trans_color_rgb->blue);
329-
}
312+
fallthrough;
313+
case PNG_COLOR_TYPE_RGB:
314+
case PNG_COLOR_TYPE_RGB_ALPHA:
315+
/* gd 2.0: we now support truecolor. See the comment above
316+
* for a rare situation in which the transparent pixel may not
317+
* work properly with 16-bit channels.
318+
*/
319+
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
320+
png_get_tRNS(png_ptr, info_ptr, NULL, NULL, &trans_color_rgb);
321+
if (bit_depth == 16) { /* png_set_strip_16() not yet in effect */
322+
transparent = gdTrueColor(trans_color_rgb->red >> 8,
323+
trans_color_rgb->green >> 8,
324+
trans_color_rgb->blue >> 8);
325+
} else {
326+
transparent = gdTrueColor(trans_color_rgb->red,
327+
trans_color_rgb->green,
328+
trans_color_rgb->blue);
330329
}
331-
break;
330+
}
331+
break;
332332
}
333333

334334
png_read_update_info(png_ptr, info_ptr);

0 commit comments

Comments
 (0)