From 65f0b56ff1f9b62bfc316779a7c3cd04a8a31ab6 Mon Sep 17 00:00:00 2001 From: Steve Huston Date: Fri, 8 Sep 2006 23:11:21 +0000 Subject: ChangeLogTag:Fri Sep 8 21:11:20 UTC 2006 Steve Huston --- ACE/ChangeLog | 19 ++++++++++++ ACE/THANKS | 1 + ACE/ace/Bound_Ptr.h | 4 +-- ACE/ace/CDR_Stream.cpp | 2 +- ACE/protocols/ace/RMCast/Protocol.h | 59 +++++++++++++++++++++---------------- 5 files changed, 57 insertions(+), 28 deletions(-) diff --git a/ACE/ChangeLog b/ACE/ChangeLog index f03ea8a11ed..900173041bb 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,22 @@ +Fri Sep 8 21:11:20 UTC 2006 Steve Huston + + * ace/CDR_Stream.cpp (ACE_OutputCDR::replace()): Fixed compile error + from apparant cut/paste error in ACE_ENABLE_SWAP_ON_WRITE path. + Thanks to JR Andreassen for reporting this. + + * ace/Bound_Ptr.h: Changed new constructor/assignment to use + dynamic_cast in order to be able to transport pointers through + that can go both up and down a class hierarchy. + (See Wed Sep 6 07:40:03 UTC 2006 Boris Kolpackov + ). + + * protocols/ace/RMCast/Protocol.h (clone(), clone_()): Replaced use of + naked pointers returned from clone_() with ACE_Strong_Bound_Ptr and + used new ACE_Strong_Bound_Ptr ctor to facilitate carrying a more- + refined type through a Profile_ptr and back. Closes up a window + for exception unsafeness noticed by Boris Kolpackov. Also see + Tue Aug 22 22:52:41 UTC 2006 Steve Huston + Fri Sep 8 18:25:17 UTC 2006 Steve Huston * ace/Synch_Options.{h cpp}: Improved the documentation for this diff --git a/ACE/THANKS b/ACE/THANKS index 0a338539b02..ca3d750b42f 100644 --- a/ACE/THANKS +++ b/ACE/THANKS @@ -2145,6 +2145,7 @@ Liu Qian Nzer Zaidenberg Birgit Platt Andy Salnikov +Andriy Gapon I would particularly like to thank Paul Stephenson, who worked with me at Ericsson in the early 1990's. Paul devised the recursive Makefile diff --git a/ACE/ace/Bound_Ptr.h b/ACE/ace/Bound_Ptr.h index 93cd8e2ec9e..619e0c4eb87 100644 --- a/ACE/ace/Bound_Ptr.h +++ b/ACE/ace/Bound_Ptr.h @@ -131,7 +131,7 @@ public: template ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr &r) : counter_ (r.counter_), - ptr_ (r.ptr_) + ptr_ (dynamic_cast(r.ptr_)) { // This ctor is temporarily defined here to increase our chances // of being accepted by broken compilers. @@ -161,7 +161,7 @@ public: // This will work if &r == this, by first increasing the ref count COUNTER *new_counter = r.counter_; - X* new_ptr = r.ptr_; + X* new_ptr = dynamic_cast (r.ptr_); COUNTER::attach_strong (new_counter); if (COUNTER::detach_strong (this->counter_) == 0) delete this->ptr_; diff --git a/ACE/ace/CDR_Stream.cpp b/ACE/ace/CDR_Stream.cpp index f010778f59e..e5636990a7e 100644 --- a/ACE/ace/CDR_Stream.cpp +++ b/ACE/ace/CDR_Stream.cpp @@ -651,7 +651,7 @@ ACE_OutputCDR::replace (ACE_CDR::Long x, char* loc) #if !defined (ACE_ENABLE_SWAP_ON_WRITE) *reinterpret_cast (loc) = x; #else - if (!strm->do_byte_swap ()) + if (!this->do_byte_swap_) { *reinterpret_cast (loc) = x; } diff --git a/ACE/protocols/ace/RMCast/Protocol.h b/ACE/protocols/ace/RMCast/Protocol.h index 7dfd45702ca..cf2c2d2289d 100644 --- a/ACE/protocols/ace/RMCast/Protocol.h +++ b/ACE/protocols/ace/RMCast/Protocol.h @@ -5,6 +5,7 @@ #ifndef ACE_RMCAST_PROTOCOL_H #define ACE_RMCAST_PROTOCOL_H +#include "ace/Auto_Ptr.h" #include "ace/Bound_Ptr.h" #include "ace/Vector_T.h" @@ -138,7 +139,7 @@ namespace ACE_RMCast { } - virtual Profile * + virtual Profile_ptr clone_ () = 0; private: @@ -403,14 +404,15 @@ namespace ACE_RMCast From_ptr clone () { - return From_ptr (dynamic_cast (clone_ ())); + return From_ptr (clone_ ()); } protected: - virtual Profile * + virtual Profile_ptr clone_ () { - return new From (*this); + Profile_ptr p (new From (*this)); + return p; } From (From const& from) @@ -487,14 +489,15 @@ namespace ACE_RMCast To_ptr clone () { - return To_ptr (dynamic_cast (clone_ ())); + return To_ptr (clone_ ()); } protected: - virtual Profile * + virtual Profile_ptr clone_ () { - return new To (*this); + Profile_ptr p (new To (*this)); + return p; } To (To const& to) @@ -588,14 +591,15 @@ namespace ACE_RMCast Data_ptr clone () { - return Data_ptr (dynamic_cast (clone_ ())); + return Data_ptr (clone_ ()); } protected: - virtual Profile * + virtual Profile_ptr clone_ () { - return new Data (*this); + Profile_ptr p (new Data (*this)); + return p; } Data (Data const& d) @@ -698,14 +702,15 @@ namespace ACE_RMCast SN_ptr clone () { - return SN_ptr (dynamic_cast (clone_ ())); + return SN_ptr (clone_ ()); } protected: - virtual Profile * + virtual Profile_ptr clone_ () { - return new SN (*this); + Profile_ptr p (new SN (*this)); + return p; } SN (SN const& sn) @@ -801,14 +806,15 @@ namespace ACE_RMCast NAK_ptr clone () { - return NAK_ptr (dynamic_cast (clone_ ())); + return NAK_ptr (clone_ ()); } protected: - virtual Profile * + virtual Profile_ptr clone_ () { - return new NAK (*this); + Profile_ptr p (new NAK (*this)); + return p; } NAK (NAK const& nak) @@ -986,14 +992,15 @@ namespace ACE_RMCast NRTM_ptr clone () { - return NRTM_ptr (dynamic_cast (clone_ ())); + return NRTM_ptr (clone_ ()); } protected: - virtual Profile * + virtual Profile_ptr clone_ () { - return new NRTM (*this); + Profile_ptr p (new NRTM (*this)); + return p; } NRTM (NRTM const& nrtm) @@ -1137,14 +1144,15 @@ namespace ACE_RMCast NoData_ptr clone () { - return NoData_ptr (dynamic_cast (clone_ ())); + return NoData_ptr (clone_ ()); } protected: - virtual Profile * + virtual Profile_ptr clone_ () { - return new NoData (*this); + Profile_ptr p (new NoData (*this)); + return p; } NoData (NoData const& no_data) @@ -1199,14 +1207,15 @@ namespace ACE_RMCast Part_ptr clone () { - return Part_ptr (dynamic_cast (clone_ ())); + return Part_ptr (clone_ ()); } protected: - virtual Profile * + virtual Profile_ptr clone_ () { - return new Part (*this); + Profile_ptr p (new Part (*this)); + return p; } Part (Part const& part) -- cgit v1.2.1