[ORBit2] Add a CORBA_wstring_dup function. Patch from Jules Colding. Closes bug #572439.



commit 03f78024fdd5b95bdde82da64990b8df03a39924
Author: Kjartan Maraas <kmaraas gnome org>
Date:   Wed Oct 28 10:41:39 2009 +0100

    Add a CORBA_wstring_dup function. Patch from Jules Colding. Closes bug #572439.

 include/orbit/orb-core/corba-string.h |    2 ++
 src/orb/orb-core/corba-string.c       |   17 +++++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/include/orbit/orb-core/corba-string.h b/include/orbit/orb-core/corba-string.h
index 0e2fdbd..cb1b366 100644
--- a/include/orbit/orb-core/corba-string.h
+++ b/include/orbit/orb-core/corba-string.h
@@ -13,6 +13,8 @@ CORBA_wchar *CORBA_wstring_alloc (CORBA_unsigned_long len);
  */
 CORBA_char          *CORBA_string_dup  (const CORBA_char *str);
 
+CORBA_wchar         *CORBA_wstring_dup (const CORBA_wchar *str);
+
 CORBA_unsigned_long  CORBA_wstring_len (CORBA_wchar *ws);
 
 #ifdef ORBIT2_INTERNAL_API
diff --git a/src/orb/orb-core/corba-string.c b/src/orb/orb-core/corba-string.c
index f48fcc2..6b38a65 100644
--- a/src/orb/orb-core/corba-string.c
+++ b/src/orb/orb-core/corba-string.c
@@ -41,3 +41,20 @@ CORBA_wstring_len (CORBA_wchar *ws)
 
 	return i;
 }
+
+CORBA_wchar *
+CORBA_wstring_dup (const CORBA_wchar *str)
+{
+	CORBA_wchar *retval;
+	CORBA_unsigned_long len;
+
+	if (!str)
+		return NULL;
+
+	len = CORBA_wstring_len (str);
+
+	retval = CORBA_wstring_alloc (len);
+	memcpy (retval, str, (len + 1) * 2);
+
+	return retval;
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]