--- 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);
}
--- 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;
+ }
}
--- 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)