# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1279210270 -10800 # Node ID e4175d61d967f21f0fc646c6257717c7e84407da # Parent b9e74fff3740f0a97ef205eb26770402200206ae Revision: 201025 Kit: 2010127 diff -r b9e74fff3740 -r e4175d61d967 messagingfw/msgsrvnstore/server/src/CMsvCachedStore.cpp --- a/messagingfw/msgsrvnstore/server/src/CMsvCachedStore.cpp Mon Jun 21 16:13:01 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/src/CMsvCachedStore.cpp Thu Jul 15 19:11:10 2010 +0300 @@ -620,16 +620,13 @@ RFileWriteStream out(tempStoreFile); out.PushL(); WriteToFileStreamL(out); - CleanupStack::PopAndDestroy(&out); // close RFileWriteStream out - iStoreManager.ReplaceFileStoreL(iEntryId); - // Need the size - RFile storeFile; - User::LeaveIfError(iStoreManager.OpenFileStoreForRead(iEntryId, storeFile)); - CleanupClosePushL(storeFile); - User::LeaveIfError(storeFile.Size(iSize)); - CleanupStack::PopAndDestroy(&storeFile); + //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 + //the SizeL in this case will not involve any file i/o calls. + iSize=out.Sink()->SizeL(); + CleanupStack::PopAndDestroy(&out); // close RFileWriteStream out + iStoreManager.ReplaceFileStoreL(iEntryId); } diff -r b9e74fff3740 -r e4175d61d967 messagingfw/msgsrvnstore/server/src/MTCLBASE.CPP --- a/messagingfw/msgsrvnstore/server/src/MTCLBASE.CPP Mon Jun 21 16:13:01 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/src/MTCLBASE.CPP Thu Jul 15 19:11:10 2010 +0300 @@ -687,10 +687,12 @@ */ EXPORT_C void CBaseMtm::CancelAttachmentOperation() { - __ASSERT_ALWAYS(iAttachmentWaiter != NULL, PanicServer(EMsvOperationNotFound)); - iAttachmentWaiter->Cancel(); - delete iAttachmentWaiter; - iAttachmentWaiter = NULL; + if(iAttachmentWaiter) + { + iAttachmentWaiter->Cancel(); + delete iAttachmentWaiter; + iAttachmentWaiter = NULL; + } } diff -r b9e74fff3740 -r e4175d61d967 messagingfw/msgsrvnstore/server/src/TMsvServerStoreManager.cpp --- a/messagingfw/msgsrvnstore/server/src/TMsvServerStoreManager.cpp Mon Jun 21 16:13:01 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/src/TMsvServerStoreManager.cpp Thu Jul 15 19:11:10 2010 +0300 @@ -381,11 +381,17 @@ GetStoreFileName(aEntryId,tempFilePathAndName); tempFilePathAndName.Append(KMsvUtilsNewExtension); - TInt error = iFs->MkDirAll(tempFilePathAndName); - if(error == KErrNone || error == KErrAlreadyExists) - error = aFile.Replace(*iFs,tempFilePathAndName,EFileShareExclusive|EFileWrite); - + + TInt error= aFile.Replace(*iFs,tempFilePathAndName,EFileShareExclusive|EFileWrite); + if (error==KErrPathNotFound) + { + //only create directory if not found + error=iFs->MkDirAll(tempFilePathAndName); + if (error==KErrNone) + error=aFile.Replace(*iFs,tempFilePathAndName,EFileShareExclusive|EFileWrite); + } User::LeaveIfError(error); + } void TMsvServerStoreManager::ReplaceFileStoreL(TMsvId aEntryId)