From 6d20a060191fc1a57433895537f0320c447baea6 Mon Sep 17 00:00:00 2001 From: Jose Date: Mon, 22 Jan 2024 10:11:28 +0100 Subject: [PATCH] Fix review comments --- ruby/src/IceRuby/Types.cpp | 14 +++++++------- ruby/src/IceRuby/Types.h | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ruby/src/IceRuby/Types.cpp b/ruby/src/IceRuby/Types.cpp index 0d442d54300..f526796602e 100644 --- a/ruby/src/IceRuby/Types.cpp +++ b/ruby/src/IceRuby/Types.cpp @@ -1793,7 +1793,7 @@ IceRuby::DictionaryInfo::marshal(VALUE p, Ice::OutputStream* os, ValueMap* value os->writeSize(sz); if(sz > 0) { - DictionaryMarshalIterator iter(dynamic_pointer_cast(shared_from_this()), os, valueMap); + DictionaryMarshalIterator iter(shared_from_this(), os, valueMap); hashIterate(hash, iter); } } @@ -1929,7 +1929,7 @@ IceRuby::DictionaryInfo::print(VALUE value, IceUtilInternal::Output& out, PrintO } out.sb(); - DictionaryPrintIterator iter(dynamic_pointer_cast(shared_from_this()), out, history); + DictionaryPrintIterator iter(shared_from_this(), out, history); hashIterate(hash, iter); out.eb(); } @@ -2050,7 +2050,7 @@ IceRuby::ClassInfo::validate(VALUE val) assert(!NIL_P(type)); ClassInfoPtr info = dynamic_pointer_cast(getType(type)); assert(info); - return this->interface || info->isA(dynamic_pointer_cast(shared_from_this())); + return this->interface || info->isA(shared_from_this()); } bool @@ -2103,7 +2103,7 @@ IceRuby::ClassInfo::marshal(VALUE p, Ice::OutputStream* os, ValueMap* valueMap, ValueMap::iterator q = valueMap->find(p); if(q == valueMap->end()) { - writer = make_shared(p, valueMap, dynamic_pointer_cast(shared_from_this())); + writer = make_shared(p, valueMap, shared_from_this()); valueMap->insert(ValueMap::value_type(p, writer)); } else @@ -2143,7 +2143,7 @@ IceRuby::ClassInfo::unmarshal(Ice::InputStream* is, const UnmarshalCallbackPtr& // attached to the stream keeps a reference to the callback object to ensure it lives // long enough. // - ReadValueCallbackPtr rocb = make_shared(dynamic_pointer_cast(shared_from_this()), cb, target, closure); + ReadValueCallbackPtr rocb = make_shared(shared_from_this(), cb, target, closure); StreamUtil* util = reinterpret_cast(is->getClosure()); assert(util); util->add(rocb); @@ -2192,7 +2192,7 @@ IceRuby::ClassInfo::print(VALUE value, IceUtilInternal::Output& out, PrintObject // if(id == "::Ice::LocalObject") { - info = dynamic_pointer_cast(shared_from_this()); + info = shared_from_this(); } else { @@ -2354,7 +2354,7 @@ IceRuby::ProxyInfo::validate(VALUE val) assert(!NIL_P(type)); ProxyInfoPtr info = dynamic_pointer_cast(getType(type)); assert(info); - return info->isA(dynamic_pointer_cast(shared_from_this())); + return info->isA(shared_from_this()); } return true; } diff --git a/ruby/src/IceRuby/Types.h b/ruby/src/IceRuby/Types.h index a525aa8046d..958b5f1f9cf 100644 --- a/ruby/src/IceRuby/Types.h +++ b/ruby/src/IceRuby/Types.h @@ -132,7 +132,7 @@ class StreamUtil // // Base class for type information. // -class TypeInfo : public UnmarshalCallback, public std::enable_shared_from_this +class TypeInfo : public UnmarshalCallback { public: @@ -284,7 +284,7 @@ class StructInfo final : public TypeInfo using StructInfoPtr = std::shared_ptr; // Sequence information. -class SequenceInfo final : public TypeInfo +class SequenceInfo final : public TypeInfo, public std::enable_shared_from_this { public: @@ -324,7 +324,7 @@ class SequenceInfo final : public TypeInfo using SequenceInfoPtr = std::shared_ptr; // Dictionary information. -class DictionaryInfo final : public TypeInfo +class DictionaryInfo final : public TypeInfo, public std::enable_shared_from_this { public: @@ -372,7 +372,7 @@ class DictionaryInfo final : public TypeInfo using DictionaryInfoPtr = std::shared_ptr ; using TypeInfoList = std::vector; -class ClassInfo final : public TypeInfo +class ClassInfo final : public TypeInfo, public std::enable_shared_from_this { public: @@ -417,7 +417,7 @@ class ClassInfo final : public TypeInfo }; // Proxy information. -class ProxyInfo final: public TypeInfo +class ProxyInfo final: public TypeInfo, public std::enable_shared_from_this { public: