messagingfw/msgsrvnstore/server/src/CMsvCachedStore.cpp
changeset 40 320ec5cd0227
parent 0 8e480a14352b
equal deleted inserted replaced
33:61f466445ae5 40:320ec5cd0227
   618 	RFile tempStoreFile;
   618 	RFile tempStoreFile;
   619 	iStoreManager.OpenTempStoreFileL(iEntryId, tempStoreFile);
   619 	iStoreManager.OpenTempStoreFileL(iEntryId, tempStoreFile);
   620 	RFileWriteStream out(tempStoreFile);
   620 	RFileWriteStream out(tempStoreFile);
   621 	out.PushL();
   621 	out.PushL();
   622 	WriteToFileStreamL(out);
   622 	WriteToFileStreamL(out);
   623 	CleanupStack::PopAndDestroy(&out); // close RFileWriteStream out
   623 
   624 	iStoreManager.ReplaceFileStoreL(iEntryId);
   624 	//get the size of the stream, in previous call the Stream is already commited to the file, the next step simply replace the file with this temp new file so size should be the same
   625 
   625 	//the SizeL in this case will not involve any file i/o calls.
   626 	// Need the size
   626 	iSize=out.Sink()->SizeL();
   627 	RFile storeFile;
       
   628 	User::LeaveIfError(iStoreManager.OpenFileStoreForRead(iEntryId, storeFile));
       
   629 	CleanupClosePushL(storeFile);
       
   630 	User::LeaveIfError(storeFile.Size(iSize));
       
   631 	CleanupStack::PopAndDestroy(&storeFile);
       
   632 	
   627 	
       
   628     CleanupStack::PopAndDestroy(&out); // close RFileWriteStream out
       
   629     iStoreManager.ReplaceFileStoreL(iEntryId);
   633 
   630 
   634 	}
   631 	}
   635 
   632 
   636 void CMsvCachedStore::WriteToFileStreamL(RFileWriteStream &aOut)
   633 void CMsvCachedStore::WriteToFileStreamL(RFileWriteStream &aOut)
   637 	{
   634 	{