diff -r b6f2a363adf7 -r 7797b2f86d2b imservices/ossprotocoladaptation/src/ossprotocoladaptutils.cpp --- a/imservices/ossprotocoladaptation/src/ossprotocoladaptutils.cpp Wed Apr 14 16:17:20 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Utils for OSSProtocolAdaptation modules. -* -*/ - - -// INCLUDES -#include "ossprotocoladaptutils.h" -#include -#include -#include -#include "escapeutils.h" -#include "stringutils.h" - - -// --------------------------------------------------------------------------- -// OssProtocolAdapUtils::OssProtocolAdapUtils::ConvertCharToTUint16L -// --------------------------------------------------------------------------- -// -HBufC16* OssProtocolAdapUtils::ConvertCharToTUint16LC( const char *pcSrc ) - { - TUint8* scr = (TUint8*)pcSrc; - TPtrC8 ptr; - ptr.Set(scr); - HBufC16* buf = EscapeUtils::ConvertToUnicodeFromUtf8L(ptr); - CleanupStack::PushL(buf); - return buf; - } - - -// --------------------------------------------------------------------------- -// OssProtocolAdapUtils::OssProtocolAdapUtils::ConvertTUint16ToCharL -// --------------------------------------------------------------------------- -// -charFormatData OssProtocolAdapUtils::ConvertTUint16ToCharLC( const TDesC &aData ) - { - HBufC8 * data = EscapeUtils::ConvertFromUnicodeToUtf8L( aData ); - CleanupStack::PushL(data); - - TPtr8 ptr = data->Des(); - TInt length = ptr.Length(); - - //allocate new contiguous buffer as returned buffer may be fragmented. - HBufC8* newBuf = HBufC8::NewLC( length + 1 );//+1 space for '\0' - TPtr8 newBufPtr = newBuf->Des(); - newBufPtr.Copy(ptr); - - char* chPtrTemp = ( char* )newBufPtr.PtrZ(); - char* chPtr = (char*) User::AllocL( length + 1 ); - strcpy( chPtr , chPtrTemp ); - - CleanupStack::PopAndDestroy( 2 );//newBuf,data. - - charFormatData charData ; - charData.data = chPtr; - charData.dataSize = length + 1; //+1 space for '\0' - - CleanupStack::PushL(chPtr); - return charData; - } -// --------------------------------------------------------------------------- -// OssProtocolAdapUtils::ConvertTDesC8toChar -// --------------------------------------------------------------------------- -// -void OssProtocolAdapUtils::ConvertTDesC8toChar(const TDesC8& aSrc, char* aDes) -{ - char *temp = (char*)aSrc.Ptr(); - const TInt size = aSrc.Length(); - *(temp + size) = '\0'; - memcpy( aDes, temp, size ); -} - -// End of file