Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/fiddle/ffi_backend.rb
Original file line numberDiff line numberDiff line change
Expand Up@@ -240,7 +240,7 @@ def self.from_native(value, ctx)
def self.to_ptr(value)
if value.is_a?(String)
cptr = Pointer.malloc(value.bytesize)
cptr.ffi_ptr.put_string(0, value)
cptr.ffi_ptr.put_bytes(0, value)
cptr

elsif value.is_a?(Array)
Expand DownExpand Up@@ -412,7 +412,7 @@ def to_s(len = nil)
if len
ffi_ptr.read_string(len)
else
ffi_ptr.get_string(0)
ffi_ptr.get_string(0, @size)
end
rescue FFI::NullPointerError
raise DLError.new("NULL pointer access")
Expand Down