bluetoothengine/btmac/src/BTMonoCmdHandler/btmcprotocol.cpp
branchRCL_3
changeset 72 4b59561a31c0
parent 54 0ba996a9b75d
--- a/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcprotocol.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcprotocol.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -399,23 +399,21 @@
         {
         return;
         }
-    RBuf8 cmddes;
-    cmddes.CreateL(KDefaultCmdBufLength);
-    CleanupClosePushL(cmddes);
-    if (iInDataBuf.NextCommand(cmddes) || cmddes.Length() == 0)
+    TBuf8<KDefaultCmdBufLength> cmddes;
+    if (iInDataBuf.NextCommand(cmddes))
         {
-        CleanupStack::PopAndDestroy(&cmddes);
         return;
         }
-    
+    if (cmddes.Length() == 0)
+        {
+        return;
+        }
     TRACE_INFO_SEG(
         {
-        RBuf8 buf;
-        buf.CreateL(KDefaultCmdBufLength);
+        TBuf8<KDefaultCmdBufLength> buf;
         buf = cmddes;
         buf.Trim();
         Trace(_L8("[HFP] [I] %S"), &buf);
-        buf.Close();
         })
 
     CATCommand* cmd = NULL;
@@ -425,16 +423,13 @@
       	if(iAtExt)
         	{
       		iAtExt->HandleCommand(cmddes, _L8("\n\rERROR\n\r"));
-      		CleanupStack::PopAndDestroy(&cmddes);
         	return;
         	}
         CATResult* nok = CATResult::NewLC(EATERROR);
         SendResponseL(*nok);
         CleanupStack::PopAndDestroy(nok);
-        CleanupStack::PopAndDestroy(&cmddes);
         return;
         }
-    CleanupStack::PopAndDestroy(&cmddes);
     CleanupStack::PushL(cmd);
     iHandleCmdPending = ETrue;
 	TATId id = cmd->Id();
@@ -1085,17 +1080,14 @@
     {
     TRACE_INFO((_L("credit %d"), iCredit))
     TInt count = iOutgoPacketQueue->MdcaCount();
-    RBuf8 buf;
-    buf.CreateL(KDefaultCmdBufLength);
-    CleanupClosePushL(buf);
     for (TInt i = 0; iCredit >0 && i < count; i++)
         {
         iCredit--;
+        TBuf8<KDefaultCmdBufLength> buf;
         buf.Copy(iOutgoPacketQueue->MdcaPoint(0));
         iObserver.SendProtocolDataL(buf);
         iOutgoPacketQueue->Delete(0);
         }
-    CleanupStack::PopAndDestroy(&buf);
     }
 
 void CBtmcProtocol::StartTimerL(TInt aService, TInt aTimeout)