Kaydet (Commit) 745fe08e authored tarafından Michael Stahl's avatar Michael Stahl

svl: convert some legacy DBG_ASSERT

Change-Id: I8fc4d849e434e245d871dc2d2eef42713e1359bb
üst bac1c69c
...@@ -93,13 +93,13 @@ sal_uInt16 SfxAllEnumItem::GetValueCount() const ...@@ -93,13 +93,13 @@ sal_uInt16 SfxAllEnumItem::GetValueCount() const
OUString SfxAllEnumItem::GetValueTextByPos( sal_uInt16 nPos ) const OUString SfxAllEnumItem::GetValueTextByPos( sal_uInt16 nPos ) const
{ {
DBG_ASSERT( pValues && nPos < pValues->size(), "enum overflow" ); assert(pValues && nPos < pValues->size());
return (*pValues)[nPos].aText; return (*pValues)[nPos].aText;
} }
sal_uInt16 SfxAllEnumItem::GetValueByPos( sal_uInt16 nPos ) const sal_uInt16 SfxAllEnumItem::GetValueByPos( sal_uInt16 nPos ) const
{ {
DBG_ASSERT( pValues && nPos < pValues->size(), "enum overflow" ); assert(pValues && nPos < pValues->size());
return (*pValues)[nPos].nValue; return (*pValues)[nPos].nValue;
} }
...@@ -192,7 +192,7 @@ bool SfxAllEnumItem::IsEnabled( sal_uInt16 nValue ) const ...@@ -192,7 +192,7 @@ bool SfxAllEnumItem::IsEnabled( sal_uInt16 nValue ) const
void SfxAllEnumItem::RemoveValue( sal_uInt16 nValue ) void SfxAllEnumItem::RemoveValue( sal_uInt16 nValue )
{ {
sal_uInt16 nPos = GetPosByValue(nValue); sal_uInt16 nPos = GetPosByValue(nValue);
DBG_ASSERT( nPos != USHRT_MAX, "removing value not in enum" ); assert(nPos != USHRT_MAX);
pValues->erase( pValues->begin() + nPos ); pValues->erase( pValues->begin() + nPos );
} }
......
...@@ -65,7 +65,7 @@ bool SfxEnumItemInterface::PutValue(const css::uno::Any& rVal, ...@@ -65,7 +65,7 @@ bool SfxEnumItemInterface::PutValue(const css::uno::Any& rVal,
SetEnumValue(sal_uInt16(nTheValue)); SetEnumValue(sal_uInt16(nTheValue));
return true; return true;
} }
OSL_FAIL("SfxEnumItemInterface::PutValue(): Wrong type"); SAL_WARN("svl.items", "SfxEnumItemInterface::PutValue(): Wrong type");
return false; return false;
} }
...@@ -141,7 +141,7 @@ void SfxEnumItem::SetEnumValue(sal_uInt16 const nTheValue) ...@@ -141,7 +141,7 @@ void SfxEnumItem::SetEnumValue(sal_uInt16 const nTheValue)
void SfxEnumItem::SetValue(sal_uInt16 const nTheValue) void SfxEnumItem::SetValue(sal_uInt16 const nTheValue)
{ {
DBG_ASSERT(GetRefCount() == 0, "SfxEnumItem::SetValue(): Pooled item"); assert(GetRefCount() == 0 && "SfxEnumItem::SetValue(): Pooled item");
m_nValue = nTheValue; m_nValue = nTheValue;
} }
...@@ -199,7 +199,7 @@ bool SfxBoolItem::PutValue(const css::uno::Any& rVal, sal_uInt8) ...@@ -199,7 +199,7 @@ bool SfxBoolItem::PutValue(const css::uno::Any& rVal, sal_uInt8)
m_bValue = bTheValue; m_bValue = bTheValue;
return true; return true;
} }
OSL_FAIL("SfxBoolItem::PutValue(): Wrong type"); SAL_WARN("svl.items", "SfxBoolItem::PutValue(): Wrong type");
return false; return false;
} }
......
...@@ -57,7 +57,7 @@ bool CntByteItem::PutValue(const css::uno::Any& rVal, sal_uInt8) ...@@ -57,7 +57,7 @@ bool CntByteItem::PutValue(const css::uno::Any& rVal, sal_uInt8)
return true; return true;
} }
OSL_FAIL( "CntByteItem::PutValue - Wrong type!" ); SAL_WARN("svl.items", "CntByteItem::PutValue - Wrong type!");
return false; return false;
} }
...@@ -123,12 +123,12 @@ bool CntUInt16Item::PutValue(const css::uno::Any& rVal, sal_uInt8) ...@@ -123,12 +123,12 @@ bool CntUInt16Item::PutValue(const css::uno::Any& rVal, sal_uInt8)
sal_Int32 nValue = 0; sal_Int32 nValue = 0;
if (rVal >>= nValue) if (rVal >>= nValue)
{ {
DBG_ASSERT( nValue <= USHRT_MAX, "Overflow in UInt16 value!"); SAL_WARN_IF(nValue > USHRT_MAX, "svl.items", "Overflow in UInt16 value!");
m_nValue = (sal_uInt16)nValue; m_nValue = static_cast<sal_uInt16>(nValue);
return true; return true;
} }
OSL_FAIL( "CntUInt16Item::PutValue - Wrong type!" ); SAL_WARN("svl.items", "CntUInt16Item::PutValue - Wrong type!");
return false; return false;
} }
...@@ -194,7 +194,7 @@ bool CntInt32Item::PutValue(const css::uno::Any& rVal, sal_uInt8) ...@@ -194,7 +194,7 @@ bool CntInt32Item::PutValue(const css::uno::Any& rVal, sal_uInt8)
return true; return true;
} }
OSL_FAIL( "CntInt32Item::PutValue - Wrong type!" ); SAL_WARN("svl.items", "CntInt32Item::PutValue - Wrong type!");
return false; return false;
} }
...@@ -248,7 +248,7 @@ bool CntUInt32Item::GetPresentation(SfxItemPresentation, ...@@ -248,7 +248,7 @@ bool CntUInt32Item::GetPresentation(SfxItemPresentation,
bool CntUInt32Item::QueryValue(css::uno::Any& rVal, sal_uInt8) const bool CntUInt32Item::QueryValue(css::uno::Any& rVal, sal_uInt8) const
{ {
sal_Int32 nValue = m_nValue; sal_Int32 nValue = m_nValue;
DBG_ASSERT( nValue>=0, "Overflow in UInt32 value!"); SAL_WARN_IF(nValue < 0, "svl.items", "Overflow in UInt32 value!");
rVal <<= nValue; rVal <<= nValue;
return true; return true;
} }
...@@ -259,12 +259,12 @@ bool CntUInt32Item::PutValue(const css::uno::Any& rVal, sal_uInt8) ...@@ -259,12 +259,12 @@ bool CntUInt32Item::PutValue(const css::uno::Any& rVal, sal_uInt8)
sal_Int32 nValue = 0; sal_Int32 nValue = 0;
if (rVal >>= nValue) if (rVal >>= nValue)
{ {
DBG_ASSERT( nValue>=0, "Overflow in UInt32 value!"); SAL_WARN_IF(nValue < 0, "svl.items", "Overflow in UInt32 value!");
m_nValue = nValue; m_nValue = nValue;
return true; return true;
} }
OSL_FAIL( "CntUInt32Item::PutValue - Wrong type!" ); SAL_WARN("svl.items", "CntUInt32Item::PutValue - Wrong type!");
return false; return false;
} }
......
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