ffi 1.0.10 → 1.0.11

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 CHANGED
@@ -20,13 +20,13 @@ LIBEXT = case RbConfig::CONFIG['host_os'].downcase
20
20
  when /mswin|mingw/
21
21
  "dll"
22
22
  else
23
- Config::CONFIG['DLEXT']
23
+ RbConfig::CONFIG['DLEXT']
24
24
  end
25
25
 
26
26
  CPU = case RbConfig::CONFIG['host_cpu'].downcase
27
27
  when /i[3456]86/
28
28
  # Darwin always reports i686, even when running in 64bit mode
29
- if Config::CONFIG['host_os'] =~ /darwin/ && 0xfee1deadbeef.is_a?(Fixnum)
29
+ if RbConfig::CONFIG['host_os'] =~ /darwin/ && 0xfee1deadbeef.is_a?(Fixnum)
30
30
  "x86_64"
31
31
  else
32
32
  "i386"
@@ -42,10 +42,10 @@ CPU = case RbConfig::CONFIG['host_cpu'].downcase
42
42
  "powerpc"
43
43
 
44
44
  else
45
- Config::CONFIG['host_cpu']
45
+ RbConfig::CONFIG['host_cpu']
46
46
  end
47
47
 
48
- OS = case Config::CONFIG['host_os'].downcase
48
+ OS = case RbConfig::CONFIG['host_os'].downcase
49
49
  when /linux/
50
50
  "linux"
51
51
  when /darwin/
@@ -59,23 +59,23 @@ OS = case Config::CONFIG['host_os'].downcase
59
59
  when /mswin|mingw/
60
60
  "win32"
61
61
  else
62
- Config::CONFIG['host_os'].downcase
62
+ RbConfig::CONFIG['host_os'].downcase
63
63
  end
64
64
 
65
- CC=ENV['CC'] || Config::CONFIG['CC'] || "gcc"
65
+ CC=ENV['CC'] || RbConfig::CONFIG['CC'] || "gcc"
66
66
 
67
67
  GMAKE = system('which gmake >/dev/null') && 'gmake' || 'make'
68
68
 
69
69
  LIBTEST = "build/libtest.#{LIBEXT}"
70
70
  BUILD_DIR = "build"
71
- BUILD_EXT_DIR = File.join(BUILD_DIR, "#{Config::CONFIG['arch']}", 'ffi_c', RUBY_VERSION)
71
+ BUILD_EXT_DIR = File.join(BUILD_DIR, "#{RbConfig::CONFIG['arch']}", 'ffi_c', RUBY_VERSION)
72
72
 
73
73
  # Project general information
74
74
  PROJ.name = 'ffi'
75
75
  PROJ.authors = 'Wayne Meissner'
76
76
  PROJ.email = 'wmeissner@gmail.com'
77
77
  PROJ.url = 'http://wiki.github.com/ffi/ffi'
78
- PROJ.version = '1.0.10'
78
+ PROJ.version = '1.0.11'
79
79
  PROJ.rubyforge.name = 'ffi'
80
80
  PROJ.readme_file = 'README.rdoc'
81
81
 
@@ -116,23 +116,23 @@ TEST_DEPS = [ LIBTEST ]
116
116
  if RUBY_PLATFORM == "java"
117
117
  desc "Run all specs"
118
118
  task :specs => TEST_DEPS do
119
- sh %{#{Gem.ruby} -S rspec #{Dir["spec/ffi/*_spec.rb"].join(" ")} -fs --color}
119
+ sh %{#{Gem.ruby} -w -S rspec #{Dir["spec/ffi/*_spec.rb"].join(" ")} -fs --color}
120
120
  end
121
121
  desc "Run rubinius specs"
122
122
  task :rbxspecs => TEST_DEPS do
123
- sh %{#{Gem.ruby} -S rspec #{Dir["spec/ffi/rbx/*_spec.rb"].join(" ")} -fs --color}
123
+ sh %{#{Gem.ruby} -w -S rspec #{Dir["spec/ffi/rbx/*_spec.rb"].join(" ")} -fs --color}
124
124
  end
125
125
  else
126
126
  TEST_DEPS.unshift :compile
127
127
  desc "Run all specs"
128
128
  task :specs => TEST_DEPS do
129
129
  ENV["MRI_FFI"] = "1"
130
- sh %{#{Gem.ruby} -Ilib -I#{BUILD_EXT_DIR} -S rspec #{Dir["spec/ffi/*_spec.rb"].join(" ")} -fs --color}
130
+ sh %{#{Gem.ruby} -w -Ilib -I#{BUILD_EXT_DIR} -S rspec #{Dir["spec/ffi/*_spec.rb"].join(" ")} -fs --color}
131
131
  end
132
132
  desc "Run rubinius specs"
133
133
  task :rbxspecs => TEST_DEPS do
134
134
  ENV["MRI_FFI"] = "1"
135
- sh %{#{Gem.ruby} -Ilib -I#{BUILD_EXT_DIR} -S rspec #{Dir["spec/ffi/rbx/*_spec.rb"].join(" ")} -fs --color}
135
+ sh %{#{Gem.ruby} -w -Ilib -I#{BUILD_EXT_DIR} -S rspec #{Dir["spec/ffi/rbx/*_spec.rb"].join(" ")} -fs --color}
136
136
  end
137
137
  end
138
138
 
@@ -146,7 +146,7 @@ task :install => 'gem:install'
146
146
  desc "Clean all built files"
147
147
  task :distclean => :clobber do
148
148
  FileUtils.rm_rf('build')
149
- FileUtils.rm_rf(Dir["lib/**/ffi_c.#{Config::CONFIG['DLEXT']}"])
149
+ FileUtils.rm_rf(Dir["lib/**/ffi_c.#{RbConfig::CONFIG['DLEXT']}"])
150
150
  FileUtils.rm_rf('lib/1.8')
151
151
  FileUtils.rm_rf('lib/1.9')
152
152
  FileUtils.rm_rf('lib/ffi/types.conf')
@@ -645,7 +645,7 @@ MemoryOps rbffi_AbstractMemoryOps = {
645
645
  &memory_op_float64, //.float64
646
646
  &memory_op_pointer, //.pointer
647
647
  &memory_op_strptr, //.strptr
648
- NULL //.boolOp
648
+ &memory_op_bool //.boolOp
649
649
  };
650
650
 
651
651
  void
@@ -62,11 +62,11 @@
62
62
  # define MIN(a, b) ((a) < (b) ? (a) : (b))
63
63
  #endif
64
64
 
65
- #ifndef RB_GC_GUARD(x)
65
+ #ifndef RB_GC_GUARD
66
66
  # define RB_GC_GUARD(x) (x)
67
67
  #endif
68
68
 
69
- #ifndef RB_GC_GUARD_PTR(x)
69
+ #ifndef RB_GC_GUARD_PTR
70
70
  # define RB_GC_GUARD_PTR(x) (x)
71
71
  #endif
72
72
 
@@ -5,9 +5,9 @@ if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby"
5
5
  require 'rbconfig'
6
6
  dir_config("ffi_c")
7
7
 
8
- if pkg_config("libffi") ||
8
+ if ENV['RUBY_CC_VERSION'].nil? && (pkg_config("libffi") ||
9
9
  have_header("ffi.h") ||
10
- find_header("ffi.h", "/usr/local/include")
10
+ find_header("ffi.h", "/usr/local/include"))
11
11
 
12
12
  # We need at least ffi_call and ffi_prep_closure
13
13
  libffi_ok = have_library("ffi", "ffi_call", [ "ffi.h" ]) ||
@@ -43,7 +43,7 @@ if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby"
43
43
  mf.puts "include ${srcdir}/libffi.darwin.mk"
44
44
  elsif RbConfig::CONFIG['host_os'].downcase =~ /bsd/
45
45
  mf.puts '.include "${srcdir}/libffi.bsd.mk"'
46
- elsif RbConfig::CONFIG['host_os'] !~ /mswin32|mingw32/
46
+ else
47
47
  mf.puts "include ${srcdir}/libffi.mk"
48
48
  end
49
49
  end
@@ -136,8 +136,10 @@ module FFI
136
136
  #
137
137
  # @param [Symbol] convention one of +:default+, +:stdcall+
138
138
  # @return [Symbol] the new calling convention
139
- def ffi_convention(convention)
140
- @ffi_convention = convention
139
+ def ffi_convention(convention = nil)
140
+ @ffi_convention ||= :default
141
+ @ffi_convention = convention if convention
142
+ @ffi_convention
141
143
  end
142
144
 
143
145
  # @see #ffi_lib
@@ -212,7 +214,7 @@ module FFI
212
214
  # Convert :foo to the native type
213
215
  arg_types.map! { |e| find_type(e) }
214
216
  options = {
215
- :convention => defined?(@ffi_convention) ? @ffi_convention : :default,
217
+ :convention => ffi_convention,
216
218
  :type_map => defined?(@ffi_typedefs) ? @ffi_typedefs : nil,
217
219
  :blocking => defined?(@blocking) && @blocking,
218
220
  :enums => defined?(@ffi_enums) ? @ffi_enums : nil,
@@ -227,8 +229,8 @@ module FFI
227
229
  if invokers.empty?
228
230
  begin
229
231
  function = nil
230
- function_names(cname, arg_types).find do |name|
231
- function = lib.find_function(name)
232
+ function_names(cname, arg_types).find do |fname|
233
+ function = lib.find_function(fname)
232
234
  end
233
235
  raise LoadError unless function
234
236
 
@@ -239,7 +241,7 @@ module FFI
239
241
  Function.new(find_type(ret_type), arg_types, function, options)
240
242
  end
241
243
 
242
- rescue LoadError => ex
244
+ rescue LoadError
243
245
  end
244
246
  end
245
247
  end
@@ -262,7 +264,7 @@ module FFI
262
264
  # windows api, although using, doesn't have decorated names.
263
265
  def function_names(name, arg_types)
264
266
  result = [name.to_s]
265
- if @ffi_convention == :stdcall
267
+ if ffi_convention == :stdcall
266
268
  # Get the size of each parameter
267
269
  size = arg_types.inject(0) do |mem, arg|
268
270
  mem + arg.size
@@ -360,7 +362,7 @@ code
360
362
  end
361
363
 
362
364
  options = Hash.new
363
- options[:convention] = defined?(@ffi_convention) ? @ffi_convention : :default
365
+ options[:convention] = ffi_convention
364
366
  options[:enums] = @ffi_enums if defined?(@ffi_enums)
365
367
  cb = FFI::CallbackInfo.new(find_type(ret), params.map { |e| find_type(e) }, options)
366
368
 
@@ -20,8 +20,6 @@
20
20
  #
21
21
 
22
22
  require 'rbconfig'
23
- require 'ffi_c'
24
-
25
23
  module FFI
26
24
  class PlatformError < LoadError; end
27
25
 
@@ -123,10 +123,6 @@ module FFI
123
123
  @layout.alignment
124
124
  end
125
125
 
126
- def self.align
127
- @layout.alignment
128
- end
129
-
130
126
  def self.members
131
127
  @layout.members
132
128
  end
@@ -228,7 +224,7 @@ module FFI
228
224
  begin
229
225
  mod = self.name.split("::")[0..-2].inject(Object) { |obj, c| obj.const_get(c) }
230
226
  mod.respond_to?(:find_type) ? mod : nil
231
- rescue Exception => ex
227
+ rescue Exception
232
228
  nil
233
229
  end
234
230
  end
@@ -36,7 +36,7 @@ module FFI
36
36
  # When passed a block, {#calculate} is automatically called at the end of
37
37
  # the block, otherwise you must call it yourself.
38
38
  def initialize(prefix = nil, options = {})
39
- @includes = []
39
+ @includes = ['stdio.h', 'stddef.h']
40
40
  @constants = {}
41
41
  @prefix = prefix
42
42
 
@@ -61,10 +61,10 @@ module FFI
61
61
  @options
62
62
  end
63
63
  # @param [String] name
64
- # @return constant value
64
+ # @return constant value (converted if a +converter+ was defined).
65
65
  # Access a constant by name.
66
66
  def [](name)
67
- @constants[name].value
67
+ @constants[name].converted_value
68
68
  end
69
69
 
70
70
  # Request the value for C constant +name+.
@@ -107,14 +107,10 @@ module FFI
107
107
  binary = File.join Dir.tmpdir, "rb_const_gen_bin_#{Process.pid}"
108
108
 
109
109
  Tempfile.open("#{@prefix}.const_generator") do |f|
110
- f.puts "#include <stdio.h>"
111
-
112
110
  @includes.each do |inc|
113
111
  f.puts "#include <#{inc}>"
114
112
  end
115
-
116
- f.puts "#include <stddef.h>\n\n"
117
- f.puts "int main(int argc, char **argv)\n{"
113
+ f.puts "\nint main(int argc, char **argv)\n{"
118
114
 
119
115
  @constants.each_value do |const|
120
116
  f.puts <<-EOF
@@ -175,11 +171,12 @@ module FFI
175
171
  end.join "\n"
176
172
  end
177
173
 
178
- # Add a C include file to calculate constants from.
179
- # @param [String] i include file
180
- # @return [Array<String>] array of include files (stdio.h is omitted)
181
- def include(i)
182
- @includes << i
174
+ # Add additional C include file(s) to calculate constants from.
175
+ # @note +stdio.h+ and +stddef.h+ automatically included
176
+ # @param [List<String>, Array<String>] i include file(s)
177
+ # @return [Array<String>] array of include files
178
+ def include(*i)
179
+ @includes |= i.flatten
183
180
  end
184
181
 
185
182
  end
@@ -32,7 +32,7 @@ describe "async callback" do
32
32
  cb = Proc.new {|i| v = i; called = true }
33
33
  LibTest.testAsyncCallback(cb, 0x7fffffff)
34
34
  called.should be_true
35
- v.should == 0x7fffffff
35
+ v.should eq 0x7fffffff
36
36
  end
37
37
 
38
38
  it "called a second time" do
@@ -41,6 +41,6 @@ describe "async callback" do
41
41
  cb = Proc.new {|i| v = i; called = true }
42
42
  LibTest.testAsyncCallback(cb, 0x7fffffff)
43
43
  called.should be_true
44
- v.should == 0x7fffffff
44
+ v.should eq 0x7fffffff
45
45
  end
46
46
  end
@@ -25,14 +25,14 @@ describe "Function with primitive boolean arguments and return values" do
25
25
  attach_function :bool_reverse_val, [ :bool ], :bool
26
26
  end
27
27
  it "bools" do
28
- LibTest.bool_return_true.should == true
29
- LibTest.bool_return_false.should == false
28
+ LibTest.bool_return_true.should eq true
29
+ LibTest.bool_return_false.should eq false
30
30
 
31
- LibTest.bool_return_val(true).should == true
32
- LibTest.bool_return_val(false).should == false
31
+ LibTest.bool_return_val(true).should eq true
32
+ LibTest.bool_return_val(false).should eq false
33
33
 
34
- LibTest.bool_reverse_val(true).should == false
35
- LibTest.bool_reverse_val(false).should == true
34
+ LibTest.bool_reverse_val(true).should eq false
35
+ LibTest.bool_reverse_val(false).should eq true
36
36
  end
37
37
  it "raise error on invalid types" do
38
38
  lambda { LibTest.bool_return_val(nil) }.should raise_error(::TypeError)
@@ -23,13 +23,13 @@ describe "Buffer#total" do
23
23
  :long_long => 8, :ulong_long => 8, :float => 4, :double => 8
24
24
  }.each_pair do |t, s|
25
25
  it "Buffer.alloc_in(#{t}, #{i}).total == #{i * s}" do
26
- FFI::Buffer.alloc_in(t, i).total.should == i * s
26
+ FFI::Buffer.alloc_in(t, i).total.should eq i * s
27
27
  end
28
28
  it "Buffer.alloc_out(#{t}, #{i}).total == #{i * s}" do
29
- FFI::Buffer.alloc_out(t, i).total.should == i * s
29
+ FFI::Buffer.alloc_out(t, i).total.should eq i * s
30
30
  end
31
31
  it "Buffer.alloc_inout(#{t}, #{i}).total == #{i * s}" do
32
- FFI::Buffer.alloc_inout(t, i).total.should == i * s
32
+ FFI::Buffer.alloc_inout(t, i).total.should eq i * s
33
33
  end
34
34
  end
35
35
  end
@@ -40,7 +40,7 @@ describe "Buffer#put_char" do
40
40
  (0..127).each do |i|
41
41
  (0..bufsize-1).each do |offset|
42
42
  it "put_char(#{offset}, #{i}).get_char(#{offset}) == #{i}" do
43
- FFI::Buffer.alloc_in(bufsize).put_char(offset, i).get_char(offset).should == i
43
+ FFI::Buffer.alloc_in(bufsize).put_char(offset, i).get_char(offset).should eq i
44
44
  end
45
45
  end
46
46
  end
@@ -50,7 +50,7 @@ describe "Buffer#put_uchar" do
50
50
  (0..255).each do |i|
51
51
  (0..bufsize-1).each do |offset|
52
52
  it "Buffer.put_uchar(#{offset}, #{i}).get_uchar(#{offset}) == #{i}" do
53
- FFI::Buffer.alloc_in(bufsize).put_uchar(offset, i).get_uchar(offset).should == i
53
+ FFI::Buffer.alloc_in(bufsize).put_uchar(offset, i).get_uchar(offset).should eq i
54
54
  end
55
55
  end
56
56
  end
@@ -60,7 +60,7 @@ describe "Buffer#put_short" do
60
60
  [0, 1, 128, 32767].each do |i|
61
61
  (0..bufsize-2).each do |offset|
62
62
  it "put_short(#{offset}, #{i}).get_short(#{offset}) == #{i}" do
63
- FFI::Buffer.alloc_in(bufsize).put_short(offset, i).get_short(offset).should == i
63
+ FFI::Buffer.alloc_in(bufsize).put_short(offset, i).get_short(offset).should eq i
64
64
  end
65
65
  end
66
66
  end
@@ -70,7 +70,7 @@ describe "Buffer#put_ushort" do
70
70
  [ 0, 1, 128, 32767, 65535, 0xfee1, 0xdead, 0xbeef, 0xcafe ].each do |i|
71
71
  (0..bufsize-2).each do |offset|
72
72
  it "put_ushort(#{offset}, #{i}).get_ushort(#{offset}) == #{i}" do
73
- FFI::Buffer.alloc_in(bufsize).put_ushort(offset, i).get_ushort(offset).should == i
73
+ FFI::Buffer.alloc_in(bufsize).put_ushort(offset, i).get_ushort(offset).should eq i
74
74
  end
75
75
  end
76
76
  end
@@ -80,7 +80,7 @@ describe "Buffer#put_int" do
80
80
  [0, 1, 128, 32767, 0x7ffffff ].each do |i|
81
81
  (0..bufsize-4).each do |offset|
82
82
  it "put_int(#{offset}, #{i}).get_int(#{offset}) == #{i}" do
83
- FFI::Buffer.alloc_in(bufsize).put_int(offset, i).get_int(offset).should == i
83
+ FFI::Buffer.alloc_in(bufsize).put_int(offset, i).get_int(offset).should eq i
84
84
  end
85
85
  end
86
86
  end
@@ -90,7 +90,7 @@ describe "Buffer#put_uint" do
90
90
  [ 0, 1, 128, 32767, 65535, 0xfee1dead, 0xcafebabe, 0xffffffff ].each do |i|
91
91
  (0..bufsize-4).each do |offset|
92
92
  it "put_uint(#{offset}, #{i}).get_uint(#{offset}) == #{i}" do
93
- FFI::Buffer.alloc_in(bufsize).put_uint(offset, i).get_uint(offset).should == i
93
+ FFI::Buffer.alloc_in(bufsize).put_uint(offset, i).get_uint(offset).should eq i
94
94
  end
95
95
  end
96
96
  end
@@ -100,7 +100,7 @@ describe "Buffer#put_long" do
100
100
  [0, 1, 128, 32767, 0x7ffffff ].each do |i|
101
101
  (0..bufsize-FFI::Type::LONG.size).each do |offset|
102
102
  it "put_long(#{offset}, #{i}).get_long(#{offset}) == #{i}" do
103
- FFI::Buffer.alloc_in(bufsize).put_long(offset, i).get_long(offset).should == i
103
+ FFI::Buffer.alloc_in(bufsize).put_long(offset, i).get_long(offset).should eq i
104
104
  end
105
105
  end
106
106
  end
@@ -110,7 +110,7 @@ describe "Buffer#put_ulong" do
110
110
  [ 0, 1, 128, 32767, 65535, 0xfee1dead, 0xcafebabe, 0xffffffff ].each do |i|
111
111
  (0..bufsize-FFI::Type::LONG.size).each do |offset|
112
112
  it "put_ulong(#{offset}, #{i}).get_ulong(#{offset}) == #{i}" do
113
- FFI::Buffer.alloc_in(bufsize).put_ulong(offset, i).get_ulong(offset).should == i
113
+ FFI::Buffer.alloc_in(bufsize).put_ulong(offset, i).get_ulong(offset).should eq i
114
114
  end
115
115
  end
116
116
  end
@@ -120,7 +120,7 @@ describe "Buffer#put_long_long" do
120
120
  [0, 1, 128, 32767, 0x7ffffffffffffff ].each do |i|
121
121
  (0..bufsize-8).each do |offset|
122
122
  it "put_long_long(#{offset}, #{i}).get_long_long(#{offset}) == #{i}" do
123
- FFI::Buffer.alloc_in(bufsize).put_long_long(offset, i).get_long_long(offset).should == i
123
+ FFI::Buffer.alloc_in(bufsize).put_long_long(offset, i).get_long_long(offset).should eq i
124
124
  end
125
125
  end
126
126
  end
@@ -130,7 +130,7 @@ describe "Buffer#put_ulong_long" do
130
130
  [ 0, 1, 128, 32767, 65535, 0xdeadcafebabe, 0x7fffffffffffffff ].each do |i|
131
131
  (0..bufsize-8).each do |offset|
132
132
  it "put_ulong_long(#{offset}, #{i}).get_ulong_long(#{offset}) == #{i}" do
133
- FFI::Buffer.alloc_in(bufsize).put_ulong_long(offset, i).get_ulong_long(offset).should == i
133
+ FFI::Buffer.alloc_in(bufsize).put_ulong_long(offset, i).get_ulong_long(offset).should eq i
134
134
  end
135
135
  end
136
136
  end
@@ -141,21 +141,21 @@ describe "Reading/Writing binary strings" do
141
141
  buf = FFI::Buffer.new 1024
142
142
  buf.put_bytes(0, str);
143
143
  s2 = buf.get_bytes(0, 11);
144
- s2.should == str
144
+ s2.should eq str
145
145
  end
146
146
  it "Buffer#put_bytes with index and length" do
147
147
  str = "hello\0world"
148
148
  buf = FFI::Buffer.new 1024
149
149
  buf.put_bytes(0, str, 5, 6);
150
150
  s2 = buf.get_bytes(0, 6);
151
- s2.should == str[5..-1]
151
+ s2.should eq str[5..-1]
152
152
  end
153
153
  it "Buffer#put_bytes with only index" do
154
154
  str = "hello\0world"
155
155
  buf = FFI::Buffer.new 1024
156
156
  buf.put_bytes(0, str, 5);
157
157
  s2 = buf.get_bytes(0, 6);
158
- s2.should == str[5..-1]
158
+ s2.should eq str[5..-1]
159
159
  end
160
160
  it "Buffer#put_bytes with index > str.length" do
161
161
  str = "hello\0world"
@@ -179,21 +179,21 @@ describe "Reading/Writing ascii strings" do
179
179
  buf = FFI::Buffer.new 1024
180
180
  buf.put_string(0, str);
181
181
  s2 = buf.get_bytes(0, 11);
182
- s2.should == str
182
+ s2.should eq str
183
183
  end
184
184
  it "Buffer#get_string with string containing zero byte" do
185
185
  str = "hello\0world"
186
186
  buf = FFI::Buffer.new 1024
187
187
  buf.put_bytes(0, str);
188
188
  s2 = buf.get_string(0, 11);
189
- s2.should == "hello"
189
+ s2.should eq "hello"
190
190
  end
191
191
  it "Buffer#put_string without length should NUL terminate" do
192
192
  str = "hello"
193
193
  buf = FFI::Buffer.new 1024
194
194
  buf.put_string(0, str);
195
195
  s2 = buf.get_bytes(0, 6);
196
- s2.should == "hello\0"
196
+ s2.should eq "hello\0"
197
197
  end
198
198
  end
199
199
  describe "Buffer#put_pointer" do
@@ -203,13 +203,13 @@ describe "Buffer#put_pointer" do
203
203
  buf = FFI::Buffer.alloc_inout 8
204
204
  p2 = buf.put_pointer(0, p).get_pointer(0)
205
205
  p2.should_not be_nil
206
- p2.should == p
207
- p2.get_uint(0).should == 0xdeadbeef
206
+ p2.should eq p
207
+ p2.get_uint(0).should eq 0xdeadbeef
208
208
  end
209
209
  end
210
210
  describe "Buffer#size" do
211
211
  it "should return size" do
212
212
  buf = FFI::Buffer.new 14
213
- buf.size.should == 14
213
+ buf.size.should eq 14
214
214
  end
215
- end
215
+ end