From 12836ec27c5a8c0c0c4ae3b23345fdbd257c5a58 Mon Sep 17 00:00:00 2001 From: caremoli Date: Mon, 18 Feb 2008 09:39:30 +0000 Subject: [PATCH] CCAR: cleaner management of getIORaddr return value --- .../NamingService_WaitForServerReadiness.cxx | 11 +++++------ src/NamingService/Test/NamingServiceTest.cxx | 9 +++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/NamingService/NamingService_WaitForServerReadiness.cxx b/src/NamingService/NamingService_WaitForServerReadiness.cxx index 3021b6c85..d4eb2aa7e 100644 --- a/src/NamingService/NamingService_WaitForServerReadiness.cxx +++ b/src/NamingService/NamingService_WaitForServerReadiness.cxx @@ -66,9 +66,8 @@ void NamingService_WaitForServerReadiness(SALOME_NamingService* NS, { if (serverName.length() == 0) { - char* dummyadr = NS->getIORaddr(); // to wait for naming service + CORBA::String_var dummyadr = NS->getIORaddr(); // to wait for naming service found = 1; - delete [] dummyadr; break; // naming service found } else @@ -81,9 +80,9 @@ void NamingService_WaitForServerReadiness(SALOME_NamingService* NS, } MESSAGE("Server "<< serverName <<" not yet ready, waiting..."); #ifndef WNT - int a = nanosleep(&ts_req,&ts_rem); // wait before retry + nanosleep(&ts_req,&ts_rem); // wait before retry #else - Sleep(TIMESleep/1000000); + Sleep(TIMESleep/1000000); #endif } } @@ -91,9 +90,9 @@ void NamingService_WaitForServerReadiness(SALOME_NamingService* NS, { MESSAGE("CORBA::COMM_FAILURE: Naming Service not yet ready, waiting..."); #ifndef WNT - int a = nanosleep(&ts_req,&ts_rem); // wait before retry + nanosleep(&ts_req,&ts_rem); // wait before retry #else - Sleep(TIMESleep/1000000); + Sleep(TIMESleep/1000000); #endif } } diff --git a/src/NamingService/Test/NamingServiceTest.cxx b/src/NamingService/Test/NamingServiceTest.cxx index bfb70a8df..2a9e1fca2 100644 --- a/src/NamingService/Test/NamingServiceTest.cxx +++ b/src/NamingService/Test/NamingServiceTest.cxx @@ -182,9 +182,8 @@ NamingServiceTest::testConstructorDefault() //CPPUNIT_ASSERT_THROW(NS.getIORaddr(),CORBA::Exception); NS.init_orb(_orb); - char *root = NS.getIORaddr(); + CORBA::String_var root = NS.getIORaddr(); CORBA::Object_var obj = _orb->string_to_object(root); - delete [] root; CPPUNIT_ASSERT(!CORBA::is_nil(obj)); CosNaming::NamingContext_var rootContext = @@ -202,10 +201,9 @@ void NamingServiceTest::testConstructorOrb() { SALOME_NamingService NS(_orb); - char *root = NS.getIORaddr(); + CORBA::String_var root = NS.getIORaddr(); CORBA::Object_var obj = _orb->string_to_object(root); CPPUNIT_ASSERT(!CORBA::is_nil(obj)); - delete [] root; CosNaming::NamingContext_var rootContext = CosNaming::NamingContext::_narrow(obj); @@ -1208,9 +1206,8 @@ NamingServiceTest::testDestroyFullDirectory() void NamingServiceTest::testGetIorAddr() { - char *root = _NS.getIORaddr(); + CORBA::String_var root = _NS.getIORaddr(); CORBA::Object_var obj = _orb->string_to_object(root); - delete [] root; CPPUNIT_ASSERT(!CORBA::is_nil(obj)); } -- 2.39.2