Commit 56be47f87629e31afbcb0774aa65735f539ee972

Josh Triplett 2014-03-24T21:24:53

Fix a warning on 64-bit Windows When sizeof(size_t) != sizeof(unsigned), adding a size_t to cif->bytes produces a "possible loss of data" warning. However, the size_t in question refers to the size of a single parameter. Use a cast to avoid the warning.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/x86/ffi.c b/src/x86/ffi.c
index e1f2447..79407ae 100644
--- a/src/x86/ffi.c
+++ b/src/x86/ffi.c
@@ -309,7 +309,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
     {
       if (((*ptr)->alignment - 1) & cif->bytes)
         cif->bytes = ALIGN(cif->bytes, (*ptr)->alignment);
-      cif->bytes += ALIGN((*ptr)->size, FFI_SIZEOF_ARG);
+      cif->bytes += (unsigned)ALIGN((*ptr)->size, FFI_SIZEOF_ARG);
     }
 
 #ifdef X86_WIN64