From: Jehan Date: Sat, 2 Sep 2017 12:18:07 +0000 (+0200) Subject: babl: use _aligned_malloc() instead of aligned_alloc() on Win32. X-Git-Tag: archive/raspbian/1%0.1.106-3+rpi1^2~15^2~21^2~164 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5fa5653209ff96a9ebd7e421eaee6d46edee69d1;p=babl.git babl: use _aligned_malloc() instead of aligned_alloc() on Win32. Thanks to Lionel N. for raising the issue. It was failing to build for Windows with: > babl/babl-space.c:503: undefined reference to `aligned_alloc' Windows has apparently a similar API, except that the size and alignment parameters are inverted. See https://msdn.microsoft.com/library/8z34s9c6.aspx --- diff --git a/babl/babl-space.c b/babl/babl-space.c index 77fc1ec..23a1c3e 100644 --- a/babl/babl-space.c +++ b/babl/babl-space.c @@ -500,7 +500,11 @@ universal_nonlinear_rgba_u8_converter (const Babl *conversion,unsigned char *src uint8_t *rgba_in_u8 = (void*)src_char; uint8_t *rgba_out_u8 = (void*)dst_char; +#ifndef _WIN32 float *rgb = aligned_alloc (16, sizeof(float) * 4 * samples); +#else + float *rgb = _aligned_malloc (sizeof(float) * 4 * samples, 16); +#endif for (i = 0; i < samples; i++) { @@ -642,7 +646,11 @@ universal_nonlinear_rgba_u8_converter_sse2 (const Babl *conversion,unsigned char uint8_t *rgba_in_u8 = (void*)src_char; uint8_t *rgba_out_u8 = (void*)dst_char; +#ifndef _WIN32 float *rgb = aligned_alloc (16, sizeof(float) * 4 * samples); +#else + float *rgb = _aligned_malloc (sizeof(float) * 4 * samples, 16); +#endif for (i = 0; i < samples; i++) {