[Libreoffice-commits] .: filter/source

Joseph Powers jpowers at kemper.freedesktop.org
Sat May 7 18:03:03 PDT 2011


 filter/source/graphicfilter/icgm/bundles.cxx  |   33 +++++++++++---------------
 filter/source/graphicfilter/icgm/bundles.hxx  |   31 +++++++++++++-----------
 filter/source/graphicfilter/icgm/class1.cxx   |    2 -
 filter/source/graphicfilter/icgm/elements.hxx |    2 -
 4 files changed, 33 insertions(+), 35 deletions(-)

New commits:
commit edefad66bd3cbbaf11a0d91b29db972f37dffb65
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Sat May 7 18:02:47 2011 -0700

    Remove a List reference in class CGMFList.

diff --git a/filter/source/graphicfilter/icgm/bundles.cxx b/filter/source/graphicfilter/icgm/bundles.cxx
index 0a291bb..b0245a1 100644
--- a/filter/source/graphicfilter/icgm/bundles.cxx
+++ b/filter/source/graphicfilter/icgm/bundles.cxx
@@ -121,7 +121,7 @@ CGMFList::CGMFList() :
     nCharSetCount		( 0 ),
     nFontsAvailable		( 0 )
 {
-    aFontEntryList.Clear();
+    aFontEntryList.clear();
 }
 
 CGMFList::~CGMFList()
@@ -135,11 +135,11 @@ CGMFList& CGMFList::operator=( CGMFList& rSource )
 {
     ImplDeleteList();
     nFontsAvailable	= rSource.nFontsAvailable;
-    nFontNameCount = rSource.nFontNameCount;
-    nCharSetCount = rSource.nCharSetCount;
-    FontEntry* pPtr = (FontEntry*)rSource.aFontEntryList.First();
-    while( pPtr )
+    nFontNameCount  = rSource.nFontNameCount;
+    nCharSetCount   = rSource.nCharSetCount;
+    for ( size_t i = 0, n = rSource.aFontEntryList.size(); i < n; ++i )
     {
+        FontEntry* pPtr = rSource.aFontEntryList[ i ];
         FontEntry* pCFontEntry = new FontEntry;
         if ( pPtr->pFontName )
         {
@@ -155,8 +155,7 @@ CGMFList& CGMFList::operator=( CGMFList& rSource )
         }
         pCFontEntry->eCharSetType = pPtr->eCharSetType;
         pCFontEntry->nFontType = pPtr->nFontType;
-        aFontEntryList.Insert( pCFontEntry, LIST_APPEND );
-        pPtr = (FontEntry*)rSource.aFontEntryList.Next();
+        aFontEntryList.push_back( pCFontEntry );
     }
     return *this;
 }
@@ -168,7 +167,7 @@ FontEntry* CGMFList::GetFontEntry( sal_uInt32 nIndex )
     sal_uInt32 nInd = nIndex;
     if ( nInd )
         nInd--;
-    return (FontEntry*)aFontEntryList.GetObject( nInd );
+    return ( nInd < aFontEntryList.size() ) ? aFontEntryList[ nInd ] : NULL;
 }
 
 // ---------------------------------------------------------------
@@ -197,11 +196,11 @@ void CGMFList::InsertName( sal_uInt8* pSource, sal_uInt32 nSize )
     {
         nFontsAvailable++;
         pFontEntry = new FontEntry;
-        aFontEntryList.Insert( pFontEntry, LIST_APPEND );
+        aFontEntryList.push_back( pFontEntry );
     }
     else
     {
-        pFontEntry = (FontEntry*)aFontEntryList.GetObject( nFontNameCount );
+        pFontEntry = aFontEntryList[ nFontNameCount ];
     }
     nFontNameCount++;
     sal_Int8* pBuf = new sal_Int8[ nSize ];
@@ -260,11 +259,11 @@ void CGMFList::InsertCharSet( CharSetType eCharSetType, sal_uInt8* pSource, sal_
     {
         nFontsAvailable++;
         pFontEntry = new FontEntry;
-        aFontEntryList.Insert( pFontEntry, LIST_APPEND );
+        aFontEntryList.push_back( pFontEntry );
     }
     else
     {
-        pFontEntry = (FontEntry*)aFontEntryList.GetObject( nCharSetCount );
+        pFontEntry = aFontEntryList[ nCharSetCount ];
     }
     nCharSetCount++;
     pFontEntry->eCharSetType = eCharSetType;
@@ -277,13 +276,9 @@ void CGMFList::InsertCharSet( CharSetType eCharSetType, sal_uInt8* pSource, sal_
 
 void CGMFList::ImplDeleteList()
 {
-    FontEntry* pFontEntry = (FontEntry*)aFontEntryList.First();
-    while( pFontEntry )
-    {
-        delete pFontEntry;
-        pFontEntry = (FontEntry*)aFontEntryList.Next();
-    }
-    aFontEntryList.Clear();
+    for ( size_t i = 0, n = aFontEntryList.size(); i < n; ++i )
+        delete aFontEntryList[ i ];
+    aFontEntryList.clear();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/bundles.hxx b/filter/source/graphicfilter/icgm/bundles.hxx
index aed9e91..ca35898 100644
--- a/filter/source/graphicfilter/icgm/bundles.hxx
+++ b/filter/source/graphicfilter/icgm/bundles.hxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -31,8 +31,8 @@
 
 #include <sal/types.h>
 #include "cgmtypes.hxx"
-#include <tools/list.hxx>
 #include <vcl/salbtype.hxx>
+#include <vector>
 
 // ---------------------------------------------------------------
 
@@ -154,23 +154,26 @@ public:
 
 // ---------------------------------------------------------------
 
+typedef ::std::vector< FontEntry* > FontEntryList;
+
 class CGMFList
 {
-    sal_uInt32				nFontNameCount;
-    sal_uInt32				nCharSetCount;
-    List				aFontEntryList;
-    void				ImplDeleteList();
+    sal_uInt32      nFontNameCount;
+    sal_uInt32      nCharSetCount;
+    FontEntryList   aFontEntryList;
+    void            ImplDeleteList();
+
 public:
-    sal_uInt32				nFontsAvailable;
-    FontEntry*			GetFontEntry( sal_uInt32 );
-    void				InsertName( sal_uInt8* pSource, sal_uInt32 nSize );
-    void				InsertCharSet( CharSetType, sal_uInt8* pSource, sal_uInt32 nSize );
-                        CGMFList();
-    CGMFList&			operator=( CGMFList& rFontList );
-                        ~CGMFList();
+                    CGMFList();
+                    ~CGMFList();
+
+    sal_uInt32      nFontsAvailable;
+    FontEntry*      GetFontEntry( sal_uInt32 );
+    void            InsertName( sal_uInt8* pSource, sal_uInt32 nSize );
+    void            InsertCharSet( CharSetType, sal_uInt8* pSource, sal_uInt32 nSize );
+    CGMFList&       operator=( CGMFList& rFontList );
 };
 
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/class1.cxx b/filter/source/graphicfilter/icgm/class1.cxx
index 6e8e489..e63aa5c 100644
--- a/filter/source/graphicfilter/icgm/class1.cxx
+++ b/filter/source/graphicfilter/icgm/class1.cxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
diff --git a/filter/source/graphicfilter/icgm/elements.hxx b/filter/source/graphicfilter/icgm/elements.hxx
index fda5184..92b39d1 100644
--- a/filter/source/graphicfilter/icgm/elements.hxx
+++ b/filter/source/graphicfilter/icgm/elements.hxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite


More information about the Libreoffice-commits mailing list