Skip to content

Commit

Permalink
Use std::unique_ptr
Browse files Browse the repository at this point in the history
    * ACE/ACEXML/parser/parser/Parser.cpp:
    * ACE/apps/JAWS/server/HTTP_Server.cpp:
    * ACE/protocols/ace/INet/FTP_ClientRequestHandler.cpp:
    * ACE/protocols/ace/INet/HTTPS_Context.h:
    * ACE/protocols/ace/INet/HTTPS_SessionFactory.cpp:
    * ACE/protocols/ace/INet/HTTP_ClientRequestHandler.cpp:
    * ACE/protocols/ace/RMCast/Socket.cpp:
    * ACE/protocols/ace/RMCast/Socket.h:
    * ACE/protocols/examples/INet/FTP_Simple_exec.cpp:
    * ACE/protocols/examples/INet/HTTP_Simple_exec.cpp:
    * ACE/tests/Bug_3539_Regression_Test.cpp:
    * TAO/DevGuideExamples/Multithreading/GracefulShutdown/MessengerServer.cpp:
    * TAO/orbsvcs/ImplRepo_Service/Activator_Loader.h:
    * TAO/orbsvcs/ImplRepo_Service/Locator_Loader.h:
    * TAO/orbsvcs/ImplRepo_Service/tao_imr_i.h:
    * TAO/orbsvcs/examples/ImR/Combined_Service/dynserver.h:
    * TAO/orbsvcs/orbsvcs/IFRService/Container_i.cpp:
    * TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.cpp:
    * TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp:
    * TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.h:
    * TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context_Activator.cpp:
    * TAO/orbsvcs/orbsvcs/Notify/Admin.h:
    * TAO/orbsvcs/orbsvcs/Notify/Consumer.h:
    * TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.h:
    * TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Storable.cpp:
    * TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Mcast_Transport.cpp:
    * TAO/orbsvcs/tests/CosEvent/Timeout/TimeoutTestMain.cpp:
    * TAO/tests/Bug_3524_Regression/test_i.cpp:
    * TAO/tests/ORB_Local_Config/Two_DLL_ORB/ORB_DLL.h:
    * TAO/tests/Storable/Savable.cpp:
  • Loading branch information
jwillemsen committed Sep 2, 2023
1 parent 9ce21b6 commit 292335d
Show file tree
Hide file tree
Showing 30 changed files with 44 additions and 43 deletions.
1 change: 1 addition & 0 deletions ACE/ACEXML/parser/parser/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "ACEXML/parser/parser/ParserInternals.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_strings.h"
#include <memory>

static const ACEXML_Char default_attribute_type[] = ACE_TEXT ("CDATA");
static const ACEXML_Char empty_string[] = { 0 };
Expand Down
2 changes: 1 addition & 1 deletion ACE/apps/JAWS/server/HTTP_Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ HTTP_Server::init (int argc, ACE_TCHAR *argv[])
//NOTE: At this point f better not be a NULL pointer,
//so please do not change the ACE_NEW_RETURN macros unless
//you know what you are doing
ACE_Auto_Ptr<HTTP_Handler_Factory> factory (f);
std::unique_ptr<HTTP_Handler_Factory> factory (f);

// Choose what concurrency strategy to run.
switch (this->strategy_)
Expand Down
2 changes: 1 addition & 1 deletion ACE/protocols/ace/INet/FTP_ClientRequestHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace ACE
ACE_NEW_RETURN (session_holder,
SessionHolder (),
0);
ACE_Auto_Ptr<SessionHolder> session_safe_ref (session_holder);
std::unique_ptr<SessionHolder> session_safe_ref (session_holder);

(*session_holder)->set_host (ikey.host (), ikey.port ());

Expand Down
2 changes: 1 addition & 1 deletion ACE/protocols/ace/INet/HTTPS_Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace ACE
Context (const Context&);

ACE_SSL_Context* ssl_ctx_;
ACE_Auto_Ptr<ACE_SSL_Context> alloc_safe;
std::unique_ptr<ACE_SSL_Context> alloc_safe;

static int ssl_mode_;
static bool ssl_strict_;
Expand Down
2 changes: 1 addition & 1 deletion ACE/protocols/ace/INet/HTTPS_SessionFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace ACE
ACE_NEW_RETURN (session_holder,
SessionHolder_Impl (),
0);
ACE_Auto_Ptr<SessionHolder_Impl> session_safe_ref (session_holder);
std::unique_ptr<SessionHolder_Impl> session_safe_ref (session_holder);

(*session_holder)->set_host (ikey.host (), ikey.port ());
if (ikey.is_proxy_connection ())
Expand Down
2 changes: 1 addition & 1 deletion ACE/protocols/ace/INet/HTTP_ClientRequestHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace ACE
ACE_NEW_RETURN (session_holder,
SessionHolder_Impl (),
0);
ACE_Auto_Ptr<SessionHolder_Impl> session_safe_ref (session_holder);
std::unique_ptr<SessionHolder_Impl> session_safe_ref (session_holder);

(*session_holder)->set_host (ikey.host (), ikey.port ());
if (ikey.is_proxy_connection ())
Expand Down
12 changes: 6 additions & 6 deletions ACE/protocols/ace/RMCast/Socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ namespace ACE_RMCast

ACE_Pipe signal_pipe_;

ACE_Auto_Ptr<Fragment> fragment_;
ACE_Auto_Ptr<Reassemble> reassemble_;
ACE_Auto_Ptr<Acknowledge> acknowledge_;
ACE_Auto_Ptr<Retransmit> retransmit_;
ACE_Auto_Ptr<Flow> flow_;
ACE_Auto_Ptr<Link> link_;
std::unique_ptr<Fragment> fragment_;
std::unique_ptr<Reassemble> reassemble_;
std::unique_ptr<Acknowledge> acknowledge_;
std::unique_ptr<Retransmit> retransmit_;
std::unique_ptr<Flow> flow_;
std::unique_ptr<Link> link_;
};


Expand Down
2 changes: 1 addition & 1 deletion ACE/protocols/ace/RMCast/Socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace ACE_RMCast
get_handle ();

private:
ACE_Auto_Ptr<Socket_Impl> impl_;
std::unique_ptr<Socket_Impl> impl_;
};
}

Expand Down
2 changes: 1 addition & 1 deletion ACE/protocols/examples/INet/FTP_Simple_exec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class My_FTP_RequestHandler
int
ACE_TMAIN (int argc, ACE_TCHAR *argv [])
{
ACE_Auto_Ptr<std::ofstream> fout;
std::unique_ptr<std::ofstream> fout;
std::ostream* sout = &std::cout;

if (!parse_args (argc, argv))
Expand Down
4 changes: 2 additions & 2 deletions ACE/protocols/examples/INet/HTTP_Simple_exec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class My_HTTP_RequestHandler
int
ACE_TMAIN (int argc, ACE_TCHAR *argv [])
{
ACE_Auto_Ptr<std::ofstream> fout;
std::unique_ptr<std::ofstream> fout;
std::ostream* sout = &std::cout;

if (!parse_args (argc, argv))
Expand Down Expand Up @@ -212,7 +212,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv [])

std::cout << "Parsing url [" << url.c_str () << "]" << std::endl;

ACE_Auto_Ptr<ACE::INet::URL_Base> url_safe (ACE::INet::URL_Base::create_from_string (url));
std::unique_ptr<ACE::INet::URL_Base> url_safe (ACE::INet::URL_Base::create_from_string (url));

if (url_safe.get () == 0 || url != url_safe->to_string ())
{
Expand Down
2 changes: 1 addition & 1 deletion ACE/tests/Bug_3539_Regression_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ run_main (int, ACE_TCHAR *[])
{
ObjectWithTSS *o = 0;
ACE_NEW_RETURN (o, ObjectWithTSS, 1);
ACE_Auto_Ptr<ObjectWithTSS> owner (o);
std::unique_ptr<ObjectWithTSS> owner (o);

if (ACE_Thread_Manager::instance ()->spawn_n
(threads,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])

// Create a MessengerServer object.
MessengerServer * server = new MessengerServer (orb.in());
ACE_Auto_Ptr<MessengerServer> safe_ptr (server);
std::unique_ptr<MessengerServer> safe_ptr (server);

// Parse arguments to determine how we should shutdown.
if (server->parse_args (argc, argv) != 0)
Expand Down
2 changes: 1 addition & 1 deletion TAO/orbsvcs/ImplRepo_Service/Activator_Loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Activator_Export ImR_Activator_Loader : public TAO_Object_Loader
private:
ImR_Activator_i service_;
Activator_Options opts_;
ACE_Auto_Ptr<ImR_Activator_ORB_Runner> runner_;
std::unique_ptr<ImR_Activator_ORB_Runner> runner_;

private:
ImR_Activator_Loader (const ImR_Activator_Loader &) = delete;
Expand Down
2 changes: 1 addition & 1 deletion TAO/orbsvcs/ImplRepo_Service/Locator_Loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Locator_Export ImR_Locator_Loader : public TAO_Object_Loader
private:
ImR_Locator_i service_;
Options opts_;
ACE_Auto_Ptr<ImR_Locator_ORB_Runner> runner_;
std::unique_ptr<ImR_Locator_ORB_Runner> runner_;
private:
ImR_Locator_Loader (const ImR_Locator_Loader &) = delete;
ImR_Locator_Loader &operator = (const ImR_Locator_Loader &) = delete;
Expand Down
2 changes: 1 addition & 1 deletion TAO/orbsvcs/ImplRepo_Service/tao_imr_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class TAO_IMR_i
ImplementationRepository::Administration_var imr_;

/// What we need to do.
ACE_Auto_Ptr<TAO_IMR_Op> op_;
std::unique_ptr<TAO_IMR_Op> op_;
};


Expand Down
2 changes: 1 addition & 1 deletion TAO/orbsvcs/examples/ImR/Combined_Service/dynserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class DynServer_Export DynServer_Loader : public TAO_Object_Loader
CORBA::ORB_var orb_;
PortableServer::POA_var root_poa_;
DynServer service_;
ACE_Auto_Ptr<DynServer_ORB_Runner> runner_;
std::unique_ptr<DynServer_ORB_Runner> runner_;

private:
DynServer_Loader (const DynServer_Loader &) = delete;
Expand Down
2 changes: 1 addition & 1 deletion TAO/orbsvcs/orbsvcs/IFRService/Container_i.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ TAO_Container_i::create_constant_i (const char *id,
TAO_InputCDR in (out);
mb = in.steal_contents ();
}
ACE_Auto_Ptr<ACE_Message_Block> safe (mb);
std::unique_ptr<ACE_Message_Block> safe (mb);

CORBA::TypeCode_var val_tc = value.type ();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ TAO_FT_Naming_Manager::next_member (PortableGroup::ObjectGroup_ptr object_group)
::FT_Naming::LoadBalancingStrategyValue load_bal_strategy = this->global_strategy_;
if (!this->use_global_)
{
ACE_Auto_Ptr<PortableGroup::Properties> props
std::unique_ptr<PortableGroup::Properties> props
(this->get_properties (object_group));
PortableGroup::Value value;
CORBA::Boolean found =
Expand Down
6 changes: 3 additions & 3 deletions TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL

const char * TAO_Storable_Naming_Context::root_name_;
ACE_UINT32 TAO_Storable_Naming_Context::gcounter_;
ACE_Auto_Ptr<TAO::Storable_Base> TAO_Storable_Naming_Context::gfl_;
std::unique_ptr<TAO::Storable_Base> TAO_Storable_Naming_Context::gfl_;
int TAO_Storable_Naming_Context::redundant_;

TAO_Storable_IntId::TAO_Storable_IntId ()
Expand Down Expand Up @@ -414,7 +414,7 @@ TAO_Storable_Naming_Context::~TAO_Storable_Naming_Context ()
ACE_CString file_name = this->context_name_;

// Now delete the file
ACE_Auto_Ptr<TAO::Storable_Base>
std::unique_ptr<TAO::Storable_Base>
fl (
this->factory_->create_stream(file_name.c_str(), "r")
);
Expand Down Expand Up @@ -1074,7 +1074,7 @@ TAO_Storable_Naming_Context::recreate_all (

// Now does this already exist on disk?
ACE_CString file_name = poa_id;
ACE_Auto_Ptr<TAO::Storable_Base> fl (
std::unique_ptr<TAO::Storable_Base> fl (
pers_factory->create_stream (file_name.c_str (), "r"));
if (fl->exists ())
{
Expand Down
2 changes: 1 addition & 1 deletion TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ class TAO_Naming_Serv_Export TAO_Storable_Naming_Context : public TAO_Hash_Namin
static const char * root_name_;

/// The pointer to the global file used to allocate new contexts
static ACE_Auto_Ptr<TAO::Storable_Base> gfl_;
static std::unique_ptr<TAO::Storable_Base> gfl_;

/**
* @class File_Open_Lock_and_Check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ TAO_Storable_Naming_Context_Activator::incarnate (
{ // Does this already exist on disk?

ACE_CString file_name = poa_id.in ();
ACE_Auto_Ptr<TAO::Storable_Base> fl (
std::unique_ptr<TAO::Storable_Base> fl (
persistence_factory_->create_stream (file_name.c_str (),
"rw"));

Expand Down
2 changes: 1 addition & 1 deletion TAO/orbsvcs/orbsvcs/Notify/Admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class TAO_Notify_Serv_Export TAO_Notify_Admin : public TAO_Notify::Topology_Pare
void remove (TAO_Notify_Proxy *proxy);

/// The Proxy Container.
ACE_Auto_Ptr< TAO_Notify_Proxy_Container > proxy_container_;
std::unique_ptr< TAO_Notify_Proxy_Container > proxy_container_;
};

TAO_END_VERSIONED_NAMESPACE_DECL
Expand Down
2 changes: 1 addition & 1 deletion TAO/orbsvcs/orbsvcs/Notify/Consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ typedef TAO_Notify_Refcountable_Guard_T< TAO_Notify_Consumer > Ptr;

private:
/// Events pending to be delivered.
ACE_Auto_Ptr<Request_Queue> pending_events_;
std::unique_ptr<Request_Queue> pending_events_;

CORBA::Object_var rtt_obj_;
};
Expand Down
4 changes: 2 additions & 2 deletions TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ class TAO_Notify_Serv_Export TAO_CosNotify_Service : public TAO_Notify_Service
TAO_Notify_Builder& builder();

/// Service component for object factory operations.
ACE_Auto_Ptr< TAO_Notify_Factory > factory_;
std::unique_ptr< TAO_Notify_Factory > factory_;

/// Service component for building NS participants.
ACE_Auto_Ptr< TAO_Notify_Builder > builder_;
std::unique_ptr< TAO_Notify_Builder > builder_;
};

TAO_END_VERSIONED_NAMESPACE_DECL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ TAO::PG_Object_Group_Storable::PG_Object_Group_Storable (
// version already exists.
bool stream_exists = false;
{
ACE_Auto_Ptr<TAO::Storable_Base> stream (this->create_stream ("r"));
std::unique_ptr<TAO::Storable_Base> stream (this->create_stream ("r"));

if (stream->exists ())
stream_exists = true;
Expand Down Expand Up @@ -284,7 +284,7 @@ TAO::PG_Object_Group_Storable::PG_Object_Group_Storable (
// version already exists.
bool stream_exists = false;
{
ACE_Auto_Ptr<TAO::Storable_Base> stream (this->create_stream ("r"));
std::unique_ptr<TAO::Storable_Base> stream (this->create_stream ("r"));

if (stream->exists ())
stream_exists = true;
Expand All @@ -304,7 +304,7 @@ TAO::PG_Object_Group_Storable::~PG_Object_Group_Storable ()
{
if (destroyed_)
{
ACE_Auto_Ptr<TAO::Storable_Base> stream (this->create_stream ("r"));
std::unique_ptr<TAO::Storable_Base> stream (this->create_stream ("r"));

if (stream->exists ())
{
Expand Down
4 changes: 2 additions & 2 deletions TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Mcast_Transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ TAO_UIPMC_Mcast_Transport::cleanup_packets (bool expired_only)
(*cur_iter).item ()->data_length ()));
}

ACE_Auto_Ptr<TAO_PG::UIPMC_Recv_Packet> guard ((*cur_iter).item ());
std::unique_ptr<TAO_PG::UIPMC_Recv_Packet> guard ((*cur_iter).item ());
this->incomplete_.unbind (cur_iter);
}
}
Expand Down Expand Up @@ -514,7 +514,7 @@ TAO_UIPMC_Mcast_Transport::handle_input (
}

// Grab the next completed MIOP message to process from the FIFO Queue.
ACE_Auto_Ptr<TAO_PG::UIPMC_Recv_Packet> complete_owner (this->recv_all (rh));
std::unique_ptr<TAO_PG::UIPMC_Recv_Packet> complete_owner (this->recv_all (rh));
if (TAO_PG::UIPMC_Recv_Packet *complete = complete_owner.get ())
{
if (TAO_debug_level >= 9)
Expand Down
2 changes: 1 addition & 1 deletion TAO/orbsvcs/tests/CosEvent/Timeout/TimeoutTestMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
servant.activate ();
}

ACE_Auto_Ptr<SupplierTask> pST;
std::unique_ptr<SupplierTask> pST;
if (supplier)
{
// The supplier will use its own ORB.
Expand Down
4 changes: 2 additions & 2 deletions TAO/tests/Bug_3524_Regression/test_i.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ A_i::arr_method (::Test::A::FailOn where,

::Test::arr_bd_str_slice *res =
::Test::arr_bd_str_alloc ();
ACE_Auto_Ptr< ::Test::arr_bd_str_slice> safe (res);
std::unique_ptr< ::Test::arr_bd_str_slice> safe (res);

switch (where)
{
Expand Down Expand Up @@ -184,7 +184,7 @@ A_i::arr_method_s (::Test::A::FailOn where,

::Test::arr_bds_str_slice *res =
::Test::arr_bds_str_alloc ();
ACE_Auto_Ptr< ::Test::arr_bds_str_slice > safe (res);
std::unique_ptr< ::Test::arr_bds_str_slice > safe (res);

switch (where)
{
Expand Down
4 changes: 2 additions & 2 deletions TAO/tests/ORB_Local_Config/Two_DLL_ORB/ORB_DLL.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ class Service_Config_ORB_DLL_Export Service_Config_ORB_DLL

private:
signed char is_server_;
ACE_Auto_Ptr<Abstract_Worker> worker_;
ACE_Auto_Ptr<ACE_ARGV> argv_;
std::unique_ptr<Abstract_Worker> worker_;
std::unique_ptr<ACE_ARGV> argv_;
};

ACE_FACTORY_DECLARE (Service_Config_ORB_DLL, Service_Config_ORB_DLL)
Expand Down
2 changes: 1 addition & 1 deletion TAO/tests/Storable/Savable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Savable::Savable (TAO::Storable_Factory & storable_factory)
}
}

ACE_Auto_Ptr<TAO::Storable_Base> stream (storable_factory_.create_stream("test.dat", "r"));
std::unique_ptr<TAO::Storable_Base> stream (storable_factory_.create_stream("test.dat", "r"));
if (stream->exists ())
{
Savable_File_Guard fg(*this, SFG::CREATE_WITH_FILE);
Expand Down

0 comments on commit 292335d

Please sign in to comment.