[Libreoffice-commits] core.git: 2 commits - dbaccess/qa dbaccess/source filter/source

Noel (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 2 08:53:39 UTC 2020


 dbaccess/qa/extras/dialog-save.cxx                     |    2 
 dbaccess/qa/extras/empty-stdlib-save.cxx               |    2 
 dbaccess/qa/extras/nolib-save.cxx                      |    2 
 dbaccess/source/core/api/SingleSelectQueryComposer.cxx |    4 -
 dbaccess/source/core/api/tablecontainer.cxx            |    3 -
 dbaccess/source/core/api/viewcontainer.cxx             |    3 -
 dbaccess/source/ui/app/AppController.cxx               |    3 -
 dbaccess/source/ui/browser/sbagrid.cxx                 |    2 
 dbaccess/source/ui/control/FieldDescControl.cxx        |    3 -
 dbaccess/source/ui/dlg/UserAdmin.cxx                   |    2 
 dbaccess/source/ui/dlg/queryfilter.cxx                 |    2 
 dbaccess/source/ui/misc/UITools.cxx                    |    2 
 dbaccess/source/ui/querydesign/QueryDesignView.cxx     |    2 
 dbaccess/source/ui/querydesign/querycontroller.cxx     |    2 
 filter/source/graphicfilter/eps/eps.cxx                |    3 -
 filter/source/graphicfilter/icgm/class4.cxx            |    6 +-
 filter/source/graphicfilter/idxf/dxf2mtf.cxx           |    9 +--
 filter/source/graphicfilter/ios2met/ios2met.cxx        |   39 ++++++++++-------
 filter/source/graphicfilter/itiff/ccidecom.cxx         |    6 --
 filter/source/msfilter/escherex.cxx                    |    9 +--
 filter/source/msfilter/msdffimp.cxx                    |   22 ++++-----
 filter/source/msfilter/mstoolbar.cxx                   |    3 -
 filter/source/msfilter/svdfppt.cxx                     |   12 +++--
 filter/source/pdf/pdfexport.cxx                        |    2 
 filter/source/svg/svgexport.cxx                        |    2 
 filter/source/svg/svgwriter.cxx                        |    9 +--
 filter/source/t602/t602filter.cxx                      |    3 -
 27 files changed, 83 insertions(+), 76 deletions(-)

New commits:
commit 1b56843a77f0c86f483e96032b5b6ff2214968b0
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Fri Oct 2 09:36:46 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Oct 2 10:53:07 2020 +0200

    loplugin:reducevarscope in filter
    
    Change-Id: I665531de5b8a94c4646e2a85373a6f67a60f1c08
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103812
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index 9958c946310a..61502b06c503 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -1060,10 +1060,9 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
             case MetaActionType::POP :
             {
                 rVDev.Pop();
-                StackMember* pGS;
                 if( pGDIStack )
                 {
-                    pGS = pGDIStack;
+                    StackMember* pGS = pGDIStack;
                     pGDIStack = pGS->pSucc;
                     aDashArray = pGS->aDashArray;
                     eJoinType = pGS->eJoinType;
diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx
index 2e3f3c439cdb..394c2ada5f89 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -362,7 +362,7 @@ void CGM::ImplDoClass4()
 
             case 0x0d : /*Circular Arc 3 Point*/
             {
-                FloatPoint aStartingPoint, aIntermediatePoint, aEndingPoint, aCenterPoint;
+                FloatPoint aStartingPoint, aIntermediatePoint, aEndingPoint;
                 ImplGetPoint( aStartingPoint, true );
                 ImplGetPoint( aIntermediatePoint, true );
                 ImplGetPoint( aEndingPoint, true );
@@ -379,6 +379,7 @@ void CGM::ImplDoClass4()
 
                 if ( fG != 0 )
                 {
+                    FloatPoint aCenterPoint;
                     aCenterPoint.X = ( fD * fE - fB * fF ) / fG;
                     aCenterPoint.Y = ( fA * fF - fC * fE ) / fG;
                     double fStartAngle = ImplGetOrientation( aCenterPoint, aStartingPoint );
@@ -435,7 +436,7 @@ void CGM::ImplDoClass4()
                 if ( mbFigure )
                     mpOutAct->CloseRegion();
 
-                FloatPoint aStartingPoint, aIntermediatePoint, aEndingPoint, aCenterPoint;
+                FloatPoint aStartingPoint, aIntermediatePoint, aEndingPoint;
                 ImplGetPoint( aStartingPoint );
                 ImplGetPoint( aIntermediatePoint );
                 ImplGetPoint( aEndingPoint );
@@ -452,6 +453,7 @@ void CGM::ImplDoClass4()
 
                 if ( fG != 0 )
                 {
+                    FloatPoint aCenterPoint;
                     aCenterPoint.X = ( fD * fE - fB * fF ) / fG;
                     aCenterPoint.Y = ( fA * fF - fC * fE ) / fG;
                     double fStartAngle = ImplGetOrientation( aCenterPoint, aStartingPoint );
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
index 898dc6159ecb..3d9e6c9ed463 100644
--- a/filter/source/graphicfilter/idxf/dxf2mtf.cxx
+++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
@@ -49,14 +49,13 @@ Color DXF2GDIMetaFile::ConvertColor(sal_uInt8 nColor)
 long DXF2GDIMetaFile::GetEntityColor(const DXFBasicEntity & rE)
 {
     long nColor;
-    const DXFLayer * pLayer;
 
     nColor=rE.nColor;
     if (nColor==256) {
         if (rE.m_sLayer.getLength() < 2) {
             nColor=nParentLayerColor;
         } else {
-            pLayer=pDXF->aTables.SearchLayer(rE.m_sLayer);
+            const DXFLayer * pLayer=pDXF->aTables.SearchLayer(rE.m_sLayer);
             if (pLayer!=nullptr) nColor=pLayer->nColor;
             else nColor=nParentLayerColor;
         }
@@ -315,7 +314,6 @@ void DXF2GDIMetaFile::DrawArcEntity(const DXFArcEntity & rE, const DXFTransform
     double frx,fry;
     sal_uInt16 nPoints,i;
     DXFVector aC;
-    Point aPS,aPE;
 
     if (!SetLineAttribute(rE)) return;
     double fA1=rE.fStart;
@@ -330,6 +328,7 @@ void DXF2GDIMetaFile::DrawArcEntity(const DXFArcEntity & rE, const DXFTransform
         DXFVector aVE(cos((fA1+fdA)/180.0*3.14159265359),sin((fA1+fdA)/180.0*3.14159265359),0.0);
         aVE*=rE.fRadius;
         aVE+=rE.aP0;
+        Point aPS,aPE;
         if (rTransform.Mirror()) {
             rTransform.Transform(aVS,aPS);
             rTransform.Transform(aVE,aPE);
@@ -430,7 +429,6 @@ void DXF2GDIMetaFile::DrawSolidEntity(const DXFSolidEntity & rE, const DXFTransf
 void DXF2GDIMetaFile::DrawTextEntity(const DXFTextEntity & rE, const DXFTransform & rTransform)
 {
     DXFVector aV;
-    Point aPt;
     double fA;
     sal_uInt16 nHeight;
     short nAng;
@@ -443,6 +441,7 @@ void DXF2GDIMetaFile::DrawTextEntity(const DXFTextEntity & rE, const DXFTransfor
     if ( SetFontAttribute( rE,nAng, nHeight ) )
     {
         OUString const aUString(pDXF->ToOUString(rE.m_sText));
+        Point aPt;
         aT.Transform( DXFVector( 0, 0, 0 ), aPt );
         pVirDev->DrawText( aPt, aUString );
     }
@@ -491,7 +490,6 @@ void DXF2GDIMetaFile::DrawAttribEntity(const DXFAttribEntity & rE, const DXFTran
         return;
 
     DXFVector aV;
-    Point aPt;
     double fA;
     sal_uInt16 nHeight;
     short nAng;
@@ -504,6 +502,7 @@ void DXF2GDIMetaFile::DrawAttribEntity(const DXFAttribEntity & rE, const DXFTran
     if (SetFontAttribute(rE,nAng,nHeight))
     {
         OUString const aUString(pDXF->ToOUString(rE.m_sText));
+        Point aPt;
         aT.Transform( DXFVector( 0, 0, 0 ), aPt );
         pVirDev->DrawText( aPt, aUString );
     }
diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx
index 54f56f932f53..7746b579df1d 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/filter/source/graphicfilter/ios2met/ios2met.cxx
@@ -1133,9 +1133,14 @@ void OS2METReader::ReadFullArc(bool bGivenPos, sal_uInt16 nOrderSize)
         nP = o3tl::saturating_toggle_sign(nP);
     if (nQ < 0)
         nQ = o3tl::saturating_toggle_sign(nQ);
-    sal_uInt32 nMul(0); sal_uInt16 nMulS(0);
-    if (nOrderSize>=4) pOS2MET->ReadUInt32( nMul );
-    else { pOS2MET->ReadUInt16( nMulS ); nMul=static_cast<sal_uInt32>(nMulS)<<8; }
+    sal_uInt32 nMul(0);
+    if (nOrderSize>=4)
+        pOS2MET->ReadUInt32( nMul );
+    else {
+        sal_uInt16 nMulS(0);
+        pOS2MET->ReadUInt16( nMulS );
+        nMul=static_cast<sal_uInt32>(nMulS)<<8;
+    }
     if (nMul!=0x00010000) {
         nP=(nP*nMul)>>16;
         nQ=(nQ*nMul)>>16;
@@ -1180,9 +1185,14 @@ void OS2METReader::ReadPartialArc(bool bGivenPos, sal_uInt16 nOrderSize)
         nP = o3tl::saturating_toggle_sign(nP);
     if (nQ < 0)
         nQ = o3tl::saturating_toggle_sign(nQ);
-    sal_uInt32 nMul(0); sal_uInt16 nMulS(0);
-    if (nOrderSize>=12) pOS2MET->ReadUInt32( nMul );
-    else { pOS2MET->ReadUInt16( nMulS ); nMul=static_cast<sal_uInt32>(nMulS)<<8; }
+    sal_uInt32 nMul(0);
+    if (nOrderSize>=12)
+        pOS2MET->ReadUInt32( nMul );
+    else {
+        sal_uInt16 nMulS(0);
+        pOS2MET->ReadUInt16( nMulS );
+        nMul=static_cast<sal_uInt32>(nMulS)<<8;
+    }
     if (nMul!=0x00010000) {
         nP=(nP*nMul)>>16;
         nQ=(nQ*nMul)>>16;
@@ -1714,7 +1724,7 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen)
         case GOrdPIvAtr: PushAttr(nOrderID);
             [[fallthrough]];
         case GOrdSIvAtr: {
-            sal_uInt8 nA, nP, nFlags, nMix;
+            sal_uInt8 nA, nP, nFlags;
             Color aCol;
             RasterOp eROP;
             pOS2MET->ReadUChar( nA ).ReadUChar( nP ).ReadUChar( nFlags );
@@ -1763,6 +1773,7 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen)
                 }
             }
             else {
+                sal_uInt8 nMix;
                 pOS2MET->ReadUChar( nMix );
                 if (nMix==0) {
                     switch (nP) {
@@ -1790,7 +1801,6 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen)
             [[fallthrough]];
         case GOrdSIxCol: {
             sal_uInt8 nFlags;
-            Color aCol;
             pOS2MET->ReadUChar( nFlags );
             if ((nFlags&0x80)!=0) {
                 aAttr.aLinCol=aDefAttr.aLinCol;
@@ -1800,6 +1810,7 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen)
                 aAttr.aImgCol=aDefAttr.aImgCol;
             }
             else {
+                Color aCol;
                 const auto nVal = ReadLittleEndian3BytesLong();
                 if      ((nFlags&0x40)!=0 && nVal==1) aCol=COL_BLACK;
                 else if ((nFlags&0x40)!=0 && nVal==2) aCol=COL_WHITE;
@@ -1817,10 +1828,9 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen)
             [[fallthrough]];
         case GOrdSColor:
         case GOrdSXtCol: {
-            sal_uInt8 nbyte;
             sal_uInt16 nVal;
-            Color aCol;
             if (nOrderID==GOrdPColor || nOrderID==GOrdSColor) {
+                sal_uInt8 nbyte;
                 pOS2MET->ReadUChar( nbyte ); nVal=static_cast<sal_uInt16>(nbyte)|0xff00;
             }
             else pOS2MET->ReadUInt16( nVal );
@@ -1832,6 +1842,7 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen)
                 aAttr.aImgCol=aDefAttr.aImgCol;
             }
             else {
+                Color aCol;
                 if      (nVal==0x0007) aCol=COL_WHITE;
                 else if (nVal==0x0008) aCol=COL_BLACK;
                 else if (nVal==0xff08) aCol=GetPaletteColor(1);
@@ -1846,7 +1857,6 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen)
             [[fallthrough]];
         case GOrdSBgCol: {
             sal_uInt16 nVal;
-            Color aCol;
             pOS2MET->ReadUInt16( nVal );
             if (nVal==0x0000 || nVal==0xff00)  {
                 aAttr.aLinBgCol=aDefAttr.aLinBgCol;
@@ -1856,6 +1866,7 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen)
                 aAttr.aImgBgCol=aDefAttr.aImgBgCol;
             }
             else {
+                Color aCol;
                 if      (nVal==0x0007) aCol=COL_WHITE;
                 else if (nVal==0x0008) aCol=COL_BLACK;
                 else if (nVal==0xff08) aCol=GetPaletteColor(0);
@@ -1869,7 +1880,6 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen)
             [[fallthrough]];
         case GOrdSBxCol: {
             sal_uInt8 nFlags;
-            Color aCol;
             pOS2MET->ReadUChar( nFlags );
             if ((nFlags&0x80)!=0) {
                 aAttr.aLinBgCol=aDefAttr.aLinBgCol;
@@ -1879,6 +1889,7 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen)
                 aAttr.aImgBgCol=aDefAttr.aImgBgCol;
             }
             else {
+                Color aCol;
                 const auto nVal = ReadLittleEndian3BytesLong();
                 if      ((nFlags&0x40)!=0 && nVal==1) aCol=COL_BLACK;
                 else if ((nFlags&0x40)!=0 && nVal==2) aCol=COL_WHITE;
@@ -2042,7 +2053,6 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen)
         case GOrdPChCel: PushAttr(nOrderID);
             [[fallthrough]];
         case GOrdSChCel: {
-            sal_uInt8 nbyte;
             sal_uInt16 nLen=nOrderLen;
             auto nWidth = ReadCoord(bCoord32);
             auto nHeight = ReadCoord(bCoord32);
@@ -2055,6 +2065,7 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen)
                 pOS2MET->SeekRel(4); nLen-=4;
             }
             if (nLen>=2) {
+                sal_uInt8 nbyte;
                 pOS2MET->ReadUChar( nbyte );
                 if ((nbyte&0x80)==0 && aAttr.aChrCellSize==Size(0,0))
                     aAttr.aChrCellSize = aDefAttr.aChrCellSize;
@@ -2109,12 +2120,12 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen)
         case GOrdPMkCel: PushAttr(nOrderID);
             [[fallthrough]];
         case GOrdSMkCel: {
-            sal_uInt8 nbyte;
             sal_uInt16 nLen=nOrderLen;
             aAttr.aMrkCellSize.setWidth(ReadCoord(bCoord32) );
             aAttr.aMrkCellSize.setHeight(ReadCoord(bCoord32) );
             if (bCoord32) nLen-=8; else nLen-=4;
             if (nLen>=2) {
+                sal_uInt8 nbyte;
                 pOS2MET->ReadUChar( nbyte );
                 if ((nbyte&0x80)==0 && aAttr.aMrkCellSize==Size(0,0))
                     aAttr.aMrkCellSize=aDefAttr.aMrkCellSize;
diff --git a/filter/source/graphicfilter/itiff/ccidecom.cxx b/filter/source/graphicfilter/itiff/ccidecom.cxx
index 9e3e37b42930..9c9b916a1d8c 100644
--- a/filter/source/graphicfilter/itiff/ccidecom.cxx
+++ b/filter/source/graphicfilter/itiff/ccidecom.cxx
@@ -793,10 +793,9 @@ bool CCIDecompressor::ReadEOL()
 
 bool CCIDecompressor::Read2DTag()
 {
-    sal_uInt8 nByte;
-
     // read a bit and return sal_True if it's 0, otherwise return sal_False
     if (nInputBitsBufSize==0) {
+        sal_uInt8 nByte;
         pIStream->ReadUChar( nByte );
         if ( nOptions & CCI_OPTION_INVERSEBITORDER )
             nByte = pByteSwap[ nByte ];
@@ -810,10 +809,9 @@ bool CCIDecompressor::Read2DTag()
 
 sal_uInt8 CCIDecompressor::ReadBlackOrWhite()
 {
-    sal_uInt8 nByte;
-
     // read a bit and deliver 0x00 if it's 0, otherwise 0xff
     if (nInputBitsBufSize==0) {
+        sal_uInt8 nByte;
         pIStream->ReadUChar( nByte );
         if ( nOptions & CCI_OPTION_INVERSEBITORDER )
             nByte = pByteSwap[ nByte ];
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 24dcabe0277e..f9f3f7197f21 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1484,10 +1484,8 @@ bool EscherPropertyContainer::CreateGraphicProperties(const uno::Reference<beans
     bool        bCreateFillStyles = false;
 
     std::unique_ptr<GraphicAttr> pGraphicAttr;
-    OUString aGraphicUrl;
     uno::Reference<graphic::XGraphic> xGraphic;
 
-    drawing::BitmapMode eBitmapMode(drawing::BitmapMode_NO_REPEAT);
     uno::Any aAny;
 
     if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, rSource ) )
@@ -1500,6 +1498,8 @@ bool EscherPropertyContainer::CreateGraphicProperties(const uno::Reference<beans
         sal_Int16 nGreen(0);
         sal_Int16 nBlue(0);
         double fGamma(1.0);
+        drawing::BitmapMode eBitmapMode(drawing::BitmapMode_NO_REPEAT);
+        OUString aGraphicUrl;
 
         sal_uInt16 nAngle = 0;
         if ( rSource == "MetaFile" )
@@ -2194,7 +2194,6 @@ bool EscherPropertyContainer::CreateConnectorProperties(
 
     if ( rXShape.is() )
     {
-        awt::Point aStartPoint, aEndPoint;
         uno::Reference<beans::XPropertySet> aXPropSet;
         uno::Reference<drawing::XShape> aShapeA, aShapeB;
         uno::Any aAny( rXShape->queryInterface( cppu::UnoType<beans::XPropertySet>::get()));
@@ -2206,10 +2205,10 @@ bool EscherPropertyContainer::CreateConnectorProperties(
                 aAny >>= eCt;
                 if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, "EdgeStartPoint" ) )
                 {
-                    aStartPoint = *o3tl::doAccess<awt::Point>(aAny);
+                    awt::Point aStartPoint = *o3tl::doAccess<awt::Point>(aAny);
                     if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, "EdgeEndPoint" ) )
                     {
-                        aEndPoint = *o3tl::doAccess<awt::Point>(aAny);
+                        awt::Point aEndPoint = *o3tl::doAccess<awt::Point>(aAny);
 
                         rShapeFlags = ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty | ShapeFlag::Connector;
                         rGeoRect = awt::Rectangle( aStartPoint.X, aStartPoint.Y,
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 08657c686369..314675319449 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -1117,10 +1117,11 @@ static void GetShadeColors( const SvxMSDffManager& rManager, const DffPropertyRe
     sal_uInt32 nPos = rIn.Tell();
     if ( rProperties.IsProperty( DFF_Prop_fillShadeColors ) )
     {
-        sal_uInt16 i = 0, nNumElem = 0, nNumElemReserved = 0, nSize = 0;
+        sal_uInt16 i = 0, nNumElem = 0;
         bool bOk = false;
         if (rProperties.SeekToContent(DFF_Prop_fillShadeColors, rIn))
         {
+            sal_uInt16 nNumElemReserved = 0, nSize = 0;
             rIn.ReadUInt16( nNumElem ).ReadUInt16( nNumElemReserved ).ReadUInt16( nSize );
             //sanity check that the stream is long enough to fulfill nNumElem * 2 sal_Int32s
             bOk = rIn.remainingSize() / (2*sizeof(sal_Int32)) >= nNumElem;
@@ -2394,11 +2395,11 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
         {
             css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > aGluePoints;
             sal_uInt16 nNumElemVert = 0;
-            sal_uInt16 nNumElemMemVert = 0;
             sal_uInt16 nElemSizeVert = 8;
 
             if ( SeekToContent( DFF_Prop_connectorPoints, rIn ) )
             {
+                sal_uInt16 nNumElemMemVert = 0;
                 rIn.ReadUInt16( nNumElemVert ).ReadUInt16( nNumElemMemVert ).ReadUInt16( nElemSizeVert );
                 // If this value is 0xFFF0 then this record is an array of truncated 8 byte elements. Only the 4
                 // low-order bytes are recorded
@@ -2783,7 +2784,6 @@ void DffPropertyReader::ImportGradientColor( SfxItemSet& aSet, sal_uInt32 eMSO_F
     //So below var is defined.
     sal_Int32 nChgColors = 0;
     sal_Int32 nAngle = GetPropertyValue( DFF_Prop_fillAngle, 0 );
-    sal_Int32 nRotateAngle = 0;
     if(nAngle >= 0)
         nChgColors ^= 1;
 
@@ -2796,7 +2796,7 @@ void DffPropertyReader::ImportGradientColor( SfxItemSet& aSet, sal_uInt32 eMSO_F
     //Rotate angle
     if ( mbRotateGranientFillWithAngle )
     {
-        nRotateAngle = GetPropertyValue( DFF_Prop_Rotation, 0 );
+        sal_Int32 nRotateAngle = GetPropertyValue( DFF_Prop_Rotation, 0 );
         if(nRotateAngle)//fixed point number
             nRotateAngle = ( static_cast<sal_Int16>( nRotateAngle >> 16) * 100L ) + ( ( ( nRotateAngle & 0x0000ffff) * 100L ) >> 16 );
         nRotateAngle = ( nRotateAngle + 5 ) / 10 ;//round up
@@ -3760,7 +3760,6 @@ static void lcl_ApplyCropping( const DffPropSet& rPropSet, SfxItemSet* pSet, Gra
 SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, const DffObjData& rObjData )
 {
     SdrObject*  pRet = nullptr;
-    OUString    aFileName;
     OUString    aLinkFileName, aLinkFilterName;
     tools::Rectangle   aVisArea;
 
@@ -3771,6 +3770,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons
     // Graphic linked
     bLinkGrf = 0 != ( eFlags & mso_blipflagLinkToFile );
     {
+        OUString aFileName;
         Graphic aGraf;  // be sure this graphic is deleted before swapping out
         if( SeekToContent( DFF_Prop_pibName, rSt ) )
             aFileName = MSDFFReadZString( rSt, GetPropertyValue( DFF_Prop_pibName, 0 ), true );
@@ -4596,7 +4596,6 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
                         // result in wrong positions in Writer and Calc, see tdf#124029.
                         // We workaround this problem, by setting a suitable viewBox.
                         bool bIsImportPPT(GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_IMPORT_PPT);
-                        css::awt::Rectangle aViewBox_LO; // in LO coordinate system
                         if (bIsImportPPT || aPieRect_MS.getWidth() == 0 ||  aPieRect_MS.getHeight() == 0)
                         { // clear item, so that default from EnhancedCustomShapeGeometry is used
                             aGeometryItem.ClearPropertyValue(sViewBox);
@@ -4605,6 +4604,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
                         {
                             double fX((aPieRect_MS.getMinX() - aEllipseRect_MS.getMinX()) / 2.0);
                             double fY((aPieRect_MS.getMinY() - aEllipseRect_MS.getMinY()) / 2.0);
+                            css::awt::Rectangle aViewBox_LO; // in LO coordinate system
                             aViewBox_LO.X = static_cast<sal_Int32>(fX);
                             aViewBox_LO.Y = static_cast<sal_Int32>(fY);
                             aViewBox_LO.Width = static_cast<sal_Int32>(aPieRect_MS.getWidth() / 2.0);
@@ -5797,7 +5797,7 @@ void SvxMSDffManager::GetFidclData( sal_uInt32 nOffsDggL )
     if (!nOffsDggL)
         return;
 
-    sal_uInt32 nDummy, nOldPos = rStCtrl.Tell();
+    sal_uInt32 nOldPos = rStCtrl.Tell();
 
     if (nOffsDggL == rStCtrl.Seek(nOffsDggL))
     {
@@ -5809,6 +5809,7 @@ void SvxMSDffManager::GetFidclData( sal_uInt32 nOffsDggL )
         {
             aDggAtomHd.SeekToContent( rStCtrl );
             sal_uInt32 nCurMaxShapeId;
+            sal_uInt32 nDummy;
             rStCtrl.ReadUInt32( nCurMaxShapeId )
                    .ReadUInt32( mnIdClusters )
                    .ReadUInt32( nDummy )
@@ -7144,9 +7145,6 @@ css::uno::Reference < css::embed::XEmbeddedObject >  SvxMSDffManager::CheckForCo
                      return xObj;
             }
 
-            // TODO/LATER: ViewAspect must be passed from outside!
-            sal_Int64 nViewAspect = embed::Aspects::MSOLE_CONTENT;
-
             // JP 26.10.2001: Bug 93374 / 91928 the writer
             // objects need the correct visarea needs the
             // correct visarea, but this is not true for
@@ -7158,6 +7156,8 @@ css::uno::Reference < css::embed::XEmbeddedObject >  SvxMSDffManager::CheckForCo
             // TODO/LATER: it might make sense in future to set the size stored in internal object
             if( !pName && ( sStarName == "swriter" || sStarName == "scalc" ) )
             {
+                // TODO/LATER: ViewAspect must be passed from outside!
+                sal_Int64 nViewAspect = embed::Aspects::MSOLE_CONTENT;
                 MapMode aMapMode( VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nViewAspect ) ) );
                 Size aSz;
                 if ( rVisArea.IsEmpty() )
@@ -7337,9 +7337,9 @@ SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage(
                 if ( nAspect != embed::Aspects::MSOLE_ICON )
                 {
                     // working with visual area can switch the object to running state
-                    awt::Size aAwtSz;
                     try
                     {
+                        awt::Size aAwtSz;
                         // the provided visual area should be used, if there is any
                         if ( rVisArea.IsEmpty() )
                         {
diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx
index 6bed0d99351f..43d31aeccd25 100644
--- a/filter/source/msfilter/mstoolbar.cxx
+++ b/filter/source/msfilter/mstoolbar.cxx
@@ -327,12 +327,11 @@ void TBCData::ImportToolBarControl( CustomToolBarImportHelper& helper, std::vect
     else if ( rHeader.getTct() == 0x0a )
     {
         aProp.Name = "CommandURL";
-        OUString sMenuBar("private:resource/menubar/");
 
         TBCMenuSpecific* pMenu = getMenuSpecific();
         if ( pMenu )
         {
-            sMenuBar += pMenu->Name();
+            OUString sMenuBar = "private:resource/menubar/" + pMenu->Name();
             aProp.Value <<= sMenuBar; // name of popup
         }
         nStyle |= ui::ItemStyle::DROP_DOWN;
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 4e2811d04772..5d29ed9a3a4f 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -628,13 +628,14 @@ void SdrEscherImport::RecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic
     {
         for ( ; i > 0; i-- )
         {
-            sal_uInt32 nIndex, nPos = rSt.Tell();
-            sal_uInt8  nDummy, nRed, nGreen, nBlue;
+            sal_uInt32 nPos = rSt.Tell();
             sal_uInt16 nChanged;
             rSt.ReadUInt16( nChanged );
             if ( nChanged & 1 )
             {
+                sal_uInt8  nDummy, nRed, nGreen, nBlue;
                 sal_uInt32 nColor = 0;
+                sal_uInt32 nIndex;
                 rSt.ReadUChar( nDummy )
                    .ReadUChar( nRed )
                    .ReadUChar( nDummy )
@@ -2121,12 +2122,12 @@ void SdrPowerPointImport::SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOpt
 
                     if ( aAt.nPersistPtr && ( aAt.nPersistPtr < m_nPersistPtrCnt ) )
                     {
-                        sal_uInt32 nId;
                         rStCtrl.Seek( m_pPersistPtr[ aAt.nPersistPtr ] );
                         DffRecordHeader aHd;
                         ReadDffRecordHeader( rStCtrl, aHd );
                         if ( aHd.nRecType == DFF_PST_ExOleObjStg )
                         {
+                            sal_uInt32 nId;
                             rStCtrl.ReadUInt32( nId );
                             aOleObjectList.emplace_back(
                                 aAt.nId, aHd.nFilePos, pShell, nRecType, aAt.nAspect );
@@ -3252,11 +3253,11 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const
                     auto nHdEndRecPos = DffPropSet::SanitizeEndPos(rSt, aHd.GetRecEndFilePos());
                     while ( ( rSt.GetError() == ERRCODE_NONE ) && ( rSt.Tell() < nHdEndRecPos ) )
                     {
-                        sal_uInt16 nType;
                         DffRecordHeader aBuGraAtomHd;
                         ReadDffRecordHeader( rSt, aBuGraAtomHd );
                         if ( aBuGraAtomHd.nRecType == PPT_PST_ExtendedBuGraAtom )
                         {
+                            sal_uInt16 nType;
                             rSt.ReadUInt16( nType );
                             Graphic aGraphic;
                             if ( SvxMSDffManager::GetBLIPDirect( rSt, aGraphic ) )
@@ -4899,7 +4900,7 @@ void PPTStyleTextPropReader::ReadParaProps( SvStream& rIn, const DffRecordHeader
             }
             if ( nMask & 0x0020 )   // buColor
             {
-                sal_uInt32 nVal32, nHiByte;
+                sal_uInt32 nVal32;
                 rIn.ReadUInt32( nVal32 );
                 if (!rIn.good())
                 {
@@ -4907,6 +4908,7 @@ void PPTStyleTextPropReader::ReadParaProps( SvStream& rIn, const DffRecordHeader
                 }
                 else
                 {
+                    sal_uInt32 nHiByte;
                     nHiByte = nVal32 >> 24;
                     if ( nHiByte <= 8 )
                         nVal32 = nHiByte | PPT_COLSCHEME;
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 169b78bfea75..09dc879f85d9 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -330,7 +330,6 @@ static OUString getMimetypeForDocument( const Reference< XComponentContext >& xC
             if ( !aDocServiceName.isEmpty() )
             {
                 // get the actual filter name
-                OUString aFilterName;
                 Reference< lang::XMultiServiceFactory > xConfigProvider =
                     configuration::theDefaultProvider::get( xContext );
                 uno::Sequence< uno::Any > aArgs( 1 );
@@ -348,6 +347,7 @@ static OUString getMimetypeForDocument( const Reference< XComponentContext >& xC
                 xSOFConfig->getByName( aDocServiceName ) >>= xApplConfig;
                 if ( xApplConfig.is() )
                 {
+                    OUString aFilterName;
                     xApplConfig->getByName( "ooSetupFactoryActualFilter" ) >>= aFilterName;
                     if( !aFilterName.isEmpty() )
                     {
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 1b8dec4d6672..8ca9eb0327d6 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -1220,11 +1220,11 @@ void SVGFilter::implGenerateMetaData()
                     }
 
                     sal_Int32 nChange(0);
-                    double fSlideDuration(0);
 
                     if( xPropSet->getPropertySetInfo()->hasPropertyByName( "Change" ) &&
                         (xPropSet->getPropertyValue( "Change" ) >>= nChange ) && nChange == 1 )
                     {
+                        double fSlideDuration(0);
                         if( xPropSet->getPropertySetInfo()->hasPropertyByName( "HighResDuration" ) &&
                             (xPropSet->getPropertyValue( "HighResDuration" ) >>= fSlideDuration) )
                         {
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 4a35b01e9dfd..5790836fbb6d 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -342,7 +342,7 @@ void SVGAttributeWriter::SetFontAttr( const vcl::Font& rFont )
     if( rFont == rCurFont )
         return;
 
-    OUString  aFontStyle, aTextDecoration;
+    OUString  aFontStyle;
     sal_Int32        nFontWeight;
 
     rCurFont = rFont;
@@ -387,6 +387,7 @@ void SVGAttributeWriter::SetFontAttr( const vcl::Font& rFont )
 
     if( mrExport.IsUseNativeTextDecoration() )
     {
+        OUString aTextDecoration;
         if( rFont.GetUnderline() != LINESTYLE_NONE || rFont.GetStrikeout() != STRIKEOUT_NONE )
         {
             if( rFont.GetUnderline() != LINESTYLE_NONE )
@@ -1122,9 +1123,6 @@ bool SVGTextWriter::nextTextPortion()
     mbIsPlaceholderShape = false;
     if( mrTextPortionEnumeration.is() && mrTextPortionEnumeration->hasMoreElements() )
     {
-#if OSL_DEBUG_LEVEL > 0
-        OUString sInfo;
-#endif
         Reference< XPropertySet > xPortionPropSet( mrTextPortionEnumeration->nextElement(), UNO_QUERY );
         Reference< XPropertySetInfo > xPortionPropInfo( xPortionPropSet->getPropertySetInfo() );
         Reference < XTextRange > xPortionTextRange( xPortionPropSet, UNO_QUERY);
@@ -1132,6 +1130,7 @@ bool SVGTextWriter::nextTextPortion()
                 && xPortionPropInfo->hasPropertyByName( "TextPortionType" ) )
         {
 #if OSL_DEBUG_LEVEL > 0
+            OUString sInfo;
             OUString sPortionType;
             if( xPortionPropSet->getPropertyValue( "TextPortionType" ) >>= sPortionType )
             {
@@ -2788,7 +2787,6 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
 
     bool bCached = false;
     Graphic aGraphic;
-    bool bPNG = false;
     bool bJPG = false;
     if (pShape)
     {
@@ -2798,6 +2796,7 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
             const BitmapEx& rGraphicBitmap = aGraphic.GetBitmapExRef();
             if (rGraphicBitmap.GetChecksum() == rBmpEx.GetChecksum())
             {
+                bool bPNG = false;
                 GfxLink aGfxLink = aGraphic.GetGfxLink();
                 if (aGfxLink.GetType() == GfxLinkType::NativePng)
                 {
diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx
index 13a1841f7f7e..ddc50a74ab62 100644
--- a/filter/source/t602/t602filter.cxx
+++ b/filter/source/t602/t602filter.cxx
@@ -610,7 +610,6 @@ sal_Int16 T602ImportFilter::readnum(unsigned char *ch, bool show)
 unsigned char T602ImportFilter::Setformat602(const char *cmd)
 {
     unsigned char ch;
-    sal_Int16 i;
 
     ch = Readchar602();
 
@@ -637,7 +636,7 @@ unsigned char T602ImportFilter::Setformat602(const char *cmd)
     else if (cmd[0]=='P' && cmd[1]=='L')  format602.pl = readnum(&ch,false);
     else if (cmd[0]=='P' && cmd[1]=='A') { if(pst.pars) par602(true); }
     else if (cmd[0]=='C' && cmd[1]=='P') {
-        i = readnum(&ch,false);
+        sal_Int16 i = readnum(&ch,false);
         if ((i+pst.pars/2) > (format602.pl-format602.mt-format602.mb))
             if(pst.pars) par602(true);
     }
commit c87da778e35214655c8cf825ea46cb720426c5d7
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Fri Oct 2 09:35:48 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Oct 2 10:52:56 2020 +0200

    loplugin:reducevarscope in dbaccess
    
    Change-Id: I22163b3303ae0c2326d079a18fa8906f38aa1d4f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103810
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/dbaccess/qa/extras/dialog-save.cxx b/dbaccess/qa/extras/dialog-save.cxx
index a336a66e31e4..af7b9fda3f8e 100644
--- a/dbaccess/qa/extras/dialog-save.cxx
+++ b/dbaccess/qa/extras/dialog-save.cxx
@@ -55,7 +55,6 @@ void DialogSaveTest::test()
     // be locked anyway:
     SolarMutexReleaser rel;
 
-    const OUString sStandard("Standard");
     const OUString aFileName(m_directories.getURLFromWorkdir("CppunitTest/testDialogSave.odb"));
     {
         uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName);
@@ -68,6 +67,7 @@ void DialogSaveTest::test()
         uno::Reference< script::XStorageBasedLibraryContainer > xStorDlgLib(xDocScr->getDialogLibraries());
         CPPUNIT_ASSERT(xStorDlgLib.is());
         uno::Reference< script::XLibraryContainer > xDlgLib(xStorDlgLib, UNO_QUERY_THROW);
+        const OUString sStandard("Standard");
         xBasLib->loadLibrary(sStandard);
         CPPUNIT_ASSERT(xBasLib->isLibraryLoaded(sStandard));
         // the whole point of this test is to test the "save" operation
diff --git a/dbaccess/qa/extras/empty-stdlib-save.cxx b/dbaccess/qa/extras/empty-stdlib-save.cxx
index cce32ed08885..ea9c660a4e87 100644
--- a/dbaccess/qa/extras/empty-stdlib-save.cxx
+++ b/dbaccess/qa/extras/empty-stdlib-save.cxx
@@ -53,7 +53,6 @@ void DialogSaveTest::test()
     // be locked anyway:
     SolarMutexReleaser rel;
 
-    const OUString sStandard("Standard");
     const OUString aFileName(m_directories.getURLFromWorkdir("CppunitTest/testEmptyStdlibSave.odb"));
     {
         uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName);
@@ -66,6 +65,7 @@ void DialogSaveTest::test()
         uno::Reference< script::XStorageBasedLibraryContainer > xStorDlgLib(xDocScr->getDialogLibraries());
         CPPUNIT_ASSERT(xStorDlgLib.is());
         uno::Reference< script::XLibraryContainer > xDlgLib(xStorDlgLib, UNO_QUERY_THROW);
+        const OUString sStandard("Standard");
         xBasLib->loadLibrary(sStandard);
         xDlgLib->loadLibrary(sStandard);
         CPPUNIT_ASSERT(xBasLib->isLibraryLoaded(sStandard));
diff --git a/dbaccess/qa/extras/nolib-save.cxx b/dbaccess/qa/extras/nolib-save.cxx
index b42171ce2676..5914511e6dbe 100644
--- a/dbaccess/qa/extras/nolib-save.cxx
+++ b/dbaccess/qa/extras/nolib-save.cxx
@@ -53,7 +53,6 @@ void DialogSaveTest::test()
     // be locked anyway:
     SolarMutexReleaser rel;
 
-    const OUString sStandard("Standard");
     const OUString aFileName(m_directories.getURLFromWorkdir("CppunitTest/testNolibSave.odb"));
     {
         uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName);
@@ -66,6 +65,7 @@ void DialogSaveTest::test()
         uno::Reference< script::XStorageBasedLibraryContainer > xStorDlgLib(xDocScr->getDialogLibraries());
         CPPUNIT_ASSERT(xStorDlgLib.is());
         uno::Reference< script::XLibraryContainer > xDlgLib(xStorDlgLib, UNO_QUERY_THROW);
+        const OUString sStandard("Standard");
         xBasLib->loadLibrary(sStandard);
         xDlgLib->loadLibrary(sStandard);
         CPPUNIT_ASSERT(xBasLib->isLibraryLoaded(sStandard));
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index 06745cacabcc..6ca83d6d9879 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -1314,7 +1314,7 @@ OUString OSingleSelectQueryComposer::getTableAlias(const Reference< XPropertySet
     OUString sReturn;
     if(m_pTables && m_pTables->getCount() > 1)
     {
-        OUString aCatalog,aSchema,aTable,aComposedName,aColumnName;
+        OUString aCatalog,aSchema,aTable,aColumnName;
         if(column->getPropertySetInfo()->hasPropertyByName(PROPERTY_CATALOGNAME))
             column->getPropertyValue(PROPERTY_CATALOGNAME)  >>= aCatalog;
         if(column->getPropertySetInfo()->hasPropertyByName(PROPERTY_SCHEMANAME))
@@ -1343,7 +1343,7 @@ OUString OSingleSelectQueryComposer::getTableAlias(const Reference< XPropertySet
         }
         else
         {
-            aComposedName = ::dbtools::composeTableName( m_xMetaData, aCatalog, aSchema, aTable, false, ::dbtools::EComposeRule::InDataManipulation );
+            OUString aComposedName = ::dbtools::composeTableName( m_xMetaData, aCatalog, aSchema, aTable, false, ::dbtools::EComposeRule::InDataManipulation );
 
             // Is this the right case for the table name?
             // Else, look for it with different case, if applicable.
diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx
index 61405b41e464..2da2c3350a91 100644
--- a/dbaccess/source/core/api/tablecontainer.cxx
+++ b/dbaccess/source/core/api/tablecontainer.cxx
@@ -335,12 +335,13 @@ void OTableContainer::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
         xDrop->dropByName(_sElementName);
     else
     {
-        OUString sCatalog,sSchema,sTable,sComposedName;
+        OUString sComposedName;
 
         bool bIsView = false;
         Reference<XPropertySet> xTable(getObject(_nPos),UNO_QUERY);
         if ( xTable.is() && m_xMetaData.is() )
         {
+            OUString sSchema,sCatalog,sTable;
             if (m_xMetaData->supportsCatalogsInTableDefinitions())
                 xTable->getPropertyValue(PROPERTY_CATALOGNAME)  >>= sCatalog;
             if (m_xMetaData->supportsSchemasInTableDefinitions())
diff --git a/dbaccess/source/core/api/viewcontainer.cxx b/dbaccess/source/core/api/viewcontainer.cxx
index 690df713923d..796e23c9f49d 100644
--- a/dbaccess/source/core/api/viewcontainer.cxx
+++ b/dbaccess/source/core/api/viewcontainer.cxx
@@ -154,11 +154,12 @@ void OViewContainer::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
         xDrop->dropByName(_sElementName);
     else
     {
-        OUString sCatalog,sSchema,sTable,sComposedName;
+        OUString sComposedName;
 
         Reference<XPropertySet> xTable(getObject(_nPos),UNO_QUERY);
         if ( xTable.is() )
         {
+            OUString sCatalog,sSchema,sTable;
             xTable->getPropertyValue(PROPERTY_CATALOGNAME)  >>= sCatalog;
             xTable->getPropertyValue(PROPERTY_SCHEMANAME)   >>= sSchema;
             xTable->getPropertyValue(PROPERTY_NAME)         >>= sTable;
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index f8818f11d7ed..b6c1c16ffca5 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -2338,10 +2338,9 @@ sal_Int8 OApplicationController::queryDrop( const AcceptDropEvent& _rEvt, const
                 if ( nAction != DND_ACTION_NONE )
                 {
                     auto xHitEntry = pView->getEntry(_rEvt.maPosPixel);
-                    OUString sName;
                     if (xHitEntry)
                     {
-                        sName = pView->getQualifiedName(xHitEntry.get());
+                        OUString sName = pView->getQualifiedName(xHitEntry.get());
                         if ( !sName.isEmpty() )
                         {
                             Reference< XHierarchicalNameAccess > xContainer(getElements(pView->getElementType()),UNO_QUERY);
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 13b6ceac29cd..5d86042a92c6 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -1126,9 +1126,9 @@ void SbaGridControl::DoFieldDrag(sal_uInt16 nColumnPos, sal_Int16 nRowPos)
     // the old implementation copied a SBA_FIELDDATAEXCHANGE_FORMAT, too, (which was rather expensive to obtain),
     // but we have no client for this DnD format anymore (the mail part of SO 5.2 was the only client)
 
-    OUString sCellText;
     try
     {
+        OUString sCellText;
         Reference< XGridFieldDataSupplier >  xFieldData(static_cast< XGridPeer* >(GetPeer()), UNO_QUERY);
         Sequence<sal_Bool> aSupportingText = xFieldData->queryFieldDataType(cppu::UnoType<decltype(sCellText)>::get());
         if (aSupportingText.getConstArray()[nColumnPos])
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index 28f3c9662500..f0d9b9ee4468 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -1278,11 +1278,10 @@ OUString OFieldDescControl::getControlDefault( const OFieldDescription* _pFieldD
     bool bCheck = !_bCheck || _pFieldDescr->GetControlDefault().hasValue();
     if ( bCheck )
     {
-        sal_uInt32 nFormatKey;
-
         try
         {
             double nValue = 0.0;
+            sal_uInt32 nFormatKey;
             bool bTextFormat = isTextFormat(_pFieldDescr,nFormatKey);
             if ( _pFieldDescr->GetControlDefault() >>= sDefault )
             {
diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx
index 3e63f9424fce..a3e24939709f 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.cxx
+++ b/dbaccess/source/ui/dlg/UserAdmin.cxx
@@ -220,10 +220,10 @@ IMPL_LINK(OUserAdmin, UserHdl, weld::Button&, rButton, void)
                 m_xUsers->getByName(sName) >>= xUser;
                 if(xUser.is())
                 {
-                    OUString sNewPassword,sOldPassword;
                     OPasswordDialog aDlg(GetFrameWeld(), sName);
                     if (aDlg.run() == RET_OK)
                     {
+                        OUString sNewPassword,sOldPassword;
                         sNewPassword = aDlg.GetNewPassword();
                         sOldPassword = aDlg.GetOldPassword();
 
diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx
index 5eeb86ef0869..56db11946315 100644
--- a/dbaccess/source/ui/dlg/queryfilter.cxx
+++ b/dbaccess/source/ui/dlg/queryfilter.cxx
@@ -282,12 +282,12 @@ bool DlgFilterCrit::getCondition(const weld::ComboBox& _rField,const weld::Combo
     bool bHaving = false;
     try
     {
-        OUString sTableName;
         _rFilter.Name = _rField.get_active_text();
         Reference< XPropertySet > xColumn = getQueryColumn(_rFilter.Name);
         if ( xColumn.is() )
         {
             bool bFunction = false;
+            OUString sTableName;
             Reference< XPropertySetInfo > xInfo = xColumn->getPropertySetInfo();
             if ( xInfo->hasPropertyByName(PROPERTY_REALNAME) )
             {
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index 46b6c83f5692..d75ea241ed95 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -1285,9 +1285,9 @@ bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentCon
 
     if ( !_bMove || sNewName.isEmpty() )
     {
-        OUString sTargetName,sLabel;
         if ( sNewName.isEmpty() || xNameAccess->hasByName(sNewName) )
         {
+            OUString sLabel, sTargetName;
             if ( !sNewName.isEmpty() )
                 sTargetName = sNewName;
             else
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 487d6bce42ce..96e44ab6e68d 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -238,7 +238,6 @@ namespace
         bool bErg = false;
 
         OUString aTableRange,aColumnName;
-        sal_uInt16 nCntAccount;
         ::connectivity::OSQLParseTreeIterator& rParseIter = static_cast<OQueryController&>(_pView->getController()).getParseIterator();
         rParseIter.getColumnRange( pColumnRef, aColumnName, aTableRange );
 
@@ -249,6 +248,7 @@ namespace
         }
         if ( !bErg )
         {
+            sal_uInt16 nCntAccount;
             bErg = static_cast<OQueryTableView*>(_pView->getTableView())->FindTableFromField(aColumnName, _rDragInfo, nCntAccount);
             if ( !bErg )
                 bErg = _pView->HasFieldByAliasName(aColumnName, _rDragInfo);
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 31c67a71f124..b6ef3fedff6c 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -463,7 +463,6 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
             SQLExceptionInfo aError;
             try
             {
-                OUString aErrorMsg;
                 setStatement_fireEvent( getContainer()->getStatement() );
                 if(m_sStatement.isEmpty() && m_pSqlIterator)
                 {
@@ -475,6 +474,7 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
                 }
                 else
                 {
+                    OUString aErrorMsg;
                     std::unique_ptr<::connectivity::OSQLParseNode> pNode = m_aSqlParser.parseTree(aErrorMsg,m_sStatement,m_bGraphicalDesign);
                     if ( pNode )
                     {


More information about the Libreoffice-commits mailing list