aboutsummaryrefslogtreecommitdiff
path: root/ruby/repository.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-18 09:47:19 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-18 09:47:19 +0000
commit1487104037a2708342f7a8c0359628f6c1e52d26 (patch)
tree52f5f79be41c04a0a60baeac09906e01155b97f2 /ruby/repository.cc
parent1ac2d4a08a6d1f2686dfebd853f6b8f69f0e3999 (diff)
downloadpaludis-1487104037a2708342f7a8c0359628f6c1e52d26.tar.gz
paludis-1487104037a2708342f7a8c0359628f6c1e52d26.tar.xz
(ruby) Fix how we use Data_Get_Struct to avoid magic C casting between tr1::shared_ptr<>s of different types.
Diffstat (limited to 'ruby/repository.cc')
-rw-r--r--ruby/repository.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/ruby/repository.cc b/ruby/repository.cc
index 0b733a7bd..63f18839a 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -54,9 +54,9 @@ namespace
{
if (rb_obj_is_kind_of(v, c_fake_repository_base))
{
- tr1::shared_ptr<FakeRepositoryBase> * v_ptr;
- Data_Get_Struct(v, tr1::shared_ptr<FakeRepositoryBase>, v_ptr);
- return *v_ptr;
+ tr1::shared_ptr<Repository> * v_ptr;
+ Data_Get_Struct(v, tr1::shared_ptr<Repository>, v_ptr);
+ return tr1::static_pointer_cast<FakeRepositoryBase>(*v_ptr);
}
else
{
@@ -839,9 +839,9 @@ namespace
if (2 != argc)
rb_raise(rb_eArgError, "FakeRepository.new expects two arguments, but got %d", argc);
- tr1::shared_ptr<FakeRepository> * r = new tr1::shared_ptr<FakeRepository>(new
+ tr1::shared_ptr<Repository> * r = new tr1::shared_ptr<Repository>(new
FakeRepository(value_to_environment(argv[0]).get(), RepositoryName(StringValuePtr(argv[1]))));
- VALUE tdata(Data_Wrap_Struct(self, 0, &Common<tr1::shared_ptr<FakeRepository> >::free, r));
+ VALUE tdata(Data_Wrap_Struct(self, 0, &Common<tr1::shared_ptr<Repository> >::free, r));
rb_obj_call_init(tdata, argc, argv);
return tdata;
}