[PATCH] Get rid of SvNums
Maciej Rumianowski
maciej.rumianowski at gmail.com
Fri Sep 30 06:39:11 PDT 2011
SvNums is a define for SvUShort and SvULong, both are replaced with std::vector
---
svl/source/items/itemset.cxx | 7 -------
svl/source/items/nranges.cxx | 15 +++++++++------
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 0dba305..1a479ad 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -32,10 +32,7 @@
#include <string.h>
#include <cstdarg>
-#define _SVSTDARR_USHORTS
-#define _SVSTDARR_ULONGS
-#include <svl/svstdarr.hxx>
#include <svl/itemset.hxx>
#include <svl/itempool.hxx>
#include <svl/itemiter.hxx>
@@ -58,19 +55,15 @@ DBG_NAME(SfxItemSet)
//========================================================================
#define NUMTYPE sal_uInt16
-#define SvNums SvUShorts
#define SfxNumRanges SfxUShortRanges
#include "nranges.cxx"
#undef NUMTYPE
-#undef SvNums
#undef SfxNumRanges
#define NUMTYPE sal_uLong
-#define SvNums SvULongs
#define SfxNumRanges SfxULongRanges
#include "nranges.cxx"
#undef NUMTYPE
-#undef SvNums
#undef SfxNumRanges
//========================================================================
diff --git a/svl/source/items/nranges.cxx b/svl/source/items/nranges.cxx
index 0b8942c..38b9e01 100644
--- a/svl/source/items/nranges.cxx
+++ b/svl/source/items/nranges.cxx
@@ -29,6 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svl.hxx"
+#include <vector>
// compiled via include from itemset.cxx only!
//========================================================================
@@ -75,18 +76,20 @@ NUMTYPE InitializeRanges_Impl( NUMTYPE *&rpRanges, va_list pArgs,
{
NUMTYPE nSize = 0, nIns = 0;
sal_uInt16 nCnt = 0;
- SvNums aNumArr( 11, 8 );
- aNumArr.Insert( nWh1, nCnt++ );
- aNumArr.Insert( nWh2, nCnt++ );
+ std::vector<NUMTYPE> aNumArr;
+ aNumArr.push_back( nWh1 );
+ aNumArr.push_back( nWh2 );
DBG_ASSERT( nWh1 <= nWh2, "Ungueltiger Bereich" );
nSize += nWh2 - nWh1 + 1;
- aNumArr.Insert( nNull, nCnt++ );
+ aNumArr.push_back( nNull );
+ nCnt = aNumArr.size();
while ( 0 !=
( nIns =
sal::static_int_cast< NUMTYPE >(
va_arg( pArgs, NUMTYPE_ARG ) ) ) )
{
- aNumArr.Insert( nIns, nCnt++ );
+ aNumArr.push_back( nIns );
+ ++nCnt;
if ( 0 == (nCnt & 1) ) // 4,6,8, usw.
{
DBG_ASSERT( aNumArr[ nCnt-2 ] <= nIns, "Ungueltiger Bereich" );
@@ -98,7 +101,7 @@ NUMTYPE InitializeRanges_Impl( NUMTYPE *&rpRanges, va_list pArgs,
// so, jetzt sind alle Bereiche vorhanden und
rpRanges = new NUMTYPE[ nCnt+1 ];
- memcpy( rpRanges, aNumArr.GetData(), sizeof(NUMTYPE) * nCnt );
+ std::copy( aNumArr.begin(), aNumArr.begin()+nCnt, rpRanges);
*(rpRanges+nCnt) = 0;
return nSize;
--
1.7.4.1
--=-/7NNkc9T4eFa5aQBHyq+--
More information about the LibreOffice
mailing list