Kaydet (Commit) 9ad661e5 authored tarafından Michael Stahl's avatar Michael Stahl

SfxPoolItem: fix annoying -Werror=shadow the hard way

... by properly prefixing the members.

Change-Id: Idfdb93b19bf9fdd5309fb55d4e7e56da81ee822a
üst 4651402a
...@@ -172,9 +172,9 @@ friend class SfxItemPoolCache; ...@@ -172,9 +172,9 @@ friend class SfxItemPoolCache;
friend class SfxItemSet; friend class SfxItemSet;
friend class SfxVoidItem; friend class SfxVoidItem;
sal_uLong nRefCount; // Referenzzaehler sal_uLong m_nRefCount;
sal_uInt16 nWhich; sal_uInt16 m_nWhich;
sal_uInt16 nKind; sal_uInt16 m_nKind;
private: private:
inline void SetRefCount( sal_uLong n ); inline void SetRefCount( sal_uLong n );
...@@ -195,10 +195,10 @@ public: ...@@ -195,10 +195,10 @@ public:
void SetWhich( sal_uInt16 nId ) { void SetWhich( sal_uInt16 nId ) {
DBG_CHKTHIS(SfxPoolItem, 0); DBG_CHKTHIS(SfxPoolItem, 0);
nWhich = nId; } m_nWhich = nId; }
sal_uInt16 Which() const { sal_uInt16 Which() const {
DBG_CHKTHIS(SfxPoolItem, 0); DBG_CHKTHIS(SfxPoolItem, 0);
return nWhich; } return m_nWhich; }
virtual int operator==( const SfxPoolItem& ) const = 0; virtual int operator==( const SfxPoolItem& ) const = 0;
int operator!=( const SfxPoolItem& rItem ) const int operator!=( const SfxPoolItem& rItem ) const
{ return !(*this == rItem); } { return !(*this == rItem); }
...@@ -222,8 +222,8 @@ public: ...@@ -222,8 +222,8 @@ public:
virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const; virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const;
virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const = 0; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const = 0;
sal_uLong GetRefCount() const { return nRefCount; } sal_uLong GetRefCount() const { return m_nRefCount; }
inline sal_uInt16 GetKind() const { return nKind; } inline sal_uInt16 GetKind() const { return m_nKind; }
/** Read in a Unicode string from a streamed byte string representation. /** Read in a Unicode string from a streamed byte string representation.
...@@ -278,32 +278,32 @@ private: ...@@ -278,32 +278,32 @@ private:
inline void SfxPoolItem::SetRefCount( sal_uLong n ) inline void SfxPoolItem::SetRefCount( sal_uLong n )
{ {
DBG_CHKTHIS( SfxPoolItem, 0 ); DBG_CHKTHIS( SfxPoolItem, 0 );
nRefCount = n; m_nRefCount = n;
nKind = 0; m_nKind = 0;
} }
inline void SfxPoolItem::SetKind( sal_uInt16 n ) inline void SfxPoolItem::SetKind( sal_uInt16 n )
{ {
DBG_CHKTHIS( SfxPoolItem, 0 ); DBG_CHKTHIS( SfxPoolItem, 0 );
nRefCount = SFX_ITEMS_SPECIAL; m_nRefCount = SFX_ITEMS_SPECIAL;
nKind = n; m_nKind = n;
} }
inline sal_uLong SfxPoolItem::AddRef( sal_uLong n ) const inline sal_uLong SfxPoolItem::AddRef( sal_uLong n ) const
{ {
DBG_CHKTHIS( SfxPoolItem, 0 ); DBG_CHKTHIS( SfxPoolItem, 0 );
DBG_ASSERT( nRefCount <= SFX_ITEMS_MAXREF, "AddRef mit nicht-Pool-Item" ); DBG_ASSERT(m_nRefCount <= SFX_ITEMS_MAXREF, "AddRef with non-Pool-Item");
DBG_ASSERT( ULONG_MAX - nRefCount > n, "AddRef: Referenzzaehler ueberschlaegt sich" ); DBG_ASSERT(ULONG_MAX - m_nRefCount > n, "AddRef: refcount overflow");
return ( ((SfxPoolItem *)this)->nRefCount += n ); return (const_cast<SfxPoolItem *>(this)->m_nRefCount += n);
} }
inline sal_uLong SfxPoolItem::ReleaseRef( sal_uLong n ) const inline sal_uLong SfxPoolItem::ReleaseRef( sal_uLong n ) const
{ {
DBG_CHKTHIS( SfxPoolItem, 0 ); DBG_CHKTHIS( SfxPoolItem, 0 );
DBG_ASSERT( nRefCount <= SFX_ITEMS_MAXREF, "AddRef mit nicht-Pool-Item" ); DBG_ASSERT(m_nRefCount <= SFX_ITEMS_MAXREF, "AddRef with non-Pool-Item");
DBG_ASSERT( nRefCount >= n, "ReleaseRef: Referenzzaehler ueberschlaegt sich" ); DBG_ASSERT(m_nRefCount >= n, "AddRef: refcount underflow");
((SfxPoolItem *)this)->nRefCount -= n; const_cast<SfxPoolItem *>(this)->m_nRefCount -= n;
return nRefCount; return m_nRefCount;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -355,7 +355,7 @@ public: ...@@ -355,7 +355,7 @@ public:
// von sich selbst eine Kopie erzeugen // von sich selbst eine Kopie erzeugen
virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
void SetWhich(sal_uInt16 nWh) { nWhich = nWh; } void SetWhich(sal_uInt16 nWh) { m_nWhich = nWh; }
}; };
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
......
...@@ -417,7 +417,7 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich ) ...@@ -417,7 +417,7 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
// #i32448# // #i32448#
// Take care of disabled items, too. // Take care of disabled items, too.
if(!pItemToClear->nWhich) if (!pItemToClear->m_nWhich)
{ {
// item is disabled, delete it // item is disabled, delete it
delete pItemToClear; delete pItemToClear;
......
...@@ -50,13 +50,13 @@ const char* pw5 = "Wow! 10.000.000 items!"; ...@@ -50,13 +50,13 @@ const char* pw5 = "Wow! 10.000.000 items!";
IMPL_PTRHINT(SfxPoolItemHint,SfxPoolItem) IMPL_PTRHINT(SfxPoolItemHint,SfxPoolItem)
// SfxPoolItem ----------------------------------------------------------- // SfxPoolItem -----------------------------------------------------------
SfxPoolItem::SfxPoolItem( sal_uInt16 nW ) SfxPoolItem::SfxPoolItem(sal_uInt16 const nWhich)
: nRefCount( 0 ), : m_nRefCount(0)
nWhich( nW ) , m_nWhich(nWhich)
, nKind( 0 ) , m_nKind(0)
{ {
DBG_CTOR(SfxPoolItem, 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 #if OSL_DEBUG_LEVEL > 1
++nItemCount; ++nItemCount;
if ( pw1 && nItemCount>=10000 ) if ( pw1 && nItemCount>=10000 )
...@@ -89,9 +89,9 @@ SfxPoolItem::SfxPoolItem( sal_uInt16 nW ) ...@@ -89,9 +89,9 @@ SfxPoolItem::SfxPoolItem( sal_uInt16 nW )
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
SfxPoolItem::SfxPoolItem( const SfxPoolItem& rCpy ) SfxPoolItem::SfxPoolItem( const SfxPoolItem& rCpy )
: nRefCount( 0 ), // wird ja ein neues Object! : m_nRefCount(0) // don't copy that
nWhich( rCpy.Which() ) // Funktion rufen wg. ChkThis() , m_nWhich(rCpy.Which()) // call function because of ChkThis() (WTF does that mean?)
, nKind( 0 ) , m_nKind( 0 )
{ {
DBG_CTOR(SfxPoolItem, 0); DBG_CTOR(SfxPoolItem, 0);
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
...@@ -128,7 +128,8 @@ SfxPoolItem::SfxPoolItem( const SfxPoolItem& rCpy ) ...@@ -128,7 +128,8 @@ SfxPoolItem::SfxPoolItem( const SfxPoolItem& rCpy )
SfxPoolItem::~SfxPoolItem() SfxPoolItem::~SfxPoolItem()
{ {
DBG_DTOR(SfxPoolItem, 0); 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 #if OSL_DEBUG_LEVEL > 1
--nItemCount; --nItemCount;
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment