Fix a warning on 64-bit Windows
authorJosh Triplett <josh@joshtriplett.org>
Tue, 25 Mar 2014 04:24:53 +0000 (21:24 -0700)
committerJosh Triplett <josh@joshtriplett.org>
Tue, 25 Mar 2014 04:24:53 +0000 (21:24 -0700)
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.

src/x86/ffi.c

index e1f2447..79407ae 100644 (file)
@@ -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