diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2020-12-09 12:01:19 +0100 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2020-12-09 12:01:19 +0100 |
commit | 1275e501fb13aae63cfe8af020dc92437da18758 (patch) | |
tree | 07ccedcf7457d1f690b92c671140e8ac484deef2 | |
parent | 0dae8953949ffb81edb539878599e499c4aa77a7 (diff) | |
download | ATCD-1275e501fb13aae63cfe8af020dc92437da18758.tar.gz |
Use std::strcmp, layout changes, fixed memory leak
* TAO/tests/Portable_Interceptors/Dynamic/client_interceptor.cpp:
* TAO/tests/Portable_Interceptors/Dynamic/client_interceptor.h:
* TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.cpp:
3 files changed, 26 insertions, 48 deletions
diff --git a/TAO/tests/Portable_Interceptors/Dynamic/client_interceptor.cpp b/TAO/tests/Portable_Interceptors/Dynamic/client_interceptor.cpp index 6303dfd820d..a438933b32a 100644 --- a/TAO/tests/Portable_Interceptors/Dynamic/client_interceptor.cpp +++ b/TAO/tests/Portable_Interceptors/Dynamic/client_interceptor.cpp @@ -6,7 +6,7 @@ #include "tao/AnyTypeCode/AnyTypeCode_Adapter_Impl.h" #include "ace/Log_Msg.h" -#include "ace/OS_NS_string.h" +#include <cstring> Echo_Client_Request_Interceptor::Echo_Client_Request_Interceptor () : myname_ ("Echo_Client_Interceptor") @@ -25,15 +25,13 @@ Echo_Client_Request_Interceptor::destroy () } void -Echo_Client_Request_Interceptor::send_poll ( - PortableInterceptor::ClientRequestInfo_ptr) +Echo_Client_Request_Interceptor::send_poll (PortableInterceptor::ClientRequestInfo_ptr) { // Do nothing } void -Echo_Client_Request_Interceptor::send_request ( - PortableInterceptor::ClientRequestInfo_ptr ri) +Echo_Client_Request_Interceptor::send_request (PortableInterceptor::ClientRequestInfo_ptr ri) { bool catched_exception = false; try @@ -60,17 +58,14 @@ Echo_Client_Request_Interceptor::send_request ( op.in ())); // For the "normal" operation, get the argument list. - if (ACE_OS::strcmp (op.in (), - "normal") == 0) + if (std::strcmp (op.in (), "normal") == 0) { - Dynamic::ParameterList_var paramlist = - ri->arguments (); + Dynamic::ParameterList_var paramlist = ri->arguments (); if (paramlist->length () != 2) { ACE_ERROR ((LM_ERROR, "(%P|%t) All parameters not available\n")); - } CORBA::ULong first = 0, second = 1; // If you dont understand @@ -106,10 +101,8 @@ Echo_Client_Request_Interceptor::send_request ( } void -Echo_Client_Request_Interceptor::receive_other ( - PortableInterceptor::ClientRequestInfo_ptr ri) +Echo_Client_Request_Interceptor::receive_other (PortableInterceptor::ClientRequestInfo_ptr ri) { - CORBA::String_var op = ri->operation (); ACE_DEBUG ((LM_DEBUG, @@ -119,8 +112,7 @@ Echo_Client_Request_Interceptor::receive_other ( } void -Echo_Client_Request_Interceptor::receive_reply ( - PortableInterceptor::ClientRequestInfo_ptr ri) +Echo_Client_Request_Interceptor::receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri) { CORBA::String_var op = ri->operation (); @@ -130,11 +122,9 @@ Echo_Client_Request_Interceptor::receive_reply ( op.in ())); // For the "normal" operation, get the argument list. - if (ACE_OS::strcmp (op.in (), - "normal") == 0) + if (std::strcmp (op.in (), "normal") == 0) { - Dynamic::ParameterList_var paramlist = - ri->arguments (); + Dynamic::ParameterList_var paramlist = ri->arguments (); if (paramlist->length () != 2) { @@ -170,8 +160,7 @@ Echo_Client_Request_Interceptor::receive_reply ( CORBA::String_var transfer (str); - if (ACE_OS::strcmp (str, - "DO_NOT_INSULT_MY_INTELLIGENCE") != 0) + if (std::strcmp (str, "DO_NOT_INSULT_MY_INTELLIGENCE") != 0) { ACE_ERROR ((LM_ERROR, "(%P|%t) ERROR in send_request while checking " @@ -180,10 +169,9 @@ Echo_Client_Request_Interceptor::receive_reply ( } } - if (ACE_OS::strcmp (op.in (), "calculate") == 0) + if (std::strcmp (op.in (), "calculate") == 0) { - Dynamic::ParameterList_var paramlist = - ri->arguments (); + Dynamic::ParameterList_var paramlist = ri->arguments (); CORBA::Long param1, param2, result; CORBA::ULong i = 0; // index -- explicitly used to avoid @@ -202,7 +190,7 @@ Echo_Client_Request_Interceptor::receive_reply ( result)); } - if (ACE_OS::strcmp (op.in (), "_get_the_structure") == 0) + if (std::strcmp (op.in (), "_get_the_structure") == 0) { CORBA::Any_var a = ri->result (); @@ -230,8 +218,7 @@ Echo_Client_Request_Interceptor::receive_exception ( "from \"%C\"\n", op.in ())); - CORBA::String_var exception_id = - ri->received_exception_id (); + CORBA::String_var exception_id = ri->received_exception_id (); ACE_DEBUG ((LM_DEBUG, "Exception ID = %C\n", diff --git a/TAO/tests/Portable_Interceptors/Dynamic/client_interceptor.h b/TAO/tests/Portable_Interceptors/Dynamic/client_interceptor.h index e9957b142f0..47fa87db7bc 100644 --- a/TAO/tests/Portable_Interceptors/Dynamic/client_interceptor.h +++ b/TAO/tests/Portable_Interceptors/Dynamic/client_interceptor.h @@ -36,8 +36,7 @@ public: void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri) override; - void receive_exception ( - PortableInterceptor::ClientRequestInfo_ptr ri) override; + void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri) override; protected: ~Echo_Client_Request_Interceptor () override = default; diff --git a/TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.cpp b/TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.cpp index 6f423385865..f466a94ee61 100644 --- a/TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.cpp +++ b/TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.cpp @@ -6,7 +6,7 @@ #include "testC.h" #include "ace/Log_Msg.h" -#include "ace/OS_NS_string.h" +#include <cstring> Echo_Server_Request_Interceptor::Echo_Server_Request_Interceptor () : myname_ ("Echo_Server_Interceptor") @@ -57,7 +57,7 @@ Echo_Server_Request_Interceptor::receive_request ( "Echo_Server_Request_Interceptor::receive_request from \"%C\"\n", op.in ())); - if (ACE_OS::strcmp (op.in (), "normal") == 0) + if (std::strcmp (op.in (), "normal") == 0) { Dynamic::ParameterList_var paramlist = ri->arguments (); @@ -82,8 +82,7 @@ Echo_Server_Request_Interceptor::receive_request ( } } - CORBA::String_var tmdi = - ri->target_most_derived_interface (); + CORBA::String_var tmdi = ri->target_most_derived_interface (); ACE_DEBUG ((LM_DEBUG, "Target most derived interface: %C\n", @@ -91,20 +90,17 @@ Echo_Server_Request_Interceptor::receive_request ( } void -Echo_Server_Request_Interceptor::send_reply ( - PortableInterceptor::ServerRequestInfo_ptr ri) +Echo_Server_Request_Interceptor::send_reply (PortableInterceptor::ServerRequestInfo_ptr ri) { - CORBA::String_var op = ri->operation (); ACE_DEBUG ((LM_DEBUG, "Echo_Server_Request_Interceptor::send_reply from \"%C\"\n", op.in ())); - if (ACE_OS::strcmp (op.in (), "normal") == 0) + if (std::strcmp (op.in (), "normal") == 0) { - Dynamic::ParameterList_var paramlist = - ri->arguments (); + Dynamic::ParameterList_var paramlist = ri->arguments (); CORBA::Long param; CORBA::ULong i = 0; // index -- explicitly used to avoid @@ -115,10 +111,9 @@ Echo_Server_Request_Interceptor::send_reply ( param)); } - if (ACE_OS::strcmp (op.in (), "calculate") == 0) + if (std::strcmp (op.in (), "calculate") == 0) { - Dynamic::ParameterList_var paramlist = - ri->arguments (); + Dynamic::ParameterList_var paramlist = ri->arguments (); CORBA::Long param1, param2, result = 0; CORBA::ULong i = 0; // index -- explicitly used to avoid @@ -142,7 +137,6 @@ void Echo_Server_Request_Interceptor::send_exception ( PortableInterceptor::ServerRequestInfo_ptr ri) { - CORBA::String_var op = ri->operation (); ACE_DEBUG ((LM_DEBUG, @@ -150,17 +144,15 @@ Echo_Server_Request_Interceptor::send_exception ( "from \"%C\"\n", op.in ())); - - CORBA::Any_var any = - ri->sending_exception (); + CORBA::Any_var any = ri->sending_exception (); CORBA::TypeCode_var type = any->type (); - const char *exception_id = type->id (); + CORBA::String_var exception_id = type->id (); ACE_DEBUG ((LM_DEBUG, "Exception ID = %C\n", - exception_id)); + exception_id.in ())); } void |