summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-10-01 11:01:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-01 12:19:27 +0200
commitcc2b7c1f930bc05253153f3c8381fb4fb352f3ca (patch)
tree0a285ec4c67933a58fcf4ca991bfc745e715e059 /vcl/source
parent5ed9f4638e1ff12b3246a66ffee8dd9dd74b9693 (diff)
loplugin:reducevarscope in vcl
Change-Id: I768aa9bd87913bc20351fb631a6326fe01f777b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103748 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/bitmap/BitmapScaleSuperFilter.cxx4
-rw-r--r--vcl/source/control/button.cxx4
-rw-r--r--vcl/source/control/field.cxx7
-rw-r--r--vcl/source/control/imp_listbox.cxx3
-rw-r--r--vcl/source/control/slider.cxx3
-rw-r--r--vcl/source/filter/graphicfilter2.cxx23
-rw-r--r--vcl/source/filter/igif/decode.cxx3
-rw-r--r--vcl/source/filter/igif/gifread.cxx6
-rw-r--r--vcl/source/fontsubset/ttcr.cxx6
-rw-r--r--vcl/source/gdi/bitmapex.cxx5
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx5
-rw-r--r--vcl/source/gdi/svmconverter.cxx3
-rw-r--r--vcl/source/graphic/GraphicObject.cxx5
-rw-r--r--vcl/source/outdev/text.cxx9
-rw-r--r--vcl/source/treelist/imap.cxx2
-rw-r--r--vcl/source/treelist/treelistbox.cxx7
-rw-r--r--vcl/source/window/dlgctrl.cxx4
-rw-r--r--vcl/source/window/menu.cxx4
-rw-r--r--vcl/source/window/winproc.cxx12
19 files changed, 48 insertions, 67 deletions
diff --git a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx
index 42d2897143f0..97ceeb45ad35 100644
--- a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx
+++ b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx
@@ -861,7 +861,7 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) const
const long nDstW = FRound(aSizePix.Width() * fScaleX);
const long nDstH = FRound(aSizePix.Height() * fScaleY);
- const double fScaleThresh = 0.6;
+ constexpr double fScaleThresh = 0.6;
if (nDstW <= 1 || nDstH <= 1)
return BitmapEx();
@@ -898,7 +898,6 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) const
BitmapScopedWriteAccess pWriteAccess(aOutBmp);
- const long nStartY = 0;
const long nEndY = nDstH - 1;
if (pReadAccess && pWriteAccess)
@@ -967,6 +966,7 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) const
// A large source image.
bool bHorizontalWork = pReadAccess->Height() >= 512 && pReadAccess->Width() >= 512;
bool bUseThreads = true;
+ const long nStartY = 0;
static bool bDisableThreadedScaling = getenv ("VCL_NO_THREAD_SCALE");
if (bDisableThreadedScaling || !bHorizontalWork)
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index bc173254efbf..f96f8c0a57c4 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -236,11 +236,9 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
Size aTextSize;
Size aSymbolSize;
Size aDeviceTextSize;
- Size aMax;
Point aImagePos = rPos;
Point aTextPos = rPos;
tools::Rectangle aUnion(aImagePos, aImageSize);
- tools::Rectangle aSymbol;
long nSymbolHeight = 0;
if (bDrawText || bHasSymbol)
@@ -253,6 +251,7 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
if (bHasSymbol)
{
+ tools::Rectangle aSymbol;
if (bDrawText)
{
nSymbolHeight = pDev->GetTextHeight();
@@ -311,6 +310,7 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
}
}
+ Size aMax;
aMax.setWidth( std::max(aTSSize.Width(), aImageSize.Width()) );
aMax.setHeight( std::max(aTSSize.Height(), aImageSize.Height()) );
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 23bd0d14ad1e..2f7f08f40f2c 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -157,10 +157,10 @@ bool ImplNumericGetValue( const OUString& rStr, sal_Int64& rValue,
bool bCurrency = false )
{
OUString aStr = rStr;
- OUStringBuffer aStr1, aStr2, aStrFrac, aStrNum, aStrDenom;
+ OUStringBuffer aStr1, aStr2, aStrNum, aStrDenom;
bool bNegative = false;
bool bFrac = false;
- sal_Int32 nDecPos, nFracDivPos, nFracNumPos;
+ sal_Int32 nDecPos, nFracDivPos;
sal_Int64 nValue;
// react on empty string
@@ -182,7 +182,7 @@ bool ImplNumericGetValue( const OUString& rStr, sal_Int64& rValue,
if (nFracDivPos > 0)
{
bFrac = true;
- nFracNumPos = aStr.lastIndexOf(' ', nFracDivPos);
+ sal_Int32 nFracNumPos = aStr.lastIndexOf(' ', nFracDivPos);
// If in "a b/c" format.
if(nFracNumPos != -1 )
@@ -310,6 +310,7 @@ bool ImplNumericGetValue( const OUString& rStr, sal_Int64& rValue,
sal_Int64 nDenom = aStrDenom.makeStringAndClear().toInt64();
if (nDenom == 0) return false; // Division by zero
double nFrac2Dec = nWholeNum + static_cast<double>(nNum)/nDenom; // Convert to double for floating point precision
+ OUStringBuffer aStrFrac;
aStrFrac.append(nFrac2Dec);
// Reconvert division result to string and parse
nDecPos = aStrFrac.indexOf('.');
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index a11d0eb8ba7c..22d26a3ef076 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -1662,14 +1662,13 @@ void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32
nPos = mnUserDrawEntry; // real entry, not the matching entry from MRU
long nY = mpEntryList->GetAddedHeight(nPos, mnTop);
- Size aImgSz;
if (bDrawImage && mpEntryList->HasImages())
{
Image aImage = mpEntryList->GetEntryImage(nPos);
if (!!aImage)
{
- aImgSz = aImage.GetSizePixel();
+ Size aImgSz = aImage.GetSizePixel();
Point aPtImg(gnBorder - mnLeft, nY + ((nEntryHeight - aImgSz.Height()) / 2));
if (!IsZoom())
diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx
index 24c84d0a3a3e..f25cd384d68c 100644
--- a/vcl/source/control/slider.cxx
+++ b/vcl/source/control/slider.cxx
@@ -355,7 +355,6 @@ void Slider::ImplDraw(vcl::RenderContext& rRenderContext)
}
DecorationView aDecoView(&rRenderContext);
- DrawButtonFlags nStyle;
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
bool bEnabled = IsEnabled();
@@ -449,7 +448,7 @@ void Slider::ImplDraw(vcl::RenderContext& rRenderContext)
if (bEnabled)
{
- nStyle = DrawButtonFlags::NONE;
+ DrawButtonFlags nStyle = DrawButtonFlags::NONE;
if (mnStateFlags & SLIDER_STATE_THUMB_DOWN)
nStyle |= DrawButtonFlags::Pressed;
aDecoView.DrawButton(maThumbRect, nStyle);
diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx
index 0faaaeb81997..3d71a6b3b96a 100644
--- a/vcl/source/filter/graphicfilter2.cxx
+++ b/vcl/source/filter/graphicfilter2.cxx
@@ -179,9 +179,7 @@ bool GraphicDescriptor::ImpDetectBMP( SvStream& rStm, bool bExtendedInfo )
bool GraphicDescriptor::ImpDetectGIF( SvStream& rStm, bool bExtendedInfo )
{
sal_uInt32 n32 = 0;
- sal_uInt16 n16 = 0;
bool bRet = false;
- sal_uInt8 cByte = 0;
sal_Int32 nStmPos = rStm.Tell();
rStm.SetEndian( SvStreamEndian::LITTLE );
@@ -189,6 +187,7 @@ bool GraphicDescriptor::ImpDetectGIF( SvStream& rStm, bool bExtendedInfo )
if ( n32 == 0x38464947 )
{
+ sal_uInt16 n16 = 0;
rStm.ReadUInt16( n16 );
if ( ( n16 == 0x6137 ) || ( n16 == 0x6139 ) )
{
@@ -198,6 +197,7 @@ bool GraphicDescriptor::ImpDetectGIF( SvStream& rStm, bool bExtendedInfo )
if ( bExtendedInfo )
{
sal_uInt16 nTemp16 = 0;
+ sal_uInt8 cByte = 0;
// Pixel width
rStm.ReadUInt16( nTemp16 );
@@ -455,14 +455,6 @@ bool GraphicDescriptor::ImpDetectPCX( SvStream& rStm )
{
nFormat = GraphicFileFormat::PCX;
- sal_uInt16 nTemp16;
- sal_uInt16 nXmin;
- sal_uInt16 nXmax;
- sal_uInt16 nYmin;
- sal_uInt16 nYmax;
- sal_uInt16 nDPIx;
- sal_uInt16 nDPIy;
-
rStm.SeekRel( 1 );
// compression
@@ -471,6 +463,14 @@ bool GraphicDescriptor::ImpDetectPCX( SvStream& rStm )
bRet = (cByte==0 || cByte ==1);
if (bRet)
{
+ sal_uInt16 nTemp16;
+ sal_uInt16 nXmin;
+ sal_uInt16 nXmax;
+ sal_uInt16 nYmin;
+ sal_uInt16 nYmax;
+ sal_uInt16 nDPIx;
+ sal_uInt16 nDPIy;
+
// Bits/Pixel
rStm.ReadUChar( cByte );
nBitsPerPixel = cByte;
@@ -986,14 +986,13 @@ bool GraphicDescriptor::ImpDetectSVM( SvStream& rStm, bool bExtendedInfo )
{
sal_uInt32 n32 = 0;
bool bRet = false;
- sal_uInt8 cByte = 0;
sal_Int32 nStmPos = rStm.Tell();
rStm.SetEndian( SvStreamEndian::LITTLE );
rStm.ReadUInt32( n32 );
if ( n32 == 0x44475653 )
{
- cByte = 0;
+ sal_uInt8 cByte = 0;
rStm.ReadUChar( cByte );
if ( cByte == 0x49 )
{
diff --git a/vcl/source/filter/igif/decode.cxx b/vcl/source/filter/igif/decode.cxx
index 7a2af0f7916e..b062593a9e48 100644
--- a/vcl/source/filter/igif/decode.cxx
+++ b/vcl/source/filter/igif/decode.cxx
@@ -129,7 +129,6 @@ bool GIFLZWDecompressor::AddToTable( sal_uInt16 nPrevCode, sal_uInt16 nCodeFirst
bool GIFLZWDecompressor::ProcessOneCode()
{
- sal_uInt16 nCode;
bool bRet = false;
bool bEndOfBlock = false;
@@ -148,7 +147,7 @@ bool GIFLZWDecompressor::ProcessOneCode()
if ( !bEndOfBlock )
{
// fetch code from input buffer
- nCode = sal::static_int_cast< sal_uInt16 >(
+ sal_uInt16 nCode = sal::static_int_cast< sal_uInt16 >(
static_cast<sal_uInt16>(nInputBitsBuf) & ( ~( 0xffff << nCodeSize ) ));
nInputBitsBuf >>= nCodeSize;
nInputBitsBufSize = nInputBitsBufSize - nCodeSize;
diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx
index ddbf7ae0aea6..07f29e9d384c 100644
--- a/vcl/source/filter/igif/gifread.cxx
+++ b/vcl/source/filter/igif/gifread.cxx
@@ -253,8 +253,6 @@ void GIFReader::CreateBitmaps(long nWidth, long nHeight, BitmapPalette* pPal,
bool GIFReader::ReadGlobalHeader()
{
char pBuf[ 7 ];
- sal_uInt8 nRF;
- sal_uInt8 nAspect;
bool bRet = false;
rIStm.ReadBytes( pBuf, 6 );
@@ -266,6 +264,8 @@ bool GIFReader::ReadGlobalHeader()
rIStm.ReadBytes( pBuf, 7 );
if( NO_PENDING( rIStm ) )
{
+ sal_uInt8 nAspect;
+ sal_uInt8 nRF;
SvMemoryStream aMemStm;
aMemStm.SetBuffer( pBuf, 7, 7 );
@@ -510,7 +510,6 @@ bool GIFReader::ReadLocalHeader()
sal_uLong GIFReader::ReadNextBlock()
{
sal_uLong nRet = 0;
- sal_uLong nRead;
sal_uInt8 cBlockSize;
rIStm.ReadUChar( cBlockSize );
@@ -532,6 +531,7 @@ sal_uLong GIFReader::ReadNextBlock()
else
{
bool bEOI;
+ sal_uLong nRead;
sal_uInt8* pTarget = pDecomp->DecompressBlock( aSrcBuf.data(), cBlockSize, nRead, bEOI );
nRet = ( bEOI ? 3 : 1 );
diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx
index b3e502d7ce7f..b9839b727f40 100644
--- a/vcl/source/fontsubset/ttcr.cxx
+++ b/vcl/source/fontsubset/ttcr.cxx
@@ -272,13 +272,12 @@ SFErrCodes StreamToFile(TrueTypeCreator *_this, const char* fname)
sal_uInt8 *ptr;
sal_uInt32 length;
SFErrCodes r;
- FILE* fd;
if ((r = StreamToMemory(_this, &ptr, &length)) != SFErrCodes::Ok) return r;
r = SFErrCodes::BadFile;
if (fname)
{
- fd = fopen(fname, "wb");
+ FILE* fd = fopen(fname, "wb");
if (fd)
{
if (fwrite(ptr, 1, length, fd) != length) {
@@ -1262,7 +1261,6 @@ static void ProcessTables(TrueTypeCreator *tt)
listToFirst(glyphlist);
do {
GlyphData *gd = static_cast<GlyphData *>(listCurrent(glyphlist));
- sal_Int16 z;
glyfLen += gd->nbytes;
/* XXX if (gd->nbytes & 1) glyfLen++; */
@@ -1273,7 +1271,7 @@ static void ProcessTables(TrueTypeCreator *tt)
/* printf("IDs: %d %d.\n", gd->glyphID, gd->newID); */
if (gd->nbytes != 0) {
- z = GetInt16(gd->ptr, 2);
+ sal_Int16 z = GetInt16(gd->ptr, 2);
if (z < xMin) xMin = z;
z = GetInt16(gd->ptr, 4);
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 8dbe7bc1fbc9..2ec48738f2a1 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -289,7 +289,6 @@ BitmapChecksum BitmapEx::GetChecksum() const
{
BitmapChecksum nCrc = maBitmap.GetChecksum();
SVBT32 aBT32;
- BitmapChecksumOctetArray aBCOA;
UInt32ToSVBT32( o3tl::underlyingEnumValue(meTransparent), aBT32 );
nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
@@ -299,6 +298,7 @@ BitmapChecksum BitmapEx::GetChecksum() const
if( ( TransparentType::Bitmap == meTransparent ) && !maMask.IsEmpty() )
{
+ BitmapChecksumOctetArray aBCOA;
BCToBCOA( maMask.GetChecksum(), aBCOA );
nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE );
}
@@ -630,7 +630,6 @@ BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx const & aBitmap, const long aStanda
double imgOldWidth = aRet.GetSizePixel().Width();
double imgOldHeight = aRet.GetSizePixel().Height();
- Size aScaledSize;
if (imgOldWidth >= aStandardSize || imgOldHeight >= aStandardSize)
{
sal_Int32 imgNewWidth = 0;
@@ -650,7 +649,7 @@ BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx const & aBitmap, const long aStanda
imgposX = (aStandardSize - (imgOldWidth / (imgOldHeight / aStandardSize) + 0.5)) / 2 + 0.5;
}
- aScaledSize = Size( imgNewWidth, imgNewHeight );
+ Size aScaledSize( imgNewWidth, imgNewHeight );
aRet.Scale( aScaledSize, BmpScaleFlag::BestQuality );
}
else
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index b8c9614359c7..b21c9ad14407 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6579,18 +6579,17 @@ void PDFWriterImpl::drawText( const tools::Rectangle& rRect, const OUString& rOr
// multiline text
if ( nStyle & DrawTextFlags::MultiLine )
{
- OUString aLastLine;
ImplMultiTextLineInfo aMultiLineInfo;
ImplTextLineInfo* pLineInfo;
sal_Int32 i;
- sal_Int32 nLines;
sal_Int32 nFormatLines;
if ( nTextHeight )
{
vcl::DefaultTextLayout aLayout( *this );
+ OUString aLastLine;
OutputDevice::ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, aLayout );
- nLines = nHeight/nTextHeight;
+ sal_Int32 nLines = nHeight/nTextHeight;
nFormatLines = aMultiLineInfo.Count();
if ( !nLines )
nLines = 1;
diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index d65b6c52f796..d0b1ac953d80 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -714,7 +714,6 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
OUString aStr(OStringToOUString(aByteStr, eActualCharSet));
std::unique_ptr<long[]> pDXAry;
- sal_Int32 nDXAryLen = 0;
if (nAryLen > 0)
{
const size_t nMinRecordSize = sizeof(sal_Int32);
@@ -728,7 +727,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
sal_Int32 nStrLen( aStr.getLength() );
- nDXAryLen = std::max(nAryLen, nStrLen);
+ sal_Int32 nDXAryLen = std::max(nAryLen, nStrLen);
if (nDXAryLen < nLen)
{
diff --git a/vcl/source/graphic/GraphicObject.cxx b/vcl/source/graphic/GraphicObject.cxx
index 0447bddfd637..1e83722a559b 100644
--- a/vcl/source/graphic/GraphicObject.cxx
+++ b/vcl/source/graphic/GraphicObject.cxx
@@ -466,9 +466,6 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
bool bCropped = aAttr.IsCropped();
bool bRet;
- // #i29534# Provide output rects for PDF writer
- tools::Rectangle aCropRect;
-
pOut->SetDrawMode( nOldDrawMode & ~DrawModeFlags( DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill | DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient ) );
// mirrored horizontically
@@ -501,7 +498,7 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
{
// #i29534# Store crop rect for later forwarding to
// PDF writer
- aCropRect = aClipPolyPoly.GetBoundRect();
+ tools::Rectangle aCropRect = aClipPolyPoly.GetBoundRect();
pOut->IntersectClipRegion( aCropRect );
}
else
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index ac4b10eef3b0..1123aa39bb77 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -522,7 +522,6 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
// is broken into more than two lines ...
if ( xHyph.is() )
{
- sal_Unicode cAlternateReplChar = 0;
css::i18n::Boundary aBoundary = xBI->getWordBoundary( rStr, nBreakPos, rDefLocale, css::i18n::WordType::DICTIONARY_WORD, true );
sal_Int32 nWordStart = nPos;
sal_Int32 nWordEnd = aBoundary.endPos;
@@ -592,6 +591,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
SAL_WARN_IF( ( nAltEnd - nAltStart ) != 1, "vcl", "Alternate: Wrong assumption!" );
+ sal_Unicode cAlternateReplChar = 0;
if ( nTxtEnd > nTxtStart )
cAlternateReplChar = aAlt[ nAltStart ];
@@ -1538,17 +1538,16 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Recta
if ( nStyle & DrawTextFlags::MultiLine )
{
- OUString aLastLine;
ImplMultiTextLineInfo aMultiLineInfo;
ImplTextLineInfo* pLineInfo;
sal_Int32 i;
- sal_Int32 nLines;
sal_Int32 nFormatLines;
if ( nTextHeight )
{
long nMaxTextWidth = ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, _rLayout );
- nLines = static_cast<sal_Int32>(nHeight/nTextHeight);
+ sal_Int32 nLines = static_cast<sal_Int32>(nHeight/nTextHeight);
+ OUString aLastLine;
nFormatLines = aMultiLineInfo.Count();
if (nLines <= 0)
nLines = 1;
@@ -2292,9 +2291,9 @@ bool OutputDevice::GetTextBoundRect( tools::Rectangle& rRect,
pSalLayout = ImplLayout(rStr, nIndex, nLen, aPoint, nLayoutWidth, pDXAry, eDefaultLayout,
nullptr, pGlyphs);
- tools::Rectangle aPixelRect;
if( pSalLayout )
{
+ tools::Rectangle aPixelRect;
bRet = pSalLayout->GetBoundRect(aPixelRect);
if( bRet )
diff --git a/vcl/source/treelist/imap.cxx b/vcl/source/treelist/imap.cxx
index b2e5989a94b0..474b8be723a4 100644
--- a/vcl/source/treelist/imap.cxx
+++ b/vcl/source/treelist/imap.cxx
@@ -956,7 +956,6 @@ void ImageMap::Read( SvStream& rIStm )
{
char cMagic[6];
SvStreamEndian nOldFormat = rIStm.GetEndian();
- sal_uInt16 nCount;
rIStm.SetEndian( SvStreamEndian::LITTLE );
rIStm.ReadBytes(cMagic, sizeof(cMagic));
@@ -964,6 +963,7 @@ void ImageMap::Read( SvStream& rIStm )
if ( !memcmp( cMagic, IMAPMAGIC, sizeof( cMagic ) ) )
{
IMapCompat* pCompat;
+ sal_uInt16 nCount;
// delete old content
ClearImageMap();
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx
index 7ee2a50b33a7..05b3d9d2a891 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -3198,14 +3198,9 @@ void SvTreeListBox::Invalidate( const tools::Rectangle& rRect, InvalidateFlags n
void SvTreeListBox::SetHighlightRange( sal_uInt16 nStart, sal_uInt16 nEnd)
{
- sal_uInt16 nTemp;
nTreeFlags |= SvTreeFlags::USESEL;
if( nStart > nEnd )
- {
- nTemp = nStart;
- nStart = nEnd;
- nEnd = nTemp;
- }
+ std::swap(nStart, nEnd);
// select all tabs that lie within the area
nTreeFlags |= SvTreeFlags::RECALCTABS;
nFirstSelTab = nStart;
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index 30bba9b05c20..42a4ce82a8a2 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -765,8 +765,6 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput )
// do not skip Alt key, for MS Windows
if ( !aKeyCode.IsMod2() )
{
- GetDlgWindowType nType;
- GetFocusFlags nGetFocusFlags = GetFocusFlags::Tab;
sal_uInt16 nNewIndex;
bool bForm = false;
@@ -837,6 +835,8 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput )
// dialog or for the current control (#103667#)
if (!aKeyCode.IsMod1() || (pSWindow->GetStyle() & WB_NODIALOGCONTROL))
{
+ GetDlgWindowType nType;
+ GetFocusFlags nGetFocusFlags = GetFocusFlags::Tab;
if ( aKeyCode.IsShift() )
{
nType = GetDlgWindowType::Prev;
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index f0c462dcc921..ba478d86151a 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1359,11 +1359,11 @@ Size Menu::ImplGetNativeCheckAndRadioSize(vcl::RenderContext const & rRenderCont
bool Menu::ImplGetNativeSubmenuArrowSize(vcl::RenderContext const & rRenderContext, Size& rArrowSize, long& rArrowSpacing)
{
ImplControlValue aVal;
- tools::Rectangle aNativeBounds;
- tools::Rectangle aNativeContent;
tools::Rectangle aCtrlRegion(tools::Rectangle(Point(), Size(100, 15)));
if (rRenderContext.IsNativeControlSupported(ControlType::MenuPopup, ControlPart::SubmenuArrow))
{
+ tools::Rectangle aNativeContent;
+ tools::Rectangle aNativeBounds;
if (rRenderContext.GetNativeControlRegion(ControlType::MenuPopup, ControlPart::SubmenuArrow,
aCtrlRegion, ControlState::ENABLED,
aVal, aNativeBounds, aNativeContent))
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index eb2f917d0e50..ce7b2e02929f 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -79,8 +79,6 @@ static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePo
*/
bool bHitTestInsideRect = false;
FloatingWindow* pFloat = pSVData->mpWinData->mpFirstFloat->ImplFloatHitTest( pChild, rMousePos, bHitTestInsideRect );
- FloatingWindow* pLastLevelFloat;
- FloatWinPopupFlags nPopupFlags;
if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE )
{
if ( bMouseLeave )
@@ -102,7 +100,7 @@ static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePo
{
if ( !pFloat )
{
- pLastLevelFloat = pSVData->mpWinData->mpFirstFloat->ImplFindLastLevelFloat();
+ FloatingWindow* pLastLevelFloat = pSVData->mpWinData->mpFirstFloat->ImplFindLastLevelFloat();
pLastLevelFloat->EndPopupMode( FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll );
return true;
}
@@ -125,8 +123,8 @@ static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePo
}
else
{
- pLastLevelFloat = pSVData->mpWinData->mpFirstFloat->ImplFindLastLevelFloat();
- nPopupFlags = pLastLevelFloat->GetPopupModeFlags();
+ FloatingWindow* pLastLevelFloat = pSVData->mpWinData->mpFirstFloat->ImplFindLastLevelFloat();
+ FloatWinPopupFlags nPopupFlags = pLastLevelFloat->GetPopupModeFlags();
if ( !(nPopupFlags & FloatWinPopupFlags::NoMouseUpClose) )
{
pLastLevelFloat->EndPopupMode( FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll );
@@ -139,8 +137,8 @@ static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePo
{
if ( !pFloat )
{
- pLastLevelFloat = pSVData->mpWinData->mpFirstFloat->ImplFindLastLevelFloat();
- nPopupFlags = pLastLevelFloat->GetPopupModeFlags();
+ FloatingWindow* pLastLevelFloat = pSVData->mpWinData->mpFirstFloat->ImplFindLastLevelFloat();
+ FloatWinPopupFlags nPopupFlags = pLastLevelFloat->GetPopupModeFlags();
if ( nPopupFlags & FloatWinPopupFlags::AllMouseButtonClose )
{
if ( (nPopupFlags & FloatWinPopupFlags::NoMouseUpClose) &&