Skip to content

Commit

Permalink
remove some unused local vars
Browse files Browse the repository at this point in the history
found by a more aggressive variant of loplugin:unusedvariables.

This is my first pass, committing the simplest and most obviously
unnecessary vars

Change-Id: I9676a6e39a101937097788548764506c93811c57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87414
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
  • Loading branch information
Noel Grandin committed Jan 26, 2020
1 parent b9fe4f2 commit 51b5b93
Show file tree
Hide file tree
Showing 44 changed files with 5 additions and 80 deletions.
1 change: 0 additions & 1 deletion bridges/source/jni_uno/jni_data.cxx
Expand Up @@ -2339,7 +2339,6 @@ void Bridge::map_to_java(

if (0 < nElements)
{
TypeDescr element_td( element_type );
uno_Sequence * const * elements = reinterpret_cast<uno_Sequence * const *>(seq->elements);
for ( sal_Int32 nPos = 0; nPos < nElements; ++nPos )
{
Expand Down
1 change: 0 additions & 1 deletion connectivity/source/drivers/flat/ETable.cxx
Expand Up @@ -82,7 +82,6 @@ void OFlatTable::fillColumns(const css::lang::Locale& _aLocale)
setRowPos(rowNum++, rowPos);

// read first row
QuotedTokenizedString aFirstLine;
if(bRead)
{
bRead = readLine(&rowPos.second, &rowPos.first);
Expand Down
1 change: 0 additions & 1 deletion dbaccess/source/ui/misc/UITools.cxx
Expand Up @@ -145,7 +145,6 @@ SQLExceptionInfo createConnection( const OUString& _rsDataSourceName,
catch(const Exception&)
{
}
SQLExceptionInfo aInfo;

return createConnection(xProp,_rxContext,_rEvtLst,_rOUTConnection);
}
Expand Down
1 change: 0 additions & 1 deletion dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
Expand Up @@ -1388,7 +1388,6 @@ sal_Int8 OSelectionBrowseBox::ExecuteDrop( const BrowserExecuteDropEvent& _rEvt
return DND_ACTION_NONE;
}

rtl::Reference<OTableFieldDesc> aInfo;
// insert the field at the selected position
OJoinExchangeData jxdSource = OJoinExchObj::GetSourceDescription(_rEvt.maDropEvent.Transferable);
InsertField(jxdSource);
Expand Down
3 changes: 1 addition & 2 deletions embeddedobj/source/msole/olevisual.cxx
Expand Up @@ -336,8 +336,6 @@ embed::VisualRepresentation SAL_CALL OleEmbeddedObject::getPreferredVisualRepres
throw embed::WrongStateException( "The object is not loaded!",
static_cast< ::cppu::OWeakObject* >(this) );

embed::VisualRepresentation aVisualRepr;

// TODO: in case of different aspects they must be applied to the mediatype and XTransferable must be used
// the cache is used only as a fallback if object is not in loaded state
if ( !m_xCachedVisualRepresentation.is() && ( !m_bVisReplInitialized || m_bVisReplInStream )
Expand All @@ -360,6 +358,7 @@ embed::VisualRepresentation SAL_CALL OleEmbeddedObject::getPreferredVisualRepres
"Windows Metafile",
cppu::UnoType<uno::Sequence< sal_Int8 >>::get() );

embed::VisualRepresentation aVisualRepr;
aVisualRepr.Data = m_pOleComponent->getTransferData( aDataFlavor );
aVisualRepr.Flavor = aDataFlavor;

Expand Down
2 changes: 0 additions & 2 deletions filter/source/config/cache/filterfactory.cxx
Expand Up @@ -155,7 +155,6 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::crea

// analyze query and split it into its tokens
QueryTokenizer lTokens(sNewQuery);
QueryTokenizer::const_iterator pIt;
std::vector<OUString> lEnumSet;

// start query
Expand Down Expand Up @@ -263,7 +262,6 @@ std::vector<OUString> FilterFactory::impl_queryMatchByDocumentService(const Quer
try
{
const CacheItem aFilter = pCache->getItem(FilterCache::E_FILTER, filterName);
CacheItem::const_iterator pProp;

// "matchByDocumentService=" => any filter will be addressed here
// "matchByDocumentService=all" => any filter will be addressed here
Expand Down
4 changes: 0 additions & 4 deletions io/source/stm/omark.cxx
Expand Up @@ -311,8 +311,6 @@ Reference < XConnectable > OMarkableOutputStream::getPredecessor()

void OMarkableOutputStream::checkMarksAndFlush()
{
map<sal_Int32,sal_Int32,less<sal_Int32> >::iterator ii;

// find the smallest mark
sal_Int32 nNextFound = m_nCurrentPos;
for (auto const& mark : m_mapMarks)
Expand Down Expand Up @@ -731,8 +729,6 @@ Reference< XConnectable > OMarkableInputStream::getPredecessor()

void OMarkableInputStream::checkMarksAndFlush()
{
map<sal_Int32,sal_Int32,less<sal_Int32> >::iterator ii;

// find the smallest mark
sal_Int32 nNextFound = m_nCurrentPos;
for (auto const& mark : m_mapMarks)
Expand Down
1 change: 0 additions & 1 deletion oox/source/export/shapes.cxx
Expand Up @@ -671,7 +671,6 @@ static void lcl_AnalyzeHandles( const uno::Sequence<beans::PropertyValues> & rHa
const OUString sPosition( "Position" );
bool bPosition = false;
EnhancedCustomShapeParameterPair aPosition;
EnhancedCustomShapeParameterPair aPolar;
for ( const PropertyValue& rPropVal: rPropSeq )
{
if ( rPropVal.Name == sPosition )
Expand Down
2 changes: 0 additions & 2 deletions oox/source/shape/ShapeContextHandler.cxx
Expand Up @@ -63,7 +63,6 @@ uno::Reference<xml::sax::XFastContextHandler> const & ShapeContextHandler::getLo
if (!mxLockedCanvasContext.is())
{
FragmentHandler2Ref rFragmentHandler(new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
ShapePtr pMasterShape;

switch (nElement & 0xffff)
{
Expand Down Expand Up @@ -139,7 +138,6 @@ uno::Reference<xml::sax::XFastContextHandler> const & ShapeContextHandler::getWp
if (!mxWpgContext.is())
{
FragmentHandler2Ref rFragmentHandler(new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
ShapePtr pMasterShape;

switch (getBaseToken(nElement))
{
Expand Down
1 change: 0 additions & 1 deletion package/source/manifest/ManifestImport.cxx
Expand Up @@ -457,7 +457,6 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName )
aSequence[PKG_SIZE_NOENCR_MNFST].Name = "KeyInfo";
aSequence[PKG_SIZE_NOENCR_MNFST].Value <<= comphelper::containerToSequence(aKeys);
}
css::beans::PropertyValue aEmpty;
aSequence.erase(std::remove_if(aSequence.begin(), aSequence.end(),
isEmpty), aSequence.end());

Expand Down
1 change: 0 additions & 1 deletion sax/source/expatwrap/sax_expat.cxx
Expand Up @@ -809,7 +809,6 @@ bool SaxExpatParser_Impl::callbackExternalEntityRef(
const XML_Char *publicId)
{
bool bOK = true;
InputSource source;
SaxExpatParser_Impl *pImpl = static_cast<SaxExpatParser_Impl*>(XML_GetUserData( parser ));

struct Entity entity;
Expand Down
1 change: 0 additions & 1 deletion sc/source/core/data/documen5.cxx
Expand Up @@ -502,7 +502,6 @@ void ScDocument::SetChartRangeList( const OUString& rChartName,
uno::Reference< chart2::data::XDataReceiver > xReceiver( xChartDoc, uno::UNO_QUERY );
if ( xChartDoc.is() && xReceiver.is() )
{
ScRangeListRef aNewRanges;
chart::ChartDataRowSource eDataRowSource = chart::ChartDataRowSource_COLUMNS;
bool bHasCategories = false;
bool bFirstCellAsLabel = false;
Expand Down
1 change: 0 additions & 1 deletion sc/source/filter/excel/excrecds.cxx
Expand Up @@ -1022,7 +1022,6 @@ XclExpRecordRef XclExpFilterManager::CreateRecord( SCTAB nScTab )

bool XclExpFilterManager::HasFilterMode( SCTAB nScTab )
{
XclExpTabFilterRef xRec;
XclExpTabFilterMap::iterator aIt = maFilterMap.find( nScTab );
if( aIt != maFilterMap.end() )
{
Expand Down
1 change: 0 additions & 1 deletion sc/source/filter/excel/xeformula.cxx
Expand Up @@ -625,7 +625,6 @@ void XclExpFmlaCompImpl::RecalcTokenClasses()
/* Cell and array formulas start with VAL conversion and VALTYPE
parameter type, defined names start with ARR conversion and
REFTYPE parameter type for the root token. */
XclExpOperandList aOperands;
bool bNameFmla = mxData->mrCfg.meClassType == EXC_CLASSTYPE_NAME;
XclFuncParamConv eParamConv = bNameFmla ? EXC_PARAMCONV_ARR : EXC_PARAMCONV_VAL;
XclExpClassConv eClassConv = bNameFmla ? EXC_CLASSCONV_ARR : EXC_CLASSCONV_VAL;
Expand Down
1 change: 0 additions & 1 deletion sc/source/ui/view/dbfunc.cxx
Expand Up @@ -394,7 +394,6 @@ void ScDBFunc::HideAutoFilter()

ScDocument& rDoc = pDocSh->GetDocument();

ScQueryParam aParam;
ScDBData* pDBData = GetDBData( false );

SCTAB nTab;
Expand Down
2 changes: 0 additions & 2 deletions sd/source/filter/html/htmlattr.cxx
Expand Up @@ -32,8 +32,6 @@ SdHtmlAttrPreview::~SdHtmlAttrPreview()

void SdHtmlAttrPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect)
{
DecorationView aDecoView(&rRenderContext);

::tools::Rectangle aTextRect;
aTextRect.SetSize(GetOutputSizePixel());

Expand Down
1 change: 0 additions & 1 deletion sd/source/filter/xml/sdxmlwrp.cxx
Expand Up @@ -557,7 +557,6 @@ bool SdXMLFilter::Import( ErrCode& nError )

// get the input stream (storage or stream)

tools::SvRef<SotStorageStream> xDocStream;
uno::Reference < embed::XStorage > xStorage = mrMedium.GetStorage();

xInfoSet->setPropertyValue( "SourceStorage", Any( xStorage ) );
Expand Down
1 change: 0 additions & 1 deletion sd/source/ui/animations/SlideTransitionPane.cxx
Expand Up @@ -345,7 +345,6 @@ size_t getPresetOffset( const sd::impl::TransitionEffect &rEffect )
{
const sd::TransitionPresetList& rPresetList =
sd::TransitionPreset::getTransitionPresetList();
sd::TransitionPresetPtr pFound;

size_t nIdx = 0;
for( const auto& aIt: rPresetList )
Expand Down
1 change: 0 additions & 1 deletion sd/source/ui/dlg/PhotoAlbumDialog.cxx
Expand Up @@ -595,7 +595,6 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, SelectHdl, weld::TreeView&, void)

if (sImgUrl != SdResId(STR_PHOTO_ALBUM_TEXTBOX))
{
GraphicFilter aCurFilter;
Graphic aGraphic;
INetURLObject aURLObj( sImgUrl );

Expand Down
1 change: 0 additions & 1 deletion sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx
Expand Up @@ -316,7 +316,6 @@ bool PageCacheManager::InvalidatePreviewBitmap (
{
// Iterate over all caches that are currently in use and invalidate
// the previews in those that belong to the document.
PageCacheContainer::iterator iCache;
for (auto& rCache : *mpPageCaches)
if (rCache.first.mpDocument == pDocument)
bHasChanged |= rCache.second->InvalidateBitmap(pKey);
Expand Down
9 changes: 0 additions & 9 deletions sdext/source/presenter/PresenterNotesView.cxx
Expand Up @@ -544,15 +544,6 @@ void PresenterNotesView::PaintText (const awt::Rectangle& rUpdateBox)
if (aBox.Width <= 0 || aBox.Height <= 0)
return;

rendering::ViewState aViewState (
geometry::AffineMatrix2D(1,0,0, 0,1,0),
PresenterGeometryHelper::CreatePolygon(aBox, mxCanvas->getDevice()));
rendering::RenderState aRenderState(
geometry::AffineMatrix2D(1,0,0, 0,1,0),
nullptr,
Sequence<double>(3),
rendering::CompositeOperation::SOURCE);

if (mpBackground.get() != nullptr)
{
// Paint the background.
Expand Down
1 change: 0 additions & 1 deletion sdext/source/presenter/PresenterToolBar.cxx
Expand Up @@ -868,7 +868,6 @@ void PresenterToolBar::LayoutPart (
}
else {
ElementContainerPart::const_iterator iElement;
ElementContainerPart::const_iterator iEnd (rpPart->end());
ElementContainerPart::const_iterator iBegin (rpPart->begin());

for (iElement=rpPart->end()-1; iElement!=iBegin-1; --iElement)
Expand Down
1 change: 0 additions & 1 deletion sfx2/source/dialog/versdlg.cxx
Expand Up @@ -121,7 +121,6 @@ namespace
const int nRest = rVersionBox.get_preferred_size().Width() - nMax;

std::set<OUString> aAuthors;
SfxVersionInfo aInfo;
aAuthors.insert(SvtUserOptions().GetFullName());

for (int i = 0; i < rVersionBox.n_children(); ++i)
Expand Down
2 changes: 1 addition & 1 deletion sfx2/source/doc/doctemplates.cxx
Expand Up @@ -1675,7 +1675,7 @@ bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName,

// Check, whether or not there is a group with this name
// Return false, if there is no group with the given name
Content aGroup, aTemplate, aTargetGroup, aTemplateToRemove;
Content aGroup, aTemplateToRemove;
INetURLObject aGroupObj( maRootURL );
bool bRemoveOldTemplateContent = false;

Expand Down
2 changes: 1 addition & 1 deletion slideshow/source/engine/opengl/TransitionImpl.cxx
Expand Up @@ -790,7 +790,7 @@ std::shared_ptr<OGLTransitionImpl> makeIris()
aLeavingPrimitives.push_back (Slide);


Primitive irisPart, part;
Primitive irisPart;
int i, nSteps = 24, nParts = 7;
double t = 1.0/nSteps, lx = 1, ly = 0, of=2.2, f=1.42;

Expand Down
1 change: 0 additions & 1 deletion slideshow/source/engine/slide/shapemanagerimpl.cxx
Expand Up @@ -74,7 +74,6 @@ void ShapeManagerImpl::activate()
mrMultiplexer.addShapeListenerHandler( shared_from_this() );

// clone listener map
uno::Reference<presentation::XShapeEventListener> xDummyListener;
for( const auto& rListener : mrGlobalListenersMap )
listenerAdded( rListener.first );

Expand Down
2 changes: 0 additions & 2 deletions svx/source/dialog/imapwnd.cxx
Expand Up @@ -478,8 +478,6 @@ IMapObject* IMapWindow::GetIMapObj( const SdrObject* pSdrObj )

bool IMapWindow::Command(const CommandEvent& rCEvt)
{
vcl::Region aRegion;

if ( rCEvt.GetCommand() == CommandEventId::ContextMenu )
{
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDrawingArea(), "svx/ui/imapmenu.ui"));
Expand Down
1 change: 0 additions & 1 deletion svx/source/dialog/rubydialog.cxx
Expand Up @@ -286,7 +286,6 @@ void SvxRubyDialog::Close()
void SvxRubyDialog::Activate()
{
SfxModelessDialogController::Activate();
std::unique_ptr<SfxPoolItem> pState;
//get selection from current view frame
SfxViewFrame* pCurFrm = SfxViewFrame::Current();
Reference< XController > xCtrl = pCurFrm->GetFrame().GetController();
Expand Down
1 change: 0 additions & 1 deletion svx/source/form/formcontroller.cxx
Expand Up @@ -1660,7 +1660,6 @@ void FormController::focusGained(const FocusEvent& e)

if (!m_bFiltering && m_bCycle && (e.FocusFlags & FocusChangeReason::AROUND) && m_xCurrentControl.is())
{
SQLErrorEvent aErrorEvent;
OSL_ENSURE( m_xFormOperations.is(), "FormController::focusGained: hmm?" );
// should have been created in setModel
try
Expand Down
1 change: 0 additions & 1 deletion svx/source/gallery2/galtheme.cxx
Expand Up @@ -1019,7 +1019,6 @@ bool GalleryTheme::InsertModelStream(const tools::SvRef<SotStorageStream>& rxMod
if( xOStm.is() && !xOStm->GetError() )
{
GalleryCodec aCodec( *xOStm );
SvMemoryStream aMemStm( 65535, 65535 );

xOStm->SetBufferSize( 16348 );
aCodec.Write( *rxModelStream );
Expand Down
2 changes: 0 additions & 2 deletions svx/source/gengal/gengal.cxx
Expand Up @@ -103,8 +103,6 @@ static void createTheme( const OUString& aThemeName, const OUString& aGalleryURL
// if ( ! pGalTheme->InsertFileOrDirURL( aURL ) ) {
// Requires a load more components ...

Graphic aGraphic;

if ( ! pGalTheme->InsertURL( rFile ) )
fprintf( stderr, "Failed to import '%s'\n",
OUStringToOString( rFile.GetMainURL(INetURLObject::DecodeMechanism::NONE), RTL_TEXTENCODING_UTF8 ).getStr() );
Expand Down
1 change: 0 additions & 1 deletion svx/source/svdraw/svdoashp.cxx
Expand Up @@ -1118,7 +1118,6 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
{
bool bIsDefaultGeometry = false;

PropertyValue aPropVal;
OUString sShapeType;
const OUString sType( "Type" );
const SdrCustomShapeGeometryItem aGeometryItem( GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
Expand Down
5 changes: 1 addition & 4 deletions sw/source/core/access/accmap.cxx
Expand Up @@ -1188,7 +1188,6 @@ void SwAccessibleMap::InvalidateShapeInParaSelection()
//Checked for shapes.
SwAccessibleShapeMap_Impl::const_iterator aIter = mpShapeMap->cbegin();
SwAccessibleShapeMap_Impl::const_iterator aEndIter = mpShapeMap->cend();
::rtl::Reference< SwAccessibleContext > xParentAccImpl;

if( bIsSelAll)
{
Expand All @@ -1205,8 +1204,6 @@ void SwAccessibleMap::InvalidateShapeInParaSelection()
{
while( aIter != aEndIter )
{
SwAccessibleChild aFrame( (*aIter).first );

const SwFrameFormat *pFrameFormat = (*aIter).first ? ::FindFrameFormat( (*aIter).first ) : nullptr;
if( !pFrameFormat )
{
Expand Down Expand Up @@ -2209,7 +2206,7 @@ void SwAccessibleMap::RemoveContext( const SdrObject *pObj )
SwAccessibleShapeMap_Impl::iterator aIter = mpShapeMap->find( pObj );
if( aIter != mpShapeMap->end() )
{
uno::Reference < XAccessible > xAcc( (*aIter).second );
uno::Reference < XAccessible > xTempHold( (*aIter).second );
mpShapeMap->erase( aIter );
RemoveGroupContext(pObj);
// The shape selection flag is not cleared, but one might do
Expand Down
2 changes: 0 additions & 2 deletions sw/source/core/undo/unins.cxx
Expand Up @@ -421,7 +421,6 @@ void SwUndoInsert::RepeatImpl(::sw::RepeatContext & rContext)
case SwNodeType::Ole:
{
// StarView does not yet provide an option to copy a StarOBJ
tools::SvRef<SotStorage> aRef = new SotStorage( OUString() );
SwOLEObj& rSwOLE = static_cast<SwOLENode*>(pCNd)->GetOLEObj();

// temporary storage until object is inserted
Expand Down Expand Up @@ -796,7 +795,6 @@ void SwUndoReRead::SetAndSave(::sw::UndoRedoContext & rContext)
// cache the old values
std::unique_ptr<Graphic> pOldGrf( mpGraphic ? new Graphic(*mpGraphic) : nullptr);
o3tl::optional<OUString> aOldNm = maNm;
o3tl::optional<OUString> aOldFltr = maFltr;
MirrorGraph nOldMirr = mnMirror;
// since all of them are cleared/modified by SaveGraphicData:
SaveGraphicData( *pGrfNd );
Expand Down
2 changes: 0 additions & 2 deletions sw/source/filter/ww8/WW8TableInfo.cxx
Expand Up @@ -658,8 +658,6 @@ WW8TableInfo::processTableLine(const SwTable * pTable,

const SwTableBoxes & rBoxes = pTableLine->GetTabBoxes();

WW8TableNodeInfo::Pointer_t pTextNodeInfo;

for (size_t n = 0; n < rBoxes.size(); ++n)
{
const SwTableBox * pBox = rBoxes[n];
Expand Down
1 change: 0 additions & 1 deletion sw/source/filter/xml/wrtxml.cxx
Expand Up @@ -82,7 +82,6 @@ ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xS
comphelper::getProcessComponentContext();

// Get data sink ...
tools::SvRef<SotStorageStream> xDocStream;
uno::Reference<document::XGraphicStorageHandler> xGraphicStorageHandler;
rtl::Reference<SvXMLGraphicHelper> xGraphicHelper ;
uno::Reference< document::XEmbeddedObjectResolver > xObjectResolver;
Expand Down
3 changes: 1 addition & 2 deletions ucb/source/ucp/cmis/cmis_content.cxx
Expand Up @@ -1343,7 +1343,7 @@ namespace cmis
{
try
{
libcmis::FolderPtr pNew = pFolder->createFolder( m_pObjectProps );
pFolder->createFolder( m_pObjectProps );
sNewPath = STD_TO_OUSTR( newPath );
}
catch ( const libcmis::Exception& )
Expand Down Expand Up @@ -1887,7 +1887,6 @@ namespace cmis
}

OUString sParentURL = m_xIdentifier->getContentIdentifier();
URL aParentURL( sParentURL );

// Set the parent URL for the transient objects
uno::Reference< ucb::XContentIdentifier > xId(new ::ucbhelper::ContentIdentifier(sParentURL));
Expand Down
1 change: 0 additions & 1 deletion ucb/source/ucp/webdav-neon/webdavcontent.cxx
Expand Up @@ -2948,7 +2948,6 @@ Content::ResourceType Content::resourceTypeForLocks(
{
osl::MutexGuard g(m_aMutex);
//check if cache contains what we need, usually the first PROPFIND on the URI has supported lock
std::unique_ptr< ContentProperties > xProps;
if (m_xCachedProps)
{
uno::Sequence< ucb::LockEntry > aSupportedLocks;
Expand Down
2 changes: 0 additions & 2 deletions vcl/source/gdi/FileDefinitionWidgetDraw.cxx
Expand Up @@ -470,8 +470,6 @@ void munchDrawCommands(std::vector<std::shared_ptr<WidgetDrawAction>> const& rDr

auto aIterator = rCacheDrawCommands.find(rWidgetDraw.msSource);

gfx::DrawRoot aDrawRoot;

if (aIterator == rCacheDrawCommands.end())
{
SvFileStream aFileStream(rWidgetDraw.msSource, StreamMode::READ);
Expand Down

0 comments on commit 51b5b93

Please sign in to comment.