summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
Diffstat (limited to 'svl')
-rw-r--r--svl/inc/svl/ownlist.hxx23
-rw-r--r--svl/inc/svl/slstitm.hxx12
-rw-r--r--svl/inc/svl/svarray.hxx2
-rw-r--r--svl/inc/svl/svdde.hxx19
-rw-r--r--svl/inc/svl/svstdarr.hxx5
-rw-r--r--svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx4
-rw-r--r--svl/source/config/cjkoptions.cxx6
-rw-r--r--svl/source/filerec/filerec.cxx12
-rw-r--r--svl/source/inc/poolio.hxx10
-rw-r--r--svl/source/items/itemset.cxx4
-rw-r--r--svl/source/items/poolio.cxx44
-rw-r--r--svl/source/items/slstitm.cxx123
-rw-r--r--svl/source/memtools/svarray.cxx2
-rw-r--r--svl/source/misc/lockfilecommon.cxx6
-rw-r--r--svl/source/misc/ownlist.cxx104
-rw-r--r--svl/source/numbers/zforlist.cxx2
-rw-r--r--svl/source/numbers/zformat.cxx2
-rw-r--r--svl/source/numbers/zforscan.cxx4
-rw-r--r--svl/source/svdde/ddecli.cxx63
-rw-r--r--svl/source/svdde/ddedata.cxx25
-rw-r--r--svl/source/svdde/ddeimp.hxx24
-rw-r--r--svl/source/svdde/ddeinf.cxx2
-rw-r--r--svl/source/svdde/ddesvr.cxx155
23 files changed, 264 insertions, 389 deletions
diff --git a/svl/inc/svl/ownlist.hxx b/svl/inc/svl/ownlist.hxx
index 9dc31764c53c..6bb9f311119b 100644
--- a/svl/inc/svl/ownlist.hxx
+++ b/svl/inc/svl/ownlist.hxx
@@ -31,8 +31,8 @@
#include "svl/svldllapi.h"
#include <tools/stream.hxx>
-#include <tools/ownlist.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+#include <vector>
namespace com { namespace sun { namespace star {
namespace beans {
@@ -76,6 +76,8 @@ public:
}
};
+typedef ::std::vector< SvCommand > SvCommandList_impl;
+
//=========================================================================
class SVL_DLLPUBLIC SvCommandList
/* [Beschreibung]
@@ -85,9 +87,12 @@ class SVL_DLLPUBLIC SvCommandList
in die Liste gestellt.
*/
{
- PRV_SV_DECL_OWNER_LIST(SvCommandList,SvCommand);
- SvCommand & Append( const String & rCommand, const String & rArg );
- sal_Bool AppendCommands( const String & rCmd, sal_uInt16 * pEaten );
+private:
+ SvCommandList_impl aCommandList;
+
+public:
+ SvCommand& Append( const String & rCommand, const String & rArg );
+ sal_Bool AppendCommands( const String & rCmd, sal_uInt16 * pEaten );
String GetCommands() const;
sal_Bool FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& );
@@ -95,6 +100,16 @@ class SVL_DLLPUBLIC SvCommandList
SVL_DLLPUBLIC friend SvStream& operator >> ( SvStream& rStm, SvCommandList & );
SVL_DLLPUBLIC friend SvStream& operator << ( SvStream&, const SvCommandList & );
+
+ size_t size() const { return aCommandList.size(); }
+
+ SvCommand operator[]( size_t i) {
+ return aCommandList[ i ];
+ }
+
+ void clear() {
+ aCommandList.clear();
+ }
};
#endif // _OWNLIST_HXX
diff --git a/svl/inc/svl/slstitm.hxx b/svl/inc/svl/slstitm.hxx
index e72a5ffde911..3aa181d5cf7d 100644
--- a/svl/inc/svl/slstitm.hxx
+++ b/svl/inc/svl/slstitm.hxx
@@ -28,9 +28,10 @@
#ifndef _SFXSLSTITM_HXX
#define _SFXSLSTITM_HXX
+#include <vector>
+
#include "svl/svldllapi.h"
#include <tools/rtti.hxx>
-#include <tools/list.hxx>
#include <svl/poolitem.hxx>
#include <com/sun/star/uno/Sequence.h>
@@ -45,15 +46,14 @@ public:
TYPEINFO();
SfxStringListItem();
- SfxStringListItem( sal_uInt16 nWhich, const List* pList=NULL );
+ SfxStringListItem( sal_uInt16 nWhich, const std::vector<String> *pList=NULL );
SfxStringListItem( sal_uInt16 nWhich, SvStream& rStream );
SfxStringListItem( const SfxStringListItem& rItem );
~SfxStringListItem();
- List * GetList();
+ std::vector<String>& GetList();
- const List * GetList() const
- { return SAL_CONST_CAST(SfxStringListItem *, this)->GetList(); }
+ const std::vector<String>& GetList() const;
#ifndef TF_POOLABLE
virtual int IsPoolable() const;
@@ -75,7 +75,7 @@ public:
virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const;
virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const;
- void Sort( sal_Bool bAscending = sal_True, List* pParallelList = 0 );
+ void Sort( sal_Bool bAscending = sal_True);
virtual bool PutValue ( const com::sun::star::uno::Any& rVal,
sal_uInt8 nMemberId = 0 );
diff --git a/svl/inc/svl/svarray.hxx b/svl/inc/svl/svarray.hxx
index 7e5e8868f58a..48753d0c4fb1 100644
--- a/svl/inc/svl/svarray.hxx
+++ b/svl/inc/svl/svarray.hxx
@@ -743,7 +743,7 @@ SV_IMPL_VARARR(nm##_SAR, AE)\
_SV_IMPL_SORTAR_ALG( nm,AE )\
_SV_SEEK_OBJECT( nm,AE )
-#if defined (C40) || defined (C41) || defined (C42) || defined(C50) || defined(C52)
+#if defined (C40) || defined (C41) || defined (C42) || defined(C50)
#define C40_INSERT( c, p, n) Insert( (c const *) p, n )
#define C40_PTR_INSERT( c, p) Insert( (c const *) p )
#define C40_REPLACE( c, p, n) Replace( (c const *) p, n )
diff --git a/svl/inc/svl/svdde.hxx b/svl/inc/svl/svdde.hxx
index d60ef0094723..8fb7b2f06f8d 100644
--- a/svl/inc/svl/svdde.hxx
+++ b/svl/inc/svl/svdde.hxx
@@ -55,18 +55,11 @@ class DdeItemImp;
struct Conversation;
#ifndef _SVDDE_NOLISTS
-DECLARE_LIST( DdeConnections, DdeConnection* )
DECLARE_LIST( DdeServices, DdeService* )
-DECLARE_LIST( DdeTopics, DdeTopic* )
-DECLARE_LIST( DdeItems, DdeItem* )
#else
-typedef List DdeConnections;
typedef List DdeServices;
-typedef List DdeTopics;
-typedef List DdeItems;
#endif
-DECLARE_LIST( DdeTransactions, DdeTransaction* )
typedef ::std::vector< long > DdeFormats;
typedef ::std::vector< Conversation* > ConvList;
@@ -232,7 +225,7 @@ class SVL_DLLPUBLIC DdeConnection
{
friend class DdeInternal;
friend class DdeTransaction;
- DdeTransactions aTransactions;
+ std::vector<DdeTransaction*> aTransactions;
DdeString* pService;
DdeString* pTopic;
DdeImp* pImp;
@@ -244,7 +237,7 @@ public:
long GetError();
long GetConvId();
- static const DdeConnections& GetConnections();
+ static const std::vector<DdeConnection*>& GetConnections();
sal_Bool IsConnected();
@@ -331,7 +324,7 @@ private:
private:
DdeString* pName;
String aItem;
- DdeItems aItems;
+ std::vector<DdeItem*> aItems;
Link aConnectLink;
Link aDisconnectLink;
Link aGetLink;
@@ -363,7 +356,7 @@ public:
DdeItem* AddItem( const DdeItem& ); // werden kopiert !
void RemoveItem( const DdeItem& );
const String& GetCurItem() { return aItem; }
- const DdeItems& GetItems() { return aItems; }
+ const std::vector<DdeItem*>& GetItems() const { return aItems; }
private:
DdeTopic( const DdeTopic& );
@@ -394,7 +387,7 @@ protected:
const DdeTopic* GetSysTopic() const { return pSysTopic; }
private:
- DdeTopics aTopics;
+ std::vector<DdeTopic*> aTopics;
DdeFormats aFormats;
DdeTopic* pSysTopic;
DdeString* pName;
@@ -411,7 +404,7 @@ public:
short GetError() { return nStatus; }
static DdeServices& GetServices();
- DdeTopics& GetTopics() { return aTopics; }
+ std::vector<DdeTopic*>& GetTopics() { return aTopics; }
void AddTopic( const DdeTopic& );
void RemoveTopic( const DdeTopic& );
diff --git a/svl/inc/svl/svstdarr.hxx b/svl/inc/svl/svstdarr.hxx
index b831362e72da..6a54fb87ae96 100644
--- a/svl/inc/svl/svstdarr.hxx
+++ b/svl/inc/svl/svstdarr.hxx
@@ -103,11 +103,6 @@ private:
#define _SVSTDARR_USHORTSSORT_DECL
#endif
-#ifndef _SVSTDARR_LONGSSORT_DECL
-SV_DECL_VARARR_SORT_VISIBILITY( SvLongsSort, long, 1, 1, SVL_DLLPUBLIC )
-#define _SVSTDARR_LONGSSORT_DECL
-#endif
-
#include <tools/string.hxx>
typedef String* StringPtr;
diff --git a/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx
index e1883cc69f0d..3172fd9322d6 100644
--- a/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx
+++ b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx
@@ -222,14 +222,14 @@ static ::cppu::ImplementationEntry const lRegEntries[] =
};
//=============================================================================
-extern "C" void SAL_CALL component_getImplementationEnvironment(const char** pEnvTypeName,
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const char** pEnvTypeName,
uno_Environment** )
{
*pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//=============================================================================
-extern "C" void * SAL_CALL component_getFactory(const char* sImplName ,
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(const char* sImplName ,
void* pServiceManager,
void* pRegistryKey )
{
diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx
index e64a03a96e8e..a3a19fe443c8 100644
--- a/svl/source/config/cjkoptions.cxx
+++ b/svl/source/config/cjkoptions.cxx
@@ -378,7 +378,7 @@ sal_Bool SvtCJKOptions_Impl::IsReadOnly(SvtCJKOptions::EOption eOption) const
static SvtCJKOptions_Impl* pCJKOptions = NULL;
static sal_Int32 nCJKRefCount = 0;
-namespace { struct CJKMutex : public rtl::Static< ::osl::Mutex , CJKMutex >{}; }
+namespace { struct theCJKOptionsMutex : public rtl::Static< ::osl::Mutex , theCJKOptionsMutex >{}; }
// class SvtCJKOptions --------------------------------------------------
@@ -386,7 +386,7 @@ namespace { struct CJKMutex : public rtl::Static< ::osl::Mutex , CJKMutex >{}; }
SvtCJKOptions::SvtCJKOptions(sal_Bool bDontLoad)
{
// Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( CJKMutex::get() );
+ ::osl::MutexGuard aGuard( theCJKOptionsMutex::get() );
if ( !pCJKOptions )
{
pCJKOptions = new SvtCJKOptions_Impl;
@@ -404,7 +404,7 @@ SvtCJKOptions::SvtCJKOptions(sal_Bool bDontLoad)
SvtCJKOptions::~SvtCJKOptions()
{
// Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( CJKMutex::get() );
+ ::osl::MutexGuard aGuard( theCJKOptionsMutex::get() );
if ( !--nCJKRefCount )
DELETEZ( pCJKOptions );
}
diff --git a/svl/source/filerec/filerec.cxx b/svl/source/filerec/filerec.cxx
index def16ac62d8b..21b6a3bffa4e 100644
--- a/svl/source/filerec/filerec.cxx
+++ b/svl/source/filerec/filerec.cxx
@@ -882,12 +882,13 @@ bool SfxMultiRecordReader::ReadHeader_Impl()
else
_pStream->Seek( _nContentSize );
_pContentOfs = new sal_uInt32[_nContentCount];
+ memset(_pContentOfs, 0, _nContentCount*sizeof(sal_uInt32));
//! darf man jetzt so einr"ucken
#if defined(OSL_LITENDIAN)
- _pStream->Read( _pContentOfs, sizeof(sal_uInt32)*_nContentCount );
+ _pStream->Read( _pContentOfs, sizeof(sal_uInt32)*_nContentCount );
#else
- for ( sal_uInt16 n = 0; n < _nContentCount; ++n )
- *_pStream >> _pContentOfs[n];
+ for ( sal_uInt16 n = 0; n < _nContentCount; ++n )
+ *_pStream >> _pContentOfs[n];
#endif
_pStream->Seek( nContentPos );
}
@@ -899,7 +900,10 @@ bool SfxMultiRecordReader::ReadHeader_Impl()
//-------------------------------------------------------------------------
SfxMultiRecordReader::SfxMultiRecordReader( SvStream *pStream )
-: _pContentOfs( NULL ), _nContentNo(0)
+ : _pContentOfs(0)
+ , _nContentSize(0)
+ , _nContentCount(0)
+ , _nContentNo(0)
{
// Position im Stream merken, um im Fehlerfall zur"uck-seeken zu k"onnen
_nStartPos = pStream->Tell();
diff --git a/svl/source/inc/poolio.hxx b/svl/source/inc/poolio.hxx
index 1702604b7fe9..bf2180770172 100644
--- a/svl/source/inc/poolio.hxx
+++ b/svl/source/inc/poolio.hxx
@@ -88,6 +88,16 @@ struct SfxItemPool_Impl
SfxItemPool_Impl( sal_uInt16 nStart, sal_uInt16 nEnd )
: ppPoolItems (new SfxPoolItemArray_Impl*[ nEnd - nStart + 1])
+ , nLoadingVersion(0)
+ , nInitRefCount(0)
+ , nVerStart(0)
+ , nVerEnd(0)
+ , nStoringStart(0)
+ , nStoringEnd(0)
+ , nMajorVer(0)
+ , nMinorVer(0)
+ , bInSetItem(false)
+ , bStreaming(false)
{
memset( ppPoolItems, 0, sizeof( SfxPoolItemArray_Impl* ) * ( nEnd - nStart + 1) );
}
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 78fbd27e8bdb..147d90b0ea09 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -1876,12 +1876,12 @@ static SfxItemArray AddItem_Impl(SfxItemArray pItems, sal_uInt16 nOldSize, sal_u
{
// alte Items vor nPos kopieren
if ( nPos )
- memcpy( (void*) pNew, pItems, nPos * sizeof(SfxPoolItem **) );
+ memcpy( (void*) pNew, pItems, nPos * sizeof(SfxPoolItem *) );
// alte Items hinter nPos kopieren
if ( nPos < nOldSize )
memcpy( (void*) (pNew + nPos + 1), pItems + nPos,
- (nOldSize-nPos) * sizeof(SfxPoolItem **) );
+ (nOldSize-nPos) * sizeof(SfxPoolItem *) );
}
// neues Item initialisieren
diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx
index f9ddc18a2318..d75560f5a26d 100644
--- a/svl/source/items/poolio.cxx
+++ b/svl/source/items/poolio.cxx
@@ -404,7 +404,7 @@ void SfxItemPool::readTheItems (
nLastSurrogate = nSurrogate;
// Ref-Count und Item laden
- sal_uInt16 nRef;
+ sal_uInt16 nRef(0);
rStream >> nRef;
pItem = pDefItem->Create(rStream, nVersion);
@@ -607,7 +607,7 @@ SvStream &SfxItemPool::Load(SvStream &rStream)
for ( sal_uInt16 nVerNo = 0; aVerRec.GetContent(); ++nVerNo )
{
// Header f"ur einzelne Version einlesen
- sal_uInt16 nVersion, nHStart, nHEnd;
+ sal_uInt16 nVersion(0), nHStart(0), nHEnd(0);
rStream >> nVersion >> nHStart >> nHEnd;
sal_uInt16 nCount = nHEnd - nHStart + 1;
@@ -616,6 +616,7 @@ SvStream &SfxItemPool::Load(SvStream &rStream)
{
// Add new Version
sal_uInt16 *pMap = new sal_uInt16[nCount];
+ memset(pMap, 0, nCount * sizeof(sal_uInt16));
for ( sal_uInt16 n = 0; n < nCount; ++n )
rStream >> pMap[n];
SetVersionMap( nVersion, nHStart, nHEnd, pMap );
@@ -632,8 +633,8 @@ SvStream &SfxItemPool::Load(SvStream &rStream)
while ( aWhichIdsRec.GetContent() )
{
// SlotId, Which-Id und Item-Version besorgen
- sal_uInt32 nCount;
- sal_uInt16 nVersion, nWhich;
+ sal_uInt32 nCount(0);
+ sal_uInt16 nVersion(0), nWhich(0);
//!sal_uInt16 nSlotId = aWhichIdsRec.GetContentTag();
rStream >> nWhich;
if ( pImp->nLoadingVersion != pImp->nVersion )
@@ -686,7 +687,7 @@ SvStream &SfxItemPool::Load(SvStream &rStream)
while ( aDefsRec.GetContent() )
{
// SlotId, Which-Id und Item-Version besorgen
- sal_uInt16 nVersion, nWhich;
+ sal_uInt16 nVersion(0), nWhich(0);
//!sal_uInt16 nSlotId = aDefsRec.GetContentTag();
rStream >> nWhich;
if ( pImp->nLoadingVersion != pImp->nVersion )
@@ -739,7 +740,7 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_STARTPOOL_4 );
rStream >> pImp->nMajorVer >> pImp->nMinorVer;
}
- sal_uInt32 nAttribSize;
+ sal_uInt32 nAttribSize(0);
int bOwnPool = sal_True;
UniString aExternName;
if ( pImp->nMajorVer > 1 || pImp->nMinorVer >= 2 )
@@ -772,7 +773,7 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
sal_uLong nStartPos = rStream.Tell();
rStream.SeekRel( nAttribSize );
CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_SIZES );
- sal_uInt32 nSizeTableLen;
+ sal_uInt32 nSizeTableLen(0);
rStream >> nSizeTableLen;
sal_Char *pBuf = new sal_Char[nSizeTableLen];
rStream.Read( pBuf, nSizeTableLen );
@@ -784,18 +785,18 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
{
// Version-Map finden (letztes sal_uLong der Size-Table gibt Pos an)
rStream.Seek( nEndOfSizes - sizeof(sal_uInt32) );
- sal_uInt32 nVersionMapPos;
+ sal_uInt32 nVersionMapPos(0);
rStream >> nVersionMapPos;
rStream.Seek( nVersionMapPos );
// Versions-Maps einlesen
CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_VERSIONMAP );
- sal_uInt16 nVerCount;
+ sal_uInt16 nVerCount(0);
rStream >> nVerCount;
for ( sal_uInt16 nVerNo = 0; nVerNo < nVerCount; ++nVerNo )
{
// Header f"ur einzelne Version einlesen
- sal_uInt16 nVersion, nHStart, nHEnd;
+ sal_uInt16 nVersion(0), nHStart(0), nHEnd(0);
rStream >> nVersion >> nHStart >> nHEnd;
sal_uInt16 nCount = nHEnd - nHStart + 1;
sal_uInt16 nBytes = (nCount)*sizeof(sal_uInt16);
@@ -805,6 +806,7 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
{
// Add new Version
sal_uInt16 *pMap = new sal_uInt16[nCount];
+ memset(pMap, 0, nCount * sizeof(sal_uInt16));
for ( sal_uInt16 n = 0; n < nCount; ++n )
rStream >> pMap[n];
SetVersionMap( nVersion, nHStart, nHEnd, pMap );
@@ -820,7 +822,7 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_ITEMS );
bool bSecondaryLoaded = false;
long nSecondaryEnd = 0;
- sal_uInt16 nWhich, nSlot;
+ sal_uInt16 nWhich(0), nSlot(0);
while ( rStream >> nWhich, nWhich )
{
// ggf. Which-Id aus alter Version verschieben?
@@ -831,8 +833,8 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
sal_uInt16 nMappedWhich = GetWhich(nSlot, sal_False);
int bKnownItem = bOwnPool || IsWhich(nMappedWhich);
- sal_uInt16 nRef, nCount, nVersion;
- sal_uInt32 nAttrSize;
+ sal_uInt16 nRef(0), nCount(0), nVersion(0);
+ sal_uInt32 nAttrSize(0);
rStream >> nVersion >> nCount;
SfxPoolItemArray_Impl **ppArr = 0;
@@ -981,8 +983,8 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
int bKnownItem = bOwnPool || IsWhich(nMappedWhich);
sal_uLong nPos = nLastPos;
- sal_uInt32 nSize;
- sal_uInt16 nVersion;
+ sal_uInt32 nSize(0);
+ sal_uInt16 nVersion(0);
rStream >> nVersion;
if ( bKnownItem )
@@ -1072,7 +1074,7 @@ const SfxPoolItem* SfxItemPool::LoadSurrogate
{
// Read the first surrogate
- sal_uInt32 nSurrogat;
+ sal_uInt32 nSurrogat(0);
rStream >> nSurrogat;
// Is item stored directly?
@@ -1622,7 +1624,7 @@ const SfxPoolItem* SfxItemPool::LoadItem( SvStream &rStream, bool bDirect,
// pRefPool==-1 => nicht putten!
{
- sal_uInt16 nWhich, nSlot; // nSurrogate;
+ sal_uInt16 nWhich(0), nSlot(0); // nSurrogate;
rStream >> nWhich >> nSlot;
sal_Bool bDontPut = (SfxItemPool*)-1 == pRefPool;
@@ -1637,8 +1639,8 @@ const SfxPoolItem* SfxItemPool::LoadItem( SvStream &rStream, bool bDirect,
else
{
// WID in der Version nicht vorhanden => ueberspringen
- sal_uInt32 nSurro;
- sal_uInt16 nVersion, nLen;
+ sal_uInt32 nSurro(0);
+ sal_uInt16 nVersion(0), nLen(0);
rStream >> nSurro;
if ( SFX_ITEMS_DIRECT == nSurro )
{
@@ -1676,8 +1678,8 @@ const SfxPoolItem* SfxItemPool::LoadItem( SvStream &rStream, bool bDirect,
if ( bDirect || ( nWhich && !pItem ) )
{
// bDirekt bzw. nicht IsPoolable() => Item direkt laden
- sal_uInt16 nVersion;
- sal_uInt32 nLen;
+ sal_uInt16 nVersion(0);
+ sal_uInt32 nLen(0);
rStream >> nVersion >> nLen;
sal_uLong nIStart = rStream.Tell();
diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx
index e001bf1e23f2..74239d48546e 100644
--- a/svl/source/items/slstitm.cxx
+++ b/svl/source/items/slstitm.cxx
@@ -47,11 +47,11 @@ class SfxImpStringList
{
public:
sal_uInt16 nRefCount;
- List aList;
+ std::vector<String> aList;
SfxImpStringList() { nRefCount = 1; }
~SfxImpStringList();
- void Sort( sal_Bool bAscending, List* );
+ void Sort( sal_Bool bAscending);
};
//------------------------------------------------------------------------
@@ -59,21 +59,14 @@ public:
SfxImpStringList::~SfxImpStringList()
{
DBG_ASSERT(nRefCount!=0xffff,"ImpList already deleted");
- String* pStr = (String*)aList.First();
- while( pStr )
- {
- delete pStr;
- pStr = (String*)aList.Next();
- }
nRefCount = 0xffff;
}
//------------------------------------------------------------------------
-void SfxImpStringList::Sort( sal_Bool bAscending, List* pParallelList )
+void SfxImpStringList::Sort( sal_Bool bAscending)
{
- DBG_ASSERT(!pParallelList || pParallelList->Count() >= aList.Count(),"Sort:ParallelList too small");
- sal_uLong nCount = aList.Count();
+ sal_uLong nCount = aList.size();
if( nCount > 1 )
{
nCount -= 2;
@@ -84,10 +77,10 @@ void SfxImpStringList::Sort( sal_Bool bAscending, List* pParallelList )
bSwapped = sal_False;
for( sal_uLong nCur = 0; nCur <= nCount; nCur++ )
{
- String* pStr1 = (String*)aList.GetObject( nCur );
- String* pStr2 = (String*)aList.GetObject( nCur+1 );
+ String aStr1 = aList[nCur];
+ String aStr2 = aList[nCur+1];
// COMPARE_GREATER => pStr2 ist groesser als pStr1
- StringCompare eCompare = pStr1->CompareIgnoreCaseToAscii( *pStr2 ); //@@@
+ StringCompare eCompare = aStr1.CompareIgnoreCaseToAscii( aStr2 ); //@@@
sal_Bool bSwap = sal_False;
if( bAscending )
{
@@ -100,15 +93,8 @@ void SfxImpStringList::Sort( sal_Bool bAscending, List* pParallelList )
if( bSwap )
{
bSwapped = sal_True;
- aList.Replace( pStr1, nCur + 1 );
- aList.Replace( pStr2, nCur );
- if( pParallelList )
- {
- void* p1 = pParallelList->GetObject( nCur );
- void* p2 = pParallelList->GetObject( nCur + 1 );
- pParallelList->Replace( p1, nCur + 1 );
- pParallelList->Replace( p2, nCur );
- }
+ aList[nCur+1] = aStr1;
+ aList[nCur] = aStr2;
}
}
}
@@ -124,7 +110,7 @@ SfxStringListItem::SfxStringListItem() :
//------------------------------------------------------------------------
-SfxStringListItem::SfxStringListItem( sal_uInt16 which, const List* pList ) :
+SfxStringListItem::SfxStringListItem( sal_uInt16 which, const std::vector<String>* pList ) :
SfxPoolItem( which ),
pImp(NULL)
{
@@ -134,14 +120,8 @@ SfxStringListItem::SfxStringListItem( sal_uInt16 which, const List* pList ) :
{
pImp = new SfxImpStringList;
- long i, nCount = pList->Count();
- String *pStr1, *pStr2;
- for( i=0; i < nCount; i++ )
- {
- pStr1 = (String*)pList->GetObject(i);
- pStr2 = new String( *pStr1 );
- pImp->aList.Insert( pStr2, LIST_APPEND );
- }
+ if (pImp)
+ pImp->aList = *pList;
}
}
@@ -157,13 +137,15 @@ SfxStringListItem::SfxStringListItem( sal_uInt16 which, SvStream& rStream ) :
if( nEntryCount )
pImp = new SfxImpStringList;
- long i;
- String* pStr;
- for( i=0; i < nEntryCount; i++ )
+ if (pImp)
{
- pStr = new String;
- readByteString(rStream, *pStr);
- pImp->aList.Insert( pStr, LIST_APPEND );
+ long i;
+ String aStr;
+ for( i=0; i < nEntryCount; i++ )
+ {
+ readByteString(rStream, aStr);
+ pImp->aList.push_back(aStr);
+ }
}
}
@@ -171,10 +153,8 @@ SfxStringListItem::SfxStringListItem( sal_uInt16 which, SvStream& rStream ) :
SfxStringListItem::SfxStringListItem( const SfxStringListItem& rItem ) :
SfxPoolItem( rItem ),
- pImp(NULL)
+ pImp(rItem.pImp)
{
- pImp = rItem.pImp;
-
if( pImp )
{
DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
@@ -198,12 +178,17 @@ SfxStringListItem::~SfxStringListItem()
//------------------------------------------------------------------------
-List* SfxStringListItem::GetList()
+std::vector<String>& SfxStringListItem::GetList()
{
if( !pImp )
pImp = new SfxImpStringList;
DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
- return &(pImp->aList);
+ return pImp->aList;
+}
+
+const std::vector<String>& SfxStringListItem::GetList () const
+{
+ return SAL_CONST_CAST(SfxStringListItem *, this)->GetList();
}
//------------------------------------------------------------------------
@@ -214,10 +199,7 @@ int SfxStringListItem::operator==( const SfxPoolItem& rItem ) const
SfxStringListItem* pItem = (SfxStringListItem*)&rItem;
- if( pImp == pItem->pImp )
- return sal_True;
- else
- return sal_False;
+ return pImp == pItem->pImp;
}
//------------------------------------------------------------------------
@@ -268,16 +250,11 @@ SvStream& SfxStringListItem::Store( SvStream & rStream, sal_uInt16 ) const
DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
- long nCount = pImp->aList.Count();
+ sal_uInt32 nCount = pImp->aList.size();
rStream << nCount;
- long i;
- String* pStr;
- for( i=0; i < nCount; i++ )
- {
- pStr = (String*)(pImp->aList.GetObject( i ));
- writeByteString(rStream, *pStr);
- }
+ for( sal_uInt32 i=0; i < nCount; i++ )
+ writeByteString(rStream, pImp->aList[i]);
return rStream;
}
@@ -308,17 +285,15 @@ void SfxStringListItem::SetString( const XubString& rStr )
else
nLen = nDelimPos - nStart;
- XubString* pStr = new XubString(aStr.Copy(nStart, nLen));
// String gehoert der Liste
- pImp->aList.Insert( pStr, LIST_APPEND );
+ pImp->aList.push_back(aStr.Copy(nStart, nLen));
nStart += nLen + 1 ; // delimiter ueberspringen
} while( nDelimPos != STRING_NOTFOUND );
// Kein Leerstring am Ende
- if( pImp->aList.Last() &&
- !((XubString*)pImp->aList.Last())->Len() )
- delete (XubString*)pImp->aList.Remove( pImp->aList.Count()-1 );
+ if (!pImp->aList.empty() && !(pImp->aList.rbegin())->Len())
+ pImp->aList.pop_back();
}
//------------------------------------------------------------------------
@@ -329,13 +304,17 @@ XubString SfxStringListItem::GetString()
if ( pImp )
{
DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
- XubString* pStr = (XubString*)(pImp->aList.First());
- while( pStr )
+
+ std::vector<String>::iterator iter;
+ for (iter = pImp->aList.begin();;)
{
- aStr += *pStr;
- pStr = (XubString*)(pImp->aList.Next());
- if ( pStr )
+ aStr += *iter;
+ ++iter;
+
+ if (iter != pImp->aList.end())
aStr += '\r';
+ else
+ break;
}
}
aStr.ConvertLineEnd();
@@ -355,11 +334,11 @@ int SfxStringListItem::IsPoolable() const
//------------------------------------------------------------------------
-void SfxStringListItem::Sort( sal_Bool bAscending, List* pParallelList )
+void SfxStringListItem::Sort( sal_Bool bAscending)
{
DBG_ASSERT(GetRefCount()==0,"Sort:RefCount!=0");
if( pImp )
- pImp->Sort( bAscending, pParallelList );
+ pImp->Sort( bAscending);
}
//----------------------------------------------------------------------------
@@ -374,22 +353,22 @@ void SfxStringListItem::SetStringList( const com::sun::star::uno::Sequence< rtl:
pImp->nRefCount--;
pImp = new SfxImpStringList;
- for ( sal_Int32 n = 0; n < rList.getLength(); n++ )
+ if (pImp)
{
- XubString* pStr = new XubString( rList[n] );
// String gehoert der Liste
- pImp->aList.Insert( pStr, LIST_APPEND );
+ for ( sal_Int32 n = 0; n < rList.getLength(); n++ )
+ pImp->aList.push_back(XubString(rList[n]));
}
}
//----------------------------------------------------------------------------
void SfxStringListItem::GetStringList( com::sun::star::uno::Sequence< rtl::OUString >& rList ) const
{
- long nCount = pImp->aList.Count();
+ long nCount = pImp->aList.size();
rList.realloc( nCount );
for( long i=0; i < nCount; i++ )
- rList[i] = *(String*)(pImp->aList.GetObject( i ));
+ rList[i] = pImp->aList[i];
}
//----------------------------------------------------------------------------
diff --git a/svl/source/memtools/svarray.cxx b/svl/source/memtools/svarray.cxx
index 6f3cc966995b..2a0bf03a733e 100644
--- a/svl/source/memtools/svarray.cxx
+++ b/svl/source/memtools/svarray.cxx
@@ -34,7 +34,6 @@
#define _SVSTDARR_ULONGS
#define _SVSTDARR_ULONGSSORT
#define _SVSTDARR_sal_uInt16S
-#define _SVSTDARR_LONGSSORT
#define _SVSTDARR_STRINGS
#define _SVSTDARR_STRINGSDTOR
#define _SVSTDARR_STRINGSSORT
@@ -69,7 +68,6 @@ SV_IMPL_VARARR( SvULongs, sal_uLong )
SV_IMPL_VARARR( SvUShorts, sal_uInt16 )
SV_IMPL_VARARR_SORT( SvULongsSort, sal_uLong )
-SV_IMPL_VARARR_SORT( SvLongsSort, long )
SV_IMPL_PTRARR( SvStrings, StringPtr )
SV_IMPL_PTRARR( SvStringsDtor, StringPtr )
diff --git a/svl/source/misc/lockfilecommon.cxx b/svl/source/misc/lockfilecommon.cxx
index 721dece14b5e..b39998dc57f4 100644
--- a/svl/source/misc/lockfilecommon.cxx
+++ b/svl/source/misc/lockfilecommon.cxx
@@ -106,13 +106,13 @@ INetURLObject LockFileCommon::ResolveLinks( const INetURLObject& aDocURL )
// there is currently no UCB functionality to resolve the symbolic links;
// since the lock files are used only for local file systems the osl functionality is used directly
- ::osl::FileStatus aStatus( FileStatusMask_Type | FileStatusMask_LinkTargetURL );
+ ::osl::FileStatus aStatus( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_LinkTargetURL );
::osl::DirectoryItem aItem;
if ( ::osl::FileBase::E_None == ::osl::DirectoryItem::get( aURLToCheck, aItem )
&& aItem.is() && ::osl::FileBase::E_None == aItem.getFileStatus( aStatus ) )
{
- if ( aStatus.isValid( FileStatusMask_Type )
- && aStatus.isValid( FileStatusMask_LinkTargetURL )
+ if ( aStatus.isValid( osl_FileStatus_Mask_Type )
+ && aStatus.isValid( osl_FileStatus_Mask_LinkTargetURL )
&& aStatus.getFileType() == ::osl::FileStatus::Link )
{
aURLToCheck = aStatus.getLinkTargetURL();
diff --git a/svl/source/misc/ownlist.cxx b/svl/source/misc/ownlist.cxx
index c1edd6761839..0e3fae02ff8e 100644
--- a/svl/source/misc/ownlist.cxx
+++ b/svl/source/misc/ownlist.cxx
@@ -39,8 +39,6 @@ using namespace com::sun::star;
//=========================================================================
//============== SvCommandList ============================================
//=========================================================================
-PRV_SV_IMPL_OWNER_LIST(SvCommandList,SvCommand)
-
static String parseString(const String & rCmd, sal_uInt16 * pIndex)
{
@@ -110,78 +108,11 @@ sal_Bool SvCommandList::AppendCommands
value = (rCmd.GetChar(index) == '\"') ? parseString(rCmd, &index) : parseWord(rCmd, &index);
}
- SvCommand * pCmd = new SvCommand(name, value);
- aTypes.Insert(pCmd, LIST_APPEND);
+ aCommandList.push_back( SvCommand(name, value));
}
*pEaten = index;
-// sal_uInt16 nPos = 0;
-// while( nPos < rCmd.Len() )
-// {
-// // ein Zeichen ? Dann faengt hier eine Option an
-// if( isalpha( rCmd[nPos] ) )
-// {
-// String aValue;
-// sal_uInt16 nStt = nPos;
-// register char c;
-
-// while( nPos < rCmd.Len() &&
-// ( isalnum(c=rCmd[nPos]) || '-'==c || '.'==c ) )
-// nPos++;
-
-// String aToken( rCmd.Copy( nStt, nPos-nStt ) );
-
-// while( nPos < rCmd.Len() &&
-// ( !String::IsPrintable( (c=rCmd[nPos]),
-// RTL_TEXTENCODING_MS_1252 ) || isspace(c) ) )
-// nPos++;
-
-// // hat die Option auch einen Wert?
-// if( nPos!=rCmd.Len() && '='==c )
-// {
-// nPos++;
-
-// while( nPos < rCmd.Len() &&
-// ( !String::IsPrintable( (c=rCmd[nPos]),
-// RTL_TEXTENCODING_MS_1252 ) || isspace(c) ) )
-// nPos++;
-
-// if( nPos != rCmd.Len() )
-// {
-// sal_uInt16 nLen = 0;
-// nStt = nPos;
-// if( '"' == c )
-// {
-// nPos++; nStt++;
-// while( nPos < rCmd.Len() &&
-// '"' != rCmd[nPos] )
-// nPos++, nLen++;
-// if( nPos!=rCmd.Len() )
-// nPos++;
-// }
-// else
-// // hier sind wir etwas laxer als der
-// // Standard und erlauben alles druckbare
-// while( nPos < rCmd.Len() &&
-// String::IsPrintable( (c=rCmd[nPos]),
-// RTL_TEXTENCODING_MS_1252 ) &&
-// !isspace( c ) )
-// nPos++, nLen++;
-
-// if( nLen )
-// aValue = rCmd( nStt, nLen );
-// }
-// }
-
-// SvCommand * pCmd = new SvCommand( aToken, aValue );
-// aTypes.Insert( pCmd, LIST_APPEND );
-// }
-// else
-// // white space un unerwartete Zeichen ignorieren wie
-// nPos++;
-// }
-// *pEaten = nPos;
return sal_True;
}
@@ -199,16 +130,16 @@ String SvCommandList::GetCommands() const
*/
{
String aRet;
- for( sal_uLong i = 0; i < aTypes.Count(); i++ )
+ for( sal_uLong i = 0; i < aCommandList.size(); i++ )
{
if( i != 0 )
aRet += ' ';
- SvCommand * pCmd = (SvCommand *)aTypes.GetObject( i );
- aRet += pCmd->GetCommand();
- if( pCmd->GetArgument().Len() )
+ SvCommand aCmd = aCommandList[ i ];
+ aRet += aCmd.GetCommand();
+ if( aCmd.GetArgument().Len() )
{
aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "=\"" ) );
- aRet += pCmd->GetArgument();
+ aRet += aCmd.GetArgument();
aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\"" ) );
}
}
@@ -231,9 +162,8 @@ SvCommand & SvCommandList::Append
SvCommand & Das erteugte Objekt wird zur"uckgegeben.
*/
{
- SvCommand * pCmd = new SvCommand( rCommand, rArg );
- aTypes.Insert( pCmd, LIST_APPEND );
- return *pCmd;
+ aCommandList.push_back( SvCommand( rCommand, rArg ) );
+ return aCommandList.back();
}
//=========================================================================
@@ -259,9 +189,9 @@ SvStream & operator >>
{
while( nCount-- )
{
- SvCommand * pCmd = new SvCommand();
- rStm >> *pCmd;
- rThis.aTypes.Insert( pCmd, LIST_APPEND );
+ SvCommand aCmd;
+ rStm >> aCmd;
+ rThis.aCommandList.push_back( aCmd );
}
}
return rStm;
@@ -284,13 +214,12 @@ SvStream & operator <<
SvStream & Der "ubergebene Stream.
*/
{
- sal_uInt32 nCount = rThis.aTypes.Count();
+ sal_uInt32 nCount = rThis.aCommandList.size();
rStm << nCount;
for( sal_uInt32 i = 0; i < nCount; i++ )
{
- SvCommand * pCmd = (SvCommand *)rThis.aTypes.GetObject( i );
- rStm << *pCmd;
+ rStm << rThis.aCommandList[ i ];
}
return rStm;
}
@@ -314,14 +243,13 @@ sal_Bool SvCommandList::FillFromSequence( const com::sun::star::uno::Sequence <
void SvCommandList::FillSequence( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& aCommandSequence )
{
- const sal_Int32 nCount = Count();
+ const sal_Int32 nCount = aCommandList.size();
aCommandSequence.realloc( nCount );
for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
{
- const SvCommand& rCommand = (*this)[ nIndex ];
- aCommandSequence[nIndex].Name = rCommand.GetCommand();
+ aCommandSequence[nIndex].Name = aCommandList[ nIndex ].GetCommand();
aCommandSequence[nIndex].Handle = -1;
- aCommandSequence[nIndex].Value = uno::makeAny( ::rtl::OUString( rCommand.GetArgument() ) );
+ aCommandSequence[nIndex].Value = uno::makeAny( ::rtl::OUString( aCommandList[ nIndex ].GetArgument() ) );
aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE;
}
}
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 7f35277118db..b4611b79babf 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -4429,8 +4429,6 @@ sal_Char NfCurrencyEntry::GetEuroSymbol( rtl_TextEncoding eTextEncoding )
default: // default system
#if WNT
return '\x80';
-#elif OS2
- return '\xD5';
#elif UNX
// return '\xA4'; // #56121# 0xA4 waere korrekt fuer iso-8859-15
return '\x80'; // aber Windoze-Code fuer die konvertierten TrueType-Fonts
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index b1c1c138bdde..990b7e261172 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -3548,11 +3548,11 @@ sal_Bool SvNumberformat::ImpGetNumberOutput(double fNumber,
sal_uInt16 i, j;
xub_StrLen k;
String sStr;
- long nPrecExp;
sal_Bool bInteger = sal_False;
if ( rInfo.nThousand != FLAG_STANDARD_IN_FORMAT )
{ // special formatting only if no GENERAL keyword in format code
const sal_uInt16 nThousand = rInfo.nThousand;
+ long nPrecExp;
for (i = 0; i < nThousand; i++)
{
if (fNumber > _D_MIN_M_BY_1000)
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 7a92da90543b..9eee6a55c823 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -1400,11 +1400,12 @@ bool ImpSvNumberformatScan::InsertSymbol( sal_uInt16 & nPos, svt::NfSymbolType e
{
if (nAnzStrings >= NF_MAX_FORMAT_SYMBOLS || nPos > nAnzStrings)
return false;
- ++nAnzResStrings;
if (nPos > 0 && nTypeArray[nPos-1] == NF_SYMBOLTYPE_EMPTY)
--nPos; // reuse position
else
{
+ if ((size_t) (nAnzStrings + 1) >= NF_MAX_FORMAT_SYMBOLS)
+ return false;
++nAnzStrings;
for (size_t i = nAnzStrings; i > nPos; --i)
{
@@ -1412,6 +1413,7 @@ bool ImpSvNumberformatScan::InsertSymbol( sal_uInt16 & nPos, svt::NfSymbolType e
sStrArray[i] = sStrArray[i-1];
}
}
+ ++nAnzResStrings;
nTypeArray[nPos] = static_cast<short>(eType);
sStrArray[nPos] = rStr;
return true;
diff --git a/svl/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx
index 6e8fe7662e05..3f6ffafd0028 100644
--- a/svl/source/svdde/ddecli.cxx
+++ b/svl/source/svdde/ddecli.cxx
@@ -31,6 +31,7 @@
#define UNICODE
#include <string.h> // memset
+#include <algorithm>
#include "ddeimp.hxx"
#include <svl/svdde.hxx>
@@ -39,11 +40,6 @@
#include <tools/solarmutex.hxx>
#include <osl/mutex.hxx>
-// static DWORD hDdeInst = NULL;
-// static short nInstance = 0;
-
-// DdeConnections* DdeConnection::pConnections = NULL;
-
DdeInstData* ImpInitInstData()
{
DdeInstData* pData = new DdeInstData;
@@ -74,30 +70,34 @@ HDDEDATA CALLBACK DdeInternal::CliCallback(
HDDEDATA hData, DWORD nInfo1, DWORD )
{
HDDEDATA nRet = DDE_FNOTPROCESSED;
- DdeConnections& rAll = (DdeConnections&)DdeConnection::GetConnections();
+ const std::vector<DdeConnection*> &rAll = DdeConnection::GetConnections();
DdeConnection* self = 0;
DdeInstData* pInst = ImpGetInstData();
DBG_ASSERT(pInst,"SVDDE:No instance data");
- for ( self = rAll.First(); self; self = rAll.Next() )
+ for ( size_t i = 0; i < rAll.size(); ++i)
+ {
+ self = rAll[i];
+
if ( self->pImp->hConv == hConv )
break;
+ }
if( self )
{
- DdeTransaction* t;
sal_Bool bFound = sal_False;
- for( t = self->aTransactions.First(); t; t = self->aTransactions.Next() )
+ std::vector<DdeTransaction*>::iterator iter;
+ for( iter = self->aTransactions.begin(); iter != self->aTransactions.end(); ++iter )
{
switch( nCode )
{
case XTYP_XACT_COMPLETE:
- if( (DWORD)t->nId == nInfo1 )
+ if( (DWORD)(*iter)->nId == nInfo1 )
{
- nCode = t->nType & (XCLASS_MASK | XTYP_MASK);
- t->bBusy = sal_False;
- t->Done( 0 != hData );
+ nCode = (*iter)->nType & (XCLASS_MASK | XTYP_MASK);
+ (*iter)->bBusy = sal_False;
+ (*iter)->Done( 0 != hData );
bFound = sal_True;
}
break;
@@ -107,27 +107,27 @@ HDDEDATA CALLBACK DdeInternal::CliCallback(
self->pImp->nStatus = self->pImp->hConv
? DMLERR_NO_ERROR
: DdeGetLastError( pInst->hDdeInstCli );
- t = 0;
+ iter = self->aTransactions.end();
nRet = 0;
bFound = sal_True;
break;
case XTYP_ADVDATA:
- bFound = sal_Bool( *t->pName == hText2 );
+ bFound = sal_Bool( *(*iter)->pName == hText2 );
break;
}
if( bFound )
break;
}
- if( t )
+ if( iter != self->aTransactions.end() )
{
switch( nCode )
{
case XTYP_ADVDATA:
if( !hData )
{
- ((DdeLink*) t)->Notify();
+ static_cast<DdeLink*>(*iter)->Notify();
nRet = (HDDEDATA)DDE_FACK;
break;
}
@@ -143,7 +143,7 @@ HDDEDATA CALLBACK DdeInternal::CliCallback(
d.pImp->hData = hData;
d.pImp->nFmt = DdeData::GetInternalFormat( nCbType );
d.Lock();
- t->Data( &d );
+ (*iter)->Data( &d );
nRet = (HDDEDATA)DDE_FACK;
break;
}
@@ -173,7 +173,6 @@ DdeConnection::DdeConnection( const String& rService, const String& rTopic )
CBF_FAIL_ALLSVRXACTIONS |
CBF_SKIP_REGISTRATIONS |
CBF_SKIP_UNREGISTRATIONS, 0L );
- pInst->pConnections = new DdeConnections;
}
pService = new DdeString( pInst->hDdeInstCli, rService );
@@ -186,8 +185,7 @@ DdeConnection::DdeConnection( const String& rService, const String& rTopic )
pImp->nStatus = DdeGetLastError( pInst->hDdeInstCli );
}
- if ( pInst->pConnections )
- pInst->pConnections->Insert( this );
+ pInst->aConnections.push_back( this );
}
// --- DdeConnection::~DdeConnection() -----------------------------
@@ -202,8 +200,12 @@ DdeConnection::~DdeConnection()
DdeInstData* pInst = ImpGetInstData();
DBG_ASSERT(pInst,"SVDDE:No instance data");
- if ( pInst->pConnections )
- pInst->pConnections->Remove( this );
+
+ std::vector<DdeConnection*>::iterator it(std::find(pInst->aConnections.begin(),
+ pInst->aConnections.end(),
+ this));
+ if (it != pInst->aConnections.end())
+ pInst->aConnections.erase(it);
pInst->nInstanceCli--;
pInst->nRefCount--;
@@ -212,8 +214,6 @@ DdeConnection::~DdeConnection()
if( DdeUninitialize( pInst->hDdeInstCli ) )
{
pInst->hDdeInstCli = NULL;
- delete pInst->pConnections;
- pInst->pConnections = NULL;
if( pInst->nRefCount == 0 )
ImpDeinitInstData();
}
@@ -226,11 +226,7 @@ DdeConnection::~DdeConnection()
sal_Bool DdeConnection::IsConnected()
{
CONVINFO c;
-#ifdef OS2
- c.nSize = sizeof( c );
-#else
c.cb = sizeof( c );
-#endif
if ( DdeQueryConvInfo( pImp->hConv, QID_SYNC, &c ) )
return sal_True;
else
@@ -263,11 +259,11 @@ long DdeConnection::GetConvId()
return (long)pImp->hConv;
}
-const DdeConnections& DdeConnection::GetConnections()
+const std::vector<DdeConnection*>& DdeConnection::GetConnections()
{
DdeInstData* pInst = ImpGetInstData();
DBG_ASSERT(pInst,"SVDDE:No instance data");
- return *(pInst->pConnections);
+ return pInst->aConnections;
}
// --- DdeTransaction::DdeTransaction() ----------------------------
@@ -283,7 +279,7 @@ DdeTransaction::DdeTransaction( DdeConnection& d, const String& rItemName,
nType = 0;
bBusy = sal_False;
- rDde.aTransactions.Insert( this );
+ rDde.aTransactions.push_back( this );
}
// --- DdeTransaction::~DdeTransaction() ---------------------------
@@ -297,7 +293,8 @@ DdeTransaction::~DdeTransaction()
}
delete pName;
- rDde.aTransactions.Remove( this );
+ rDde.aTransactions.erase(std::remove(rDde.aTransactions.begin(),
+ rDde.aTransactions.end(),this));
}
// --- DdeTransaction::Execute() -----------------------------------
diff --git a/svl/source/svdde/ddedata.cxx b/svl/source/svdde/ddedata.cxx
index 6afb6c20de87..0364c1bcf7e1 100644
--- a/svl/source/svdde/ddedata.cxx
+++ b/svl/source/svdde/ddedata.cxx
@@ -161,23 +161,11 @@ sal_uLong DdeData::GetExternalFormat( sal_uLong nFmt )
default:
{
-#if defined(WNT) || defined( PM2 )
- String aName( SotExchange::GetFormatName( nFmt ) );
-
#if defined(WNT)
-
+ String aName( SotExchange::GetFormatName( nFmt ) );
if( aName.Len() )
nFmt = RegisterClipboardFormat( reinterpret_cast<LPCWSTR>(aName.GetBuffer()) );
#endif
-#if defined( PM2 )
-
- if( aName.Len() )
- {
- HATOMTBL hSysTable = WinQuerySystemAtomTable();
- nFmt = (sal_uLong)WinAddAtom( hSysTable, (PSZ)aName.GetBuffer() );
- }
-#endif
-#endif
}
}
return nFmt;
@@ -209,17 +197,6 @@ sal_uLong DdeData::GetInternalFormat( sal_uLong nFmt )
nFmt = SotExchange::RegisterFormatName( String(reinterpret_cast<const sal_Unicode*>(szName)) );
}
#endif
-#if defined(PM2)
- if( nFmt > CF_PALETTE )
- {
- char szName[ 256 ];
-
- HATOMTBL hSysTable = WinQuerySystemAtomTable();
- WinQueryAtomName( hSysTable, (ATOM)nFmt, (PSZ)szName,
- sizeof( szName ) );
- nFmt = SotExchange::RegisterFormatName( String( szName ) );
- }
-#endif
break;
}
return nFmt;
diff --git a/svl/source/svdde/ddeimp.hxx b/svl/source/svdde/ddeimp.hxx
index 2488c9712dcf..bf9bb50fde1f 100644
--- a/svl/source/svdde/ddeimp.hxx
+++ b/svl/source/svdde/ddeimp.hxx
@@ -29,35 +29,17 @@
#ifndef _DDEIMP_HXX
#define _DDEIMP_HXX
-#ifdef OS2
-
-#include "ddemlos2.h"
-
-#define WORD sal_uInt16
-#define DWORD sal_uLong
-#define LPBYTE sal_uInt8*
-#define LPWORD sal_uInt16*
-#define LPDWORD sal_uLong*
-#define LPCTSTR PCSZ
-
-#else
-
#include <windows.h>
#include <ddeml.h>
#include "ddewrap.hxx"
-#endif
-
#include <tools/string.hxx>
-#include <tools/list.hxx>
#include <tools/shl.hxx>
#include <vector>
class DdeService;
class DdeTopic;
class DdeItem;
-class DdeTopics;
-class DdeItems;
// ----------------
// - Conversation -
@@ -86,7 +68,7 @@ public:
static HDDEDATA CALLBACK InfCallback
( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD );
#else
-#if (defined ( GCC ) && defined ( OS2 )) || defined( ICC )
+#if defined( ICC )
static HDDEDATA CALLBACK CliCallback
( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD );
static HDDEDATA CALLBACK SvrCallback
@@ -138,13 +120,13 @@ struct DdeDataImp
sal_uLong nFmt;
};
-class DdeConnections;
+class DdeConnection;
class DdeServices;
struct DdeInstData
{
sal_uInt16 nRefCount;
- DdeConnections* pConnections;
+ std::vector<DdeConnection*> aConnections;
// Server
long hCurConvSvr;
DWORD hDdeInstSvr;
diff --git a/svl/source/svdde/ddeinf.cxx b/svl/source/svdde/ddeinf.cxx
index f93d1b653a9f..3c4f7a4fcaa2 100644
--- a/svl/source/svdde/ddeinf.cxx
+++ b/svl/source/svdde/ddeinf.cxx
@@ -41,7 +41,7 @@
HDDEDATA CALLBACK DdeInternal::InfCallback(
WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD )
#else
-#if ( defined ( GCC ) && defined ( OS2 )) || defined( ICC )
+#if defined( ICC )
HDDEDATA CALLBACK DdeInternal::InfCallback(
WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD )
#else
diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx
index a2ff3fda485b..99b8cce0ae71 100644
--- a/svl/source/svdde/ddesvr.cxx
+++ b/svl/source/svdde/ddesvr.cxx
@@ -31,6 +31,7 @@
#define UNICODE
#include "ddeimp.hxx"
+#include <algorithm>
#include <svl/svdde.hxx>
#include <svl/svarray.hxx>
#include <tools/debug.hxx>
@@ -60,7 +61,7 @@ HDDEDATA CALLBACK DdeInternal::SvrCallback(
WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2,
HDDEDATA hData, DWORD, DWORD )
#else
-#if ( defined ( GCC ) && defined ( OS2 )) || defined( ICC )
+#if defined( ICC )
HDDEDATA CALLBACK DdeInternal::SvrCallback(
WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2,
HDDEDATA hData, DWORD, DWORD )
@@ -121,10 +122,10 @@ HDDEDATA CALLBACK _export DdeInternal::SvrCallback(
{
if ( !hText2 || ( *pService->pName == hText2 ) )
{
- for( pTopic = pService->aTopics.First(); pTopic;
- pTopic = pService->aTopics.Next() )
+ std::vector<DdeTopic*>::const_iterator iter;
+ for (iter = pService->aTopics.begin(); iter != pService->aTopics.end(); ++iter)
{
- if ( !hText1 || (*pTopic->pName == hText1) )
+ if ( !hText1 || iter->pName == hText1 )
nTopics++;
}
}
@@ -330,25 +331,38 @@ found:
if( !pItem->pImpData && pTopic->StartAdviseLoop() )
{
// dann wurde das Item ausgewechselt
- pTopic->aItems.Remove( pItem );
- DdeItem* pTmp;
- for( pTmp = pTopic->aItems.First(); pTmp;
- pTmp = pTopic->aItems.Next() )
- if( *pTmp->pName == hText2 )
+ std::vector<DdeItem*>::iterator it(std::find(pTopic->aItems.begin(),
+ pTopic->aItems.end(),
+ pItem));
+ if (it != pTopic->aItems.end())
+ pTopic->aItems.erase(it);
+
+ std::vector<DdeItem*>::iterator iter;
+ for( iter = pTopic->aItems.begin();
+ iter != pTopic->aItems.end();
+ ++iter )
+ {
+ if( *(*iter)->pName == hText2 )
{
// es wurde tatsaechlich ausgewechselt
delete pItem;
pItem = 0;
break;
}
+ }
+
if( pItem )
// es wurde doch nicht ausgewechselt, also wieder rein
- pTopic->aItems.Insert( pItem );
+ pTopic->aItems.push_back(pItem);
else
- pItem = pTmp;
+ pItem = iter != pTopic->aItems.end() ? *iter : NULL;
+ }
+
+ if (pItem)
+ {
+ pItem->IncMonitor( (long)hConv );
+ pInst->hCurConvSvr = NULL;
}
- pItem->IncMonitor( (long)hConv );
- pInst->hCurConvSvr = NULL;
}
return (HDDEDATA)sal_True;
@@ -403,17 +417,17 @@ DdeService* DdeInternal::FindService( HSZ hService )
DdeTopic* DdeInternal::FindTopic( DdeService& rService, HSZ hTopic )
{
- DdeTopic* s;
- DdeTopics& rTopics = rService.aTopics;
+ std::vector<DdeTopic*>::iterator iter;
+ std::vector<DdeTopic*> &rTopics = rService.aTopics;
int bWeiter = sal_False;
DdeInstData* pInst = ImpGetInstData();
DBG_ASSERT(pInst,"SVDDE:No instance data");
do { // middle check loop
- for ( s = rTopics.First(); s; s = rTopics.Next() )
+ for ( iter = rTopics.begin(); iter != rTopics.end(); ++iter )
{
- if ( *s->pName == hTopic )
- return s;
+ if ( *(*iter)->pName == hTopic )
+ return *iter;
}
bWeiter = !bWeiter;
@@ -434,17 +448,17 @@ DdeTopic* DdeInternal::FindTopic( DdeService& rService, HSZ hTopic )
DdeItem* DdeInternal::FindItem( DdeTopic& rTopic, HSZ hItem )
{
- DdeItem* s;
- DdeItems& rItems = rTopic.aItems;
+ std::vector<DdeItem*>::iterator iter;
+ std::vector<DdeItem*> &rItems = rTopic.aItems;
DdeInstData* pInst = ImpGetInstData();
DBG_ASSERT(pInst,"SVDDE:No instance data");
int bWeiter = sal_False;
do { // middle check loop
- for ( s = rItems.First(); s; s = rItems.Next() )
- if ( *s->pName == hItem )
- return s;
+ for ( iter = rItems.begin(); iter != rItems.end(); ++iter )
+ if ( *(*iter)->pName == hItem )
+ return *iter;
bWeiter = !bWeiter;
if( !bWeiter )
@@ -559,19 +573,19 @@ DdeServices& DdeService::GetServices()
void DdeService::AddTopic( const DdeTopic& rTopic )
{
RemoveTopic( rTopic );
- aTopics.Insert( (DdeTopic*) &rTopic );
+ aTopics.push_back((DdeTopic *) &rTopic);
}
// --- DdeService::RemoveTopic() -----------------------------------
void DdeService::RemoveTopic( const DdeTopic& rTopic )
{
- DdeTopic* t;
- for ( t = aTopics.First(); t; t = aTopics.Next() )
+ std::vector<DdeTopic*>::iterator iter;
+ for ( iter = aTopics.begin(); iter != aTopics.end(); ++iter )
{
- if ( !DdeCmpStringHandles (*t->pName, *rTopic.pName ) )
+ if ( !DdeCmpStringHandles (*(*iter)->pName, *rTopic.pName ) )
{
- aTopics.Remove( t );
+ aTopics.erase(iter);
// JP 27.07.95: und alle Conversions loeschen !!!
// (sonst wird auf geloeschten Topics gearbeitet!!)
for( size_t n = pConv->size(); n; )
@@ -644,13 +658,13 @@ DdeTopic::DdeTopic( const String& rName )
DdeTopic::~DdeTopic()
{
- DdeItem* t;
- while( ( t = aItems.First() ) != NULL )
+ std::vector<DdeItem*>::iterator iter;
+ for (iter = aItems.begin(); iter != aItems.end(); ++iter)
{
- aItems.Remove( t );
- t->pMyTopic = 0;
- delete t;
+ (*iter)->pMyTopic = 0;
+ delete *iter;
}
+
delete pName;
}
@@ -679,7 +693,7 @@ DdeItem* DdeTopic::AddItem( const DdeItem& r )
s = new DdeItem( r );
if ( s )
{
- aItems.Insert( s );
+ aItems.push_back( s );
s->pMyTopic = this;
}
return s;
@@ -691,7 +705,7 @@ void DdeTopic::InsertItem( DdeItem* pNew )
{
if( pNew )
{
- aItems.Insert( pNew );
+ aItems.push_back( pNew );
pNew->pMyTopic = this;
}
}
@@ -700,18 +714,18 @@ void DdeTopic::InsertItem( DdeItem* pNew )
void DdeTopic::RemoveItem( const DdeItem& r )
{
- DdeItem* s;
- for ( s = aItems.First(); s; s = aItems.Next() )
+ std::vector<DdeItem*>::iterator iter;
+ for (iter = aItems.begin(); iter != aItems.end(); ++iter)
{
- if ( !DdeCmpStringHandles (*s->pName, *r.pName ) )
+ if ( !DdeCmpStringHandles (*(*iter)->pName, *r.pName ) )
break;
}
- if ( s )
+ if ( iter != aItems.end() )
{
- aItems.Remove( s );
- s->pMyTopic = 0;
- delete s;
+ (*iter)->pMyTopic = 0;
+ delete *iter;
+ aItems.erase(iter);
}
}
@@ -719,17 +733,16 @@ void DdeTopic::RemoveItem( const DdeItem& r )
void DdeTopic::NotifyClient( const String& rItem )
{
- DdeItem* pItem;
+ std::vector<DdeItem*>::iterator iter;
DdeInstData* pInst = ImpGetInstData();
DBG_ASSERT(pInst,"SVDDE:No instance data");
- for ( pItem = aItems.First(); pItem; pItem = aItems.Next() )
+ for ( iter = aItems.begin(); iter != aItems.end(); ++iter)
{
- if ( pItem->GetName() == rItem )
+ if ( (*iter)->GetName() == rItem && (*iter)->pImpData)
{
- if ( pItem->pImpData )
- DdePostAdvise( pInst->hDdeInstSvr, *pName, *pItem->pName );
+ DdePostAdvise( pInst->hDdeInstSvr, *pName, *(*iter)->pName );
+ break;
}
- break;
}
}
@@ -751,8 +764,9 @@ void DdeTopic::Disconnect( long nId )
void DdeTopic::_Disconnect( long nId )
{
- for( DdeItem* pItem = aItems.First(); pItem; pItem = aItems.Next() )
- pItem->DecMonitor( nId );
+ std::vector<DdeItem*>::iterator iter;
+ for (iter = aItems.begin(); iter != aItems.end(); ++iter)
+ (*iter)->DecMonitor( nId );
Disconnect( nId );
}
@@ -851,7 +865,8 @@ DdeItem::DdeItem( const DdeItem& r)
DdeItem::~DdeItem()
{
if( pMyTopic )
- pMyTopic->aItems.Remove( this );
+ pMyTopic->aItems.erase(std::remove(pMyTopic->aItems.begin(),
+ pMyTopic->aItems.end(),this));
delete pName;
delete pImpData;
}
@@ -986,18 +1001,18 @@ void DdeGetPutItem::AdviseLoop( sal_Bool )
String DdeService::SysItems()
{
String s;
- DdeTopic* t;
- for ( t = aTopics.First(); t; t = aTopics.Next() )
+ std::vector<DdeTopic*>::iterator iter;
+ std::vector<DdeItem*>::iterator iterItem;
+ for ( iter = aTopics.begin(); iter != aTopics.end(); ++iter )
{
- if ( t->GetName() == reinterpret_cast<const sal_Unicode*>(SZDDESYS_TOPIC) )
+ if ( (*iter)->GetName() == reinterpret_cast<const sal_Unicode*>(SZDDESYS_TOPIC) )
{
short n = 0;
- DdeItem* pi;
- for ( pi = t->aItems.First(); pi; pi = t->aItems.Next(), n++ )
+ for ( iterItem = (*iter)->aItems.begin(); iterItem != (*iter)->aItems.end(); ++iterItem, n++ )
{
if ( n )
s += '\t';
- s += pi->GetName();
+ s += (*iterItem)->GetName();
}
s += String::CreateFromAscii("\r\n");
}
@@ -1011,14 +1026,14 @@ String DdeService::SysItems()
String DdeService::Topics()
{
String s;
- DdeTopic* t;
+ std::vector<DdeTopic*>::iterator iter;
short n = 0;
- for ( t = aTopics.First(); t; t = aTopics.Next(), n++ )
+ for ( iter = aTopics.begin(); iter != aTopics.end(); ++iter, n++ )
{
if ( n )
s += '\t';
- s += t->GetName();
+ s += (*iter)->GetName();
}
s += String::CreateFromAscii("\r\n");
@@ -1050,28 +1065,8 @@ String DdeService::Formats()
case CF_BITMAP:
p = reinterpret_cast<LPCTSTR>(String::CreateFromAscii("BITMAP").GetBuffer());
break;
-#ifdef OS2
- case CF_DSPTEXT:
- p = String::CreateFromAscii("TEXT").GetBuffer();
- break;
- case CF_DSPBITMAP:
- p = String::CreateFromAscii("BITMAP").GetBuffer();
- break;
- case CF_METAFILE:
- p = String::CreateFromAscii("METAFILE").GetBuffer();
- break;
- case CF_DSPMETAFILE:
- p = String::CreateFromAscii("METAFILE").GetBuffer();
- break;
- case CF_PALETTE:
- p = String::CreateFromAscii("PALETTE").GetBuffer();
- break;
- default:
- p= String::CreateFromAscii("PRIVATE").GetBuffer();
-#else
default:
GetClipboardFormatName( (UINT)f, buf, sizeof(buf) / sizeof(TCHAR) );
-#endif
}
s += String( reinterpret_cast<const sal_Unicode*>(p) );
}