diff -rc src/lib/omniORB2/dynamic/context.cc newsrc/lib/omniORB2/dynamic/context.cc *** src/lib/omniORB2/dynamic/context.cc Thu Jan 7 16:50:20 1999 --- newsrc/lib/omniORB2/dynamic/context.cc Mon Feb 1 15:23:59 1999 *************** *** 114,120 **** if( !prop_name ) throw CORBA::BAD_PARAM(0, CORBA::COMPLETED_NO); check_property_name(prop_name); ! CORBA::String_var name = CORBA::string_dup(prop_name); char* strval; if( !(value >>= strval) ) --- 114,120 ---- if( !prop_name ) throw CORBA::BAD_PARAM(0, CORBA::COMPLETED_NO); check_property_name(prop_name); ! CORBA::String_var name(CORBA::string_dup(prop_name)); char* strval; if( !(value >>= strval) ) diff -rc src/lib/omniORB2/dynamic/request.cc newsrc/lib/omniORB2/dynamic/request.cc *** src/lib/omniORB2/dynamic/request.cc Tue Jan 12 16:38:54 1999 --- newsrc/lib/omniORB2/dynamic/request.cc Mon Feb 1 15:24:35 1999 *************** *** 345,351 **** // Retrieve the Interface Repository ID of the exception. CORBA::ULong repoIdLen; repoIdLen <<= giop_client; ! CORBA::String_var repoId = CORBA::string_alloc(repoIdLen - 1); giop_client.get_char_array((CORBA::Char*)(char*)repoId, repoIdLen); --- 345,351 ---- // Retrieve the Interface Repository ID of the exception. CORBA::ULong repoIdLen; repoIdLen <<= giop_client; ! CORBA::String_var repoId(CORBA::string_alloc(repoIdLen - 1)); giop_client.get_char_array((CORBA::Char*)(char*)repoId, repoIdLen); *************** *** 390,397 **** case GIOP::LOCATION_FORWARD: { ! CORBA::Object_var obj = ! CORBA::Object::unmarshalObjRef(giop_client); giop_client.RequestCompleted(); if( CORBA::is_nil(obj) ){ if( omniORB::traceLevel > 10 ){ --- 390,396 ---- case GIOP::LOCATION_FORWARD: { ! CORBA::Object_var obj(CORBA::Object::unmarshalObjRef(giop_client)); giop_client.RequestCompleted(); if( CORBA::is_nil(obj) ){ if( omniORB::traceLevel > 10 ){ diff -rc src/lib/omniORB2/dynamic/serverRequest.cc newsrc/lib/omniORB2/dynamic/serverRequest.cc *** src/lib/omniORB2/dynamic/serverRequest.cc Thu Jan 7 17:09:07 1999 --- newsrc/lib/omniORB2/dynamic/serverRequest.cc Mon Feb 1 15:26:05 1999 *************** *** 65,71 **** } pd_context = new ContextImpl("", CORBA::Context::_nil()); - if( !pd_context ) _CORBA_new_operator_return_null(); if( pd_giopS->RdMessageUnRead() >= 4 ){ CORBA::ULong num_strings; --- 65,70 ---- *************** *** 81,93 **** for( CORBA::ULong i = 0; i < num_ctxts; i++ ){ len <<= *pd_giopS; ! CORBA::String_var name = CORBA::string_alloc(len - 1); ! if( !(char*)name ) _CORBA_new_operator_return_null(); pd_giopS->get_char_array((CORBA::Char*)(char*)name, len); len <<= *pd_giopS; ! CORBA::String_var value = CORBA::string_alloc(len - 1); ! if( !(char*)value ) _CORBA_new_operator_return_null(); pd_giopS->get_char_array((CORBA::Char*)(char*)value, len); ((ContextImpl*)(CORBA::Context_ptr)pd_context)-> --- 80,90 ---- for( CORBA::ULong i = 0; i < num_ctxts; i++ ){ len <<= *pd_giopS; ! CORBA::String_var name(CORBA::string_alloc(len - 1)); pd_giopS->get_char_array((CORBA::Char*)(char*)name, len); len <<= *pd_giopS; ! CORBA::String_var value(CORBA::string_alloc(len - 1)); pd_giopS->get_char_array((CORBA::Char*)(char*)value, len); ((ContextImpl*)(CORBA::Context_ptr)pd_context)-> diff -rc src/lib/omniORB2/orbcore/bootstrap_i.cc newsrc/lib/omniORB2/orbcore/bootstrap_i.cc *** src/lib/omniORB2/orbcore/bootstrap_i.cc Mon Jan 11 09:45:53 1999 --- newsrc/lib/omniORB2/orbcore/bootstrap_i.cc Mon Feb 1 15:13:04 1999 *************** *** 29,34 **** --- 29,37 ---- /* $Log: bootstrap_i.cc,v $ + Revision 1.6 1999/02/01 15:13:04 djr + Replace copy-initialisation of _var types with direct initialisation. + Revision 1.5 1999/01/11 09:45:53 djr *** empty log message *** *************** *** 108,114 **** // out to be a chain of invocations and eventually go back // to us. if (omniORB::traceLevel >= 10) { ! CORBA::String_var ior = omni::objectToString(pd_bootagent->PR_getobj()); omniORB::log << "omniORB: Getting initial object reference for " << identifier << " from '" << (const char*) ior << "'..."; --- 111,117 ---- // out to be a chain of invocations and eventually go back // to us. if (omniORB::traceLevel >= 10) { ! CORBA::String_var ior(omni::objectToString(pd_bootagent->PR_getobj())); omniORB::log << "omniORB: Getting initial object reference for " << identifier << " from '" << (const char*) ior << "'..."; *************** *** 168,174 **** if (!pd_bootagentImpl) { try { ! CORBA::BOA_var boa = CORBA::BOA::getBOA(); pd_bootagentImpl = new CORBA_InitialReferences_i(boa); } catch(...) { --- 171,177 ---- if (!pd_bootagentImpl) { try { ! CORBA::BOA_var boa(CORBA::BOA::getBOA()); pd_bootagentImpl = new CORBA_InitialReferences_i(boa); } catch(...) { *************** *** 214,223 **** t->encodeIOPprofile((Endpoint*)&addr,objkey,4,p[0]); ! CORBA::String_var ior = (char*) IOP::iorToEncapStr((const CORBA::Char*) ! CORBA_InitialReferences_IntfRepoID,&p); ! CORBA::Object_var o = (CORBA::Object_ptr)(omni::stringToObject(ior) ! ->_widenFromTheMostDerivedIntf(0)); pd_bootagent = CORBA_InitialReferences::_narrow(o); pd_bootagent->noExistentCheck(); } --- 217,226 ---- t->encodeIOPprofile((Endpoint*)&addr,objkey,4,p[0]); ! CORBA::String_var ior((char*) IOP::iorToEncapStr((const CORBA::Char*) ! CORBA_InitialReferences_IntfRepoID,&p)); ! CORBA::Object_var o((CORBA::Object_ptr) (omni::stringToObject(ior) ! ->_widenFromTheMostDerivedIntf(0))); pd_bootagent = CORBA_InitialReferences::_narrow(o); pd_bootagent->noExistentCheck(); } *************** *** 271,278 **** for( CORBA::ULong i = 0; i < list->length(); i++ ) { const char* name = (*list)[i]; ! CORBA::Object_var obj = _singleton->get(name); ! CORBA::String_var sref = omni::objectToString(obj->PR_getobj()); omniORB::log << " Name : " << name << "\n" " IR ID : " << obj->PR_getobj()->NP_IRRepositoryId() << "\n" --- 274,281 ---- for( CORBA::ULong i = 0; i < list->length(); i++ ) { const char* name = (*list)[i]; ! CORBA::Object_var obj(_singleton->get(name)); ! CORBA::String_var sref(omni::objectToString(obj->PR_getobj())); omniORB::log << " Name : " << name << "\n" " IR ID : " << obj->PR_getobj()->NP_IRRepositoryId() << "\n" diff -rc src/lib/omniORB2/orbcore/corbaOrb.cc newsrc/lib/omniORB2/orbcore/corbaOrb.cc *** src/lib/omniORB2/orbcore/corbaOrb.cc Thu Jan 7 15:33:34 1999 --- newsrc/lib/omniORB2/orbcore/corbaOrb.cc Mon Feb 1 15:16:15 1999 *************** *** 29,34 **** --- 29,37 ---- /* $Log: corbaOrb.cc,v $ + Revision 1.19 1999/02/01 15:16:14 djr + Replace copy-initialisation of _var types with direct initialisation. + Revision 1.18 1999/01/07 15:33:34 djr New configuration variable omniORB::diiThrowsSysExceptions New command line options -ORBdiiThrowsSysExceptions *************** *** 122,128 **** #if defined(HAS_Cplusplus_Namespace) char* omniORB::serverName = 0; #else ! CORBA::String_var omniORB::serverName = (const char*)"unknown"; #endif CORBA::Boolean omniORB::tcAliasExpand = 0; unsigned int omniORB::maxTcpConnectionPerServer = 5; --- 125,131 ---- #if defined(HAS_Cplusplus_Namespace) char* omniORB::serverName = 0; #else ! CORBA::String_var omniORB::serverName((const char*) "unknown"); #endif CORBA::Boolean omniORB::tcAliasExpand = 0; unsigned int omniORB::maxTcpConnectionPerServer = 5; diff -rc src/lib/omniORB2/orbcore/corbaString.cc newsrc/lib/omniORB2/orbcore/corbaString.cc *** src/lib/omniORB2/orbcore/corbaString.cc Thu Jan 7 15:41:29 1999 --- newsrc/lib/omniORB2/orbcore/corbaString.cc Mon Feb 1 15:40:45 1999 *************** *** 29,34 **** --- 29,43 ---- /* $Log: corbaString.cc,v $ + Revision 1.10 1999/02/01 15:40:44 djr + Initialise strings allocated with string_alloc() to zero length. + Inline uses of string_alloc() and string_free(). + + Revision 1.10 1999/02/01 14:42:36 djr + Initialise allocated strings to zero length. + Corrected several cases where a string is duplicated - the buffer allocated + was 1 byte too long. + Revision 1.9 1999/01/07 15:41:29 djr *** empty log message *** *************** *** 55,77 **** #include char* CORBA::string_alloc(CORBA::ULong len) { ! return new char[(int)len+1]; } void CORBA::string_free(char* p) { ! delete [] p; } char* CORBA::string_dup(const char* p) { if (p) { ! char* q = CORBA::string_alloc((CORBA::ULong)(strlen(p)+1)); if (q) { strcpy(q,p); return q; --- 64,97 ---- #include + #define ALLOC_BYTES(len) (new char[(int)(len)]) + #define FREE_BYTES(p) delete[] (p) + + char* CORBA::string_alloc(CORBA::ULong len) { ! // We initialise the string to zero length to help prevent errors ! // if this string is copied before it is initialied. This is easy ! // to do when assigning the returned value to a CORBA::String_var. ! char* s = ALLOC_BYTES(len + 1); ! if( s ) *s = '\0'; ! return s; } + void CORBA::string_free(char* p) { ! FREE_BYTES(p); } + char* CORBA::string_dup(const char* p) { if (p) { ! char* q = ALLOC_BYTES(strlen(p) + 1); if (q) { strcpy(q,p); return q; *************** *** 80,89 **** return 0; } CORBA::String_var::String_var(const CORBA::String_member& s) { if ((const char*)s) { ! _data = string_alloc((ULong)(strlen(s)+1)); strcpy(_data,s); } else --- 100,113 ---- return 0; } + ////////////////////////////////////////////////////////////////////// + ///////////////////////////// String_var ///////////////////////////// + ////////////////////////////////////////////////////////////////////// + CORBA::String_var::String_var(const CORBA::String_member& s) { if ((const char*)s) { ! _data = ALLOC_BYTES(strlen(s) + 1); strcpy(_data,s); } else *************** *** 95,105 **** CORBA::String_var::operator= (const CORBA::String_member& s) { if (_data) { ! string_free(_data); _data = 0; } if ((const char*)s) { ! _data = string_alloc((ULong)(strlen(s)+1)); strcpy(_data,s); } return *this; --- 119,129 ---- CORBA::String_var::operator= (const CORBA::String_member& s) { if (_data) { ! FREE_BYTES(_data); _data = 0; } if ((const char*)s) { ! _data = ALLOC_BYTES(strlen(s) + 1); strcpy(_data,s); } return *this; *************** *** 148,154 **** CORBA::String_member::operator<<= (NetBufferedStream& s) { if( _ptr ) { ! CORBA::string_free(_ptr); _ptr = 0; } --- 172,178 ---- CORBA::String_member::operator<<= (NetBufferedStream& s) { if( _ptr ) { ! FREE_BYTES(_ptr); _ptr = 0; } *************** *** 156,162 **** len <<= s; if( !len && omniORB::traceLevel > 1 ) _CORBA_null_string_ptr(1); ! char* p = CORBA::string_alloc(len ? len - 1 : 1); if( !p ) throw CORBA::NO_MEMORY(0, CORBA::COMPLETED_MAYBE); if( len ) { --- 180,187 ---- len <<= s; if( !len && omniORB::traceLevel > 1 ) _CORBA_null_string_ptr(1); ! CORBA::ULong nbytes = len ? len : 1; ! char* p = ALLOC_BYTES(nbytes); if( !p ) throw CORBA::NO_MEMORY(0, CORBA::COMPLETED_MAYBE); if( len ) { *************** *** 164,174 **** s.get_char_array((CORBA::Char*)p, len); } catch(...) { ! CORBA::string_free(p); throw; } if( p[len - 1] != '\0' ) { ! CORBA::string_free(p); throw CORBA::MARSHAL(0, CORBA::COMPLETED_MAYBE); } } --- 189,199 ---- s.get_char_array((CORBA::Char*)p, len); } catch(...) { ! FREE_BYTES(p); throw; } if( p[len - 1] != '\0' ) { ! FREE_BYTES(p); throw CORBA::MARSHAL(0, CORBA::COMPLETED_MAYBE); } } *************** *** 200,206 **** CORBA::String_member::operator<<= (MemBufferedStream& s) { if( _ptr ) { ! CORBA::string_free(_ptr); _ptr = 0; } --- 225,231 ---- CORBA::String_member::operator<<= (MemBufferedStream& s) { if( _ptr ) { ! FREE_BYTES(_ptr); _ptr = 0; } *************** *** 209,220 **** if( !len || s.RdMessageUnRead() < len ) throw CORBA::MARSHAL(0,CORBA::COMPLETED_MAYBE); ! char* p = CORBA::string_alloc(len - 1); if( !p ) throw CORBA::NO_MEMORY(0, CORBA::COMPLETED_MAYBE); s.get_char_array((CORBA::Char*)p, len); if( p[len - 1] != '\0' ) { ! CORBA::string_free(p); throw CORBA::MARSHAL(0,CORBA::COMPLETED_MAYBE); } --- 234,245 ---- if( !len || s.RdMessageUnRead() < len ) throw CORBA::MARSHAL(0,CORBA::COMPLETED_MAYBE); ! char* p = ALLOC_BYTES(len); if( !p ) throw CORBA::NO_MEMORY(0, CORBA::COMPLETED_MAYBE); s.get_char_array((CORBA::Char*)p, len); if( p[len - 1] != '\0' ) { ! FREE_BYTES(p); throw CORBA::MARSHAL(0,CORBA::COMPLETED_MAYBE); } diff -rc src/lib/omniORB2/orbcore/objectRef.cc newsrc/lib/omniORB2/orbcore/objectRef.cc *** src/lib/omniORB2/orbcore/objectRef.cc Mon Jan 11 09:55:54 1999 --- newsrc/lib/omniORB2/orbcore/objectRef.cc Mon Feb 1 15:40:54 1999 *************** *** 29,34 **** --- 29,37 ---- /* $Log: objectRef.cc,v $ + Revision 1.22 1999/02/01 15:40:53 djr + Replace copy-initialisation of _var types with direct initialisation. + Revision 1.21 1999/01/11 09:55:53 djr *** empty log message *** *************** *** 901,908 **** if( omniORB::traceLevel >= 15 ) { const char* repoId = (*p)->NP_IRRepositoryId(); ! CORBA::String_var obj_ref = (char*) ! IOP::iorToEncapStr((const CORBA::Char*) repoId, (*p)->iopProfiles()); omniORB::log << "omniORB: WARNING - Proxy object not released.\n" --- 904,912 ---- if( omniORB::traceLevel >= 15 ) { const char* repoId = (*p)->NP_IRRepositoryId(); ! CORBA::String_var obj_ref((char*) ! IOP::iorToEncapStr((const CORBA::Char*) repoId, ! (*p)->iopProfiles())); omniORB::log << "omniORB: WARNING - Proxy object not released.\n" diff -rc src/lib/omniORB2/orbcore/proxyCall.cc newsrc/lib/omniORB2/orbcore/proxyCall.cc *** src/lib/omniORB2/orbcore/proxyCall.cc Thu Jan 7 16:34:45 1999 --- newsrc/lib/omniORB2/orbcore/proxyCall.cc Mon Feb 1 15:22:08 1999 *************** *** 95,101 **** // Retrieve the Interface Repository ID of the exception. CORBA::ULong repoIdLen; repoIdLen <<= giop_client; ! CORBA::String_var repoId = CORBA::string_alloc(repoIdLen - 1); giop_client.get_char_array((CORBA::Char*)(char*)repoId, repoIdLen); --- 95,101 ---- // Retrieve the Interface Repository ID of the exception. CORBA::ULong repoIdLen; repoIdLen <<= giop_client; ! CORBA::String_var repoId(CORBA::string_alloc(repoIdLen - 1)); giop_client.get_char_array((CORBA::Char*)(char*)repoId, repoIdLen); *************** *** 112,119 **** case GIOP::LOCATION_FORWARD: { ! CORBA::Object_var obj = ! CORBA::Object::unmarshalObjRef(giop_client); giop_client.RequestCompleted(); if( CORBA::is_nil(obj) ){ if( omniORB::traceLevel > 10 ){ --- 112,118 ---- case GIOP::LOCATION_FORWARD: { ! CORBA::Object_var obj(CORBA::Object::unmarshalObjRef(giop_client)); giop_client.RequestCompleted(); if( CORBA::is_nil(obj) ){ if( omniORB::traceLevel > 10 ){