summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlie Savage <cfis@zerista.com>2011-08-17 23:56:22 -0600
committerCharlie Savage <cfis@zerista.com>2011-08-17 23:56:22 -0600
commita2763086cb6d02f8e130fb050a9e7ae8efe7eb52 (patch)
tree3770a886982805b048fcb27e553f25658639107e
parent365a162a5e1fda91a3d55dd1ad663051e50bb89e (diff)
downloadffi-a2763086cb6d02f8e130fb050a9e7ae8efe7eb52.tar.gz
VC++ requires variables to be declared at the start of blocks.
-rw-r--r--ext/ffi_c/MethodHandle.c5
-rw-r--r--ext/ffi_c/Variadic.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/ext/ffi_c/MethodHandle.c b/ext/ffi_c/MethodHandle.c
index ef82347..6e96c48 100644
--- a/ext/ffi_c/MethodHandle.c
+++ b/ext/ffi_c/MethodHandle.c
@@ -150,7 +150,7 @@ trampoline_size(void)
}
/*
- * attached_method_vinvoke is used functions with more than 6 parameters, or
+ * attached_method_invoke is used functions with more than 6 parameters, or
* with struct param or return values
*/
static void
@@ -316,6 +316,7 @@ trampoline_size(void)
void
rbffi_MethodHandle_Init(VALUE module)
{
+ ffi_status ffiStatus;
defaultClosurePool = rbffi_ClosurePool_New((int) trampoline_size(), prep_trampoline, NULL);
#if defined(CUSTOM_TRAMPOLINE)
@@ -323,7 +324,7 @@ rbffi_MethodHandle_Init(VALUE module)
rb_raise(rb_eFatal, "Could not locate offsets in trampoline code");
}
#else
- ffi_status ffiStatus = ffi_prep_cif(&mh_cif, FFI_DEFAULT_ABI, 3, &ffi_type_ulong,
+ ffiStatus = ffi_prep_cif(&mh_cif, FFI_DEFAULT_ABI, 3, &ffi_type_ulong,
methodHandleParamTypes);
if (ffiStatus != FFI_OK) {
rb_raise(rb_eFatal, "ffi_prep_cif failed. status=%#x", ffiStatus);
diff --git a/ext/ffi_c/Variadic.c b/ext/ffi_c/Variadic.c
index 3d125b5..5b27d90 100644
--- a/ext/ffi_c/Variadic.c
+++ b/ext/ffi_c/Variadic.c
@@ -86,7 +86,8 @@ variadic_initialize(VALUE self, VALUE rbFunction, VALUE rbParameterTypes, VALUE
VALUE retval = Qnil;
VALUE convention = Qnil;
VALUE fixed = Qnil;
- int i;
+ VALUE rbConventionStr;
+ int i;
Check_Type(options, T_HASH);
convention = rb_hash_aref(options, ID2SYM(rb_intern("convention")));
@@ -97,7 +98,7 @@ variadic_initialize(VALUE self, VALUE rbFunction, VALUE rbParameterTypes, VALUE
invoker->function = rbffi_AbstractMemory_Cast(rbFunction, rbffi_PointerClass)->address;
#if defined(_WIN32) || defined(__WIN32__)
- VALUE rbConventionStr = rb_funcall2(convention, rb_intern("to_s"), 0, NULL);
+ rbConventionStr = rb_funcall2(convention, rb_intern("to_s"), 0, NULL);
invoker->abi = (RTEST(convention) && strcmp(StringValueCStr(rbConventionStr), "stdcall") == 0)
? FFI_STDCALL : FFI_DEFAULT_ABI;
#else