utilitylibraries/libutils/src/stringtodescriptor8.cpp
branchRCL_3
changeset 57 2efc27d87e1c
parent 56 acd3cd4aaceb
--- a/utilitylibraries/libutils/src/stringtodescriptor8.cpp	Tue Aug 31 16:54:36 2010 +0300
+++ b/utilitylibraries/libutils/src/stringtodescriptor8.cpp	Wed Sep 01 12:36:54 2010 +0100
@@ -79,7 +79,7 @@
    * @param aSrc is the string 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, -1 is EInsufficientMemory)
+   * @return Status code (0 is ESuccess, -3 is EStringNoData)
    */
 
 EXPORT_C  int StringToTptr8 (string& aSrc, TPtr8& aDes)
@@ -110,7 +110,7 @@
    * reference to the descriptor where the result of conversion 
    * is stored 
    * @return Status code (0 is ESuccess, -1 is EInsufficientMemory, 
-   * -3 is EStringNoData , -5 is EUseNewMaxL , -4 is EInvalidPointer )
+   * -3 is EStringNoData , -5 is EUSENEWMAXL )
    */
 
 EXPORT_C int StringToHbufc8(string& aSrc , HBufC8* aDes)
@@ -148,7 +148,7 @@
    * @param aSrc is the string 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, -9 is EInsufficientSystemMemory)
+   * @return Status code (0 is ESuccess,-3 is EStringNoData)
    */  
 
 EXPORT_C int StringToRbuf8(const string& aSrc, RBuf8& aDes)
@@ -161,8 +161,15 @@
     }
     
     int ilen = strlen(charString);
-
-    aDes.Copy((const unsigned char *)charString, ilen);	
+    
+    if (KErrNone == aDes.Create(ilen))
+    {
+    	aDes.Copy((const unsigned char *)charString, ilen);	
+    }
+	else 
+	{
+        retval = EInsufficientSystemMemory;	
+	}
 	
-	  return retval;
+	return retval;
 }