fiddle 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/fiddle/closure.c +20 -6
- data/ext/fiddle/conversions.h +0 -1
- data/lib/fiddle/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85e08da5c953ef4aefaf622427c196efc6559472c28675e018c3c5fc90aeae3b
|
4
|
+
data.tar.gz: b15949472d4634e76131d93507cae2908b1aa3988cd66632425d643b8dfad99a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06705e378f8a9a698e640bcf795ea41db5d4c95fce920fb2ed770a0ca438e84ab51591aad211a275e9956861aafa17345e2cb80a72cc9cdc42d83a30e4f5ee69
|
7
|
+
data.tar.gz: 3c0a54c5bca05e215c406953e4bf8c1559df2c9c5ad8526d659eca956bef9de2d9fa0fca68ea7b9c97587a56186d54dc34c33b375ca8ea0becb91dca0af72227
|
data/ext/fiddle/closure.c
CHANGED
@@ -130,6 +130,10 @@ with_gvl_callback(void *ptr)
|
|
130
130
|
rb_ary_push(params, ULL2NUM(*(unsigned LONG_LONG *)x->args[i]));
|
131
131
|
break;
|
132
132
|
#endif
|
133
|
+
case TYPE_CONST_STRING:
|
134
|
+
rb_ary_push(params,
|
135
|
+
rb_str_new_cstr(*((const char **)(x->args[i]))));
|
136
|
+
break;
|
133
137
|
default:
|
134
138
|
rb_raise(rb_eRuntimeError, "closure args: %d", type);
|
135
139
|
}
|
@@ -175,6 +179,10 @@ with_gvl_callback(void *ptr)
|
|
175
179
|
*(unsigned LONG_LONG *)x->resp = NUM2ULL(ret);
|
176
180
|
break;
|
177
181
|
#endif
|
182
|
+
case TYPE_CONST_STRING:
|
183
|
+
/* Dangerous. Callback must keep reference of the String. */
|
184
|
+
*((const char **)(x->resp)) = StringValueCStr(ret);
|
185
|
+
break;
|
178
186
|
default:
|
179
187
|
rb_raise(rb_eRuntimeError, "closure retval: %d", type);
|
180
188
|
}
|
@@ -221,6 +229,7 @@ initialize(int rbargc, VALUE argv[], VALUE self)
|
|
221
229
|
{
|
222
230
|
VALUE ret;
|
223
231
|
VALUE args;
|
232
|
+
VALUE normalized_args;
|
224
233
|
VALUE abi;
|
225
234
|
fiddle_closure * cl;
|
226
235
|
ffi_cif * cif;
|
@@ -239,21 +248,26 @@ initialize(int rbargc, VALUE argv[], VALUE self)
|
|
239
248
|
|
240
249
|
cl->argv = (ffi_type **)xcalloc(argc + 1, sizeof(ffi_type *));
|
241
250
|
|
251
|
+
normalized_args = rb_ary_new_capa(argc);
|
242
252
|
for (i = 0; i < argc; i++) {
|
243
|
-
|
244
|
-
|
253
|
+
VALUE arg = rb_fiddle_type_ensure(RARRAY_AREF(args, i));
|
254
|
+
rb_ary_push(normalized_args, arg);
|
255
|
+
cl->argv[i] = rb_fiddle_int_to_ffi_type(NUM2INT(arg));
|
245
256
|
}
|
246
257
|
cl->argv[argc] = NULL;
|
247
258
|
|
259
|
+
ret = rb_fiddle_type_ensure(ret);
|
248
260
|
rb_iv_set(self, "@ctype", ret);
|
249
|
-
rb_iv_set(self, "@args",
|
261
|
+
rb_iv_set(self, "@args", normalized_args);
|
250
262
|
|
251
263
|
cif = &cl->cif;
|
252
264
|
pcl = cl->pcl;
|
253
265
|
|
254
|
-
result = ffi_prep_cif(cif,
|
255
|
-
|
256
|
-
|
266
|
+
result = ffi_prep_cif(cif,
|
267
|
+
NUM2INT(abi),
|
268
|
+
argc,
|
269
|
+
rb_fiddle_int_to_ffi_type(NUM2INT(ret)),
|
270
|
+
cl->argv);
|
257
271
|
|
258
272
|
if (FFI_OK != result)
|
259
273
|
rb_raise(rb_eRuntimeError, "error prepping CIF %d", result);
|
data/ext/fiddle/conversions.h
CHANGED
@@ -24,7 +24,6 @@ typedef union
|
|
24
24
|
void * pointer; /* ffi_type_pointer */
|
25
25
|
} fiddle_generic;
|
26
26
|
|
27
|
-
/* Deprecated. Use rb_fiddle_*() version. */
|
28
27
|
VALUE rb_fiddle_type_ensure(VALUE type);
|
29
28
|
ffi_type * rb_fiddle_int_to_ffi_type(int type);
|
30
29
|
void rb_fiddle_value_to_generic(int type, VALUE *src, fiddle_generic *dst);
|
data/lib/fiddle/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fiddle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-12-
|
12
|
+
date: 2020-12-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
|
-
rubygems_version: 3.2.
|
121
|
+
rubygems_version: 3.2.3
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: A libffi wrapper for Ruby.
|