[Libreoffice-commits] .: svl/inc svl/source

Joseph Powers jpowers at kemper.freedesktop.org
Wed Mar 2 20:45:56 PST 2011


 svl/inc/svl/svdde.hxx       |    3 ++-
 svl/source/svdde/ddeimp.hxx |    3 ++-
 svl/source/svdde/ddesvr.cxx |   29 ++++++++++++++++++++---------
 3 files changed, 24 insertions(+), 11 deletions(-)

New commits:
commit eb4d8d03965f1a70d33abf73757cc7c43b818a3f
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Wed Mar 2 20:45:36 2011 -0800

    Remove DECLARE_LIST( ConvList, Conversation* )

diff --git a/svl/inc/svl/svdde.hxx b/svl/inc/svl/svdde.hxx
index b38cf7d..86c2280 100644
--- a/svl/inc/svl/svdde.hxx
+++ b/svl/inc/svl/svdde.hxx
@@ -49,10 +49,10 @@ class DdeExecute;
 class DdeItem;
 class DdeTopic;
 class DdeService;
-class ConvList;
 struct DdeDataImp;
 struct DdeImp;
 class DdeItemImp;
+struct Conversation;
 
 #ifndef _SVDDE_NOLISTS
 DECLARE_LIST( DdeConnections, DdeConnection* )
@@ -68,6 +68,7 @@ typedef List DdeItems;
 
 DECLARE_LIST( DdeTransactions, DdeTransaction* )
 typedef ::std::vector< long > DdeFormats;
+typedef ::std::vector< Conversation* > ConvList;
 
 // -----------
 // - DdeData -
diff --git a/svl/source/svdde/ddeimp.hxx b/svl/source/svdde/ddeimp.hxx
index 15b12c0..45492b2 100644
--- a/svl/source/svdde/ddeimp.hxx
+++ b/svl/source/svdde/ddeimp.hxx
@@ -52,6 +52,7 @@
 #include <tools/string.hxx>
 #include <tools/list.hxx>
 #include <tools/shl.hxx>
+#include <vector>
 
 class DdeService;
 class DdeTopic;
@@ -69,7 +70,7 @@ struct Conversation
     DdeTopic*   pTopic;
 };
 
-DECLARE_LIST( ConvList, Conversation* );
+typedef ::std::vector< Conversation* > ConvList;
 
 // ---------------
 // - DdeInternal -
diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx
index 2b92c21..57232ee 100644
--- a/svl/source/svdde/ddesvr.cxx
+++ b/svl/source/svdde/ddesvr.cxx
@@ -209,7 +209,7 @@ HDDEDATA CALLBACK _export DdeInternal::SvrCallback(
                     pC = new Conversation;
                     pC->hConv = hConv;
                     pC->pTopic = pTopic;
-                    pService->pConv->Insert( pC );
+                    pService->pConv->push_back( pC );
                 }
             }
             return (HDDEDATA)NULL;
@@ -217,9 +217,9 @@ HDDEDATA CALLBACK _export DdeInternal::SvrCallback(
 
     for ( pService = rAll.First(); pService; pService = rAll.Next() )
     {
-        for( pC = pService->pConv->First(); pC;
-             pC = pService->pConv->Next() )
+        for ( size_t i = 0, n = pService->pConv->size(); i < n; ++i )
         {
+            pc = (*pService->pConv)[ i ];
             if ( pC->hConv == hConv )
                 goto found;
         }
@@ -231,8 +231,17 @@ found:
     if ( nCode == XTYP_DISCONNECT)
     {
         pC->pTopic->_Disconnect( (long) hConv );
-        pService->pConv->Remove( pC );
-        delete pC;
+        for ( ConvList::iterator it = pService->pConv->begin();
+              it < pService->pConv->end();
+              ++it
+        ) {
+            if ( *it == pC )
+            {
+                delete *it;
+                pService->pConv->erase( it );
+                break;
+            }
+        }
         return (HDDEDATA)NULL;
     }
 
@@ -565,13 +574,15 @@ void DdeService::RemoveTopic( const DdeTopic& rTopic )
             aTopics.Remove( t );
             // JP 27.07.95: und alle Conversions loeschen !!!
             //              (sonst wird auf geloeschten Topics gearbeitet!!)
-            for( ULONG n = pConv->Count(); n; )
+            for( size_t n = pConv->size(); n; )
             {
-                Conversation* pC = pConv->GetObject( --n );
+                Conversation* pC = (*pConv)[ --n ];
                 if( pC->pTopic == &rTopic )
                 {
-                    pConv->Remove( pC );
-                    delete pC;
+                    ConvList::iterator it = pConv->begin();
+                    ::std::advance( it, n );
+                    delete *it;
+                    pConv->erase( it );
                 }
             }
             break;


More information about the Libreoffice-commits mailing list