ffi 1.11.2-x64-mingw32 → 1.13.0-x64-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -190,7 +190,7 @@ module FFI
190
190
  # :field2, :pointer, 6, # set offset to 6 for this field
191
191
  # :field3, :string
192
192
  # end
193
- # @example Creating a layout from a hash +spec+ (Ruby 1.9 only)
193
+ # @example Creating a layout from a hash +spec+
194
194
  # class MyStructFromHash < Struct
195
195
  # layout :field1 => :int,
196
196
  # :field2 => :pointer,
@@ -202,9 +202,8 @@ module FFI
202
202
  # :function2, callback([:pointer], :void),
203
203
  # :field3, :string
204
204
  # end
205
- # @note Creating a layout from a hash +spec+ is supported only for Ruby 1.9.
206
205
  def layout(*spec)
207
- #raise RuntimeError, "struct layout already defined for #{self.inspect}" if defined?(@layout)
206
+ warn "[DEPRECATION] Struct layout is already defined for class #{self.inspect}. Redefinition as in #{caller[0]} will be disallowed in ffi-2.0." if defined?(@layout)
208
207
  return @layout if spec.size == 0
209
208
 
210
209
  builder = StructLayoutBuilder.new
@@ -229,7 +228,11 @@ module FFI
229
228
 
230
229
  def callback(params, ret)
231
230
  mod = enclosing_module
232
- FFI::CallbackInfo.new(find_type(ret, mod), params.map { |e| find_type(e, mod) })
231
+ ret_type = find_type(ret, mod)
232
+ if ret_type == Type::STRING
233
+ raise TypeError, ":string is not allowed as return type of callbacks"
234
+ end
235
+ FFI::CallbackInfo.new(ret_type, params.map { |e| find_type(e, mod) })
233
236
  end
234
237
 
235
238
  def packed(packed = 1)
@@ -245,7 +248,9 @@ module FFI
245
248
  def enclosing_module
246
249
  begin
247
250
  mod = self.name.split("::")[0..-2].inject(Object) { |obj, c| obj.const_get(c) }
248
- (mod < FFI::Library || mod < FFI::Struct || mod.respond_to?(:find_type)) ? mod : nil
251
+ if mod.respond_to?(:find_type) && (mod.is_a?(FFI::Library) || mod < FFI::Struct)
252
+ mod
253
+ end
249
254
  rescue Exception
250
255
  nil
251
256
  end
@@ -47,6 +47,8 @@ module FFI
47
47
  typedefs = nil
48
48
  Tempfile.open 'ffi_types_generator' do |io|
49
49
  io.puts <<-C
50
+ #include <stdint.h>
51
+ #include <stddef.h>
50
52
  #include <sys/types.h>
51
53
  #if !(defined(WIN32))
52
54
  #include <sys/socket.h>
@@ -1,3 +1,3 @@
1
1
  module FFI
2
- VERSION = '1.11.2'
2
+ VERSION = '1.13.0'
3
3
  end
@@ -1,5 +1,5 @@
1
- require 'rubygems'
2
1
  require 'ffi'
2
+
3
3
  module Foo
4
4
  extend FFI::Library
5
5
  ffi_lib FFI::Library::LIBC
@@ -1,5 +1,5 @@
1
- require 'rubygems'
2
1
  require 'ffi'
2
+
3
3
  module Foo
4
4
  extend FFI::Library
5
5
  ffi_lib FFI::Library::LIBC
@@ -1,16 +1,16 @@
1
- require 'rubygems'
2
1
  require 'ffi'
2
+ require 'rbconfig'
3
+
3
4
  class Timeval < FFI::Struct
4
- rb_maj, rb_min, rb_micro = RUBY_VERSION.split('.')
5
- if rb_maj.to_i >= 1 && rb_min.to_i >= 9 || RUBY_PLATFORM =~ /java/
6
- layout :tv_sec => :ulong, :tv_usec => :ulong
7
- else
8
- layout :tv_sec, :ulong, 0, :tv_usec, :ulong, 4
9
- end
5
+ layout tv_sec: :ulong, tv_usec: :ulong
10
6
  end
11
7
  module LibC
12
8
  extend FFI::Library
13
- ffi_lib FFI::Library::LIBC
9
+ if FFI::Platform.windows?
10
+ ffi_lib RbConfig::CONFIG["LIBRUBY_SO"]
11
+ else
12
+ ffi_lib FFI::Library::LIBC
13
+ end
14
14
  attach_function :gettimeofday, [ :pointer, :pointer ], :int
15
15
  end
16
16
  t = Timeval.new
@@ -1,4 +1,5 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), "sample_helper"))
1
+ require 'ffi'
2
+
2
3
  module Foo
3
4
  extend FFI::Library
4
5
  ffi_lib FFI::Library::LIBC
@@ -1,5 +1,5 @@
1
- require 'rubygems'
2
1
  require 'ffi'
2
+
3
3
  module Inotify
4
4
  extend FFI::Library
5
5
  ffi_lib FFI::Library::LIBC
@@ -1,6 +1,5 @@
1
1
  require 'ffi'
2
2
 
3
-
4
3
  module PTY
5
4
  private
6
5
  module LibC
@@ -41,7 +40,7 @@ module PTY
41
40
  #
42
41
  exec_cmd, exec_args = build_args(args)
43
42
  pid = LibC.forkpty(mfdp, name, nil, nil)
44
- raise "forkpty failed: #{LibC.strerror(FFI.errno)}" if pid < 0
43
+ raise "forkpty failed: #{LibC.strerror(FFI.errno)}" if pid < 0
45
44
  if pid == 0
46
45
  LibC.execvp(exec_cmd, exec_args)
47
46
  exit 1
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
1
  require 'ffi'
3
2
 
4
3
  module LibC
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.2
4
+ version: 1.13.0
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Wayne Meissner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-11 00:00:00.000000000 Z
11
+ date: 2020-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '12.1'
19
+ version: '13.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '12.1'
26
+ version: '13.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake-compiler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.7.0
47
+ version: '1.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.7.0
54
+ version: '1.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -87,6 +87,7 @@ extensions: []
87
87
  extra_rdoc_files: []
88
88
  files:
89
89
  - ".appveyor.yml"
90
+ - ".github/workflows/ci.yml"
90
91
  - ".gitignore"
91
92
  - ".gitmodules"
92
93
  - ".travis.yml"
@@ -99,11 +100,11 @@ files:
99
100
  - README.md
100
101
  - Rakefile
101
102
  - ffi.gemspec
102
- - lib/2.2/ffi_c.so
103
103
  - lib/2.3/ffi_c.so
104
104
  - lib/2.4/ffi_c.so
105
105
  - lib/2.5/ffi_c.so
106
106
  - lib/2.6/ffi_c.so
107
+ - lib/2.7/ffi_c.so
107
108
  - lib/ffi.rb
108
109
  - lib/ffi/autopointer.rb
109
110
  - lib/ffi/buffer.rb
@@ -145,12 +146,14 @@ files:
145
146
  - lib/ffi/platform/powerpc-aix/types.conf
146
147
  - lib/ffi/platform/powerpc-darwin/types.conf
147
148
  - lib/ffi/platform/powerpc-linux/types.conf
149
+ - lib/ffi/platform/powerpc-openbsd/types.conf
148
150
  - lib/ffi/platform/powerpc64-linux/types.conf
149
151
  - lib/ffi/platform/s390-linux/types.conf
150
152
  - lib/ffi/platform/s390x-linux/types.conf
151
153
  - lib/ffi/platform/sparc-linux/types.conf
152
154
  - lib/ffi/platform/sparc-solaris/types.conf
153
155
  - lib/ffi/platform/sparc64-linux/types.conf
156
+ - lib/ffi/platform/sparcv9-openbsd/types.conf
154
157
  - lib/ffi/platform/sparcv9-solaris/types.conf
155
158
  - lib/ffi/platform/x86_64-cygwin/types.conf
156
159
  - lib/ffi/platform/x86_64-darwin/types.conf
@@ -183,7 +186,6 @@ files:
183
186
  - samples/inotify.rb
184
187
  - samples/pty.rb
185
188
  - samples/qsort.rb
186
- - samples/sample_helper.rb
187
189
  homepage: https://github.com/ffi/ffi/wiki
188
190
  licenses:
189
191
  - BSD-3-Clause
@@ -204,18 +206,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
204
206
  requirements:
205
207
  - - ">="
206
208
  - !ruby/object:Gem::Version
207
- version: '2.2'
209
+ version: '2.3'
208
210
  - - "<"
209
211
  - !ruby/object:Gem::Version
210
- version: 2.7.dev
212
+ version: 2.8.dev
211
213
  required_rubygems_version: !ruby/object:Gem::Requirement
212
214
  requirements:
213
215
  - - ">="
214
216
  - !ruby/object:Gem::Version
215
217
  version: '0'
216
218
  requirements: []
217
- rubyforge_project:
218
- rubygems_version: 2.7.9
219
+ rubygems_version: 3.1.2
219
220
  signing_key:
220
221
  specification_version: 4
221
222
  summary: Ruby FFI
@@ -1,6 +0,0 @@
1
- require 'rubygems'
2
- require 'spec'
3
-
4
- $:.unshift File.join(File.dirname(__FILE__), "..", "lib"), File.join(File.dirname(__FILE__), "..", "build", RUBY_VERSION) unless RUBY_PLATFORM =~ /java/
5
- require "ffi"
6
-