diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-05-19 20:29:37 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-05-19 20:29:37 +0000 |
commit | 86c0a922aeb4a1acf72878e991acd532d5cb5f09 (patch) | |
tree | 6d556d5dac04d4e74cb26aa362e6aebbaa883603 /TAO/tao/corbafwd.i | |
parent | d12b5514c320eb360b5baa3ec613f2f451485700 (diff) | |
download | ATCD-86c0a922aeb4a1acf72878e991acd532d5cb5f09.tar.gz |
ChangeLogTag:Wed May 19 15:25:00 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/corbafwd.i')
-rw-r--r-- | TAO/tao/corbafwd.i | 31 |
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); } |