ffi 1.2.1-x86-mingw32 → 1.3.0-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 (69) hide show
  1. data/README.md +10 -5
  2. data/ext/ffi_c/ArrayType.c +6 -2
  3. data/ext/ffi_c/Buffer.c +3 -1
  4. data/ext/ffi_c/Call.c +12 -21
  5. data/ext/ffi_c/FunctionInfo.c +27 -2
  6. data/ext/ffi_c/MappedType.c +1 -2
  7. data/ext/ffi_c/MemoryPointer.c +35 -4
  8. data/ext/ffi_c/Pointer.c +5 -4
  9. data/ext/ffi_c/Struct.c +125 -8
  10. data/ext/ffi_c/StructByReference.c +33 -0
  11. data/ext/ffi_c/StructByValue.c +2 -2
  12. data/ext/ffi_c/StructLayout.c +135 -1
  13. data/ext/ffi_c/Type.c +1 -0
  14. data/ext/ffi_c/extconf.rb +1 -1
  15. data/ffi.gemspec +1 -1
  16. data/lib/1.8/ffi_c.so +0 -0
  17. data/lib/1.9/ffi_c.so +0 -0
  18. data/lib/ffi.rb +2 -1
  19. data/lib/ffi/library.rb +2 -0
  20. data/lib/ffi/managedstruct.rb +37 -37
  21. data/lib/ffi/struct.rb +74 -1
  22. data/lib/ffi/struct_layout_builder.rb +50 -1
  23. data/lib/ffi/tools/generator.rb +2 -0
  24. data/lib/ffi/tools/generator_task.rb +1 -0
  25. data/lib/ffi/tools/types_generator.rb +2 -0
  26. data/libtest/Benchmark.c +1 -15
  27. data/libtest/BoolTest.c +2 -16
  28. data/libtest/BufferTest.c +3 -17
  29. data/libtest/ClosureTest.c +1 -15
  30. data/libtest/EnumTest.c +1 -15
  31. data/libtest/FunctionTest.c +2 -16
  32. data/libtest/GlobalVariable.c +2 -16
  33. data/libtest/LastErrorTest.c +2 -16
  34. data/libtest/NumberTest.c +1 -15
  35. data/libtest/PointerTest.c +1 -15
  36. data/libtest/ReferenceTest.c +1 -15
  37. data/libtest/StringTest.c +1 -15
  38. data/libtest/StructTest.c +1 -15
  39. data/libtest/UnionTest.c +1 -15
  40. data/libtest/VariadicTest.c +2 -16
  41. data/spec/ffi/async_callback_spec.rb +3 -14
  42. data/spec/ffi/bool_spec.rb +7 -18
  43. data/spec/ffi/buffer_spec.rb +26 -37
  44. data/spec/ffi/callback_spec.rb +96 -107
  45. data/spec/ffi/custom_param_type.rb +2 -13
  46. data/spec/ffi/custom_type_spec.rb +1 -12
  47. data/spec/ffi/dup_spec.rb +7 -18
  48. data/spec/ffi/enum_spec.rb +128 -139
  49. data/spec/ffi/errno_spec.rb +2 -13
  50. data/spec/ffi/ffi_spec.rb +4 -15
  51. data/spec/ffi/function_spec.rb +6 -17
  52. data/spec/ffi/library_spec.rb +26 -26
  53. data/spec/ffi/long_double.rb +1 -12
  54. data/spec/ffi/managed_struct_spec.rb +3 -18
  55. data/spec/ffi/number_spec.rb +32 -43
  56. data/spec/ffi/pointer_spec.rb +7 -22
  57. data/spec/ffi/rbx/memory_pointer_spec.rb +17 -17
  58. data/spec/ffi/rbx/struct_spec.rb +2 -2
  59. data/spec/ffi/spec_helper.rb +10 -12
  60. data/spec/ffi/string_spec.rb +9 -20
  61. data/spec/ffi/strptr_spec.rb +2 -13
  62. data/spec/ffi/struct_callback_spec.rb +3 -14
  63. data/spec/ffi/struct_initialize_spec.rb +3 -14
  64. data/spec/ffi/struct_packed_spec.rb +7 -18
  65. data/spec/ffi/struct_spec.rb +93 -104
  66. data/spec/ffi/typedef_spec.rb +5 -16
  67. data/spec/ffi/union_spec.rb +4 -15
  68. data/spec/ffi/variadic_spec.rb +7 -18
  69. metadata +4 -4
@@ -1,17 +1,6 @@
1
1
  #
2
2
  # This file is part of ruby-ffi.
3
- #
4
- # This code is free software: you can redistribute it and/or modify it under
5
- # the terms of the GNU Lesser General Public License version 3 only, as
6
- # published by the Free Software Foundation.
7
- #
8
- # This code is distributed in the hope that it will be useful, but WITHOUT
9
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
- # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11
- # version 3 for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public License
14
- # version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
3
+ # For licensing, see LICENSE.SPECS
15
4
  #
16
5
 
17
6
  require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
@@ -23,7 +12,7 @@ describe "Custom type definitions" do
23
12
  typedef :uint, :fubar_t
24
13
  attach_function :ret_u32, [ :fubar_t ], :fubar_t
25
14
  end
26
- CustomTypedef.ret_u32(0x12345678).should eq 0x12345678
15
+ CustomTypedef.ret_u32(0x12345678).should == 0x12345678
27
16
  end
28
17
  it "variadic invoker with custom typedef" do
29
18
  module VariadicCustomTypedef
@@ -34,7 +23,7 @@ describe "Custom type definitions" do
34
23
  end
35
24
  buf = FFI::Buffer.new :uint, 10
36
25
  VariadicCustomTypedef.pack_varargs(buf, "i", :fubar_t, 0x12345678)
37
- buf.get_int64(0).should eq 0x12345678
26
+ buf.get_int64(0).should == 0x12345678
38
27
  end
39
28
  it "Callback with custom typedef parameter" do
40
29
  module CallbackCustomTypedef
@@ -46,7 +35,7 @@ describe "Custom type definitions" do
46
35
  end
47
36
  i = 0
48
37
  CallbackCustomTypedef.testCallbackU32rV(0xdeadbeef) { |v| i = v }
49
- i.should eq 0xdeadbeef
38
+ i.should == 0xdeadbeef
50
39
  end
51
40
  module StructCustomTypedef
52
41
  extend FFI::Library
@@ -59,7 +48,7 @@ describe "Custom type definitions" do
59
48
  it "Struct with custom typedef field" do
60
49
  s = StructCustomTypedef::S.new
61
50
  s[:a] = 0x12345678
62
- s.pointer.get_uint(0).should eq 0x12345678
51
+ s.pointer.get_uint(0).should == 0x12345678
63
52
  end
64
53
 
65
54
  it "attach_function after a typedef should not reject normal types" do
@@ -1,17 +1,6 @@
1
1
  #
2
2
  # This file is part of ruby-ffi.
3
- #
4
- # This code is free software: you can redistribute it and/or modify it under
5
- # the terms of the GNU Lesser General Public License version 3 only, as
6
- # published by the Free Software Foundation.
7
- #
8
- # This code is distributed in the hope that it will be useful, but WITHOUT
9
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
- # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11
- # version 3 for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public License
14
- # version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
3
+ # For licensing, see LICENSE.SPECS
15
4
  #
16
5
 
17
6
  require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
@@ -56,7 +45,7 @@ describe 'Union' do
56
45
  if k == 'f32' or k == 'f64'
57
46
  (@u[type[1]] - LibTest.send("union_align_#{k}", @u.to_ptr)).abs.should < 0.00001
58
47
  else
59
- @u[type[1]].should eq LibTest.send("union_align_#{k}", @u.to_ptr)
48
+ @u[type[1]].should == LibTest.send("union_align_#{k}", @u.to_ptr)
60
49
  end
61
50
  end
62
51
  end
@@ -66,11 +55,11 @@ describe 'Union' do
66
55
  if k == 'f32' or k == 'f64'
67
56
  (@u[type[1]] - type[2]).abs.should < 0.00001
68
57
  else
69
- @u[type[1]].should eq type[2]
58
+ @u[type[1]].should == type[2]
70
59
  end
71
60
  end
72
61
  end
73
62
  it 'should return a size equals to the size of the biggest field' do
74
- LibTest::TestUnion.size.should eq LibTest.union_size
63
+ LibTest::TestUnion.size.should == LibTest.union_size
75
64
  end
76
65
  end
@@ -1,17 +1,6 @@
1
1
  #
2
2
  # This file is part of ruby-ffi.
3
- #
4
- # This code is free software: you can redistribute it and/or modify it under
5
- # the terms of the GNU Lesser General Public License version 3 only, as
6
- # published by the Free Software Foundation.
7
- #
8
- # This code is distributed in the hope that it will be useful, but WITHOUT
9
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
- # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11
- # version 3 for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public License
14
- # version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
3
+ # For licensing, see LICENSE.SPECS
15
4
  #
16
5
 
17
6
  require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
@@ -25,28 +14,28 @@ describe "Function with variadic arguments" do
25
14
  it "call variadic with (:char (#{i})) argument" do
26
15
  buf = FFI::Buffer.new :long_long
27
16
  LibTest.pack_varargs(buf, "c", :char, i)
28
- buf.get_int64(0).should eq i
17
+ buf.get_int64(0).should == i
29
18
  end
30
19
  end
31
20
  [ 0, 0x7f, 0x80, 0xff ].each do |i|
32
21
  it "call variadic with (:uchar (#{i})) argument" do
33
22
  buf = FFI::Buffer.new :long_long
34
23
  LibTest.pack_varargs(buf, "C", :uchar, i)
35
- buf.get_int64(0).should eq i
24
+ buf.get_int64(0).should == i
36
25
  end
37
26
  end
38
27
  [ 0, 1.234567, 9.87654321 ].each do |v|
39
28
  it "call variadic with (:float (#{v})) argument" do
40
29
  buf = FFI::Buffer.new :long_long
41
30
  LibTest.pack_varargs(buf, "f", :float, v.to_f)
42
- buf.get_float64(0).should eq v
31
+ buf.get_float64(0).should == v
43
32
  end
44
33
  end
45
34
  [ 0, 1.234567, 9.87654321 ].each do |v|
46
35
  it "call variadic with (:double (#{v})) argument" do
47
36
  buf = FFI::Buffer.new :long_long
48
37
  LibTest.pack_varargs(buf, "f", :double, v.to_f)
49
- buf.get_float64(0).should eq v
38
+ buf.get_float64(0).should == v
50
39
  end
51
40
  end
52
41
 
@@ -73,9 +62,9 @@ describe "Function with variadic arguments" do
73
62
 
74
63
  def verify(p, off, v)
75
64
  if v.kind_of?(Float)
76
- p.get_float64(off).should eq v
65
+ p.get_float64(off).should == v
77
66
  else
78
- p.get_int64(off).should eq v
67
+ p.get_int64(off).should == v
79
68
  end
80
69
  end
81
70
 
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: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 2
9
- - 1
10
- version: 1.2.1
8
+ - 3
9
+ - 0
10
+ version: 1.3.0
11
11
  platform: x86-mingw32
12
12
  authors:
13
13
  - Wayne Meissner