summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1999-03-08 19:45:52 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1999-03-08 19:45:52 +0000
commit03a85c247fbd7d41911e701bc17b99d72da3fa7e (patch)
tree2d582527e3286eea8a2c4e17b263c309e5fbef9e
parentf50814ccf70a02d9136f48e656f7444be6610c3d (diff)
downloadATCD-03a85c247fbd7d41911e701bc17b99d72da3fa7e.tar.gz
.
-rw-r--r--TAO/tao/ORB.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp
index 6d00f99374d..05a401e452f 100644
--- a/TAO/tao/ORB.cpp
+++ b/TAO/tao/ORB.cpp
@@ -955,8 +955,8 @@ CORBA_ORB::create_dyn_enum (CORBA_TypeCode_ptr tc,
return TAO_DynAny_i::create_dyn_enum (tc, env);
}
-// String utility support; this can need to be integrated with the
-// ORB's own memory allocation subsystem.
+// String utility support; this needs to be integrated with the ORB's
+// own memory allocation subsystem.
CORBA::String
CORBA::string_copy (const CORBA::Char *str)
@@ -964,13 +964,14 @@ CORBA::string_copy (const CORBA::Char *str)
if (!str)
return 0;
- CORBA::String retval =
- CORBA::string_alloc (ACE_OS::strlen (str));
+ size_t len = ACE_OS::strlen (str);
- // clear the contents of the allocated string
- ACE_OS::memset(retval, '\0', ACE_OS::strlen (str));
+ // This allocates an extra byte for the '\0';
+ CORBA::String copy = CORBA::string_alloc (len);
- return ACE_OS::strcpy (retval, str);
+ ACE_OS::memcpy (copy, str, len);
+ copy[len] = '\0';
+ return copy;
}
CORBA_String_var &