tzservices/tzserver/Server/Source/timezonesession.cpp
changeset 48 2222076f5c60
parent 0 2e3d3ce01487
child 81 676b6116ca93
equal deleted inserted replaced
40:951aeeb3da43 48:2222076f5c60
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   696  * Arguments: 0 : Output - Data buffer contained time zone name 
   696  * Arguments: 0 : Output - Data buffer contained time zone name 
   697 */	
   697 */	
   698  TInt CTzServerSession::doGetUserTimeZoneNamesL(const RMessage2& aMessage)
   698  TInt CTzServerSession::doGetUserTimeZoneNamesL(const RMessage2& aMessage)
   699 	{
   699 	{
   700 	TInt size = iTzUserDataCache->SizeOfNames();
   700 	TInt size = iTzUserDataCache->SizeOfNames();
   701 	CBufFlat* buffer = CBufFlat::NewL(size);
   701 	if ( size > 0 )
   702 	CleanupStack::PushL(buffer);
   702 		{
   703 	buffer->ExpandL(0,size);
   703 		CBufFlat* buffer = CBufFlat::NewL(size);
   704 	
   704 		CleanupStack::PushL(buffer);
   705 	RBufWriteStream writeStream;
   705 		buffer->ExpandL(0,size);
   706 	CleanupClosePushL(writeStream);
   706 		
   707 	writeStream.Open(*buffer);
   707 		RBufWriteStream writeStream;
   708 	const CTzUserNames& names = iTzUserDataCache->GetNames();
   708 		CleanupClosePushL(writeStream);
   709 	writeStream << names;
   709 		writeStream.Open(*buffer);
   710 	writeStream.CommitL();
   710 		const CTzUserNames& names = iTzUserDataCache->GetNames();
   711 	aMessage.WriteL(0, buffer->Ptr(0));
   711 		writeStream << names;
   712 	CleanupStack::PopAndDestroy(2, buffer);
   712 		writeStream.CommitL();
   713 	return KErrNone;
   713 		aMessage.WriteL(0, buffer->Ptr(0));
       
   714 		CleanupStack::PopAndDestroy(2, buffer);
       
   715 		return KErrNone;
       
   716 		}
       
   717 	return KErrArgument;
   714 	}
   718 	}
   715 	
   719 	
   716 /**
   720 /**
   717  * Gets the size of user defined time zone Ids
   721  * Gets the size of user defined time zone Ids
   718  * Arguments: 0 : Output - Size of time zone IDs
   722  * Arguments: 0 : Output - Size of time zone IDs