[Libreoffice-commits] .: filter/inc filter/source
Joseph Powers
jpowers at kemper.freedesktop.org
Thu Jun 16 20:42:35 PDT 2011
filter/inc/filter/msfilter/escherex.hxx | 22 +++++----
filter/source/msfilter/escherex.cxx | 75 +++++++++++++++++---------------
2 files changed, 52 insertions(+), 45 deletions(-)
New commits:
commit 067f42d9a68de34be941226db137a639c7418a1d
Author: Joseph Powers <jpowers27 at cox.net>
Date: Thu Jun 16 20:37:07 2011 -0700
Replace List with std::vector< EscherPersistEntry* >
diff --git a/filter/inc/filter/msfilter/escherex.hxx b/filter/inc/filter/msfilter/escherex.hxx
index 7473b93..4afd1f0 100644
--- a/filter/inc/filter/msfilter/escherex.hxx
+++ b/filter/inc/filter/msfilter/escherex.hxx
@@ -1342,22 +1342,24 @@ public:
// ---------------------------------------------------------------------------------------------
+typedef ::std::vector< EscherPersistEntry* > EscherPersistTable_impl;
+
class MSFILTER_DLLPUBLIC EscherPersistTable
{
- public:
- List maPersistTable;
+public:
+ EscherPersistTable_impl maPersistTable;
- sal_Bool PtIsID( sal_uInt32 nID );
- void PtInsert( sal_uInt32 nID, sal_uInt32 nOfs );
- sal_uInt32 PtDelete( sal_uInt32 nID );
- sal_uInt32 PtGetOffsetByID( sal_uInt32 nID );
- sal_uInt32 PtReplace( sal_uInt32 nID, sal_uInt32 nOfs );
- sal_uInt32 PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOfs );
- sal_uInt32 PtGetCount() const { return maPersistTable.Count(); };
+ sal_Bool PtIsID( sal_uInt32 nID );
+ void PtInsert( sal_uInt32 nID, sal_uInt32 nOfs );
+ sal_uInt32 PtDelete( sal_uInt32 nID );
+ sal_uInt32 PtGetOffsetByID( sal_uInt32 nID );
+ sal_uInt32 PtReplace( sal_uInt32 nID, sal_uInt32 nOfs );
+ sal_uInt32 PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOfs );
+ sal_uInt32 PtGetCount() const { return maPersistTable.size(); };
EscherPersistTable();
- virtual ~EscherPersistTable();
+ virtual ~EscherPersistTable();
};
// ---------------------------------------------------------------------------------------------
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index ba70b02..f87b18c 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -3283,32 +3283,37 @@ EscherPersistTable::EscherPersistTable()
EscherPersistTable::~EscherPersistTable()
{
- for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() )
- delete (EscherPersistEntry*)pPtr;
+ for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) {
+ delete maPersistTable[ i ];
+ }
}
sal_Bool EscherPersistTable::PtIsID( sal_uInt32 nID )
{
- for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() )
- {
- if ( ((EscherPersistEntry*)pPtr)->mnID == nID )
+ for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) {
+ EscherPersistEntry* pPtr = maPersistTable[ i ];
+ if ( pPtr->mnID == nID ) {
return sal_True;
+ }
}
return sal_False;
}
void EscherPersistTable::PtInsert( sal_uInt32 nID, sal_uInt32 nOfs )
{
- maPersistTable.Insert( new EscherPersistEntry( nID, nOfs ) );
+ maPersistTable.push_back( new EscherPersistEntry( nID, nOfs ) );
}
sal_uInt32 EscherPersistTable::PtDelete( sal_uInt32 nID )
{
- for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() )
- {
- if ( ((EscherPersistEntry*)pPtr)->mnID == nID )
- {
- delete (EscherPersistEntry*) maPersistTable.Remove();
+ for(
+ EscherPersistTable_impl::iterator it = maPersistTable.begin();
+ it < maPersistTable.end();
+ ++it
+ ) {
+ if ( (*it)->mnID == nID ) {
+ delete *it;
+ maPersistTable.erase( it );
}
}
return 0;
@@ -3316,22 +3321,22 @@ sal_uInt32 EscherPersistTable::PtDelete( sal_uInt32 nID )
sal_uInt32 EscherPersistTable::PtGetOffsetByID( sal_uInt32 nID )
{
- for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() )
- {
- if ( ((EscherPersistEntry*)pPtr)->mnID == nID )
+ for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) {
+ EscherPersistEntry* pPtr = maPersistTable[ i ];
+ if ( pPtr->mnID == nID ) {
return ((EscherPersistEntry*)pPtr)->mnOffset;
+ }
}
return 0;
};
sal_uInt32 EscherPersistTable::PtReplace( sal_uInt32 nID, sal_uInt32 nOfs )
{
- for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() )
- {
- if ( ((EscherPersistEntry*)pPtr)->mnID == nID )
- {
- sal_uInt32 nRetValue = ((EscherPersistEntry*)pPtr)->mnOffset;
- ((EscherPersistEntry*)pPtr)->mnOffset = nOfs;
+ for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) {
+ EscherPersistEntry* pPtr = maPersistTable[ i ];
+ if ( pPtr->mnID == nID ) {
+ sal_uInt32 nRetValue = pPtr->mnOffset;
+ pPtr->mnOffset = nOfs;
return nRetValue;
}
}
@@ -3340,12 +3345,11 @@ sal_uInt32 EscherPersistTable::PtReplace( sal_uInt32 nID, sal_uInt32 nOfs )
sal_uInt32 EscherPersistTable::PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOfs )
{
- for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() )
- {
- if ( ((EscherPersistEntry*)pPtr)->mnID == nID )
- {
- sal_uInt32 nRetValue = ((EscherPersistEntry*)pPtr)->mnOffset;
- ((EscherPersistEntry*)pPtr)->mnOffset = nOfs;
+ for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) {
+ EscherPersistEntry* pPtr = maPersistTable[ i ];
+ if ( pPtr->mnID == nID ) {
+ sal_uInt32 nRetValue = pPtr->mnOffset;
+ pPtr->mnOffset = nOfs;
return nRetValue;
}
}
@@ -3355,10 +3359,10 @@ sal_uInt32 EscherPersistTable::PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOf
sal_Bool EscherPropertyValueHelper::GetPropertyValue(
::com::sun::star::uno::Any& rAny,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
- const String& rString,
- sal_Bool bTestPropertyAvailability )
-{
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ const String& rString,
+ sal_Bool bTestPropertyAvailability
+) {
sal_Bool bRetValue = sal_True;
if ( bTestPropertyAvailability )
{
@@ -4409,11 +4413,12 @@ void EscherEx::InsertAtCurrentPos( sal_uInt32 nBytes, bool bExpandEndOfAtom )
sal_uInt8* pBuf;
// Persist table anpassen
- for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() )
- {
- sal_uInt32 nOfs = ((EscherPersistEntry*)pPtr)->mnOffset;
- if ( nOfs >= nCurPos )
- ((EscherPersistEntry*)pPtr)->mnOffset += nBytes;
+ for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) {
+ EscherPersistEntry* pPtr = maPersistTable[ i ];
+ sal_uInt32 nOfs = pPtr->mnOffset;
+ if ( nOfs >= nCurPos ) {
+ pPtr->mnOffset += nBytes;
+ }
}
// container und atom sizes anpassen
More information about the Libreoffice-commits
mailing list