summaryrefslogtreecommitdiff
path: root/TAO/tao/corbafwd.i
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tao/corbafwd.i')
-rw-r--r--TAO/tao/corbafwd.i31
1 files changed, 28 insertions, 3 deletions
diff --git a/TAO/tao/corbafwd.i b/TAO/tao/corbafwd.i
index b9e4789de9c..766b0ee6a30 100644
--- a/TAO/tao/corbafwd.i
+++ b/TAO/tao/corbafwd.i
@@ -16,16 +16,41 @@ CORBA::string_free (CORBA::Char *str)
ACE_INLINE TAO_Export CORBA::String
CORBA::string_dup (const CORBA::Char *str)
{
- return CORBA::string_copy (str);
+ if (!str)
+ return 0;
+
+ size_t len = ACE_OS::strlen (str);
+
+ // This allocates an extra byte for the '\0';
+ CORBA::String copy = CORBA::string_alloc (len);
+
+ ACE_OS::memcpy (copy, str, len + 1);
+ return copy;
}
// ----------------------------------------------------------------------
// Wide strings
// ----------------------------------------------------------------------
-ACE_INLINE TAO_Export CORBA::WString
+ACE_INLINE TAO_Export CORBA::WChar*
+CORBA::wstring_alloc (CORBA::ULong len)
+{
+ return new CORBA::WChar [(size_t) (len + 1)];
+}
+
+ACE_INLINE TAO_Export void
+CORBA::wstring_free (CORBA::WChar *const str)
+{
+ delete [] str;
+}
+
+ACE_INLINE TAO_Export CORBA::WChar*
CORBA::wstring_dup (const WChar *const str)
{
- return CORBA::wstring_copy (str);
+ if (!str)
+ return 0;
+
+ CORBA::WChar* retval = CORBA::wstring_alloc (ACE_OS::wslen (str));
+ return ACE_OS::wscpy (retval, str);
}