Make 'fast_composite_scaled_nearest_*' less suspicious
authorSiarhei Siamashka <siarhei.siamashka@nokia.com>
Mon, 10 Jan 2011 16:29:33 +0000 (18:29 +0200)
committerSiarhei Siamashka <siarhei.siamashka@nokia.com>
Sun, 16 Jan 2011 20:32:33 +0000 (22:32 +0200)
Taking address of a variable and then using it as an array looks suspicious
to static code analyzers. So change it into an array with 1 element to make
them happy. Both old and new variants of this code are correct because 'vx'
and 'unit_x' arguments are set to 0 and it means that the called scanline
function can only access a single element of 'zero' buffer.

pixman/pixman-fast-path.h

index d98cfbf..b829030 100644 (file)
@@ -346,16 +346,16 @@ fast_composite_scaled_nearest  ## scale_func_name (pixman_implementation_t *imp,
        }                                                                                       \
        else if (PIXMAN_REPEAT_ ## repeat_mode == PIXMAN_REPEAT_NONE)                           \
        {                                                                                       \
-           static src_type_t zero = 0;                                                         \
+           static src_type_t zero[1] = { 0 };                                                  \
            if (y < 0 || y >= src_image->bits.height)                                           \
            {                                                                                   \
-               scanline_func (dst, &zero, left_pad + width + right_pad, 0, 0, 0);              \
+               scanline_func (dst, zero, left_pad + width + right_pad, 0, 0, 0);               \
                continue;                                                                       \
            }                                                                                   \
            src = src_first_line + src_stride * y;                                              \
            if (left_pad > 0)                                                                   \
            {                                                                                   \
-               scanline_func (dst, &zero, left_pad, 0, 0, 0);                                  \
+               scanline_func (dst, zero, left_pad, 0, 0, 0);                                   \
            }                                                                                   \
            if (width > 0)                                                                      \
            {                                                                                   \
@@ -363,7 +363,7 @@ fast_composite_scaled_nearest  ## scale_func_name (pixman_implementation_t *imp,
            }                                                                                   \
            if (right_pad > 0)                                                                  \
            {                                                                                   \
-               scanline_func (dst + left_pad + width, &zero, right_pad, 0, 0, 0);              \
+               scanline_func (dst + left_pad + width, zero, right_pad, 0, 0, 0);               \
            }                                                                                   \
        }                                                                                       \
        else                                                                                    \