autorecovery: ENSURE_OR_RETURN => ENSURE_OR_RETURN_FALSE, added new ENSURE_OR_RETURN taking a return value

This commit is contained in:
Frank Schoenheit [fs]
2010-01-29 08:49:42 +01:00
parent b418f6485a
commit 40ae7d9aca
6 changed files with 28 additions and 22 deletions

View File

@@ -1008,7 +1008,7 @@ namespace dxcanvas
break; break;
default: default:
ENSURE_OR_RETURN(false, ENSURE_OR_RETURN_FALSE(false,
"DXSurface::update(): Unknown/unimplemented buffer format" ); "DXSurface::update(): Unknown/unimplemented buffer format" );
break; break;
} }

View File

@@ -544,7 +544,7 @@ namespace dxcanvas
break; break;
default: default:
ENSURE_OR_RETURN(false, ENSURE_OR_RETURN_FALSE(false,
"DXSurface::update(): Unknown/unimplemented buffer format" ); "DXSurface::update(): Unknown/unimplemented buffer format" );
break; break;
} }

View File

@@ -345,7 +345,7 @@ namespace dxcanvas
GraphicsPathSharedPtr pGradientPath( GraphicsPathSharedPtr pGradientPath(
tools::graphicsPathFromB2DPolygon( rValues.maGradientPoly ) ); tools::graphicsPathFromB2DPolygon( rValues.maGradientPoly ) );
ENSURE_OR_RETURN( pGradientPath.get(), ENSURE_OR_RETURN_FALSE( pGradientPath.get(),
"ParametricPolyPolygon::fillPolygonalGradient(): Could not clone path" ); "ParametricPolyPolygon::fillPolygonalGradient(): Could not clone path" );
PathGradientBrushSharedPtr pGradientBrush; PathGradientBrushSharedPtr pGradientBrush;

View File

@@ -1390,7 +1390,7 @@ namespace vclcanvas
const ::Size& rSz, const ::Size& rSz,
const GraphicAttr& rAttr ) const const GraphicAttr& rAttr ) const
{ {
ENSURE_OR_RETURN( rGrf, ENSURE_OR_RETURN_FALSE( rGrf,
"Invalid Graphic" ); "Invalid Graphic" );
if( !mpOutDev ) if( !mpOutDev )

View File

@@ -1876,16 +1876,16 @@ namespace cppcanvas
::vcl::unotools::xBitmapFromBitmapEx( ::vcl::unotools::xBitmapFromBitmapEx(
rCanvas->getUNOCanvas()->getDevice(), rCanvas->getUNOCanvas()->getDevice(),
aBmpEx ); aBmpEx );
if( aFill.isTiling() ) if( aFill.isTiling() )
{ {
aTexture.RepeatModeX = rendering::TexturingMode::REPEAT; aTexture.RepeatModeX = rendering::TexturingMode::REPEAT;
aTexture.RepeatModeY = rendering::TexturingMode::REPEAT; aTexture.RepeatModeY = rendering::TexturingMode::REPEAT;
} }
else else
{ {
aTexture.RepeatModeX = rendering::TexturingMode::CLAMP; aTexture.RepeatModeX = rendering::TexturingMode::CLAMP;
aTexture.RepeatModeY = rendering::TexturingMode::CLAMP; aTexture.RepeatModeY = rendering::TexturingMode::CLAMP;
} }
::PolyPolygon aPath; ::PolyPolygon aPath;
aFill.getPath( aPath ); aFill.getPath( aPath );
@@ -2877,7 +2877,7 @@ namespace cppcanvas
aSubset.mnSubsetEnd = ::std::min( aRangeBegin->mpAction->getActionCount(), aSubset.mnSubsetEnd = ::std::min( aRangeBegin->mpAction->getActionCount(),
nEndIndex - aRangeBegin->mnOrigIndex ); nEndIndex - aRangeBegin->mnOrigIndex );
ENSURE_OR_RETURN( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, ENSURE_OR_RETURN_FALSE( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0,
"ImplRenderer::forSubsetRange(): Invalid indices" ); "ImplRenderer::forSubsetRange(): Invalid indices" );
rFunctor( *aRangeBegin, aSubset ); rFunctor( *aRangeBegin, aSubset );
@@ -2893,7 +2893,7 @@ namespace cppcanvas
nStartIndex - aRangeBegin->mnOrigIndex ); nStartIndex - aRangeBegin->mnOrigIndex );
aSubset.mnSubsetEnd = aRangeBegin->mpAction->getActionCount(); aSubset.mnSubsetEnd = aRangeBegin->mpAction->getActionCount();
ENSURE_OR_RETURN( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, ENSURE_OR_RETURN_FALSE( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0,
"ImplRenderer::forSubsetRange(): Invalid indices" ); "ImplRenderer::forSubsetRange(): Invalid indices" );
rFunctor( *aRangeBegin, aSubset ); rFunctor( *aRangeBegin, aSubset );
@@ -2922,7 +2922,7 @@ namespace cppcanvas
aSubset.mnSubsetBegin = 0; aSubset.mnSubsetBegin = 0;
aSubset.mnSubsetEnd = nEndIndex - aRangeEnd->mnOrigIndex; aSubset.mnSubsetEnd = nEndIndex - aRangeEnd->mnOrigIndex;
ENSURE_OR_RETURN( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, ENSURE_OR_RETURN_FALSE( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0,
"ImplRenderer::forSubsetRange(): Invalid indices" ); "ImplRenderer::forSubsetRange(): Invalid indices" );
rFunctor( *aRangeEnd, aSubset ); rFunctor( *aRangeEnd, aSubset );
@@ -2937,10 +2937,10 @@ namespace cppcanvas
ActionVector::const_iterator& o_rRangeBegin, ActionVector::const_iterator& o_rRangeBegin,
ActionVector::const_iterator& o_rRangeEnd ) const ActionVector::const_iterator& o_rRangeEnd ) const
{ {
ENSURE_OR_RETURN( io_rStartIndex<=io_rEndIndex, ENSURE_OR_RETURN_FALSE( io_rStartIndex<=io_rEndIndex,
"ImplRenderer::getSubsetIndices(): invalid action range" ); "ImplRenderer::getSubsetIndices(): invalid action range" );
ENSURE_OR_RETURN( !maActions.empty(), ENSURE_OR_RETURN_FALSE( !maActions.empty(),
"ImplRenderer::getSubsetIndices(): no actions to render" ); "ImplRenderer::getSubsetIndices(): no actions to render" );
const sal_Int32 nMinActionIndex( maActions.front().mnOrigIndex ); const sal_Int32 nMinActionIndex( maActions.front().mnOrigIndex );

View File

@@ -120,12 +120,18 @@
::rtl::OUString::createFromAscii(",\n"m), \ ::rtl::OUString::createFromAscii(",\n"m), \
ifc ); } ifc ); }
/** This macro asserts the given condition (in debug mode), and
returns the given value afterwards.
*/
#define ENSURE_OR_RETURN(c, m, r) if( !(c) ) { \
OSL_ENSURE(c, m); \
return r; }
/** This macro asserts the given condition (in debug mode), and /** This macro asserts the given condition (in debug mode), and
returns false afterwards. returns false afterwards.
*/ */
#define ENSURE_OR_RETURN(c, m) if( !(c) ) { \ #define ENSURE_OR_RETURN_FALSE(c, m) \
OSL_ENSURE(c, m); \ ENSURE_OR_RETURN(c, m, false)
return false; }