gir_ffi 0.10.1 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa45cf6ed9c1af0159b7faeea5573b925d0fbff3
4
- data.tar.gz: c016996c65de12f29c5133955b211d8ae0346f9d
3
+ metadata.gz: 87a8f4c01010d8c1d510e080f58ebc0cc601b163
4
+ data.tar.gz: 25eae9388e40ac27eb7724ca335d21c5a6dd0b80
5
5
  SHA512:
6
- metadata.gz: 21a3c042d42c4c441908818ba387905d8a397245adbdd112980d4fba07166954b997219327781b3ab461d3fb93c9abd47e9f3e5aee2b3264c23208bab3aec2b6
7
- data.tar.gz: 412062c0492c572e3aa2d9fb2beda46665c43fdf5263c77b96afc2b9c6c66f4ecf6d7ac7bda7ae722ea93e929d04f995b69bb0521b10b34d239ceed2de89c4fd
6
+ metadata.gz: 7c045bfc9d552fc6fec83cfe4aa222f123c3df3bd0327b0768f247ff3257d31debf9da3704523d95c6601c3a09afddb6d743d23ef8f4f74af2242d5bd78915e2
7
+ data.tar.gz: 16e9ebda8c005d7b9363f76d4a8a9c79e5fc26ab07298f27f087c688fd955db771b762bd0c9e6e9ec2b92653573fbdb52d29e395a630aee81814cb09ac0b97a7
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.2 / 2016-04-29
4
+
5
+ * Update ffi-bit_masks dependency and remove monkey-patch
6
+ * Support gobject-introspection version 1.48
7
+
3
8
  ## 0.10.1 / 2016-03-28
4
9
 
5
10
  * Restore JRuby compatibility.
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
  # The gem's dependencies are specified in gir_ffi.gemspec
5
5
  gemspec
6
6
 
7
- gem 'rubocop', '~> 0.38.0', type: :development
7
+ gem 'rubocop', '~> 0.39.0', type: :development
8
8
 
9
9
  if ENV['CI']
10
10
  if ENV['TRAVIS_RUBY_VERSION'] == '2.2'
@@ -7,6 +7,7 @@ module GObject
7
7
  # To create Closure objects wrapping Ruby code, use {RubyClosure}.
8
8
  class Closure
9
9
  setup_method :new_simple
10
+ setup_instance_method :invoke
10
11
 
11
12
  # @override
12
13
  #
@@ -16,6 +17,25 @@ module GObject
16
17
  Lib.g_closure_set_marshal self, callback
17
18
  end
18
19
 
20
+ # @override
21
+ #
22
+ # This override of invoke ensures the return value location can be passed
23
+ # in as the first argument, which is needed to ensure the GValue is
24
+ # initialized with the proper type.
25
+ #
26
+ # @param [GObject::Value] return_value The GValue to store the return
27
+ # value, or nil if no return value is expected.
28
+ # @param [Array] param_values the closure parameters, or nil if no
29
+ # parameters are needed.
30
+ # @param invocation_hint
31
+ def invoke(return_value, param_values, invocation_hint = nil)
32
+ rval = GObject::Value.from(return_value)
33
+ n_params = param_values.nil? ? 0 : param_values.length
34
+ params = GirFFI::SizedArray.from(GObject::Value, -1, param_values)
35
+ GObject::Lib.g_closure_invoke self, rval, n_params, params, invocation_hint
36
+ rval.get_value
37
+ end
38
+
19
39
  def store_pointer(ptr)
20
40
  super
21
41
  # NOTE: Call C functions directly to avoid extra argument conversion
@@ -1,13 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require 'ffi/bit_masks'
3
3
 
4
- # NOTE: Monkey-patch BitMask to work on JRuby.
5
- FFI::BitMasks::BitMask.class_eval do
6
- def reference_required?
7
- false
8
- end
9
- end
10
-
11
4
  module GObject
12
5
  # Module for attaching functions from the gobject library
13
6
  module Lib
@@ -70,14 +70,16 @@ module GirFFI
70
70
  end
71
71
 
72
72
  def class_init_proc
73
- proc do |object_class_ptr, _data|
73
+ proc do |type_class_or_ptr, _data|
74
+ object_class_ptr = type_class_or_ptr.to_ptr
74
75
  setup_properties object_class_ptr
75
76
  setup_vfuncs object_class_ptr
76
77
  end
77
78
  end
78
79
 
79
80
  def interface_init_proc(interface)
80
- proc do |interface_ptr, _data|
81
+ proc do |interface_or_ptr, _data|
82
+ interface_ptr = interface_or_ptr.to_ptr
81
83
  setup_interface_vfuncs interface, interface_ptr
82
84
  end
83
85
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  # Current GirFFI version
3
3
  module GirFFI
4
- VERSION = '0.10.1'.freeze
4
+ VERSION = '0.10.2'.freeze
5
5
  end
@@ -59,7 +59,7 @@ describe GObject::RubyClosure do
59
59
  a = 0
60
60
  c = GObject::RubyClosure.new { a = 2 }
61
61
  c2 = GObject::Closure.wrap(c.to_ptr)
62
- c2.invoke nil, nil, nil
62
+ c2.invoke nil, []
63
63
  assert_equal 2, a
64
64
  end
65
65
  end
@@ -488,16 +488,16 @@ describe GirFFI::Builders::FunctionBuilder do
488
488
  end
489
489
 
490
490
  describe 'for functions where some allow-none cannot be honored' do
491
- let(:function_info) { get_method_introspection_data 'GObject', 'Closure', 'invoke' }
491
+ let(:function_info) { get_introspection_data 'GIMarshallingTests', 'array_in_utf8_two_in_out_of_order' }
492
492
  it 'builds correct definition with default parameter value on the later arguments' do
493
493
  code.must_equal <<-CODE.reset_indentation
494
- def invoke(return_value, param_values, invocation_hint = nil)
495
- _v1 = GObject::Value.from(return_value)
496
- n_param_values = param_values.nil? ? 0 : param_values.length
497
- _v2 = n_param_values
498
- _v3 = invocation_hint
499
- _v4 = GirFFI::SizedArray.from(GObject::Value, -1, param_values)
500
- GObject::Lib.g_closure_invoke self, _v1, _v2, _v4, _v3
494
+ def self.array_in_utf8_two_in_out_of_order(a, ints, b = nil)
495
+ length = ints.nil? ? 0 : ints.length
496
+ _v1 = length
497
+ _v2 = GirFFI::InPointer.from_utf8(a)
498
+ _v3 = GirFFI::InPointer.from_utf8(b)
499
+ _v4 = GirFFI::SizedArray.from(:gint32, -1, ints)
500
+ GIMarshallingTests::Lib.gi_marshalling_tests_array_in_utf8_two_in_out_of_order _v1, _v2, _v4, _v3
501
501
  end
502
502
  CODE
503
503
  end
@@ -1841,8 +1841,9 @@ describe GIMarshallingTests do
1841
1841
  it 'has a working function #gclosure_return' do
1842
1842
  cl = GIMarshallingTests.gclosure_return
1843
1843
  gv = GObject::Value.wrap_ruby_value 0
1844
- cl.invoke gv, nil, nil
1844
+ result = cl.invoke gv, nil
1845
1845
  assert_equal 42, gv.get_value
1846
+ result.must_equal 42
1846
1847
  end
1847
1848
 
1848
1849
  it 'has a working function #genum_in' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gir_ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matijs van Zuijlen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-28 00:00:00.000000000 Z
11
+ date: 2016-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.0
33
+ version: 0.1.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.1.0
40
+ version: 0.1.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: indentation
43
43
  requirement: !ruby/object:Gem::Requirement