Revision: 201035 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 15 Sep 2010 11:57:08 +0300
branchRCL_3
changeset 61 57a9de0b82e8
parent 56 3e6957da2ff8
child 67 2abf74df9cdc
Revision: 201035 Kit: 201036
omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp
omads/omadsextensions/datamod/src/nsmldatamodbase.cpp
--- a/omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp	Tue Sep 14 20:55:10 2010 +0300
+++ b/omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp	Wed Sep 15 11:57:08 2010 +0300
@@ -217,6 +217,8 @@
        iCommittedUidArr->Reset();
        delete iCommittedUidArr;
        }
+    
+     delete iAgendaAdapterLog;
 	FLOG(_L("CNSmlAgendaDataStore::~CNSmlAgendaDataStore(): END"));
 	}
 
@@ -272,6 +274,11 @@
 	
 	iChangeFinder = CNSmlChangeFinder::NewL( aContext, iKey, iHasHistory,
 	                                         KNSmlAgendaAdapterImplUid );
+	if (iAgendaAdapterLog)
+	    {
+	    delete iAgendaAdapterLog;
+	    iAgendaAdapterLog = NULL;
+	    }
 	iAgendaAdapterLog = CNSmlAgendaAdapterLog::NewL( aContext );
 	iState = ENSmlOpenAndWaiting;
     User::RequestComplete( iCallerStatus, err );
--- a/omads/omadsextensions/datamod/src/nsmldatamodbase.cpp	Tue Sep 14 20:55:10 2010 +0300
+++ b/omads/omadsextensions/datamod/src/nsmldatamodbase.cpp	Wed Sep 15 11:57:08 2010 +0300
@@ -112,7 +112,7 @@
 EXPORT_C void CNSmlDataModBase::StripTxL( CBufBase& aItem )
 	{
 	_DBG_FILE("CNSmlDataModBase::StripTxL(): begin");
-	HBufC8* buf = HBufC8::NewLC(aItem.Size() * 2);
+	HBufC8* buf = HBufC8::NewLC(aItem.Size());
 	*buf = aItem.Ptr(0);
 	TPtr8 ptrBuf = buf->Des();
 
@@ -133,7 +133,29 @@
 	_DBG_FILE("CNSmlDataModBase::MergeRxL(): begin");
 	if( NeedsMerge() )
 		{
-		HBufC8* b1 = HBufC8::NewLC(aNewItem.Size() + aOldItem.Size());
+	
+        TInt totalSize = aNewItem.Size();
+        
+        /*
+         
+        Extra size is allocated to buffer as versit parser will increase the stream size by spliting 
+		
+		the whole data into multiple lines each containing 64 byte data and it will append 6 more bytes
+		
+		(4 spaces,one line return and one carriage return)to each line which will result a total 
+		
+		increase around 9.375% (6/64) stream size. so here the size is increased by 12.5% to accomodate 
+		
+		these extra bytes. 
+    
+        */
+        
+        totalSize += (totalSize>>3); //increases size of new item by 12.5% 
+
+        totalSize += aOldItem.Size();
+
+        HBufC8* b1 = HBufC8::NewLC(totalSize);
+		
 		*b1 = aNewItem.Ptr(0);
 		TPtr8 ptrB1 = b1->Des();
 		TPtr8 p2 = aOldItem.Ptr(0);