diff options
-rw-r--r-- | svl/inc/svl/poolitem.hxx | 38 | ||||
-rw-r--r-- | svl/source/items/itemset.cxx | 2 | ||||
-rw-r--r-- | svl/source/items/poolitem.cxx | 19 |
3 files changed, 30 insertions, 29 deletions
diff --git a/svl/inc/svl/poolitem.hxx b/svl/inc/svl/poolitem.hxx index 70d4eeacf0cc..4e50e1ceb270 100644 --- a/svl/inc/svl/poolitem.hxx +++ b/svl/inc/svl/poolitem.hxx @@ -172,9 +172,9 @@ friend class SfxItemPoolCache; friend class SfxItemSet; friend class SfxVoidItem; - sal_uLong nRefCount; // Referenzzaehler - sal_uInt16 nWhich; - sal_uInt16 nKind; + sal_uLong m_nRefCount; + sal_uInt16 m_nWhich; + sal_uInt16 m_nKind; private: inline void SetRefCount( sal_uLong n ); @@ -195,10 +195,10 @@ public: void SetWhich( sal_uInt16 nId ) { DBG_CHKTHIS(SfxPoolItem, 0); - nWhich = nId; } + m_nWhich = nId; } sal_uInt16 Which() const { DBG_CHKTHIS(SfxPoolItem, 0); - return nWhich; } + return m_nWhich; } virtual int operator==( const SfxPoolItem& ) const = 0; int operator!=( const SfxPoolItem& rItem ) const { return !(*this == rItem); } @@ -222,8 +222,8 @@ public: virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const = 0; - sal_uLong GetRefCount() const { return nRefCount; } - inline sal_uInt16 GetKind() const { return nKind; } + sal_uLong GetRefCount() const { return m_nRefCount; } + inline sal_uInt16 GetKind() const { return m_nKind; } /** Read in a Unicode string from a streamed byte string representation. @@ -278,32 +278,32 @@ private: inline void SfxPoolItem::SetRefCount( sal_uLong n ) { DBG_CHKTHIS( SfxPoolItem, 0 ); - nRefCount = n; - nKind = 0; + m_nRefCount = n; + m_nKind = 0; } inline void SfxPoolItem::SetKind( sal_uInt16 n ) { DBG_CHKTHIS( SfxPoolItem, 0 ); - nRefCount = SFX_ITEMS_SPECIAL; - nKind = n; + m_nRefCount = SFX_ITEMS_SPECIAL; + m_nKind = n; } inline sal_uLong SfxPoolItem::AddRef( sal_uLong n ) const { DBG_CHKTHIS( SfxPoolItem, 0 ); - DBG_ASSERT( nRefCount <= SFX_ITEMS_MAXREF, "AddRef mit nicht-Pool-Item" ); - DBG_ASSERT( ULONG_MAX - nRefCount > n, "AddRef: Referenzzaehler ueberschlaegt sich" ); - return ( ((SfxPoolItem *)this)->nRefCount += n ); + DBG_ASSERT(m_nRefCount <= SFX_ITEMS_MAXREF, "AddRef with non-Pool-Item"); + DBG_ASSERT(ULONG_MAX - m_nRefCount > n, "AddRef: refcount overflow"); + return (const_cast<SfxPoolItem *>(this)->m_nRefCount += n); } inline sal_uLong SfxPoolItem::ReleaseRef( sal_uLong n ) const { DBG_CHKTHIS( SfxPoolItem, 0 ); - DBG_ASSERT( nRefCount <= SFX_ITEMS_MAXREF, "AddRef mit nicht-Pool-Item" ); - DBG_ASSERT( nRefCount >= n, "ReleaseRef: Referenzzaehler ueberschlaegt sich" ); - ((SfxPoolItem *)this)->nRefCount -= n; - return nRefCount; + DBG_ASSERT(m_nRefCount <= SFX_ITEMS_MAXREF, "AddRef with non-Pool-Item"); + DBG_ASSERT(m_nRefCount >= n, "AddRef: refcount underflow"); + const_cast<SfxPoolItem *>(this)->m_nRefCount -= n; + return m_nRefCount; } // ----------------------------------------------------------------------- @@ -355,7 +355,7 @@ public: // von sich selbst eine Kopie erzeugen virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - void SetWhich(sal_uInt16 nWh) { nWhich = nWh; } + void SetWhich(sal_uInt16 nWh) { m_nWhich = nWh; } }; // ----------------------------------------------------------------------- diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index 27f2a8d6dd08..dbe5140eaf83 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -417,7 +417,7 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich ) // #i32448# // Take care of disabled items, too. - if(!pItemToClear->nWhich) + if (!pItemToClear->m_nWhich) { // item is disabled, delete it delete pItemToClear; diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx index 3ac1e7bebfc3..532107f7b14f 100644 --- a/svl/source/items/poolitem.cxx +++ b/svl/source/items/poolitem.cxx @@ -50,13 +50,13 @@ const char* pw5 = "Wow! 10.000.000 items!"; IMPL_PTRHINT(SfxPoolItemHint,SfxPoolItem) // SfxPoolItem ----------------------------------------------------------- -SfxPoolItem::SfxPoolItem( sal_uInt16 nW ) - : nRefCount( 0 ), - nWhich( nW ) - , nKind( 0 ) +SfxPoolItem::SfxPoolItem(sal_uInt16 const nWhich) + : m_nRefCount(0) + , m_nWhich(nWhich) + , m_nKind(0) { DBG_CTOR(SfxPoolItem, 0); - DBG_ASSERT(nW <= SHRT_MAX, "Which Bereich ueberschritten"); + DBG_ASSERT(nWhich <= SHRT_MAX, "invalid WhichId"); #if OSL_DEBUG_LEVEL > 1 ++nItemCount; if ( pw1 && nItemCount>=10000 ) @@ -89,9 +89,9 @@ SfxPoolItem::SfxPoolItem( sal_uInt16 nW ) // ----------------------------------------------------------------------- SfxPoolItem::SfxPoolItem( const SfxPoolItem& rCpy ) - : nRefCount( 0 ), // wird ja ein neues Object! - nWhich( rCpy.Which() ) // Funktion rufen wg. ChkThis() - , nKind( 0 ) + : m_nRefCount(0) // don't copy that + , m_nWhich(rCpy.Which()) // call function because of ChkThis() (WTF does that mean?) + , m_nKind( 0 ) { DBG_CTOR(SfxPoolItem, 0); #if OSL_DEBUG_LEVEL > 1 @@ -128,7 +128,8 @@ SfxPoolItem::SfxPoolItem( const SfxPoolItem& rCpy ) SfxPoolItem::~SfxPoolItem() { DBG_DTOR(SfxPoolItem, 0); - DBG_ASSERT(nRefCount == 0 || nRefCount > SFX_ITEMS_MAXREF, "destroying item in use" ); + DBG_ASSERT(m_nRefCount == 0 || m_nRefCount > SFX_ITEMS_MAXREF, + "destroying item in use"); #if OSL_DEBUG_LEVEL > 1 --nItemCount; #endif |