remove some unused local vars

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>
This commit is contained in:
Noel Grandin
2020-01-26 08:01:42 +01:00
parent b9fe4f26ea
commit 51b5b93092
44 changed files with 5 additions and 80 deletions
-1
View File
@@ -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 )
{
@@ -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);
-1
View File
@@ -145,7 +145,6 @@ SQLExceptionInfo createConnection( const OUString& _rsDataSourceName,
catch(const Exception&)
{
}
SQLExceptionInfo aInfo;
return createConnection(xProp,_rxContext,_rEvtLst,_rOUTConnection);
}
@@ -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);
+1 -2
View File
@@ -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 )
@@ -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;
-2
View File
@@ -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
@@ -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
-4
View File
@@ -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)
@@ -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)
-1
View File
@@ -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 )
-2
View File
@@ -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)
{
@@ -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))
{
@@ -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());
-1
View File
@@ -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;
-1
View File
@@ -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;
-1
View File
@@ -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() )
{
-1
View File
@@ -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;
-1
View File
@@ -394,7 +394,6 @@ void ScDBFunc::HideAutoFilter()
ScDocument& rDoc = pDocSh->GetDocument();
ScQueryParam aParam;
ScDBData* pDBData = GetDBData( false );
SCTAB nTab;
-2
View File
@@ -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());
-1
View File
@@ -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 ) );
@@ -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 )
-1
View File
@@ -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 );
@@ -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);
@@ -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.
@@ -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)
-1
View File
@@ -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)
+1 -1
View File
@@ -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;
@@ -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;
@@ -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 );
-2
View File
@@ -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"));
-1
View File
@@ -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();
-1
View File
@@ -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
-1
View File
@@ -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 );
-2
View File
@@ -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() );
-1
View File
@@ -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 ) );
+1 -4
View File
@@ -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)
{
@@ -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 )
{
@@ -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
-2
View File
@@ -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
@@ -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 );
-2
View File
@@ -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];
-1
View File
@@ -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;
+1 -2
View File
@@ -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& )
@@ -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));
@@ -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;
@@ -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);
-3
View File
@@ -434,7 +434,6 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S
void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos,
const Size& rSize )
{
vcl::Region aDrawClipRegion;
MapMode aDrawMap( GetPrefMapMode() );
Size aDestSize( pOut->LogicToPixel( rSize ) );
@@ -1284,7 +1283,6 @@ static void ImplActionBounds( tools::Rectangle& o_rOutBounds,
tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::Rectangle* pHairline ) const
{
GDIMetaFile aMtf;
ScopedVclPtrInstance< VirtualDevice > aMapVDev( i_rReference );
aMapVDev->EnableOutput( false );
@@ -2199,7 +2197,6 @@ GDIMetaFile GDIMetaFile::GetMonochromeMtf( const Color& rColor ) const
BitmapChecksum GDIMetaFile::GetChecksum() const
{
GDIMetaFile aMtf;
SvMemoryStream aMemStm( 65535, 65535 );
ImplMetaWriteData aWriteData;
SVBT16 aBT16;
-1
View File
@@ -229,7 +229,6 @@ static void ImplTCToPAL( const BitmapBuffer& rSrcBuffer, BitmapBuffer const & rD
const long nHeight1 = rDstBuffer.mnHeight- 1;
const ColorMask& rSrcMask = rSrcBuffer.maColorMask;
const ColorMask& rDstMask = rDstBuffer.maColorMask;
BitmapPalette aColMap( rSrcBuffer.maPalette.GetEntryCount() );
std::unique_ptr<sal_uInt8[]> pColToPalMap(new sal_uInt8[ TC_TO_PAL_COLORS ]);
BitmapColor aIndex( 0 );
-2
View File
@@ -412,8 +412,6 @@ void IconViewImpl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
nStartId--;
}
vcl::Region aClipRegion(GetClipRegionRect());
if (!m_pCursor && !mbNoAutoCurEntry)
{
// do not select if multiselection or explicit set
-1
View File
@@ -1399,7 +1399,6 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, con
Point aTmpPoint = pOffset ? *pOffset : Point();
tools::Rectangle aInRect( aTmpPoint, Size( pData->mnWidth, pData->mnHeight ) );
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
DecorationView aDecoView(&rRenderContext);
Color aFaceColor(rStyleSettings.GetFaceColor());
Color aFrameColor(aFaceColor);
-10
View File
@@ -1732,16 +1732,6 @@ bool X11SalGraphicsImpl::drawPolyLine(
}
basegfx::triangulator::B2DTriangleVector aTriangles;
const basegfx::B2DPolyPolygon aAreaPolyPoly(
basegfx::utils::createAreaGeometry(
aPolygon,
0.5 * aLineWidth.getX(),
eLineJoin,
eLineCap,
basegfx::deg2rad(12.5),
0.4,
fMiterMinimumAngle,
&aTriangles));
if(!aTriangles.empty())
{