From 18bb10da560a4ae69008652a3659e3813d05b2ed Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Wed, 27 Apr 2011 18:24:59 -0430
Subject: [PATCH 1/2] Remove DECLARE_LIST(DdeTransactions,DdeTransaction*).

---
 svl/inc/svl/svdde.hxx       |    3 +--
 svl/source/svdde/ddecli.cxx |   27 ++++++++++++++-------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/svl/inc/svl/svdde.hxx b/svl/inc/svl/svdde.hxx
index 83aba8c..d739c51 100644
--- a/svl/inc/svl/svdde.hxx
+++ b/svl/inc/svl/svdde.hxx
@@ -60,7 +60,6 @@ DECLARE_LIST( DdeServices, DdeService* )
 typedef List DdeServices;
 #endif
 
-DECLARE_LIST( DdeTransactions, DdeTransaction* )
 typedef ::std::vector< long > DdeFormats;
 typedef ::std::vector< Conversation* > ConvList;
 
@@ -226,7 +225,7 @@ class SVL_DLLPUBLIC DdeConnection
 {
     friend class    DdeInternal;
     friend class    DdeTransaction;
-    DdeTransactions aTransactions;
+    std::vector<DdeTransaction*> aTransactions;
     DdeString*      pService;
     DdeString*      pTopic;
     DdeImp*         pImp;
diff --git a/svl/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx
index 920a0cf..2de79f5 100644
--- a/svl/source/svdde/ddecli.cxx
+++ b/svl/source/svdde/ddecli.cxx
@@ -85,18 +85,18 @@ HDDEDATA CALLBACK DdeInternal::CliCallback(
 
     if( self )
     {
-        DdeTransaction* t;
         sal_Bool bFound = sal_False;
-        for( t = self->aTransactions.First(); t; t = self->aTransactions.Next() )
+        std::vector<DdeTransaction*> iter;
+        for( iter = self->aTransactions.begin(); iter != self->aTransactions.end(); ++iter )
         {
             switch( nCode )
             {
                 case XTYP_XACT_COMPLETE:
-                    if( (DWORD)t->nId == nInfo1 )
+                    if( (DWORD)iter->nId == nInfo1 )
                     {
-                        nCode = t->nType & (XCLASS_MASK | XTYP_MASK);
-                        t->bBusy = sal_False;
-                        t->Done( 0 != hData );
+                        nCode = iter->nType & (XCLASS_MASK | XTYP_MASK);
+                        iter->bBusy = sal_False;
+                        iter->Done( 0 != hData );
                         bFound = sal_True;
                     }
                     break;
@@ -106,27 +106,27 @@ HDDEDATA CALLBACK DdeInternal::CliCallback(
                     self->pImp->nStatus = self->pImp->hConv
                                     ? DMLERR_NO_ERROR
                                     : DdeGetLastError( pInst->hDdeInstCli );
-                    t = 0;
+                    iter = self->aTransactions.end();
                     nRet = 0;
                     bFound = sal_True;
                     break;
 
                 case XTYP_ADVDATA:
-                    bFound = sal_Bool( *t->pName == hText2 );
+                    bFound = sal_Bool( *iter->pName == hText2 );
                     break;
             }
             if( bFound )
                 break;
         }
 
-        if( t )
+        if( iter != self->aTransactions.end() )
         {
             switch( nCode )
             {
             case XTYP_ADVDATA:
                 if( !hData )
                 {
-                    ((DdeLink*) t)->Notify();
+                    static_cast<DdeLink*>(*iter)->Notify();
                     nRet = (HDDEDATA)DDE_FACK;
                     break;
                 }
@@ -142,7 +142,7 @@ HDDEDATA CALLBACK DdeInternal::CliCallback(
                 d.pImp->hData = hData;
                 d.pImp->nFmt  = DdeData::GetInternalFormat( nCbType );
                 d.Lock();
-                t->Data( &d );
+                iter->Data( &d );
                 nRet = (HDDEDATA)DDE_FACK;
                 break;
             }
@@ -279,7 +279,7 @@ DdeTransaction::DdeTransaction( DdeConnection& d, const String& rItemName,
     nType = 0;
     bBusy = sal_False;
 
-    rDde.aTransactions.Insert( this );
+    rDde.aTransactions.push_back( this );
 }
 
 // --- DdeTransaction::~DdeTransaction() ---------------------------
@@ -293,7 +293,8 @@ DdeTransaction::~DdeTransaction()
     }
 
     delete pName;
-    rDde.aTransactions.Remove( this );
+    rDde.aTransactions.erase(std::remove(rDde.aTransactions.begin(),
+                                         rDde.aTransactions.end(),this));
 }
 
 // --- DdeTransaction::Execute() -----------------------------------
-- 
1.7.3.4

