tests: Fix undefined left shift in internal-screenshot-test
authorAdam Jackson <ajax@redhat.com>
Wed, 16 Oct 2019 20:07:47 +0000 (16:07 -0400)
committerAdam Jackson <ajax@redhat.com>
Wed, 16 Oct 2019 20:07:47 +0000 (16:07 -0400)
../tests/internal-screenshot-test.c:60:18: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'

tests/internal-screenshot-test.c

index 2a7424b8b89933a142d41396d68a1cc5c49fa947..1963e77eeeff91030fa57443f9a04e7b39c3ce8f 100644 (file)
@@ -38,7 +38,7 @@ draw_stuff(pixman_image_t *image)
        int w, h;
        int stride; /* bytes */
        int x, y;
-       uint8_t r, g, b;
+       uint32_t r, g, b;
        uint32_t *pixels;
        uint32_t *pixel;
        pixman_format_code_t fmt;
@@ -57,7 +57,7 @@ draw_stuff(pixman_image_t *image)
                        g = x + y;
                        r = y;
                        pixel = pixels + (y * stride / 4) + x;
-                       *pixel = (255 << 24) | (r << 16) | (g << 8) | b;
+                       *pixel = (255U << 24) | (r << 16) | (g << 8) | b;
                }
 }