* ext/fiddle/lib/fiddle/struct.rb (Fiddle::CStructEntity#set_ctypes):

CPtr -> Pointer.
* test/fiddle/test_c_struct_entry.rb
  (Fiddle::TestCStructEntity#test_aref_pointer):
  Added the test for the above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kou 2012-12-21 14:16:02 +00:00
Родитель e852838cee
Коммит 8346f7b2ad
3 изменённых файлов: 18 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Fri Dec 21 23:15:25 2012 Kouhei Sutou <kou@cozmixng.org>
* ext/fiddle/lib/fiddle/struct.rb (Fiddle::CStructEntity#set_ctypes):
CPtr -> Pointer.
* test/fiddle/test_c_struct_entry.rb
(Fiddle::TestCStructEntity#test_aref_pointer):
Added the test for the above.
Fri Dec 21 23:12:05 2012 Kouhei Sutou <kou@cozmixng.org>
* ext/fiddle/lib/fiddle/struct.rb (Fiddle::CStructEntity#set_ctypes):

Просмотреть файл

@ -168,7 +168,7 @@ module Fiddle
val = val.collect{|v| Pointer.new(v)}
end
when TYPE_VOIDP
val = CPtr.new(val[0])
val = Pointer.new(val[0])
else
val = val[0]
end

Просмотреть файл

@ -61,5 +61,14 @@ module Fiddle
team["names"] = [alice, bob]
assert_equal(["Alice", "Bob"], team["names"].map(&:to_s))
end
def test_aref_pointer
user = CStructEntity.malloc([TYPE_VOIDP])
user.assign_names(["name"])
alice = Fiddle::Pointer.malloc(6)
alice[0, 6] = "Alice\0"
user["name"] = alice
assert_equal("Alice", user["name"].to_s)
end
end
end