utilitylibraries/libutils/src/wstringtodescriptor16.cpp
changeset 44 97b0fb8a2cc2
parent 0 e4d67989cc36
child 57 2efc27d87e1c
--- a/utilitylibraries/libutils/src/wstringtodescriptor16.cpp	Mon May 03 14:06:43 2010 +0300
+++ b/utilitylibraries/libutils/src/wstringtodescriptor16.cpp	Tue Jul 20 16:35:53 2010 +0530
@@ -59,7 +59,7 @@
    * @param aSrc is the wstring to be converted , aDes is the 
    * reference to the descriptor where the result of conversion 
    * is stored 
-   * @return Status code (0 is ESuccess, -3 is EStringNoData)
+   * @return Status code (0 is ESuccess, -3 is EStringNoData, -1 is EInsufficientMemory)
    */
 
 EXPORT_C int WstringToTptr16(wstring& aSrc, TPtr16& aDes )
@@ -114,7 +114,7 @@
    * reference to the descriptor where the result of conversion 
    * is stored 
    * @return Status code (0 is ESuccess, -1 is EInsufficientMemory, 
-   * -3 is EStringNoData )
+   * -3 is EStringNoData, -4 is EInvalidPointer )
    */
 
 EXPORT_C int WstringToHbufc16(wstring& aSrc, HBufC16* aDes)
@@ -168,15 +168,8 @@
     }
     
     wlen = wcslen(wcharString);
-    
-    if (KErrNone == aDes.Create(wlen))
-    {
-        aDes.Copy((const unsigned short *)wcharString, wlen);	
-    }
-    else 
-    {
-    	retval = EInsufficientSystemMemory;
-    }
-	
-	return retval;
+
+    aDes.Copy((const unsigned short *)wcharString, wlen);	
+
+	  return retval;
 }