utilitylibraries/libutils/src/wchartodescriptor16.cpp
changeset 34 5fae379060a7
parent 0 e4d67989cc36
child 57 2efc27d87e1c
equal deleted inserted replaced
31:ce057bb09d0b 34:5fae379060a7
    55    *
    55    *
    56    * @param aSrc is the Wstring to be converted , aDes is the 
    56    * @param aSrc is the Wstring to be converted , aDes is the 
    57    * reference to the descriptor where the result of conversion 
    57    * reference to the descriptor where the result of conversion 
    58    * is stored 
    58    * is stored 
    59    * @return Status code (0 is ESuccess, -1 is EInsufficientMemory, 
    59    * @return Status code (0 is ESuccess, -1 is EInsufficientMemory, 
    60    * -3 is EStringNoData )
    60    * -3 is EStringNoData, -6 is EUseNewMaxL )
    61    */
    61    */
    62 
    62 
    63 EXPORT_C  int WcharToHbufc16 (const wchar_t* aSrc ,HBufC16* aDes )
    63 EXPORT_C  int WcharToHbufc16 (const wchar_t* aSrc ,HBufC16* aDes )
    64 {
    64 {
    65    
    65    
   141    * Converts a wchar to a descriptor of type RBuf16
   141    * Converts a wchar to a descriptor of type RBuf16
   142    *
   142    *
   143    * @param aSrc is the wchar to be converted , aDes is the 
   143    * @param aSrc is the wchar to be converted , aDes is the 
   144    * reference to the descriptor where the result of conversion 
   144    * reference to the descriptor where the result of conversion 
   145    * is stored 
   145    * is stored 
   146    * @return Status code (0 is ESuccess ,-1 is EInsufficientMemory -3 is EStringNoData )
   146    * @return Status code (0 is ESuccess ,-1 is EInsufficientMemory,
       
   147    * -3 is EStringNoData, -4 is EInvalidPointer )
   147    */
   148    */
   148 
   149 
   149 EXPORT_C int WcharToRbuf16(const wchar_t* aSrc, RBuf16& aDes)
   150 EXPORT_C int WcharToRbuf16(const wchar_t* aSrc, RBuf16& aDes)
   150 {
   151 {
   151    
   152    
   155 	{
   156 	{
   156 		return EInvalidPointer;
   157 		return EInvalidPointer;
   157 	}
   158 	}
   158 	
   159 	
   159 	wlen = wcslen(aSrc);
   160 	wlen = wcslen(aSrc);
   160 	
   161 
   161     if (KErrNone == aDes.Create(wlen))
   162   aDes.Copy((const unsigned short *)aSrc, wlen);	
   162     {
   163 
   163     	aDes.Copy((const unsigned short *)aSrc, wlen);	
       
   164     }
       
   165 	else 
       
   166 	{
       
   167 		retval = EInsufficientSystemMemory;
       
   168 	}
       
   169 	
       
   170 	return retval;
   164 	return retval;
   171 }
   165 }