]> granicus.if.org Git - php/commitdiff
Return void from php_jpeg_emit_message()
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 19 Jun 2020 14:07:14 +0000 (16:07 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 19 Jun 2020 14:59:29 +0000 (16:59 +0200)
Instead of returning long and then casting to void.

This fixes a build warning on Ubuntu 20.04.

Closes GH-5742.

ext/gd/libgd/gd_jpeg.c

index 3f0241a8e037625cec81ff008b412cd9f02ab493..e7c3d752919b2e7ec252bcf7d6097c77f47b96e0 100644 (file)
@@ -47,7 +47,7 @@ typedef struct _jmpbuf_wrapper
        int ignore_warning;
 } jmpbuf_wrapper;
 
-static long php_jpeg_emit_message(j_common_ptr jpeg_info, int level)
+static void php_jpeg_emit_message(j_common_ptr jpeg_info, int level)
 {
        char message[JMSG_LENGTH_MAX];
        jmpbuf_wrapper *jmpbufw;
@@ -81,11 +81,9 @@ static long php_jpeg_emit_message(j_common_ptr jpeg_info, int level)
                        }
                }
        }
-       return 1;
 }
 
 
-
 /* Called by the IJG JPEG library upon encountering a fatal error */
 static void fatal_jpeg_error (j_common_ptr cinfo)
 {
@@ -356,8 +354,7 @@ gdImagePtr gdImageCreateFromJpegCtxEx (gdIOCtx * infile, int ignore_warning)
 
        cinfo.err = jpeg_std_error (&jerr);
        cinfo.client_data = &jmpbufw;
-
-       cinfo.err->emit_message = (void (*)(j_common_ptr,int)) php_jpeg_emit_message;
+       cinfo.err->emit_message = php_jpeg_emit_message;
 
        if (setjmp (jmpbufw.jmpbuf) != 0) {
                /* we're here courtesy of longjmp */