[Libreoffice-commits] .: 2 commits - filter/source
Joseph Powers
jpowers at kemper.freedesktop.org
Sun May 8 11:12:02 PDT 2011
filter/source/graphicfilter/icgm/cgm.cxx | 26 +++++++++++---------------
filter/source/graphicfilter/icgm/cgm.hxx | 6 +++---
filter/source/graphicfilter/icgm/chart.cxx | 19 +++++++++++++------
filter/source/graphicfilter/icgm/chart.hxx | 4 ++--
filter/source/graphicfilter/icgm/class1.cxx | 6 +++---
5 files changed, 32 insertions(+), 29 deletions(-)
New commits:
commit b751e318d96c3cef5592317211860c2d25da1c6a
Author: Joseph Powers <jpowers27 at cox.net>
Date: Sun May 8 11:10:27 2011 -0700
Replace List type in chart.hxx with a vector<>
diff --git a/filter/source/graphicfilter/icgm/chart.cxx b/filter/source/graphicfilter/icgm/chart.cxx
index 40f8cd7..0ec9bea 100644
--- a/filter/source/graphicfilter/icgm/chart.cxx
+++ b/filter/source/graphicfilter/icgm/chart.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
@@ -52,10 +52,9 @@ CGMChart::~CGMChart()
{
// delete the whole textentry structure
- TextEntry* pTextEntry;
- while( ( pTextEntry = (TextEntry*)maTextEntryList.First() ) != NULL )
+ while( !maTextEntryList.empty() )
{
- DeleteTextEntry( pTextEntry );
+ DeleteTextEntry( maTextEntryList[ 0 ] );
}
};
@@ -73,7 +72,15 @@ void CGMChart::DeleteTextEntry( TextEntry* pTextEntry )
delete pTempTAttr;
}
delete pTextEntry;
- maTextEntryList.Remove( pTextEntry );
+ ::std::vector< TextEntry* >::iterator it;
+ for ( it = maTextEntryList.begin(); it < maTextEntryList.end(); ++it )
+ {
+ if ( *it == pTextEntry )
+ {
+ maTextEntryList.erase( it );
+ break;
+ }
+ }
}
};
@@ -81,7 +88,7 @@ void CGMChart::DeleteTextEntry( TextEntry* pTextEntry )
void CGMChart::InsertTextEntry( TextEntry* pTextEntry )
{
- maTextEntryList.Insert( pTextEntry );
+ maTextEntryList.push_back( pTextEntry );
};
// ---------------------------------------------------------------
diff --git a/filter/source/graphicfilter/icgm/chart.hxx b/filter/source/graphicfilter/icgm/chart.hxx
index 59e6cdd..ce1a7d1 100644
--- a/filter/source/graphicfilter/icgm/chart.hxx
+++ b/filter/source/graphicfilter/icgm/chart.hxx
@@ -188,8 +188,8 @@ class CGMChart
protected:
CGM* mpCGM;
- sal_Int8 mnCurrentFileType;
- List maTextEntryList;
+ sal_Int8 mnCurrentFileType;
+ ::std::vector< TextEntry* > maTextEntryList;
DataNode mDataNode[ 7 ];
ChartZone mChartZone;
PageOrientDim mPageOrientDim;
diff --git a/filter/source/graphicfilter/icgm/class1.cxx b/filter/source/graphicfilter/icgm/class1.cxx
index e63aa5c..726d6f3 100644
--- a/filter/source/graphicfilter/icgm/class1.cxx
+++ b/filter/source/graphicfilter/icgm/class1.cxx
@@ -176,12 +176,12 @@ void CGM::ImplDoClass1()
{
if ( mnElementSize > 1 )
{
- sal_Int8* pBuf = new sal_Int8[ mnElementSize ];
+ sal_uInt8* pBuf = new sal_uInt8[ mnElementSize ];
if ( pBuf )
{
memcpy( pBuf, mpSource, mnElementSize );
- maDefRepList.Insert( pBuf, LIST_APPEND );
- maDefRepSizeList.Insert( (void*)(sal_uIntPtr)mnElementSize, LIST_APPEND );
+ maDefRepList.push_back( pBuf );
+ maDefRepSizeList.push_back( mnElementSize );
}
}
mnParaSize = mnElementSize;
commit c33fad3616e56c292d4facbc361733e44c00a17c
Author: Joseph Powers <jpowers27 at cox.net>
Date: Sun May 8 11:08:37 2011 -0700
Replace List types in cgm.hxx with vector<>
diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx
index e28bea9..d9d34e5 100644
--- a/filter/source/graphicfilter/icgm/cgm.cxx
+++ b/filter/source/graphicfilter/icgm/cgm.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
@@ -161,13 +161,10 @@ CGM::~CGM()
*mpGraphic = Graphic( *mpGDIMetaFile );
}
#endif
- sal_Int8* pBuf = (sal_Int8*)maDefRepList.First();
- while( pBuf )
- {
- delete pBuf;
- pBuf = (sal_Int8*)maDefRepList.Next();
- }
- maDefRepList.Clear();
+ for( size_t i = 0, n = maDefRepList.size(); i < n; ++i )
+ delete maDefRepList[ i ];
+ maDefRepList.clear();
+ maDefRepSizeList.clear();
delete mpBitmapInUse;
delete mpCommentOut;
delete mpChart;
@@ -751,17 +748,18 @@ void CGM::ImplDoClass()
void CGM::ImplDefaultReplacement()
{
- sal_uInt8* pBuf = (sal_uInt8*)maDefRepList.First();
- if ( pBuf )
+ if ( !maDefRepList.empty() )
{
- sal_uInt32 nElementSize = (sal_uInt32)(sal_uIntPtr)maDefRepSizeList.First();
sal_uInt32 nOldEscape = mnEscape;
sal_uInt32 nOldElementClass = mnElementClass;
sal_uInt32 nOldElementID = mnElementID;
sal_uInt32 nOldElementSize = mnElementSize;
sal_uInt8* pOldBuf = mpSource;
- while( pBuf )
+
+ for ( size_t i = 0, n = maDefRepList.size(); i < n; ++i )
{
+ sal_uInt8* pBuf = maDefRepList[ i ];
+ sal_uInt32 nElementSize = maDefRepSizeList[ i ];
sal_uInt32 nCount = 0;
while ( mbStatus && ( nCount < nElementSize ) )
{
@@ -784,8 +782,6 @@ void CGM::ImplDefaultReplacement()
if ( ( mnElementClass != 1 ) || ( mnElementID != 0xc ) ) // rekursion hier nicht moeglich!!
ImplDoClass();
}
- nElementSize = (sal_uInt32)(sal_uIntPtr)maDefRepSizeList.Next();
- pBuf = (sal_uInt8*)maDefRepList.Next();
}
mnEscape = nOldEscape;
mnElementClass = nOldElementClass;
@@ -850,7 +846,7 @@ SvStream& operator>>( SvStream& rOStm, CGM& /*rCGM*/ )
extern "C" sal_uInt32 __LOADONCALLAPI ImportCGM( String& rFileName, uno::Reference< frame::XModel > & rXModel, sal_uInt32 nMode, void* pProgressBar )
{
-
+
sal_uInt32 nStatus = 0; // retvalue == 0 -> ERROR
// == 0xffrrggbb -> background color in the lower 24 bits
sal_Bool bProgressBar = sal_False;
diff --git a/filter/source/graphicfilter/icgm/cgm.hxx b/filter/source/graphicfilter/icgm/cgm.hxx
index ed7b5d9..66243cf 100644
--- a/filter/source/graphicfilter/icgm/cgm.hxx
+++ b/filter/source/graphicfilter/icgm/cgm.hxx
@@ -44,7 +44,7 @@
#include <tools/solar.h>
#include <rtl/ustring.hxx>
-#include <tools/list.hxx>
+#include <vector>
#include "cgmtypes.hxx"
// ---------------------------------------------------------------
@@ -99,8 +99,8 @@ class CGM
CGMElements* pElement;
CGMElements* pCopyOfE;
CGMOutAct* mpOutAct;
- List maDefRepList;
- List maDefRepSizeList;
+ ::std::vector< sal_uInt8 * > maDefRepList;
+ ::std::vector< sal_uInt32 > maDefRepSizeList;
sal_uInt8* mpSource; // source buffer that is not increased
// ( instead use mnParaCount to index )
More information about the Libreoffice-commits
mailing list