ffi 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ffi might be problematic. Click here for more details.
- data/Rakefile +1 -1
- data/ext/AbstractMemory.c +4 -1
- data/ext/Invoker.c +3 -1
- data/ext/compat.h +8 -0
- metadata +3 -2
data/Rakefile
CHANGED
data/ext/AbstractMemory.c
CHANGED
@@ -19,6 +19,9 @@ VALUE rb_FFI_AbstractMemory_class = Qnil;
|
|
19
19
|
static VALUE classMemory = Qnil;
|
20
20
|
|
21
21
|
#define ADDRESS(self, offset) (memory_address((self)) + NUM2ULONG(offset))
|
22
|
+
#ifndef RARRAY_LEN
|
23
|
+
# define RARRAY_LEN(ary) RARRAY(ary)->len
|
24
|
+
#endif
|
22
25
|
|
23
26
|
#define NUM_OP(name, type, toNative, fromNative) \
|
24
27
|
static VALUE memory_put_##name(VALUE self, VALUE offset, VALUE value); \
|
@@ -47,7 +50,7 @@ static VALUE memory_put_array_of_##name(VALUE self, VALUE offset, VALUE ary); \
|
|
47
50
|
static VALUE \
|
48
51
|
memory_put_array_of_##name(VALUE self, VALUE offset, VALUE ary) \
|
49
52
|
{ \
|
50
|
-
long count =
|
53
|
+
long count = RARRAY_LEN(ary); \
|
51
54
|
long off = NUM2LONG(offset); \
|
52
55
|
AbstractMemory* memory = (AbstractMemory *) DATA_PTR(self); \
|
53
56
|
caddr_t address = memory->address; \
|
data/ext/Invoker.c
CHANGED
@@ -7,6 +7,8 @@
|
|
7
7
|
#include <ffi.h>
|
8
8
|
|
9
9
|
#include "rbffi.h"
|
10
|
+
#include "compat.h"
|
11
|
+
|
10
12
|
#include "AbstractMemory.h"
|
11
13
|
#include "MemoryPointer.h"
|
12
14
|
#include "Platform.h"
|
@@ -54,7 +56,7 @@ invoker_new(VALUE self, VALUE libname, VALUE cname, VALUE parameterTypes,
|
|
54
56
|
invoker = ALLOC(Invoker);
|
55
57
|
MEMZERO(invoker, Invoker, 1);
|
56
58
|
|
57
|
-
invoker->paramCount =
|
59
|
+
invoker->paramCount = RARRAY_LEN(parameterTypes);
|
58
60
|
invoker->paramTypes = ALLOC_N(NativeType, invoker->paramCount);
|
59
61
|
invoker->ffiParamTypes = ALLOC_N(ffi_type *, invoker->paramCount);
|
60
62
|
|
data/ext/compat.h
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wayne Meissner
|
@@ -31,6 +31,7 @@ files:
|
|
31
31
|
- ext/Buffer.c
|
32
32
|
- ext/Callback.c
|
33
33
|
- ext/Callback.h
|
34
|
+
- ext/compat.h
|
34
35
|
- ext/extconf.rb
|
35
36
|
- ext/ffi.c
|
36
37
|
- ext/ffi.mk
|
@@ -351,7 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
351
352
|
requirements: []
|
352
353
|
|
353
354
|
rubyforge_project: ffi
|
354
|
-
rubygems_version: 1.3.
|
355
|
+
rubygems_version: 1.3.1
|
355
356
|
signing_key:
|
356
357
|
specification_version: 2
|
357
358
|
summary: A Ruby foreign function interface (compatible with Rubinius and JRuby FFI)
|