smsprotocols/smsstack/smsprot/Src/smspstor.cpp
changeset 20 244d7c5f118e
parent 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
--- a/smsprotocols/smsstack/smsprot/Src/smspstor.cpp	Fri Mar 19 09:55:57 2010 +0200
+++ b/smsprotocols/smsstack/smsprot/Src/smspstor.cpp	Fri Apr 16 16:12:37 2010 +0300
@@ -559,7 +559,6 @@
 
 
 void CSmsReassemblyStore::SetPassedToClientL(TInt aIndex, TBool aPassed)
-//TODO CommentThisFunction
 	{
 	LOGSMSPROT1("CSmsReassemblyStore::SetPassedToClientL()");
 
@@ -774,7 +773,6 @@
 
 	BeginTransactionLC();
 
-	//TODO AA: What is it doing here? Please comment
 	for (TInt i=count-1; i>=0; --i)
 		{
 		if ((logid!=KLogNullId) && (logid==Entries()[i].LogServerId()))
@@ -818,7 +816,6 @@
 				ChangeEntryL(j,entry);
 				}
 
-			//TODO What is happening here? Seems strange
 			RSmsSegmentationStoreRefStatusArray refStatusTemp;
 			CleanupClosePushL(refStatusTemp);
 
@@ -844,7 +841,6 @@
 
 TBool CSmsSegmentationStore::AddReferenceL(const CSmsMessage& aSmsMessage,TInt aReference)
 	{
-	TSmsSegmentationEntry entry; // TODO const and inside loop
 	const TInt count=Entries().Count();
 	LOGSMSPROT3("CSmsSegmentationStore::AddReferenceL [count=%d, ref=%d]", count, aReference);
 	TInt i=0;
@@ -853,8 +849,7 @@
 		{
 		for (i=0; i<count; i++)
 			{
-			entry = (TSmsSegmentationEntry&)Entries()[i];
-			if (logserverid==entry.LogServerId())
+            if (logserverid==((TSmsSegmentationEntry&)Entries()[i]).LogServerId())
 				break;
 			}
 		}
@@ -865,22 +860,25 @@
 		TInt telLen;
 		for (i=0; i<count; i++)
 			{
-			entry = (TSmsSegmentationEntry&)Entries()[i];
-			telLen=Min(entry.Description2().Length(),parsedaddress.iTelNumber.Length());
-			const CSmsPDU::TSmsPDUType type=entry.PduType();
-			if ((type==aSmsMessage.Type()) && (!entry.IsComplete()) && (aSmsMessage.Time()==entry.Time()) && (entry.Description2().Right(telLen)==parsedaddress.iTelNumber.Right(telLen)))
-				break;
-			}
-		}
-//	__ASSERT_DEBUG(i<count,SmspPanic(KSmspPanicEntryWithLogServerIdNotFound)); TODO
+            TSAREntry tsareenty = Entries()[i];      
+            TSmsSegmentationEntry& entry = static_cast<TSmsSegmentationEntry&>(tsareenty);        
+            telLen=Min(entry.Description2().Length(),parsedaddress.iTelNumber.Length());
+            const CSmsPDU::TSmsPDUType type=entry.PduType();
+            if ((type==aSmsMessage.Type()) && (!entry.IsComplete()) && (aSmsMessage.Time()==entry.Time()) && (entry.Description2().Right(telLen)==parsedaddress.iTelNumber.Right(telLen)))
+                    break;
+                }
+            }
 	if(i>=count)
 		{
 		LOGSMSPROT3("WARNING! KSmspPanicEntryWithLogServerIdNotFound [i=%d, count=%d]", i, count);
+		return EFalse;
 		}
 
 	RSmsSegmentationStoreRefStatusArray refStatusArray;
 	CleanupClosePushL(refStatusArray);
 
+	TSAREntry tsareenty = Entries()[i];      
+	TSmsSegmentationEntry& entry = static_cast<TSmsSegmentationEntry&>(tsareenty);        
 	TStreamId streamid=entry.DataStreamId();
 	TSmsAddr smsaddr;
 	CSmsBuffer* buffer=CSmsBuffer::NewL();
@@ -923,7 +921,6 @@
  */
 TBool CSmsSegmentationStore::AddReferenceStatusPairL(const CSmsMessage& aSmsMessage,TInt aReference, TUint aSegmentSequenceNumber)
  	{
-	TSmsSegmentationEntry entry; // TODO const and inside loop
 	const TInt count=Entries().Count();
 	LOGSMSPROT3("CSmsSegmentationStore::AddReferenceStatusPairL [count=%d, ref=%d]", count, aReference);
 	TInt i=0;
@@ -932,8 +929,7 @@
 		{
 		for (i=0; i<count; i++)
 			{
-			entry = (TSmsSegmentationEntry&)Entries()[i];
-			if (logserverid==entry.LogServerId())
+            if (logserverid==((TSmsSegmentationEntry&)Entries()[i]).LogServerId())
 				break;
 			}
 		}
@@ -944,21 +940,24 @@
 		TInt telLen;
 		for (i=0; i<count; i++)
 			{
-			entry = (TSmsSegmentationEntry&)Entries()[i];
+            TSAREntry tsareenty = Entries()[i];  
+            TSmsSegmentationEntry& entry = static_cast<TSmsSegmentationEntry&>(tsareenty);
 			telLen=Min(entry.Description2().Length(),parsedaddress.iTelNumber.Length());
 			const CSmsPDU::TSmsPDUType type=entry.PduType();
 			if ((type==aSmsMessage.Type()) && (!entry.IsComplete()) && (aSmsMessage.Time()==entry.Time()) && (entry.Description2().Right(telLen)==parsedaddress.iTelNumber.Right(telLen)))
 				break;
 			}
 		}
-//	__ASSERT_DEBUG(i<count,SmspPanic(KSmspPanicEntryWithLogServerIdNotFound)); TODO
 	if(i>=count)
 		{
 		LOGSMSPROT3("WARNING! KSmspPanicEntryWithLogServerIdNotFound [i=%d, count=%d]", i, count);
+		return EFalse;
 		}
 
 	RSmsSegmentationStoreRefStatusArray refStatusArray;
 	CleanupClosePushL(refStatusArray);
+    TSAREntry tsareenty = Entries()[i];  
+    TSmsSegmentationEntry& entry = static_cast<TSmsSegmentationEntry&>(tsareenty);
 
 	TStreamId streamid=entry.DataStreamId();
 	TSmsAddr smsaddr;
@@ -1059,7 +1058,6 @@
 	CleanupStack::PushL(smsmessage);
 	TGsmSmsTelNumber parsedaddress;
 	aStatusReport.ParsedToFromAddress(parsedaddress);
-	TSmsSegmentationEntry entry; // TODO const ref and inside loop
 
 	BeginTransactionLC();
 
@@ -1068,7 +1066,8 @@
 	TInt telLen;
 	while (!found && aIndex--)
 		{
-		entry = (TSmsSegmentationEntry&)Entries()[aIndex];
+        TSAREntry tsareenty = Entries()[aIndex]; 
+        TSmsSegmentationEntry& entry = static_cast<TSmsSegmentationEntry&>(tsareenty);  
 
 		// Remove leading zeros of national numbers
 		TPtrC trimmedTelNumber(TrimLeadingZeros(entry.Description2()));
@@ -1149,7 +1148,8 @@
 		TInt telLen;
 		for (aIndex=0; aIndex<count1; aIndex++)
 			{
-			entry = (TSmsSegmentationEntry&)Entries()[aIndex];
+            TSAREntry tsareenty = Entries()[aIndex]; 
+	        TSmsSegmentationEntry& entry = static_cast<TSmsSegmentationEntry&>(tsareenty);  
 			telLen=Min(entry.Description2().Length(),parsedaddress.iTelNumber.Length());
 			const CSmsPDU::TSmsPDUType type = entry.PduType();
 			if ((type==CSmsPDU::ESmsSubmit) &&
@@ -1176,7 +1176,6 @@
 				__ASSERT_DEBUG(count2 == refStatusArray2.Count(),SmspPanic(KSmspPanicBadReferenceArray));
 				for (TInt i=0; i<count2; i++)
 					{
-					//TODO What is this doing?
 					TSmsSegmentationStoreRefStatus& refStatus2 = refStatusArray2[i];
 					if (!IsPermanentStatus(refStatus2.Status()))
 						{
@@ -1321,7 +1320,7 @@
 		aEntry.SetReference(0);
 		aEntry.SetTotal(1);
 		CSmsSubmit& submit=(CSmsSubmit&) aSmsMessage.SmsPDU();
-		aEntry.SetValidityPeriod(submit.ValidityPeriod().Int()); // TODO use val per type
+		aEntry.SetValidityPeriod(submit.ValidityPeriod().Int());
 		
 		if (aSmsMessage.Scheme() == EDefaultScheme)
 		    {
@@ -1426,16 +1425,6 @@
 		if (ret)
 			permanent++;
 		}
-	/*
-	 *  
-	 *  TODO ahe - for release
-	 *  tested hack: the messagereceived function will be called right
-	 *  I did a lot of testing with multipart messages, the sms are
-	 *  almost always received and sent now, there might be only problems
-	 *  with the SR now - to wait for more logs to see what happens in this
-	 *  special cases - and the device crashes and is too slow of course
-	 *  
-	 */
 	return (permanent==count) && (permanent==aEntry.Total() );
 	} // CSmsSegmentationStore::StatusArrayComplete