--- a/messagingfw/msgsrvnstore/server/src/MCLIENT.CPP Wed Jun 09 10:13:14 2010 +0300
+++ b/messagingfw/msgsrvnstore/server/src/MCLIENT.CPP Mon Jun 21 16:13:01 2010 +0300
@@ -472,30 +472,36 @@
*/
EXPORT_C TInt RMsvServerSession::GetEntry(TMsvId aId, TMsvId& aService, TMsvEntry& aEntry)
{
- TRAPD(error, DoGetEntryL(aId, aService, aEntry));
- return error;
- }
-
-void RMsvServerSession::DoGetEntryL(TMsvId aId, TMsvId& aService, TMsvEntry& aEntry)
- {
- // pass the buffer to receive the data through
- TPtr8 ptr=iBuffer->Des();
- // get the service the entry i sunder
- TPckg<TMsvId> service(aService);
+ // pass the buffer and its max length to receive the data through
+ TPtr8 ptr=iBuffer->Des();
+ TInt maxLength = iBuffer->Des().MaxLength();
+
// signal the server
- TInt error = SendReceive(EMsvGetEntry,TIpcArgs(aId,&ptr,&service));
- while(error == KErrOverflow)
- {
- // increase the size of the buffer and try again
- iBuffer->Des().SetLength(0);
- iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength);
- // pass the buffer to receive the data through
- TPtr8 ptr=iBuffer->Des();
- error = SendReceive(EMsvGetEntry,TIpcArgs(aId,&ptr,&service));
- }
- User::LeaveIfError(error);
- TMsvPackedEntry packedEntry(iBuffer);
- packedEntry.UnpackEntry(aEntry);
+ TInt error = SendReceive(EMsvGetEntry,TIpcArgs(aId, &ptr, maxLength));
+ while(error == KErrOverflow)
+ {
+ // increase the size of the buffer and try again
+ iBuffer->Des().SetLength(0);
+ // TRAP here and return if leaving with error
+ TRAP(error, iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength));
+ if( error != KErrNone)
+ {
+ break;
+ }
+ // pass the buffer to receive the data through
+ TPtr8 ptr=iBuffer->Des();
+ maxLength = iBuffer->Des().MaxLength();
+ error = SendReceive(EMsvGetEntry,TIpcArgs(aId,&ptr,maxLength));
+ }
+
+ if( error == KErrNone)
+ {
+ TMsvPackedEntry packedEntry(iBuffer);
+ // Unpack the entry and servie id from same buffer
+ packedEntry.UnpackEntryAndService(aEntry, aService);
+ }
+
+ return error;
}
/**