]> granicus.if.org Git - php/commitdiff
Fix [-Wtype-limits] in bundled GD lib by using signed integers
authorGeorge Peter Banyard <girgias@php.net>
Thu, 6 Feb 2020 00:20:46 +0000 (01:20 +0100)
committerGeorge Peter Banyard <girgias@php.net>
Thu, 6 Feb 2020 00:34:09 +0000 (01:34 +0100)
As seen in the gdImageRotateBicubicFixed() function the same setup
occurs but it uses signed integers, therefore we use also use
signed integers in gdImageRotateBilinear()

Moreover, these two functions have been removed upstream in
https://github.com/libgd/libgd/commit/bd6d2e101f6f1df106d1cd2e2dc8058a5538109b
therefore we should also mimic upstream and remove them...

Thanks to @cmb69 for pointing it out.

ext/gd/libgd/gd_interpolation.c

index 1a7cf209dc55e4af567984921e66021b81ce73b1..651c92467a81723988c5795db47935f691c9ec5e 100644 (file)
@@ -1771,8 +1771,8 @@ gdImagePtr gdImageRotateBilinear(gdImagePtr src, const float degrees, const int
                        const gdFixed f_j = gd_itofx((int)j - (int)new_width/2);
                        const gdFixed f_m = gd_mulfx(f_j,f_sin) + gd_mulfx(f_i,f_cos) + f_0_5 + f_H;
                        const gdFixed f_n = gd_mulfx(f_j,f_cos) - gd_mulfx(f_i,f_sin) + f_0_5 + f_W;
-                       const unsigned int m = gd_fxtoi(f_m);
-                       const unsigned int n = gd_fxtoi(f_n);
+                       const int m = gd_fxtoi(f_m);
+                       const int n = gd_fxtoi(f_n);
 
                        if ((m >= 0) && (m < src_h - 1) && (n >= 0) && (n < src_w - 1)) {
                                const gdFixed f_f = f_m - gd_itofx(m);