ffi 1.2.0.pre3-x86-mingw32 → 1.2.0.pre6-x86-mingw32
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/lib/1.8/ffi_c.so +0 -0
- data/lib/1.9/ffi_c.so +0 -0
- data/lib/ffi.rb +9 -0
- data/lib/ffi/library.rb +4 -2
- data/spec/ffi/callback_spec.rb +11 -1
- metadata +4 -5
data/lib/1.8/ffi_c.so
CHANGED
Binary file
|
data/lib/1.9/ffi_c.so
CHANGED
Binary file
|
data/lib/ffi.rb
CHANGED
@@ -12,4 +12,13 @@ if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby"
|
|
12
12
|
end
|
13
13
|
|
14
14
|
require 'ffi/ffi'
|
15
|
+
|
16
|
+
elsif defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
|
17
|
+
$LOAD_PATH.delete(File.dirname(__FILE__))
|
18
|
+
$LOAD_PATH.delete(File.join(File.dirname(__FILE__), 'ffi'))
|
19
|
+
unless $LOADED_FEATURES.nil?
|
20
|
+
$LOADED_FEATURES.delete(__FILE__)
|
21
|
+
$LOADED_FEATURES.delete('ffi.rb')
|
22
|
+
end
|
23
|
+
require 'ffi.rb'
|
15
24
|
end
|
data/lib/ffi/library.rb
CHANGED
@@ -212,7 +212,7 @@ module FFI
|
|
212
212
|
cname, arg_types, ret_type, opts = (a4 && (a2.is_a?(String) || a2.is_a?(Symbol))) ? [ a2, a3, a4, a5 ] : [ mname.to_s, a2, a3, a4 ]
|
213
213
|
|
214
214
|
# Convert :foo to the native type
|
215
|
-
arg_types.map
|
215
|
+
arg_types = arg_types.map { |e| find_type(e) }
|
216
216
|
options = {
|
217
217
|
:convention => ffi_convention,
|
218
218
|
:type_map => defined?(@ffi_typedefs) ? @ffi_typedefs : nil,
|
@@ -361,10 +361,12 @@ code
|
|
361
361
|
[ nil, args[0], args[1] ]
|
362
362
|
end
|
363
363
|
|
364
|
+
native_params = params.map { |e| find_type(e) }
|
365
|
+
raise ArgumentError, "callbacks cannot have variadic parameters" if native_params.include?(FFI::Type::VARARGS)
|
364
366
|
options = Hash.new
|
365
367
|
options[:convention] = ffi_convention
|
366
368
|
options[:enums] = @ffi_enums if defined?(@ffi_enums)
|
367
|
-
cb = FFI::CallbackInfo.new(find_type(ret),
|
369
|
+
cb = FFI::CallbackInfo.new(find_type(ret), native_params, options)
|
368
370
|
|
369
371
|
# Add to the symbol -> type map (unless there was no name)
|
370
372
|
unless name.nil?
|
data/spec/ffi/callback_spec.rb
CHANGED
@@ -665,4 +665,14 @@ describe "Callback with " do
|
|
665
665
|
v.pointer.should eq FFI::Pointer::NULL
|
666
666
|
end
|
667
667
|
|
668
|
-
|
668
|
+
it "varargs parameters are rejected" do
|
669
|
+
lambda {
|
670
|
+
Module.new do
|
671
|
+
extend FFI::Library
|
672
|
+
ffi_lib TestLibrary::PATH
|
673
|
+
callback :cbVrL, [ :varargs ], :long
|
674
|
+
end
|
675
|
+
}.should raise_error(ArgumentError)
|
676
|
+
end
|
677
|
+
|
678
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 2496615925
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
9
|
- 0
|
10
10
|
- pre
|
11
|
-
-
|
12
|
-
version: 1.2.0.
|
11
|
+
- 6
|
12
|
+
version: 1.2.0.pre6
|
13
13
|
platform: x86-mingw32
|
14
14
|
authors:
|
15
15
|
- Wayne Meissner
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-11-
|
20
|
+
date: 2012-11-13 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
prerelease: false
|
@@ -516,7 +516,6 @@ rdoc_options: []
|
|
516
516
|
|
517
517
|
require_paths:
|
518
518
|
- lib
|
519
|
-
- lib/ffi
|
520
519
|
- ext/ffi_c
|
521
520
|
required_ruby_version: !ruby/object:Gem::Requirement
|
522
521
|
none: false
|