summaryrefslogtreecommitdiff
path: root/svl/source/svdde
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-07-27 20:03:08 +0200
committerMichael Stahl <mstahl@redhat.com>2012-07-27 20:08:45 +0200
commit5dbbe223c8586bd653685d27c664aa8395632e4a (patch)
tree590d49e9db3e9a54dc4468f3f330c32979907691 /svl/source/svdde
parent3ae618f9e4c34d5f6f10d953e3fb074018001748 (diff)
convert DdeItemImp to std::vector
... with some fixes from the committer. Change-Id: I51e0c14222a90e7826711b6bc02a6b70eef887b5
Diffstat (limited to 'svl/source/svdde')
-rw-r--r--svl/source/svdde/ddesvr.cxx25
1 files changed, 15 insertions, 10 deletions
diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx
index 0e4dbd149d1d..ea221a76b846 100644
--- a/svl/source/svdde/ddesvr.cxx
+++ b/svl/source/svdde/ddesvr.cxx
@@ -23,9 +23,9 @@
#include <algorithm>
#include <comphelper/string.hxx>
#include <svl/svdde.hxx>
-#include <svl/svarray.hxx>
#include <tools/debug.hxx>
#include <osl/thread.h>
+#include <o3tl/sorted_vector.hxx>
enum DdeItemType
{
@@ -41,8 +41,7 @@ struct DdeItemImpData
DdeItemImpData( sal_uLong nH ) : nHCnv( nH ), nCnt( 1 ) {}
};
-SV_DECL_VARARR( DdeItemImp, DdeItemImpData, 1 )
-SV_IMPL_VARARR( DdeItemImp, DdeItemImpData )
+class DdeItemImp : public std::vector<DdeItemImpData> {};
// --- DdeInternat::SvrCallback() ----------------------------------
@@ -864,7 +863,7 @@ void DdeItem::IncMonitor( sal_uLong nHCnv )
}
else
{
- for( sal_uInt16 n = pImpData->Count(); n; )
+ for( sal_uInt16 n = pImpData->size(); n; )
if( (*pImpData)[ --n ].nHCnv == nHCnv )
{
++(*pImpData)[ n ].nHCnv;
@@ -872,7 +871,7 @@ void DdeItem::IncMonitor( sal_uLong nHCnv )
}
}
- pImpData->Insert( DdeItemImpData( nHCnv ), pImpData->Count() );
+ pImpData->push_back( DdeItemImpData( nHCnv ) );
}
// --- DdeItem::DecMonitor() ------------------------------------------
@@ -881,14 +880,17 @@ void DdeItem::DecMonitor( sal_uLong nHCnv )
{
if( pImpData )
{
- DdeItemImpData* pData = (DdeItemImpData*)pImpData->GetData();
- for( sal_uInt16 n = pImpData->Count(); n; --n, ++pData )
+ for( sal_uInt16 n = 0; n < pImpData->size(); ++n )
+ {
+ DdeItemImpData* pData = &(*pImpData)[n];
if( pData->nHCnv == nHCnv )
{
if( !pData->nCnt || !--pData->nCnt )
{
- if( 1 < pImpData->Count() )
- pImpData->Remove( pImpData->Count() - n );
+ if( 1 < pImpData->size() )
+ {
+ pImpData->erase(pImpData->begin() + n);
+ }
else
{
delete pImpData, pImpData = 0;
@@ -898,6 +900,7 @@ void DdeItem::DecMonitor( sal_uLong nHCnv )
}
return ;
}
+ }
}
}
@@ -907,8 +910,10 @@ short DdeItem::GetLinks()
{
short nCnt = 0;
if( pImpData )
- for( sal_uInt16 n = pImpData->Count(); n; )
+ for( sal_uInt16 n = pImpData->size(); n; )
+ {
nCnt = nCnt + (*pImpData)[ --n ].nCnt;
+ }
return nCnt;
}