diff -r acd3cd4aaceb -r 2efc27d87e1c utilitylibraries/libutils/src/chartodescriptor8.cpp --- a/utilitylibraries/libutils/src/chartodescriptor8.cpp Tue Aug 31 16:54:36 2010 +0300 +++ b/utilitylibraries/libutils/src/chartodescriptor8.cpp Wed Sep 01 12:36:54 2010 +0100 @@ -29,8 +29,6 @@ * the result of conversion.aDes needs to be allocated with sufficient amount * of memory before being passed to function. This Descriptor should have * a allocation that is equal to or greater than char* - * - * @return Status code (0 is ESuccess, -1 is EInsufficientMemory, -4 is EInvalidPointer) */ EXPORT_C int CharToTbuf8 (const char* aSrc, TDes8& aDes) @@ -59,8 +57,6 @@ * the result of conversion.aDes needs to be allocated with sufficient amount * of memory before being passed to function. This Descriptor should have * a allocation that is equal to or greater than char* - * - * @return Status code (0 is ESuccess, -1 is EInsufficientMemory, -4 is EInvalidPointer, -6 is EUseNewMaxL) */ EXPORT_C int CharToHbufc8(const char* aSrc, HBufC8* aDes) @@ -95,8 +91,6 @@ * the result of conversion.aDes needs to be allocated with sufficient amount * of memory before being passed to function. This Descriptor should have * a allocation that is equal to or greater than char* - * - * @return Status code (0 is ESuccess, -1 is EInsufficientMemory, -4 is EInvalidPointer) */ EXPORT_C int CharpToTptr8( const char* aSrc, TPtr8& aDes ) @@ -127,8 +121,6 @@ * the result of conversion.aDes needs to be allocated with sufficient amount * of memory before being passed to function. This Descriptor should have * a allocation that is equal to or greater than char* - * - * @return Status code (0 is ESuccess, -4 is EInvalidPointer) */ EXPORT_C int CharpToTptrc8(const char* aSrc, TPtrC8& aDes) @@ -150,19 +142,27 @@ * the result of conversion.aDes needs to be allocated with sufficient amount * of memory before being passed to function. This Descriptor should have * a allocation that is equal to or greater than char* - * - * @return Status code (0 is ESuccess, -1 is EInsufficientMemory, -4 is EInvalidPointer) */ EXPORT_C int CharToRbuf8(const char* aSrc, RBuf8& aDes) -{ - if ( !aSrc ) - { - return EInvalidPointer; - } - - aDes.Copy((const unsigned char *)aSrc, strlen(aSrc)); +{ + int retval = ESuccess, ilen = 0; + + if ( !aSrc ) + { + return EInvalidPointer; + } + + ilen = strlen(aSrc); + + if (KErrNone == aDes.Create(ilen)) + { + aDes.Copy((const unsigned char *)aSrc, ilen); + } + else + { + retval = EInsufficientSystemMemory; + } - return ESuccess; + return retval; } -