[libpng16] arm: Use png_aligncastconst for an upcast in Neon intrinsics

This changes the arm/palette_neon_intrinsics.c code from using a bare
cast to using the portable macro `png_aligncastconst`.  This removes
the `-Wcast-align` warning.

The cast is safe because the pointer was allocated by `malloc(1024)`,
and `malloc` is required to return a pointer with sufficient alignment
for anything the allocation can accomodate.

Nevertheless, this is a quick and dirty fix; the use of `png_bytep` in
the `png_struct` declaration of the pointer is machine-specific.  Other
architectures may need different types and, consequently, the only type
which is portable to other companies' CPUs is `(void*)`.

This is a cherry-pick of commit a604b12c112162bfb45a0476e956777f6ed82d85
from branch 'libpng18'.

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
This commit is contained in:
John Bowler 2024-09-26 09:35:34 -07:00 committed by Cosmin Truta
parent d288a1dd36
commit d3cf9b6e22

View File

@ -64,7 +64,7 @@ png_do_expand_palette_rgba8_neon(png_structrp png_ptr, png_row_infop row_info,
{ {
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
const png_uint_32 *riffled_palette = const png_uint_32 *riffled_palette =
(const png_uint_32 *)png_ptr->riffled_palette; png_aligncastconst(png_const_uint_32p, png_ptr->riffled_palette);
const png_uint_32 pixels_per_chunk = 4; const png_uint_32 pixels_per_chunk = 4;
png_uint_32 i; png_uint_32 i;