pixman: Branch 'master' - 10 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 16 20:18:15 UTC 2019


 pixman/pixman-access.c          |   32 ++++++++++++++++----------------
 pixman/pixman-bits-image.c      |   30 ++++++++++++++++--------------
 pixman/pixman-combine32.c       |    4 ++--
 pixman/pixman-fast-path.c       |    4 ++--
 pixman/pixman-gradient-walker.c |    8 ++++----
 pixman/pixman-image.c           |    2 +-
 pixman/pixman-sse2.c            |    4 ++--
 pixman/pixman-utils.c           |    2 +-
 test/affine-test.c              |    2 +-
 test/utils.c                    |    8 ++++----
 10 files changed, 49 insertions(+), 47 deletions(-)

New commits:
commit fef82109eb38525fee036f741c0ef25c027c84ce
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Oct 15 16:35:25 2019 -0400

    pixman-bits-image: Fix various undefined left shifts
    
    ../pixman/pixman-bits-image.c:221:20: runtime error: left shift of 204 by 24 places cannot be represented in type 'int'

diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index 1ecbe54..ea74046 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -191,8 +191,8 @@ bits_image_fetch_pixel_bilinear_float (bits_image_t   *image,
     *ret = bilinear_interpolation_float (tl, tr, bl, br, distx, disty);
 }
 
-static force_inline void accum_32(int *satot, int *srtot,
-				  int *sgtot, int *sbtot,
+static force_inline void accum_32(unsigned int *satot, unsigned int *srtot,
+				  unsigned int *sgtot, unsigned int *sbtot,
 				  const void *p, pixman_fixed_t f)
 {
     uint32_t pixel = *(uint32_t *)p;
@@ -203,8 +203,9 @@ static force_inline void accum_32(int *satot, int *srtot,
     *satot += (int)ALPHA_8 (pixel) * f;
 }
 
-static force_inline void reduce_32(int satot, int srtot,
-				   int sgtot, int sbtot, void *p)
+static force_inline void reduce_32(unsigned int satot, unsigned int srtot,
+				   unsigned int sgtot, unsigned int sbtot,
+                                   void *p)
 {
     uint32_t *ret = p;
 
@@ -221,8 +222,8 @@ static force_inline void reduce_32(int satot, int srtot,
     *ret = ((satot << 24) | (srtot << 16) | (sgtot <<  8) | (sbtot));
 }
 
-static force_inline void accum_float(int *satot, int *srtot,
-				     int *sgtot, int *sbtot,
+static force_inline void accum_float(unsigned int *satot, unsigned int *srtot,
+				     unsigned int *sgtot, unsigned int *sbtot,
 				     const void *p, pixman_fixed_t f)
 {
     const argb_t *pixel = p;
@@ -233,8 +234,8 @@ static force_inline void accum_float(int *satot, int *srtot,
     *sbtot += pixel->b * f;
 }
 
-static force_inline void reduce_float(int satot, int srtot,
-				      int sgtot, int sbtot,
+static force_inline void reduce_float(unsigned int satot, unsigned int srtot,
+				      unsigned int sgtot, unsigned int sbtot,
 				      void *p)
 {
     argb_t *ret = p;
@@ -245,12 +246,13 @@ static force_inline void reduce_float(int satot, int srtot,
     ret->b = CLIP (sbtot / 65536.f, 0.f, 1.f);
 }
 
-typedef void (* accumulate_pixel_t) (int *satot, int *srtot,
-				     int *sgtot, int *sbtot,
+typedef void (* accumulate_pixel_t) (unsigned int *satot, unsigned int *srtot,
+				     unsigned int *sgtot, unsigned int *sbtot,
 				     const void *pixel, pixman_fixed_t f);
 
-typedef void (* reduce_pixel_t) (int satot, int srtot,
-				 int sgtot, int sbtot, void *out);
+typedef void (* reduce_pixel_t) (unsigned int satot, unsigned int srtot,
+				 unsigned int sgtot, unsigned int sbtot,
+                                 void *out);
 
 static force_inline void
 bits_image_fetch_pixel_convolution (bits_image_t   *image,
@@ -270,7 +272,7 @@ bits_image_fetch_pixel_convolution (bits_image_t   *image,
     pixman_repeat_t repeat_mode = image->common.repeat;
     int width = image->width;
     int height = image->height;
-    int srtot, sgtot, sbtot, satot;
+    unsigned int srtot, sgtot, sbtot, satot;
 
     params += 2;
 
@@ -339,7 +341,7 @@ bits_image_fetch_pixel_separable_convolution (bits_image_t  *image,
     int x_off = ((cwidth << 16) - pixman_fixed_1) >> 1;
     int y_off = ((cheight << 16) - pixman_fixed_1) >> 1;
     pixman_fixed_t *y_params;
-    int srtot, sgtot, sbtot, satot;
+    unsigned int srtot, sgtot, sbtot, satot;
     int32_t x1, x2, y1, y2;
     int32_t px, py;
     int i, j;
commit 7d6b71b315a7c70c9334aa6849301834c5004014
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Oct 15 16:34:56 2019 -0400

    pixman-fast-path: Fix various undefined left shifts
    
    ../pixman/pixman-fast-path.c:3089:23: runtime error: left shift of 154 by 24 places cannot be represented in type 'int'

diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index b4daa26..1ba779b 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -908,7 +908,7 @@ fast_composite_add_n_8_8 (pixman_implementation_t *imp,
 #define CREATE_BITMASK(n) (0x80000000 >> (n))
 #define UPDATE_BITMASK(n) ((n) >> 1)
 #else
-#define CREATE_BITMASK(n) (1 << (n))
+#define CREATE_BITMASK(n) (1U << (n))
 #define UPDATE_BITMASK(n) ((n) << 1)
 #endif
 
@@ -3086,7 +3086,7 @@ convert_x8r8g8b8 (const uint8_t *row, int x)
 static force_inline uint32_t
 convert_a8 (const uint8_t *row, int x)
 {
-    return *(row + x) << 24;
+    return (uint32_t) *(row + x) << 24;
 }
 
 static force_inline uint32_t
commit 880f48b2b474c9d110dc921c2ace89ffee39d0e1
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Oct 15 16:33:46 2019 -0400

    pixman-sse2: Fix an undefined left shift
    
    ../pixman/pixman-sse2.c:3346:14: runtime error: left shift of 41891 by 16 places cannot be represented in type 'int'

diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index aa0f84d..1db9441 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -3333,8 +3333,8 @@ sse2_fill (pixman_implementation_t *imp,
 
     if (bpp == 8)
     {
-	uint8_t b;
-	uint16_t w;
+	uint32_t b;
+	uint32_t w;
 
 	stride = stride * (int) sizeof (uint32_t) / 1;
 	byte_line = (uint8_t *)(((uint8_t *)bits) + stride * y + x);
commit 4897ad0a3fe08a3dcdc8b76082f6d3a85d95bf52
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Oct 15 16:30:27 2019 -0400

    pixman-gradient-walker: Fix undefined left shift
    
    ../pixman/pixman-gradient-walker.c:216:35: runtime error: left shift of 163 by 24 places cannot be represented in type 'int'

diff --git a/pixman/pixman-gradient-walker.c b/pixman/pixman-gradient-walker.c
index af4df58..fb7f401 100644
--- a/pixman/pixman-gradient-walker.c
+++ b/pixman/pixman-gradient-walker.c
@@ -213,10 +213,10 @@ pixman_gradient_walker_pixel_32 (pixman_gradient_walker_t *walker,
     f.g = f.a * (walker->g_s * y + walker->g_b);
     f.b = f.a * (walker->b_s * y + walker->b_b);
 
-    return (((uint8_t)(f.a + .5f) << 24) & 0xff000000) |
-           (((uint8_t)(f.r + .5f) << 16) & 0x00ff0000) |
-           (((uint8_t)(f.g + .5f) <<  8) & 0x0000ff00) |
-           (((uint8_t)(f.b + .5f) >>  0) & 0x000000ff);
+    return (((uint32_t)(f.a + .5f) << 24) & 0xff000000) |
+           (((uint32_t)(f.r + .5f) << 16) & 0x00ff0000) |
+           (((uint32_t)(f.g + .5f) <<  8) & 0x0000ff00) |
+           (((uint32_t)(f.b + .5f) >>  0) & 0x000000ff);
 }
 
 void
commit 7eb9c8c004d528fe2e94b75507aef229ccb79d21
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Oct 15 16:29:52 2019 -0400

    pixman-image: Fix undefined left shift
    
    ../pixman/pixman-image.c:963:46: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'

diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 461164a..db29ff5 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -960,7 +960,7 @@ _pixman_image_get_solid (pixman_implementation_t *imp,
 	else if (image->bits.format == PIXMAN_x8r8g8b8)
 	    result = image->bits.bits[0] | 0xff000000;
 	else if (image->bits.format == PIXMAN_a8)
-	    result = (*(uint8_t *)image->bits.bits) << 24;
+	    result = (uint32_t)(*(uint8_t *)image->bits.bits) << 24;
 	else
 	    goto otherwise;
     }
commit 81c87543d198926a529e5d9b57c457b98e143c59
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Oct 15 16:27:16 2019 -0400

    pixman-combine: Fix various undefined left shifts
    
    ../pixman/pixman-combine32.c:657:1: runtime error: left shift of 128 by 24 places cannot be represented in type 'int'
    ../pixman/pixman-combine32.c:694:1: runtime error: left shift of 232 by 24 places cannot be represented in type 'int'
    ../pixman/pixman-combine32.c:712:1: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
    ../pixman/pixman-combine32.c:786:1: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
    ../pixman/pixman-combine32.c:805:1: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'

diff --git a/pixman/pixman-combine32.c b/pixman/pixman-combine32.c
index 4c484d3..4a89384 100644
--- a/pixman/pixman-combine32.c
+++ b/pixman/pixman-combine32.c
@@ -568,7 +568,7 @@ combine_multiply_ca (pixman_implementation_t *imp,
 	    uint8_t isa = ~sa;						\
 	    uint8_t da = ALPHA_8 (d);					\
 	    uint8_t ida = ~da;						\
-	    int32_t ra, rr, rg, rb;					\
+	    uint32_t ra, rr, rg, rb;					\
 	    								\
 	    ra = da * 0xff + sa * 0xff - sa * da;			\
 	    rr = isa * RED_8 (d) + ida * RED_8 (s);			\
@@ -609,7 +609,7 @@ combine_multiply_ca (pixman_implementation_t *imp,
 	    uint32_t d = *(dest + i);					\
 	    uint8_t da = ALPHA_8 (d);					\
 	    uint8_t ida = ~da;						\
-	    int32_t ra, rr, rg, rb;					\
+	    uint32_t ra, rr, rg, rb;					\
 	    uint8_t ira, iga, iba;					\
 	    								\
 	    combine_mask_ca (&s, &m);					\
commit 6d0a930b14565149a1214a9265d99ebf516a4e63
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Oct 15 16:25:00 2019 -0400

    pixman-access: Fix various undefined left shifts
    
    ../pixman/pixman-access.c:389:2: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
    ../pixman/pixman-access.c:1101:2: runtime error: left shift of 2 by 30 places cannot be represented in type 'int'
    ../pixman/pixman-access.c:1152:2: runtime error: left shift of 2 by 30 places cannot be represented in type 'int'

diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index 8dfd35f..7c5ce78 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -68,14 +68,14 @@
 
 #ifdef WORDS_BIGENDIAN
 #define FETCH_24(img,l,o)                                              \
-    ((READ (img, (((uint8_t *)(l)) + ((o) * 3) + 0)) << 16)    |       \
-     (READ (img, (((uint8_t *)(l)) + ((o) * 3) + 1)) << 8)     |       \
-     (READ (img, (((uint8_t *)(l)) + ((o) * 3) + 2)) << 0))
+    ((uint32_t)(READ (img, (((uint8_t *)(l)) + ((o) * 3) + 0)) << 16)    |       \
+     (uint32_t)(READ (img, (((uint8_t *)(l)) + ((o) * 3) + 1)) << 8)     |       \
+     (uint32_t)(READ (img, (((uint8_t *)(l)) + ((o) * 3) + 2)) << 0))
 #else
 #define FETCH_24(img,l,o)						\
-    ((READ (img, (((uint8_t *)(l)) + ((o) * 3) + 0)) << 0)	|	\
-     (READ (img, (((uint8_t *)(l)) + ((o) * 3) + 1)) << 8)	|	\
-     (READ (img, (((uint8_t *)(l)) + ((o) * 3) + 2)) << 16))
+    ((uint32_t)(READ (img, (((uint8_t *)(l)) + ((o) * 3) + 0)) << 0)	|	\
+     (uint32_t)(READ (img, (((uint8_t *)(l)) + ((o) * 3) + 1)) << 8)	|	\
+     (uint32_t)(READ (img, (((uint8_t *)(l)) + ((o) * 3) + 2)) << 16))
 #endif
 
 /* Store macros */
@@ -87,7 +87,7 @@
 	uint32_t  *__d = ((uint32_t *)(l)) + ((o) >> 5);		\
 	uint32_t __m, __v;						\
 									\
-	__m = 1 << (0x1f - ((o) & 0x1f));				\
+	__m = 1U << (0x1f - ((o) & 0x1f));				\
 	__v = (v)? __m : 0;						\
 									\
 	WRITE((img), __d, (READ((img), __d) & ~__m) | __v);		\
@@ -100,7 +100,7 @@
 	uint32_t  *__d = ((uint32_t *)(l)) + ((o) >> 5);		\
 	uint32_t __m, __v;						\
 									\
-	__m = 1 << ((o) & 0x1f);					\
+	__m = 1U << ((o) & 0x1f);					\
 	__v = (v)? __m : 0;						\
 									\
 	WRITE((img), __d, (READ((img), __d) & ~__m) | __v);		\
@@ -1091,7 +1091,7 @@ store_scanline_a2r10g10b10_float (bits_image_t *  image,
 
     for (i = 0; i < width; ++i)
     {
-	uint16_t a, r, g, b;
+	uint32_t a, r, g, b;
 
 	a = pixman_float_to_unorm (values[i].a, 2);
 	r = pixman_float_to_unorm (values[i].r, 10);
@@ -1117,7 +1117,7 @@ store_scanline_x2r10g10b10_float (bits_image_t *  image,
 
     for (i = 0; i < width; ++i)
     {
-	uint16_t r, g, b;
+	uint32_t r, g, b;
 
 	r = pixman_float_to_unorm (values[i].r, 10);
 	g = pixman_float_to_unorm (values[i].g, 10);
@@ -1142,7 +1142,7 @@ store_scanline_a2b10g10r10_float (bits_image_t *  image,
 
     for (i = 0; i < width; ++i)
     {
-	uint16_t a, r, g, b;
+	uint32_t a, r, g, b;
 
 	a = pixman_float_to_unorm (values[i].a, 2);
 	r = pixman_float_to_unorm (values[i].r, 10);
@@ -1168,7 +1168,7 @@ store_scanline_x2b10g10r10_float (bits_image_t *  image,
 
     for (i = 0; i < width; ++i)
     {
-	uint16_t r, g, b;
+	uint32_t r, g, b;
 
 	r = pixman_float_to_unorm (values[i].r, 10);
 	g = pixman_float_to_unorm (values[i].g, 10);
@@ -1193,7 +1193,7 @@ store_scanline_a8r8g8b8_sRGB_float (bits_image_t *  image,
 
     for (i = 0; i < width; ++i)
     {
-	uint8_t a, r, g, b;
+	uint32_t a, r, g, b;
 
 	a = pixman_float_to_unorm (values[i].a, 8);
 	r = to_srgb (values[i].r);
@@ -1266,7 +1266,7 @@ fetch_scanline_a8r8g8b8_32_sRGB (bits_image_t   *image,
     
     while (pixel < end)
     {
-	uint8_t a, r, g, b;
+	uint32_t a, r, g, b;
 
 	tmp = READ (image, pixel++);
 
@@ -1290,7 +1290,7 @@ fetch_pixel_a8r8g8b8_32_sRGB (bits_image_t *image,
 {
     uint32_t *bits = image->bits + line * image->rowstride;
     uint32_t tmp = READ (image, bits + offset);
-    uint8_t a, r, g, b;
+    uint32_t a, r, g, b;
 
     a = (tmp >> 24) & 0xff;
     r = (tmp >> 16) & 0xff;
@@ -1319,7 +1319,7 @@ store_scanline_a8r8g8b8_32_sRGB (bits_image_t   *image,
     
     for (i = 0; i < width; ++i)
     {
-	uint8_t a, r, g, b;
+	uint32_t a, r, g, b;
 
 	tmp = values[i];
 
commit a09bcc062ff4a66e905d8d22889ddfb48e3a8cd9
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Oct 15 16:20:17 2019 -0400

    pixman: Fix undefined left shift in pixel_contract_from_float
    
    ../pixman/pixman-utils.c:216:14: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'

diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index 4a3a835..2c2dddd 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -206,7 +206,7 @@ pixman_contract_from_float (uint32_t     *dst,
 
     for (i = 0; i < width; ++i)
     {
-	uint8_t a, r, g, b;
+	uint32_t a, r, g, b;
 
 	a = float_to_unorm (src[i].a, 8);
 	r = float_to_unorm (src[i].r, 8);
commit f6040f56da837e5550d2dd7d49a5814c8a54c1e7
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Oct 15 16:16:45 2019 -0400

    test: Fix undefined left shift in pixel_checker_init
    
    ../test/utils.c:2070:57: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'

diff --git a/test/utils.c b/test/utils.c
index 2e3b547..1fafd80 100644
--- a/test/utils.c
+++ b/test/utils.c
@@ -2067,10 +2067,10 @@ pixel_checker_init (pixel_checker_t *checker, pixman_format_code_t format)
 	break;
     }
 
-    checker->am = ((1 << PIXMAN_FORMAT_A (format)) - 1) << checker->as;
-    checker->rm = ((1 << PIXMAN_FORMAT_R (format)) - 1) << checker->rs;
-    checker->gm = ((1 << PIXMAN_FORMAT_G (format)) - 1) << checker->gs;
-    checker->bm = ((1 << PIXMAN_FORMAT_B (format)) - 1) << checker->bs;
+    checker->am = ((1U << PIXMAN_FORMAT_A (format)) - 1) << checker->as;
+    checker->rm = ((1U << PIXMAN_FORMAT_R (format)) - 1) << checker->rs;
+    checker->gm = ((1U << PIXMAN_FORMAT_G (format)) - 1) << checker->gs;
+    checker->bm = ((1U << PIXMAN_FORMAT_B (format)) - 1) << checker->bs;
 
     checker->aw = PIXMAN_FORMAT_A (format);
     checker->rw = PIXMAN_FORMAT_R (format);
commit 52c27c82dee14725b12959d795a7ffb2c23576bf
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Oct 15 16:12:51 2019 -0400

    test: Fix undefined left shift in affine-test
    
    ../test/affine-test.c:174:34: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

diff --git a/test/affine-test.c b/test/affine-test.c
index 8e19023..f516856 100644
--- a/test/affine-test.c
+++ b/test/affine-test.c
@@ -171,7 +171,7 @@ test_composite (int      testnum,
 	    int i = prng_rand_n (2);
 	    int j = prng_rand_n (3);
 	    int bitnum = prng_rand_n (32);
-	    transform.matrix[i][j] ^= 1 << bitnum;
+	    transform.matrix[i][j] ^= 1U << bitnum;
 	    if (prng_rand_n (2))
 		break;
 	}


More information about the xorg-commit mailing list