Make loplugin:simplifypointertobool handle parenthesized expressions

...as discussed as an open TODO in the commit message of
fe6cce01c8 "Fix loplugin:simplifypointertobool for
libstdc++ std::shared_ptr".  The necessary changes across the code base have
been done fully automatically with the rewriting plugin on Linux.  (All those
changes apparently involve uses of macro arguments wrapped in parentheses in the
macro body, but always in conditionally-converted-to-bool contexts.  In other
contexts, such automatic rewriting would add the "bool" to the macro body, which
would be wrong in general, but we apparently get away with that sloppy coding
for now.)

The parenExprs_ stack that fe6cce01c8 had
introduced to treat such (then-undetected, it had turned out) parenthesized
cases now turns out to not be needed after all.

Change-Id: I2021f61c2e2805be7e18b38edf8744d186cac3cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95010
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2020-05-28 09:48:09 +02:00
parent 412ff42bf0
commit e84d05483c
44 changed files with 119 additions and 134 deletions
+1 -1
View File
@@ -842,7 +842,7 @@ void ObjectPage::DeleteCurrent()
std::unique_ptr<weld::TreeIter> xCurEntry(m_xBasicBox->make_iterator());
if (!m_xBasicBox->get_cursor(xCurEntry.get()))
xCurEntry.reset();
DBG_ASSERT( xCurEntry.get(), "No current entry!" );
DBG_ASSERT( xCurEntry, "No current entry!" );
EntryDescriptor aDesc( m_xBasicBox->GetEntryDescriptor( xCurEntry.get() ) );
const ScriptDocument& aDocument( aDesc.GetDocument() );
DBG_ASSERT( aDocument.isAlive(), "ObjectPage::DeleteCurrent: no document!" );
@@ -42,7 +42,7 @@ namespace cairocanvas
maSize( ::canvas::tools::roundUp( rSpriteSize.Width ),
::canvas::tools::roundUp( rSpriteSize.Height ) )
{
ENSURE_OR_THROW( rRefDevice.get(),
ENSURE_OR_THROW( rRefDevice,
"CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" );
SAL_INFO( "canvas.cairo", "sprite size: " << ::canvas::tools::roundUp( rSpriteSize.Width ) << ", " << ::canvas::tools::roundUp( rSpriteSize.Height ));
+1 -1
View File
@@ -45,7 +45,7 @@ namespace cairocanvas
void SpriteHelper::init( const geometry::RealSize2D& rSpriteSize,
const SpriteCanvasRef& rSpriteCanvas )
{
ENSURE_OR_THROW( rSpriteCanvas.get(),
ENSURE_OR_THROW( rSpriteCanvas,
"SpriteHelper::init(): Invalid device, sprite canvas or surface" );
mpSpriteCanvas = rSpriteCanvas;
@@ -38,7 +38,7 @@ namespace oglcanvas
mfAlpha(0.0),
mfPriority(0.0)
{
ENSURE_OR_THROW( rRefDevice.get(),
ENSURE_OR_THROW( rRefDevice,
"CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" );
::canvas::tools::setIdentityAffineMatrix2D(maTransformation);
+1 -1
View File
@@ -78,7 +78,7 @@ namespace oglcanvas
{
::osl::MutexGuard aGuard( m_aMutex );
ENSURE_OR_THROW( mpFont.get(),
ENSURE_OR_THROW( mpFont,
"TextLayout::queryTextBounds(): invalid font" );
// fake text bounds by either taking the advancement values,
@@ -164,7 +164,7 @@ namespace canvas
void CanvasCustomSpriteHelper::init( const geometry::RealSize2D& rSpriteSize,
const SpriteSurface::Reference& rOwningSpriteCanvas )
{
ENSURE_OR_THROW( rOwningSpriteCanvas.get(),
ENSURE_OR_THROW( rOwningSpriteCanvas,
"CanvasCustomSpriteHelper::init(): Invalid owning sprite canvas" );
mpSpriteCanvas = rOwningSpriteCanvas;
+2 -2
View File
@@ -994,7 +994,7 @@ namespace vclcanvas
const rendering::RenderState& renderState,
ColorType eColorType ) const
{
ENSURE_OR_THROW( mpOutDevProvider.get(),
ENSURE_OR_THROW( mpOutDevProvider,
"outdev null. Are we disposed?" );
::canvas::tools::verifyInput( renderState,
@@ -1079,7 +1079,7 @@ namespace vclcanvas
const rendering::RenderState& renderState,
const uno::Reference< rendering::XCanvasFont >& xFont ) const
{
ENSURE_OR_THROW( mpOutDevProvider.get(),
ENSURE_OR_THROW( mpOutDevProvider,
"outdev null. Are we disposed?" );
OutputDevice& rOutDev( mpOutDevProvider->getOutDev() );
+2 -2
View File
@@ -798,7 +798,7 @@ void Chart2ExportTest::testEmbeddingsGrabBag()
{
aEmbeddingsList[j].Value >>= aEmbeddingXlsxStream;
aEmbeddedfileName = aEmbeddingsList[j].Name;
CPPUNIT_ASSERT(aEmbeddingXlsxStream.get()); // Reference not empty
CPPUNIT_ASSERT(aEmbeddingXlsxStream); // Reference not empty
CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(testEmbeddedFileNames[j]),aEmbeddedfileName);
}
}
@@ -1536,7 +1536,7 @@ void Chart2ExportTest::testEmbeddingsOleObjectGrabBag()
{
aEmbeddingsList[j].Value >>= aEmbeddingXlsxStream;
aEmbeddedfileName = aEmbeddingsList[j].Name;
CPPUNIT_ASSERT(aEmbeddingXlsxStream.get()); // Reference not empty
CPPUNIT_ASSERT(aEmbeddingXlsxStream); // Reference not empty
CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(testEmbeddedFileNames[j]),aEmbeddedfileName);
}
}
@@ -41,7 +41,6 @@ public:
bool TraverseWhileStmt( WhileStmt* ) { return complain(); }
bool TraverseDoStmt( DoStmt* ) { return complain(); }
bool TraverseForStmt( ForStmt* ) { return complain(); }
bool TraverseParenExpr( ParenExpr* ) { return complain(); }
bool TraverseUnaryLNot( UnaryOperator* ) { return complain(); }
bool TraverseBinLAnd( BinaryOperator* ) { return complain(); }
bool TraverseBinLOr( BinaryOperator* ) { return complain(); }
+15 -30
View File
@@ -10,7 +10,6 @@
#include <algorithm>
#include <cassert>
#include <deque>
#include <stack>
#include <string>
#include <iostream>
#include <fstream>
@@ -234,28 +233,6 @@ public:
return res;
}
bool PreTraverseParenExpr(ParenExpr* expr)
{
parenExprs_.push(expr);
return true;
}
bool PostTraverseParenExpr(ParenExpr*, bool)
{
assert(!parenExprs_.empty());
parenExprs_.pop();
return true;
}
bool TraverseParenExpr(ParenExpr* expr)
{
auto res = PreTraverseParenExpr(expr);
assert(res);
res = FilteringRewritePlugin::TraverseParenExpr(expr);
PostTraverseParenExpr(expr, res);
return res;
}
private:
bool isContextuallyConverted(Expr const* expr) const
{
@@ -318,8 +295,6 @@ private:
//TODO: There are some more places where an expression is contextually converted to bool, but
// those are probably not relevant for our needs here.
std::deque<Expr const*> contextuallyConvertedExprs_;
std::stack<ParenExpr const*> parenExprs_;
};
bool SimplifyPointerToBool::VisitImplicitCastExpr(ImplicitCastExpr const* castExpr)
@@ -328,7 +303,7 @@ bool SimplifyPointerToBool::VisitImplicitCastExpr(ImplicitCastExpr const* castEx
return true;
if (castExpr->getCastKind() != CK_PointerToBoolean)
return true;
auto memberCallExpr = dyn_cast<CXXMemberCallExpr>(castExpr->getSubExpr());
auto memberCallExpr = dyn_cast<CXXMemberCallExpr>(castExpr->getSubExpr()->IgnoreParens());
if (!memberCallExpr)
return true;
auto methodDecl = memberCallExpr->getMethodDecl();
@@ -395,17 +370,27 @@ bool SimplifyPointerToBool::VisitImplicitCastExpr(ImplicitCastExpr const* castEx
report(DiagnosticsEngine::Warning, "simplify, drop the get()", memberCallExpr->getExprLoc())
<< memberCallExpr->getSourceRange();
}
else if (!parenExprs_.empty() && parenExprs_.top()->IgnoreImpCasts() == memberCallExpr)
else if (isa<ParenExpr>(castExpr->getSubExpr()))
{
//TODO: attempt rewrite
if (rewriter)
{
auto const loc
= compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(memberCallExpr));
auto const range = getCallSourceRange(memberCallExpr);
if (loc.isValid() && range.isValid() && insertText(loc, "bool") && removeText(range))
{
//TODO: atomically only change both or neither
return true;
}
}
report(DiagnosticsEngine::Warning,
"simplify, drop the get() and turn the surrounding parentheses into a functional "
"cast to bool",
memberCallExpr->getExprLoc())
<< memberCallExpr->getSourceRange();
report(DiagnosticsEngine::Note, "surrounding parentheses here",
parenExprs_.top()->getExprLoc())
<< parenExprs_.top()->getSourceRange();
castExpr->getSubExpr()->getExprLoc())
<< castExpr->getSubExpr()->getSourceRange();
}
else
{
@@ -18,7 +18,8 @@ bool test1(std::unique_ptr<int> p2)
foo();
// expected-error@+1 {{simplify, drop the get() and wrap the expression in a functional cast to bool [loplugin:simplifypointertobool]}}
bool b1 = p2.get();
//TODO:
// expected-error@+3 {{simplify, drop the get() and turn the surrounding parentheses into a functional cast to bool [loplugin:simplifypointertobool]}}
// expected-note@+1 {{surrounding parentheses here [loplugin:simplifypointertobool]}}
bool b2 = ( // deliberately spread across multiple lines
p2.get());
return b1 && b2;
@@ -106,7 +106,7 @@ extern "C" SAL_JNI_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Nati
#endif
std::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
OSL_ENSURE(pHelper.get(),"No stream helper!");
OSL_ENSURE(pHelper,"No stream helper!");
jlong nReturn = pHelper ? pHelper->getSeek()->getPosition() : jlong(0);
#ifdef HSQLDB_DBG
@@ -130,7 +130,7 @@ extern "C" SAL_JNI_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Nati
#endif
std::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
OSL_ENSURE(pHelper.get(),"No stream helper!");
OSL_ENSURE(pHelper,"No stream helper!");
jlong nReturn = pHelper ? pHelper->getSeek()->getLength() :jlong(0);
#ifdef HSQLDB_DBG
@@ -140,7 +140,7 @@ extern "C" SAL_JNI_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stor
"n < 0");
std::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
OSL_ENSURE(pHelper.get(),"No stream helper!");
OSL_ENSURE(pHelper,"No stream helper!");
if ( pHelper )
{
Reference<XInputStream> xIn = pHelper->getInputStream();
@@ -202,7 +202,7 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stora
#endif
std::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
OSL_ENSURE(pHelper.get(),"No stream helper!");
OSL_ENSURE(pHelper,"No stream helper!");
Reference<XInputStream> xIn = pHelper ? pHelper->getInputStream() : Reference<XInputStream>();
if ( xIn.is() )
{
+1 -1
View File
@@ -46,7 +46,7 @@ namespace cppcanvas::internal
OSL_ENSURE( rParentCanvas.is() , "ImplSprite::ImplSprite(): Invalid canvas");
OSL_ENSURE( mxGraphicDevice.is(), "ImplSprite::ImplSprite(): Invalid graphic device");
OSL_ENSURE( mxSprite.is(), "ImplSprite::ImplSprite(): Invalid sprite");
OSL_ENSURE( mpTransformArbiter.get(), "ImplSprite::ImplSprite(): Invalid transformation arbiter");
OSL_ENSURE( mpTransformArbiter, "ImplSprite::ImplSprite(): Invalid transformation arbiter");
}
ImplSprite::~ImplSprite()
@@ -766,7 +766,7 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
ActivateAggregate( tpColumnName );
ActivateAggregate( tpType );
OSL_ENSURE(pFieldType.get(),"We need a type information here!");
OSL_ENSURE(pFieldType,"We need a type information here!");
// If the type has changed, substitute Controls
if( m_pPreviousType != pFieldType )
{
+1 -1
View File
@@ -1074,7 +1074,7 @@ TOTypeInfoSP queryPrimaryKeyType(const OTypeInfoMap& _rTypeInfo)
if ( !pTypeInfo ) // just a fallback
pTypeInfo = queryTypeInfoByType(DataType::VARCHAR,_rTypeInfo);
OSL_ENSURE(pTypeInfo.get(),"checkColumns: can't find a type which is usable as a key!");
OSL_ENSURE(pTypeInfo,"checkColumns: can't find a type which is usable as a key!");
return pTypeInfo;
}
+1 -1
View File
@@ -2851,7 +2851,7 @@ void DesktopLOKTest::testMetricField()
WindowUIObject aWinUI(pWin);
std::unique_ptr<UIObject> pUIWin(aWinUI.get_child("selectwidth"));
CPPUNIT_ASSERT(pUIWin.get());
CPPUNIT_ASSERT(pUIWin);
StringMap aMap;
aMap["VALUE"] = "75.06";
+1 -1
View File
@@ -330,7 +330,7 @@ void VbaFormControl::importModelOrStorage( BinaryInputStream& rInStrm, StorageBa
if( mxSiteModel->isContainer() )
{
StorageRef xSubStrg = rStrg.openSubStorage( mxSiteModel->getSubStorageName(), false );
OSL_ENSURE( xSubStrg.get(), "VbaFormControl::importModelOrStorage - cannot find storage for embedded control" );
OSL_ENSURE( xSubStrg, "VbaFormControl::importModelOrStorage - cannot find storage for embedded control" );
if( xSubStrg )
importStorage( *xSubStrg, rClassTable );
}
+3 -3
View File
@@ -196,7 +196,7 @@ void VbaProject::importVbaData(const uno::Reference<io::XInputStream>& xInputStr
void VbaProject::registerMacroAttacher( const VbaMacroAttacherRef& rxAttacher )
{
OSL_ENSURE( rxAttacher.get(), "VbaProject::registerMacroAttacher - unexpected empty reference" );
OSL_ENSURE( rxAttacher, "VbaProject::registerMacroAttacher - unexpected empty reference" );
maMacroAttachers.push_back( rxAttacher );
}
@@ -263,7 +263,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
void VbaProject::readVbaModules( StorageBase& rVbaPrjStrg )
{
StorageRef xVbaStrg = rVbaPrjStrg.openSubStorage( "VBA", false );
OSL_ENSURE( xVbaStrg.get(), "VbaProject::readVbaModules - cannot open 'VBA' substorage" );
OSL_ENSURE( xVbaStrg, "VbaProject::readVbaModules - cannot open 'VBA' substorage" );
if( !xVbaStrg )
return;
@@ -425,7 +425,7 @@ void VbaProject::readVbaModules( StorageBase& rVbaPrjStrg )
void VbaProject::importModulesAndForms( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper )
{
StorageRef xVbaStrg = rVbaPrjStrg.openSubStorage( "VBA", false );
OSL_ENSURE( xVbaStrg.get(), "VbaProject::importModulesAndForms - cannot open 'VBA' substorage" );
OSL_ENSURE( xVbaStrg, "VbaProject::importModulesAndForms - cannot open 'VBA' substorage" );
if( !xVbaStrg )
return;
rtl_TextEncoding eTextEnc = RTL_TEXTENCODING_MS_1252;
@@ -1984,7 +1984,7 @@ std::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel(const uno::R
SdrModel& OReportDefinition::getSdrModelFromUnoModel() const
{
OSL_ENSURE(m_pImpl->m_pReportModel.get(), "No SdrModel in ReportDesign, should not happen");
OSL_ENSURE(m_pImpl->m_pReportModel, "No SdrModel in ReportDesign, should not happen");
return *m_pImpl->m_pReportModel;
}
+1 -1
View File
@@ -119,7 +119,7 @@ XclExpSstImpl::XclExpSstImpl() :
sal_uInt32 XclExpSstImpl::Insert( XclExpStringRef xString )
{
OSL_ENSURE( xString.get(), "XclExpSstImpl::Insert - empty pointer not allowed" );
OSL_ENSURE( xString, "XclExpSstImpl::Insert - empty pointer not allowed" );
if( !xString )
xString.reset( new XclExpString );
+1 -1
View File
@@ -2217,7 +2217,7 @@ void XclExpFmlaCompImpl::PushOperandPos( sal_uInt16 nTokPos )
void XclExpFmlaCompImpl::PushOperatorPos( sal_uInt16 nTokPos, const XclExpOperandListRef& rxOperands )
{
PushOperandPos( nTokPos );
OSL_ENSURE( rxOperands.get(), "XclExpFmlaCompImpl::AppendOperatorTokenId - missing operand list" );
OSL_ENSURE( rxOperands, "XclExpFmlaCompImpl::AppendOperatorTokenId - missing operand list" );
if( mxData->maOpListVec.size() <= nTokPos )
mxData->maOpListVec.resize( nTokPos + 1, XclExpOperandListRef() );
mxData->maOpListVec[ nTokPos ] = rxOperands;
+4 -4
View File
@@ -1910,14 +1910,14 @@ ScHTMLTable* ScHTMLTable::FindNestedTable( ScHTMLTableId nTableId ) const
void ScHTMLTable::PutItem( const SfxPoolItem& rItem )
{
OSL_ENSURE( mxCurrEntry.get(), "ScHTMLTable::PutItem - no current entry" );
OSL_ENSURE( mxCurrEntry, "ScHTMLTable::PutItem - no current entry" );
if( mxCurrEntry && mxCurrEntry->IsEmpty() )
mxCurrEntry->GetItemSet().Put( rItem );
}
void ScHTMLTable::PutText( const HtmlImportInfo& rInfo )
{
OSL_ENSURE( mxCurrEntry.get(), "ScHTMLTable::PutText - no current entry" );
OSL_ENSURE( mxCurrEntry, "ScHTMLTable::PutText - no current entry" );
if( mxCurrEntry )
{
if( !mxCurrEntry->HasContents() && IsSpaceCharInfo( rInfo ) )
@@ -1956,7 +1956,7 @@ void ScHTMLTable::InsertLeadingEmptyLine()
void ScHTMLTable::AnchorOn()
{
OSL_ENSURE( mxCurrEntry.get(), "ScHTMLTable::AnchorOn - no current entry" );
OSL_ENSURE( mxCurrEntry, "ScHTMLTable::AnchorOn - no current entry" );
// don't skip entries with single hyperlinks
if( mxCurrEntry )
mxCurrEntry->SetImportAlways();
@@ -2332,7 +2332,7 @@ bool ScHTMLTable::PushEntry( ScHTMLEntryPtr& rxEntry )
bool ScHTMLTable::PushEntry( const HtmlImportInfo& rInfo, bool bLastInCell )
{
OSL_ENSURE( mxCurrEntry.get(), "ScHTMLTable::PushEntry - no current entry" );
OSL_ENSURE( mxCurrEntry, "ScHTMLTable::PushEntry - no current entry" );
bool bPushed = false;
if( mxCurrEntry )
{
+1 -1
View File
@@ -49,7 +49,7 @@ RichStringContext::RichStringContext( ParentType& rParent, RichStringRef xString
mxString( xString )
{
mbEnableTrimSpace = false;
OSL_ENSURE( mxString.get(), "RichStringContext::RichStringContext - missing string object" );
OSL_ENSURE( mxString, "RichStringContext::RichStringContext - missing string object" );
}
} // namespace xls
+2 -2
View File
@@ -213,7 +213,7 @@ void QueryTable::importQueryTable( SequenceInputStream& rStrm )
void QueryTable::finalizeImport()
{
ConnectionRef xConnection = getConnections().getConnection( maModel.mnConnId );
OSL_ENSURE( xConnection.get(), "QueryTable::finalizeImport - missing connection object" );
OSL_ENSURE( xConnection, "QueryTable::finalizeImport - missing connection object" );
if( xConnection && (xConnection->getConnectionType() == BIFF12_CONNECTION_HTML) )
{
// check that valid web query properties exist
@@ -226,7 +226,7 @@ void QueryTable::finalizeImport()
// resolve destination cell range (stored as defined name containing the range)
OUString aDefName = maModel.maDefName.replace( ' ', '_' ).replace( '-', '_' );
DefinedNameRef xDefName = getDefinedNames().getByModelName( aDefName, getSheetIndex() );
OSL_ENSURE( xDefName.get(), "QueryTable::finalizeImport - missing defined name" );
OSL_ENSURE( xDefName, "QueryTable::finalizeImport - missing defined name" );
if( xDefName )
{
ScRange aDestRange;
+1 -1
View File
@@ -141,7 +141,7 @@ void SheetDataBuffer::setStringCell( const CellModel& rModel, const OUString& rT
void SheetDataBuffer::setStringCell( const CellModel& rModel, const RichStringRef& rxString )
{
OSL_ENSURE( rxString.get(), "SheetDataBuffer::setStringCell - missing rich string object" );
OSL_ENSURE( rxString, "SheetDataBuffer::setStringCell - missing rich string object" );
const oox::xls::Font* pFirstPortionFont = getStyles().getFontFromCellXf( rModel.mnXfId ).get();
OUString aText;
if( rxString->extractPlainString( aText, pFirstPortionFont ) )
+4 -4
View File
@@ -1712,7 +1712,7 @@ void Fill::importPatternFill( const AttributeList& rAttribs )
void Fill::importFgColor( const AttributeList& rAttribs )
{
OSL_ENSURE( mxPatternModel.get(), "Fill::importFgColor - missing pattern data" );
OSL_ENSURE( mxPatternModel, "Fill::importFgColor - missing pattern data" );
if( mxPatternModel )
{
mxPatternModel->maPatternColor.importColor( rAttribs );
@@ -1722,7 +1722,7 @@ void Fill::importFgColor( const AttributeList& rAttribs )
void Fill::importBgColor( const AttributeList& rAttribs )
{
OSL_ENSURE( mxPatternModel.get(), "Fill::importBgColor - missing pattern data" );
OSL_ENSURE( mxPatternModel, "Fill::importBgColor - missing pattern data" );
if( mxPatternModel )
{
mxPatternModel->maFillColor.importColor( rAttribs );
@@ -1743,7 +1743,7 @@ void Fill::importGradientFill( const AttributeList& rAttribs )
void Fill::importColor( const AttributeList& rAttribs, double fPosition )
{
OSL_ENSURE( mxGradientModel.get(), "Fill::importColor - missing gradient data" );
OSL_ENSURE( mxGradientModel, "Fill::importColor - missing gradient data" );
if( mxGradientModel && (fPosition >= 0.0) )
mxGradientModel->maColors[ fPosition ].importColor( rAttribs );
}
@@ -2853,7 +2853,7 @@ FontRef StylesBuffer::getDefaultFont() const
// no font from styles - try first loaded font (e.g. BIFF2)
if( !xDefFont )
xDefFont = maFonts.get( 0 );
OSL_ENSURE( xDefFont.get(), "StylesBuffer::getDefaultFont - no default font found" );
OSL_ENSURE( xDefFont, "StylesBuffer::getDefaultFont - no default font found" );
return xDefFont;
}
+1 -1
View File
@@ -559,7 +559,7 @@ void ViewSettings::finalizeImport()
// use active sheet to set sheet properties that are document-global in Calc
sal_Int16 nActiveSheet = getActiveCalcSheet();
SheetViewModelRef& rxActiveSheetView = maSheetViews[ nActiveSheet ];
OSL_ENSURE( rxActiveSheetView.get(), "ViewSettings::finalizeImport - missing active sheet view settings" );
OSL_ENSURE( rxActiveSheetView, "ViewSettings::finalizeImport - missing active sheet view settings" );
if( !rxActiveSheetView )
rxActiveSheetView = std::make_shared<SheetViewModel>();
+1 -1
View File
@@ -421,7 +421,7 @@ void WorkbookFragment::finalizeImport()
{
// create the WorksheetGlobals object
WorksheetGlobalsRef xSheetGlob = WorksheetHelper::constructGlobals( *this, xSheetSegment, eSheetType, nCalcSheet );
OSL_ENSURE( xSheetGlob.get(), "WorkbookFragment::finalizeImport - missing sheet in document" );
OSL_ENSURE( xSheetGlob, "WorkbookFragment::finalizeImport - missing sheet in document" );
if( xSheetGlob )
{
// create the sheet fragment handler
+1 -1
View File
@@ -908,7 +908,7 @@ XclTxo::XclTxo( const XclExpRoot& rRoot, const EditTextObject& rEditObj, SdrObje
void XclTxo::SaveCont( XclExpStream& rStrm )
{
OSL_ENSURE( mpString.get(), "XclTxo::SaveCont - missing string" );
OSL_ENSURE( mpString, "XclTxo::SaveCont - missing string" );
// #i96858# do not save existing string formatting if text is empty
sal_uInt16 nRunLen = mpString->IsEmpty() ? 0 : (8 * mpString->GetFormatsCount());
+1 -1
View File
@@ -2970,7 +2970,7 @@ void SdImportTest::testOOXTheme()
bTheme = true;
uno::Reference<xml::dom::XDocument> aThemeDom;
CPPUNIT_ASSERT(prop.Value >>= aThemeDom); // PropertyValue of proper type
CPPUNIT_ASSERT(aThemeDom.get()); // Reference not empty
CPPUNIT_ASSERT(aThemeDom); // Reference not empty
}
}
CPPUNIT_ASSERT(bTheme); // Grab Bag has all the expected elements
+1 -1
View File
@@ -1718,7 +1718,7 @@ CustomAnimationEffectPtr EffectSequenceHelper::append( const CustomAnimationPres
}
}
DBG_ASSERT( pEffect.get(), "sd::EffectSequenceHelper::append(), failed!" );
DBG_ASSERT( pEffect, "sd::EffectSequenceHelper::append(), failed!" );
return pEffect;
}
+2 -2
View File
@@ -173,7 +173,7 @@ Iterator OutlinerContainer::CreateSelectionIterator (
bool bDirectionIsForward,
IteratorLocation aLocation)
{
OSL_ASSERT(rpViewShell.get());
OSL_ASSERT(rpViewShell);
sal_Int32 nObjectIndex;
@@ -212,7 +212,7 @@ Iterator OutlinerContainer::CreateDocumentIterator (
bool bDirectionIsForward,
IteratorLocation aLocation)
{
OSL_ASSERT(rpViewShell.get());
OSL_ASSERT(rpViewShell);
PageKind ePageKind;
EditMode eEditMode;
+1 -1
View File
@@ -1830,7 +1830,7 @@ void SlideShowImpl::removeShapeEventListener(
// entry for this shape found -> remove listener from
// helper object
ENSURE_OR_THROW(
aIter->second.get(),
aIter->second,
"SlideShowImpl::removeShapeEventListener(): "
"listener map contains NULL broadcast helper" );
+2 -2
View File
@@ -831,7 +831,7 @@ bool SlideView::updateScreen() const
{
osl::MutexGuard aGuard( m_aMutex );
ENSURE_OR_RETURN_FALSE( mpCanvas.get(),
ENSURE_OR_RETURN_FALSE( mpCanvas,
"SlideView::updateScreen(): Disposed" );
return mpCanvas->updateScreen( false );
@@ -841,7 +841,7 @@ bool SlideView::paintScreen() const
{
osl::MutexGuard aGuard( m_aMutex );
ENSURE_OR_RETURN_FALSE( mpCanvas.get(),
ENSURE_OR_RETURN_FALSE( mpCanvas,
"SlideView::paintScreen(): Disposed" );
return mpCanvas->updateScreen( true );
+3 -3
View File
@@ -60,18 +60,18 @@ CPPUNIT_TEST_FIXTURE(StylePoolTest, testIterationOrder)
aStylePool.insertItemSet(aChild2, &aChild2Name);
std::unique_ptr<IStylePoolIteratorAccess> pIter = aStylePool.createIterator();
std::shared_ptr<SfxItemSet> pStyle1 = pIter->getNext();
CPPUNIT_ASSERT(pStyle1.get());
CPPUNIT_ASSERT(pStyle1);
const SfxStringItem* pItem1 = static_cast<const SfxStringItem*>(pStyle1->GetItem(1));
CPPUNIT_ASSERT_EQUAL(OUString("Item1"), pItem1->GetValue());
std::shared_ptr<SfxItemSet> pStyle2 = pIter->getNext();
CPPUNIT_ASSERT(pStyle2.get());
CPPUNIT_ASSERT(pStyle2);
const SfxStringItem* pItem2 = static_cast<const SfxStringItem*>(pStyle2->GetItem(1));
// Without the accompanying fix in place, this test would have failed with 'Expected: Item2;
// Actual: Item3'. The iteration order depended on the pointer address on the pointer
// address of the parents.
CPPUNIT_ASSERT_EQUAL(OUString("Item2"), pItem2->GetValue());
std::shared_ptr<SfxItemSet> pStyle3 = pIter->getNext();
CPPUNIT_ASSERT(pStyle3.get());
CPPUNIT_ASSERT(pStyle3);
const SfxStringItem* pItem3 = static_cast<const SfxStringItem*>(pStyle3->GetItem(1));
CPPUNIT_ASSERT_EQUAL(OUString("Item3"), pItem3->GetValue());
CPPUNIT_ASSERT(!pIter->getNext());
+7 -7
View File
@@ -427,7 +427,7 @@ DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx")
bTheme = true;
uno::Reference<xml::dom::XDocument> aThemeDom;
CPPUNIT_ASSERT(prop.Value >>= aThemeDom); // PropertyValue of proper type
CPPUNIT_ASSERT(aThemeDom.get()); // Reference not empty
CPPUNIT_ASSERT(aThemeDom); // Reference not empty
}
}
CPPUNIT_ASSERT(bTheme); // Grab Bag has all the expected elements
@@ -449,28 +449,28 @@ DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx")
bData = true;
uno::Reference<xml::dom::XDocument> aDataDom;
CPPUNIT_ASSERT(prop.Value >>= aDataDom); // PropertyValue of proper type
CPPUNIT_ASSERT(aDataDom.get()); // Reference not empty
CPPUNIT_ASSERT(aDataDom); // Reference not empty
}
else if (prop.Name == "OOXLayout")
{
bLayout = true;
uno::Reference<xml::dom::XDocument> aLayoutDom;
CPPUNIT_ASSERT(prop.Value >>= aLayoutDom); // PropertyValue of proper type
CPPUNIT_ASSERT(aLayoutDom.get()); // Reference not empty
CPPUNIT_ASSERT(aLayoutDom); // Reference not empty
}
else if (prop.Name == "OOXStyle")
{
bQStyle = true;
uno::Reference<xml::dom::XDocument> aStyleDom;
CPPUNIT_ASSERT(prop.Value >>= aStyleDom); // PropertyValue of proper type
CPPUNIT_ASSERT(aStyleDom.get()); // Reference not empty
CPPUNIT_ASSERT(aStyleDom); // Reference not empty
}
else if (prop.Name == "OOXColor")
{
bColor = true;
uno::Reference<xml::dom::XDocument> aColorDom;
CPPUNIT_ASSERT(prop.Value >>= aColorDom); // PropertyValue of proper type
CPPUNIT_ASSERT(aColorDom.get()); // Reference not empty
CPPUNIT_ASSERT(aColorDom); // Reference not empty
}
else if (prop.Name == "OOXDrawing")
{
@@ -479,7 +479,7 @@ DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx")
uno::Reference<xml::dom::XDocument> aDrawingDom;
CPPUNIT_ASSERT(prop.Value >>= diagramDrawing);
CPPUNIT_ASSERT(diagramDrawing[0] >>= aDrawingDom); // PropertyValue of proper type
CPPUNIT_ASSERT(aDrawingDom.get()); // Reference not empty
CPPUNIT_ASSERT(aDrawingDom); // Reference not empty
}
}
CPPUNIT_ASSERT(bData && bLayout && bQStyle && bColor && bDrawing); // Grab Bag has all the expected elements
@@ -541,7 +541,7 @@ DECLARE_OOXMLEXPORT_TEST(testCustomXmlGrabBag, "customxml.docx")
sal_Int32 length = aCustomXmlDomList.getLength();
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), length);
aCustomXmlDom = aCustomXmlDomList[0];
CPPUNIT_ASSERT(aCustomXmlDom.get()); // Reference not empty
CPPUNIT_ASSERT(aCustomXmlDom); // Reference not empty
}
}
CPPUNIT_ASSERT(CustomXml); // Grab Bag has all the expected elements
+1 -1
View File
@@ -677,7 +677,7 @@ void HTMLTableCnts::Add( std::unique_ptr<HTMLTableCnts> pNewCnts )
inline void HTMLTableCnts::SetTableBox( SwTableBox *pBox )
{
OSL_ENSURE(m_xLayoutInfo.get(), "There is no layout info");
OSL_ENSURE(m_xLayoutInfo, "There is no layout info");
if (m_xLayoutInfo)
m_xLayoutInfo->SetTableBox(pBox);
}
+2 -2
View File
@@ -1281,7 +1281,7 @@ the appropriate set/ask field.
long SwWW8ImplReader::MapBookmarkVariables(const WW8FieldDesc* pF,
OUString &rOrigName, const OUString &rData)
{
OSL_ENSURE(m_xPlcxMan.get(), "No pPlcxMan");
OSL_ENSURE(m_xPlcxMan, "No pPlcxMan");
long nNo;
/*
If there was no bookmark associated with this set field, then we create a
@@ -1344,7 +1344,7 @@ SwFltStackEntry *SwWW8FltRefStack::RefToVar(const SwField* pField,
OUString SwWW8ImplReader::GetMappedBookmark(const OUString &rOrigName)
{
OUString sName(BookmarkToWriter(rOrigName));
OSL_ENSURE(m_xPlcxMan.get(), "no pPlcxMan");
OSL_ENSURE(m_xPlcxMan, "no pPlcxMan");
m_xPlcxMan->GetBook()->MapName(sName);
//See if there has been a variable set with this name, if so get
+33 -33
View File
@@ -215,7 +215,7 @@ DocumentHolder PdfExportTest::exportAndParse(const OUString& rURL, const utl::Me
maMemory.WriteStream(aFile);
DocumentHolder pPdfDocument(
FPDF_LoadMemDocument(maMemory.GetData(), maMemory.GetSize(), /*password=*/nullptr));
CPPUNIT_ASSERT(pPdfDocument.get());
CPPUNIT_ASSERT(pPdfDocument);
return pPdfDocument;
}
@@ -362,12 +362,12 @@ void PdfExportTest::testTdf105461()
SvMemoryStream aMemory;
aMemory.WriteStream(aFile);
DocumentHolder pPdfDocument(FPDF_LoadMemDocument(aMemory.GetData(), aMemory.GetSize(), /*password=*/nullptr));
CPPUNIT_ASSERT(pPdfDocument.get());
CPPUNIT_ASSERT(pPdfDocument);
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get()));
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
// Make sure there is a filled rectangle inside.
int nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get());
@@ -423,7 +423,7 @@ void PdfExportTest::testTdf107868()
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get()));
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
// Make sure there is no filled rectangle inside.
int nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get());
@@ -681,7 +681,7 @@ void PdfExportTest::testSofthyphenPos()
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get()));
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
// tdf#96892 incorrect fractional part of font size caused soft-hyphen to
// be positioned inside preceding text (incorrect = 11.1, correct = 11.05)
@@ -910,12 +910,12 @@ void PdfExportTest::testTdf108963()
SvMemoryStream aMemory;
aMemory.WriteStream(aFile);
DocumentHolder pPdfDocument(FPDF_LoadMemDocument(aMemory.GetData(), aMemory.GetSize(), /*password=*/nullptr));
CPPUNIT_ASSERT(pPdfDocument.get());
CPPUNIT_ASSERT(pPdfDocument);
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get()));
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
// FIXME: strangely this fails on some Win systems after a pdfium update, expected: 793.7; actual: 793
#if !defined _WIN32
@@ -1158,12 +1158,12 @@ void PdfExportTest::testTdf115117_1a()
SvMemoryStream aMemory;
aMemory.WriteStream(aFile);
DocumentHolder pPdfDocument(FPDF_LoadMemDocument(aMemory.GetData(), aMemory.GetSize(), /*password=*/nullptr));
CPPUNIT_ASSERT(pPdfDocument.get());
CPPUNIT_ASSERT(pPdfDocument);
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get()));
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
auto pPdfTextPage = FPDFText_LoadPage(pPdfPage.get());
CPPUNIT_ASSERT(pPdfTextPage);
@@ -1205,12 +1205,12 @@ void PdfExportTest::testTdf115117_2a()
SvMemoryStream aMemory;
aMemory.WriteStream(aFile);
DocumentHolder pPdfDocument(FPDF_LoadMemDocument(aMemory.GetData(), aMemory.GetSize(), /*password=*/nullptr));
CPPUNIT_ASSERT(pPdfDocument.get());
CPPUNIT_ASSERT(pPdfDocument);
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get()));
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
auto pPdfTextPage = FPDFText_LoadPage(pPdfPage.get());
CPPUNIT_ASSERT(pPdfTextPage);
@@ -1519,12 +1519,12 @@ void PdfExportTest::testTdf105954()
aMemory.WriteStream(aFile);
DocumentHolder pPdfDocument(
FPDF_LoadMemDocument(aMemory.GetData(), aMemory.GetSize(), /*password=*/nullptr));
CPPUNIT_ASSERT(pPdfDocument.get());
CPPUNIT_ASSERT(pPdfDocument);
// The document has one page.
CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get()));
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
// There is a single image on the page.
int nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get());
@@ -1552,7 +1552,7 @@ void PdfExportTest::testTdf128630()
// Assert the aspect ratio of the only bitmap on the page.
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
int nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get());
for (int i = 0; i < nPageObjectCount; ++i)
{
@@ -1586,7 +1586,7 @@ void PdfExportTest::testTdf106702()
// First page already has the correct image position.
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
int nExpected = 0;
int nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get());
for (int i = 0; i < nPageObjectCount; ++i)
@@ -1603,7 +1603,7 @@ void PdfExportTest::testTdf106702()
// Second page had an incorrect image position.
pPdfPage.reset(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/1));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
int nActual = 0;
nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get());
for (int i = 0; i < nPageObjectCount; ++i)
@@ -1644,7 +1644,7 @@ void PdfExportTest::testTdf113143()
// First has the original (larger) image.
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
int nLarger = 0;
int nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get());
for (int i = 0; i < nPageObjectCount; ++i)
@@ -1661,7 +1661,7 @@ void PdfExportTest::testTdf113143()
// Second page has the scaled (smaller) image.
pPdfPage.reset(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/1));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
int nSmaller = 0;
nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get());
for (int i = 0; i < nPageObjectCount; ++i)
@@ -1702,7 +1702,7 @@ void PdfExportTest::testTdf115262()
// Get the 6th page.
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/5));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
// Look up the position of the first image and the 400th row.
FPDF_TEXTPAGE pTextPage = FPDFText_LoadPage(pPdfPage.get());
@@ -1746,7 +1746,7 @@ void PdfExportTest::testTdf121962()
// Get the first page
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
FPDF_TEXTPAGE pTextPage = FPDFText_LoadPage(pPdfPage.get());
// Make sure the table sum is displayed as "0", not faulty expression.
@@ -1776,7 +1776,7 @@ void PdfExportTest::testTdf115967()
// Get the first page
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
FPDF_TEXTPAGE pTextPage = FPDFText_LoadPage(pPdfPage.get());
// Make sure the elements inside a formula in a RTL document are exported
@@ -1873,11 +1873,11 @@ void PdfExportTest::testTocLink()
maMemory.WriteStream(aFile);
DocumentHolder pPdfDocument(
FPDF_LoadMemDocument(maMemory.GetData(), maMemory.GetSize(), /*password=*/nullptr));
CPPUNIT_ASSERT(pPdfDocument.get());
CPPUNIT_ASSERT(pPdfDocument);
CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get()));
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
// Ensure there is a link on the first page (in the ToC).
int nStartPos = 0;
@@ -1904,10 +1904,10 @@ void PdfExportTest::testReduceSmallImage()
maMemory.WriteStream(aFile);
DocumentHolder pPdfDocument(
FPDF_LoadMemDocument(maMemory.GetData(), maMemory.GetSize(), /*password=*/nullptr));
CPPUNIT_ASSERT(pPdfDocument.get());
CPPUNIT_ASSERT(pPdfDocument);
CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get()));
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
CPPUNIT_ASSERT_EQUAL(1, FPDFPage_CountObjects(pPdfPage.get()));
FPDF_PAGEOBJECT pPageObject = FPDFPage_GetObject(pPdfPage.get(), 0);
CPPUNIT_ASSERT_EQUAL(FPDF_PAGEOBJ_IMAGE, FPDFPageObj_GetType(pPageObject));
@@ -1959,10 +1959,10 @@ void PdfExportTest::testReduceImage()
maMemory.WriteStream(aFile);
DocumentHolder pPdfDocument(
FPDF_LoadMemDocument(maMemory.GetData(), maMemory.GetSize(), /*password=*/nullptr));
CPPUNIT_ASSERT(pPdfDocument.get());
CPPUNIT_ASSERT(pPdfDocument);
CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get()));
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
CPPUNIT_ASSERT_EQUAL(1, FPDFPage_CountObjects(pPdfPage.get()));
FPDF_PAGEOBJECT pPageObject = FPDFPage_GetObject(pPdfPage.get(), 0);
CPPUNIT_ASSERT_EQUAL(FPDF_PAGEOBJ_IMAGE, FPDFPageObj_GetType(pPageObject));
@@ -2001,7 +2001,7 @@ void PdfExportTest::testLinkWrongPage()
// First page should have 1 link (2nd slide, 1st was hidden).
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
// Without the accompanying fix in place, this test would have failed, as the link of the first
// page went to the second page due to the hidden first slide.
@@ -2009,7 +2009,7 @@ void PdfExportTest::testLinkWrongPage()
// Second page should have no links (3rd slide).
PageHolder pPdfPage2(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/1));
CPPUNIT_ASSERT(pPdfPage2.get());
CPPUNIT_ASSERT(pPdfPage2);
CPPUNIT_ASSERT(!HasLinksOnPage(pPdfPage2));
}
@@ -2074,12 +2074,12 @@ void PdfExportTest::testPdfImageResourceInlineXObjectRef()
maMemory.WriteStream(aFile);
DocumentHolder pPdfDocument(
FPDF_LoadMemDocument(maMemory.GetData(), maMemory.GetSize(), /*password=*/nullptr));
CPPUNIT_ASSERT(pPdfDocument.get());
CPPUNIT_ASSERT(pPdfDocument);
CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get()));
// Make sure that the page -> form -> form has a child image.
PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
CPPUNIT_ASSERT(pPdfPage.get());
CPPUNIT_ASSERT(pPdfPage);
CPPUNIT_ASSERT_EQUAL(1, FPDFPage_CountObjects(pPdfPage.get()));
FPDF_PAGEOBJECT pPageObject = FPDFPage_GetObject(pPdfPage.get(), 0);
CPPUNIT_ASSERT_EQUAL(FPDF_PAGEOBJ_FORM, FPDFPageObj_GetType(pPageObject));
@@ -2133,7 +2133,7 @@ void PdfExportTest::testDefaultVersion()
maMemory.WriteStream(aFile);
DocumentHolder pPdfDocument(
FPDF_LoadMemDocument(maMemory.GetData(), maMemory.GetSize(), /*password=*/nullptr));
CPPUNIT_ASSERT(pPdfDocument.get());
CPPUNIT_ASSERT(pPdfDocument);
int nFileVersion = 0;
FPDF_GetFileVersion(pPdfDocument.get(), &nFileVersion);
CPPUNIT_ASSERT_EQUAL(16, nFileVersion);
@@ -2159,7 +2159,7 @@ void PdfExportTest::testVersion15()
maMemory.WriteStream(aFile);
DocumentHolder pPdfDocument(
FPDF_LoadMemDocument(maMemory.GetData(), maMemory.GetSize(), /*password=*/nullptr));
CPPUNIT_ASSERT(pPdfDocument.get());
CPPUNIT_ASSERT(pPdfDocument);
int nFileVersion = 0;
FPDF_GetFileVersion(pPdfDocument.get(), &nFileVersion);
CPPUNIT_ASSERT_EQUAL(15, nFileVersion);
+1 -1
View File
@@ -1261,7 +1261,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
break;
}
OSL_ENSURE(rContext.get(), "PropertyMap has to be valid!");
OSL_ENSURE(rContext, "PropertyMap has to be valid!");
if(!rContext)
return ;
@@ -1369,7 +1369,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
#endif
const StyleSheetEntryPtr pEntry = GetStyleSheetTable()->FindStyleSheetByConvertedStyleName( GetCurrentParaStyleName() );
OSL_ENSURE( pEntry.get(), "no style sheet found" );
OSL_ENSURE( pEntry, "no style sheet found" );
const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : nullptr);
bool isNumberingViaStyle(false);
bool isNumberingViaRule = pParaContext && pParaContext->GetListId() > -1;
@@ -3860,7 +3860,7 @@ void DomainMapper_Impl::AppendFieldCommand(OUString const & rPartOfCommand)
#endif
FieldContextPtr pContext = m_aFieldStack.back();
OSL_ENSURE( pContext.get(), "no field context available");
OSL_ENSURE( pContext, "no field context available");
if( pContext )
{
pContext->AppendCommand( rPartOfCommand );
@@ -4832,7 +4832,7 @@ void DomainMapper_Impl::CloseFieldCommand()
FieldContextPtr pContext;
if(!m_aFieldStack.empty())
pContext = m_aFieldStack.back();
OSL_ENSURE( pContext.get(), "no field context available");
OSL_ENSURE( pContext, "no field context available");
if( pContext )
{
m_bSetUserFieldContent = false;
@@ -5640,7 +5640,7 @@ bool DomainMapper_Impl::IsFieldResultAsString()
bool bRet = false;
OSL_ENSURE( !m_aFieldStack.empty(), "field stack empty?");
FieldContextPtr pContext = m_aFieldStack.back();
OSL_ENSURE( pContext.get(), "no field context available");
OSL_ENSURE( pContext, "no field context available");
if( pContext )
{
bRet = pContext->GetTextField().is()
@@ -5716,7 +5716,7 @@ void DomainMapper_Impl::SetFieldResult(OUString const& rResult)
#endif
FieldContextPtr pContext = m_aFieldStack.back();
OSL_ENSURE( pContext.get(), "no field context available");
OSL_ENSURE( pContext, "no field context available");
if (m_aFieldStack.size() > 1)
{
@@ -5882,7 +5882,7 @@ void DomainMapper_Impl::PopFieldContext()
return;
FieldContextPtr pContext = m_aFieldStack.back();
OSL_ENSURE( pContext.get(), "no field context available");
OSL_ENSURE( pContext, "no field context available");
if( pContext )
{
if( !pContext->IsCommandCompleted() )
@@ -664,7 +664,7 @@ void ListsManager::lcl_attribute( Id nName, Value& rVal )
if (nName != NS_ooxml::LN_CT_NumPicBullet_numPicBulletId)
{
OSL_ENSURE( m_pCurrentDefinition.get(), "current entry has to be set here");
OSL_ENSURE( m_pCurrentDefinition, "current entry has to be set here");
if(!m_pCurrentDefinition)
return ;
pCurrentLvl = m_pCurrentDefinition->GetCurrentLevel( );
@@ -2667,7 +2667,7 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState)
= new RTFReferenceProperties(aObjAttributes, aObjSprms);
uno::Reference<drawing::XShape> xShape;
RTFValue::Pointer_t pShape = m_aObjectAttributes.find(NS_ooxml::LN_shape);
OSL_ASSERT(pShape.get());
OSL_ASSERT(pShape);
if (pShape)
pShape->getAny() >>= xShape;
if (xShape.is())