fiddle 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/fiddle/pointer.c +2 -1
- data/lib/fiddle/ffi_backend.rb +20 -9
- data/lib/fiddle/version.rb +1 -1
- data/lib/fiddle.rb +5 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a45e277aca605b7e6ca64874fcb263a34c4ec365ee3c718c3df7e6d37e0786d7
|
4
|
+
data.tar.gz: a441f4a982a218093e53de55f101f1afb0307c8764a028ad60b703d0f81c906e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4abc678600a35970e801719b4319908312e312db6ff987c020b52047c37ec123e2168346db6ad534462d0591645eaa40ea57851fd0e2e7bab92e297928c0d464
|
7
|
+
data.tar.gz: 9a8cbe9817d22c1d740caecf58252781c8268eea84a9957fe1704ac917482981fe4fe862d6d95d4a17ce8ac94a6b9cbc1272609ae77ab6d1f97901dcb2239a09
|
data/ext/fiddle/pointer.c
CHANGED
@@ -827,7 +827,8 @@ rb_fiddle_ptr_read_mem(VALUE klass, VALUE address, VALUE len)
|
|
827
827
|
static VALUE
|
828
828
|
rb_fiddle_ptr_write_mem(VALUE klass, VALUE addr, VALUE str)
|
829
829
|
{
|
830
|
-
|
830
|
+
const char *ptr = StringValuePtr(str);
|
831
|
+
memcpy(NUM2PTR(addr), ptr, RSTRING_LEN(str));
|
831
832
|
return str;
|
832
833
|
}
|
833
834
|
|
data/lib/fiddle/ffi_backend.rb
CHANGED
@@ -159,15 +159,16 @@ module Fiddle
|
|
159
159
|
args[i] = Fiddle::FFIBackend.to_ffi_type(args[i])
|
160
160
|
end
|
161
161
|
else
|
162
|
-
args.
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
162
|
+
@args.each_with_index do |arg_type, i|
|
163
|
+
next unless arg_type == Types::VOIDP
|
164
|
+
|
165
|
+
src = args[i]
|
166
|
+
next if src.nil?
|
167
|
+
next if src.is_a?(String)
|
168
|
+
next if src.is_a?(FFI::AbstractMemory)
|
169
|
+
next if src.is_a?(FFI::Struct)
|
170
|
+
|
171
|
+
args[i] = Pointer[src]
|
171
172
|
end
|
172
173
|
end
|
173
174
|
result = @function.call(*args, &block)
|
@@ -261,6 +262,14 @@ module Fiddle
|
|
261
262
|
end
|
262
263
|
end
|
263
264
|
|
265
|
+
def self.write(addr, bytes)
|
266
|
+
FFI::Pointer.new(addr).write_bytes(bytes)
|
267
|
+
end
|
268
|
+
|
269
|
+
def self.read(addr, len)
|
270
|
+
FFI::Pointer.new(addr).read_bytes(len)
|
271
|
+
end
|
272
|
+
|
264
273
|
class << self
|
265
274
|
alias [] to_ptr
|
266
275
|
end
|
@@ -308,6 +317,8 @@ module Fiddle
|
|
308
317
|
end
|
309
318
|
elsif addr.is_a?(IO)
|
310
319
|
raise NotImplementedError, "IO ptr isn't supported"
|
320
|
+
else
|
321
|
+
FFI::Pointer.new(Integer(addr))
|
311
322
|
end
|
312
323
|
|
313
324
|
@size = size ? size : ptr.size
|
data/lib/fiddle/version.rb
CHANGED
data/lib/fiddle.rb
CHANGED
@@ -111,7 +111,11 @@ module Fiddle
|
|
111
111
|
case line
|
112
112
|
when /\A\s*(?:INPUT|GROUP)\s*\(\s*([^\s,\)]+)/
|
113
113
|
# TODO: Should we support multiple files?
|
114
|
-
|
114
|
+
first_input = $1
|
115
|
+
if first_input.start_with?("-l")
|
116
|
+
first_input = "lib#{first_input[2..-1]}.so"
|
117
|
+
end
|
118
|
+
return dlopen(first_input)
|
115
119
|
end
|
116
120
|
end
|
117
121
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fiddle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
|
-
original_platform: ''
|
7
6
|
authors:
|
8
7
|
- Aaron Patterson
|
9
8
|
- SHIBATA Hiroshi
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A libffi wrapper for Ruby.
|
15
15
|
email:
|
@@ -56,6 +56,7 @@ licenses:
|
|
56
56
|
metadata:
|
57
57
|
msys2_mingw_dependencies: libffi
|
58
58
|
changelog_uri: https://github.com/ruby/fiddle/releases
|
59
|
+
post_install_message:
|
59
60
|
rdoc_options: []
|
60
61
|
require_paths:
|
61
62
|
- lib
|
@@ -70,7 +71,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
71
|
- !ruby/object:Gem::Version
|
71
72
|
version: '0'
|
72
73
|
requirements: []
|
73
|
-
rubygems_version: 3.
|
74
|
+
rubygems_version: 3.5.22
|
75
|
+
signing_key:
|
74
76
|
specification_version: 4
|
75
77
|
summary: A libffi wrapper for Ruby.
|
76
78
|
test_files: []
|