ffi 1.0.7-x86-mingw32 → 1.0.9-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.

Files changed (38) hide show
  1. data/Rakefile +3 -3
  2. data/ext/ffi_c/AbstractMemory.c +40 -3
  3. data/ext/ffi_c/AbstractMemory.h +2 -2
  4. data/ext/ffi_c/Buffer.c +28 -0
  5. data/ext/ffi_c/DynamicLibrary.c +17 -6
  6. data/ext/ffi_c/Function.c +20 -10
  7. data/ext/ffi_c/MemoryPointer.c +17 -27
  8. data/ext/ffi_c/Platform.c +17 -7
  9. data/ext/ffi_c/Pointer.c +103 -12
  10. data/ext/ffi_c/Pointer.h +9 -0
  11. data/ext/ffi_c/Struct.c +43 -1
  12. data/ext/ffi_c/StructLayout.c +2 -1
  13. data/lib/1.8/ffi_c.so +0 -0
  14. data/lib/1.9/ffi_c.so +0 -0
  15. data/lib/ffi/enum.rb +1 -3
  16. data/lib/ffi/platform.rb +1 -1
  17. data/lib/ffi/platform/i386-darwin/types.conf +100 -0
  18. data/lib/ffi/platform/i386-linux/types.conf +100 -0
  19. data/lib/ffi/platform/i386-openbsd/types.conf +126 -0
  20. data/lib/ffi/platform/i386-solaris/types.conf +122 -0
  21. data/lib/ffi/platform/i386-windows/types.conf +105 -0
  22. data/lib/ffi/platform/powerpc-aix/types.conf +180 -0
  23. data/lib/ffi/platform/powerpc-darwin/types.conf +100 -0
  24. data/lib/ffi/platform/sparc-solaris/types.conf +128 -0
  25. data/lib/ffi/platform/sparcv9-solaris/types.conf +128 -0
  26. data/lib/ffi/platform/x86_64-darwin/types.conf +100 -0
  27. data/lib/ffi/platform/x86_64-linux/types.conf +100 -0
  28. data/lib/ffi/platform/x86_64-openbsd/types.conf +126 -0
  29. data/lib/ffi/platform/x86_64-solaris/types.conf +122 -0
  30. data/lib/ffi/struct.rb +1 -1
  31. data/lib/ffi/tools/generator.rb +1 -1
  32. data/lib/ffi/types.rb +2 -1
  33. data/spec/ffi/dup_spec.rb +65 -0
  34. data/spec/ffi/enum_spec.rb +28 -0
  35. data/spec/ffi/strptr_spec.rb +11 -2
  36. data/spec/ffi/struct_spec.rb +2 -2
  37. data/tasks/extension.rake +1 -1
  38. metadata +20 -21
@@ -196,4 +196,32 @@ describe "All enums" do
196
196
  enum[424242].should == :c15
197
197
  enum[42424242].should == :c16
198
198
  end
199
+ it "return nil for values that don't have a symbol" do
200
+ enum = TestEnum3.enum_type(:enum_type1)
201
+ enum[-1].should == nil
202
+ enum[4].should == nil
203
+
204
+ enum = TestEnum3.enum_type(:enum_type2)
205
+ enum[0].should == nil
206
+ enum[41].should == nil
207
+ enum[46].should == nil
208
+
209
+ enum = TestEnum3.enum_type(:enum_type3)
210
+ enum[0].should == nil
211
+ enum[41].should == nil
212
+ enum[44].should == nil
213
+ enum[4241].should == nil
214
+ enum[4244].should == nil
215
+
216
+ enum = TestEnum3.enum_type(:enum_type4)
217
+ enum[0].should == nil
218
+ enum[41].should == nil
219
+ enum[43].should == nil
220
+ enum[4241].should == nil
221
+ enum[4243].should == nil
222
+ enum[424241].should == nil
223
+ enum[424243].should == nil
224
+ enum[42424241].should == nil
225
+ enum[42424243].should == nil
226
+ end
199
227
  end
@@ -17,12 +17,17 @@
17
17
  require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
18
18
 
19
19
  describe "functions returning :strptr" do
20
+
20
21
  it "can attach function with :strptr return type" do
21
22
  lambda do
22
23
  m = Module.new do
23
24
  extend FFI::Library
24
25
  ffi_lib FFI::Library::LIBC
25
- attach_function :strdup, [ :string ], :strptr
26
+ if !FFI::Platform.windows?
27
+ attach_function :strdup, [ :string ], :strptr
28
+ else
29
+ attach_function :_strdup, [ :string ], :strptr
30
+ end
26
31
  end
27
32
  end.should_not raise_error
28
33
  end
@@ -30,8 +35,12 @@ describe "functions returning :strptr" do
30
35
  module StrPtr
31
36
  extend FFI::Library
32
37
  ffi_lib FFI::Library::LIBC
33
- attach_function :strdup, [ :string ], :strptr
34
38
  attach_function :free, [ :pointer ], :void
39
+ if !FFI::Platform.windows?
40
+ attach_function :strdup, [ :string ], :strptr
41
+ else
42
+ attach_function :strdup, :_strdup, [ :string ], :strptr
43
+ end
35
44
  end
36
45
 
37
46
  it "should return [ String, Pointer ]" do
@@ -584,9 +584,9 @@ describe FFI::Struct, ' with an array field' do
584
584
  # it 'should cache array object for successive calls' do
585
585
  # @s[:a].object_id.should == @s[:a].object_id
586
586
  # end
587
- it 'should return the size of the array field in bytes' do
587
+ it 'should return the number of elements in the array field' do
588
588
  @s = LibTest::StructWithArray.new(LibTest.struct_make_struct_with_array(0, 1, 2, 3, 4))
589
- @s[:a].size.should == 20
589
+ @s[:a].size.should == 5
590
590
  end
591
591
  it 'should allow iteration through the array elements' do
592
592
  @s = LibTest::StructWithArray.new(LibTest.struct_make_struct_with_array(0, 1, 2, 3, 4))
@@ -13,7 +13,7 @@ spec = Gem::Specification.new do |s|
13
13
  s.extensions = %w(ext/ffi_c/extconf.rb gen/Rakefile)
14
14
  s.require_path = 'lib'
15
15
  s.files = PROJ.gem.files
16
- s.add_dependency *PROJ.gem.dependencies.flatten
16
+ s.add_dependency *PROJ.gem.dependencies.flatten unless PROJ.gem.dependencies.empty?
17
17
  PROJ.gem.extras.each do |msg, val|
18
18
  case val
19
19
  when Proc
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 7
10
- version: 1.0.7
9
+ - 9
10
+ version: 1.0.9
11
11
  platform: x86-mingw32
12
12
  authors:
13
13
  - Wayne Meissner
@@ -15,25 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-16 00:00:00 +10:00
18
+ date: 2011-05-22 00:00:00 +10:00
19
19
  default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: rake
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 49
30
- segments:
31
- - 0
32
- - 8
33
- - 7
34
- version: 0.8.7
35
- type: :runtime
36
- version_requirements: *id001
20
+ dependencies: []
21
+
37
22
  description: |-
38
23
  Ruby-FFI is a ruby extension for programmatically loading dynamic
39
24
  libraries, binding functions within them, and calling those functions
@@ -365,6 +350,19 @@ files:
365
350
  - lib/ffi/library.rb
366
351
  - lib/ffi/managedstruct.rb
367
352
  - lib/ffi/memorypointer.rb
353
+ - lib/ffi/platform/i386-darwin/types.conf
354
+ - lib/ffi/platform/i386-linux/types.conf
355
+ - lib/ffi/platform/i386-openbsd/types.conf
356
+ - lib/ffi/platform/i386-solaris/types.conf
357
+ - lib/ffi/platform/i386-windows/types.conf
358
+ - lib/ffi/platform/powerpc-aix/types.conf
359
+ - lib/ffi/platform/powerpc-darwin/types.conf
360
+ - lib/ffi/platform/sparc-solaris/types.conf
361
+ - lib/ffi/platform/sparcv9-solaris/types.conf
362
+ - lib/ffi/platform/x86_64-darwin/types.conf
363
+ - lib/ffi/platform/x86_64-linux/types.conf
364
+ - lib/ffi/platform/x86_64-openbsd/types.conf
365
+ - lib/ffi/platform/x86_64-solaris/types.conf
368
366
  - lib/ffi/platform.rb
369
367
  - lib/ffi/pointer.rb
370
368
  - lib/ffi/struct.rb
@@ -384,6 +382,7 @@ files:
384
382
  - spec/ffi/callback_spec.rb
385
383
  - spec/ffi/custom_param_type.rb
386
384
  - spec/ffi/custom_type_spec.rb
385
+ - spec/ffi/dup_spec.rb
387
386
  - spec/ffi/enum_spec.rb
388
387
  - spec/ffi/errno_spec.rb
389
388
  - spec/ffi/ffi_spec.rb