[babl] babl: use _aligned_malloc() instead of aligned_alloc() on Win32.



commit 5fa5653209ff96a9ebd7e421eaee6d46edee69d1
Author: Jehan <jehan girinstud io>
Date:   Sat Sep 2 14:18:07 2017 +0200

    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

 babl/babl-space.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
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++)
   {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]