[Libreoffice-commits] core.git: vcl/backendtest vcl/qt5 vcl/source vcl/unx
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Thu Oct 1 10:20:07 UTC 2020
vcl/backendtest/VisualBackendTest.cxx | 6 ++----
vcl/qt5/Qt5Instance.cxx | 3 +--
vcl/source/bitmap/BitmapScaleSuperFilter.cxx | 4 ++--
vcl/source/control/button.cxx | 4 ++--
vcl/source/control/field.cxx | 7 ++++---
vcl/source/control/imp_listbox.cxx | 3 +--
vcl/source/control/slider.cxx | 3 +--
vcl/source/filter/graphicfilter2.cxx | 23 +++++++++++------------
vcl/source/filter/igif/decode.cxx | 3 +--
vcl/source/filter/igif/gifread.cxx | 6 +++---
vcl/source/fontsubset/ttcr.cxx | 6 ++----
vcl/source/gdi/bitmapex.cxx | 5 ++---
vcl/source/gdi/pdfwriter_impl.cxx | 5 ++---
vcl/source/gdi/svmconverter.cxx | 3 +--
vcl/source/graphic/GraphicObject.cxx | 5 +----
vcl/source/outdev/text.cxx | 9 ++++-----
vcl/source/treelist/imap.cxx | 2 +-
vcl/source/treelist/treelistbox.cxx | 7 +------
vcl/source/window/dlgctrl.cxx | 4 ++--
vcl/source/window/menu.cxx | 4 ++--
vcl/source/window/winproc.cxx | 12 +++++-------
vcl/unx/generic/app/wmadaptor.cxx | 12 ++++--------
vcl/unx/generic/gdi/cairo_xlib_cairo.cxx | 4 +---
vcl/unx/generic/gdi/gdiimpl.cxx | 3 +--
vcl/unx/generic/gdi/salbmp.cxx | 2 +-
vcl/unx/generic/window/salframe.cxx | 3 +--
vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 4 ++--
vcl/unx/gtk3/gtk3salprn-gtk.cxx | 2 +-
28 files changed, 62 insertions(+), 92 deletions(-)
New commits:
commit cc2b7c1f930bc05253153f3c8381fb4fb352f3ca
Author: Noel <noelgrandin at gmail.com>
AuthorDate: Thu Oct 1 11:01:41 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Oct 1 12:19:27 2020 +0200
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 at collabora.co.uk>
diff --git a/vcl/backendtest/VisualBackendTest.cxx b/vcl/backendtest/VisualBackendTest.cxx
index 8473dc193012..0383dfab6a2d 100644
--- a/vcl/backendtest/VisualBackendTest.cxx
+++ b/vcl/backendtest/VisualBackendTest.cxx
@@ -662,9 +662,6 @@ public:
long nWidth = aSize.Width();
long nHeight = aSize.Height();
- tools::Rectangle aRectangle;
- size_t index = 0;
-
if (mnTest % gnNumberOfTests == 0)
{
testRectangles(rRenderContext, nWidth, nHeight, false);
@@ -704,8 +701,9 @@ public:
else if (mnTest % gnNumberOfTests == 9)
{
std::vector<tools::Rectangle> aRegions = setupRegions(2, 1, nWidth, nHeight);
+ size_t index = 0;
- aRectangle = aRegions[index++];
+ tools::Rectangle aRectangle = aRegions[index++];
{
vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupDrawOutDev();
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 1868042cdb6d..bba348890898 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -560,7 +560,6 @@ void Qt5Instance::AllocFakeCmdlineArgs(std::unique_ptr<char* []>& rFakeArgv,
SAL_INFO("vcl.qt5", "qt version string is " << aVersion);
const sal_uInt32 nParams = osl_getCommandArgCount();
- OString aDisplay;
sal_uInt32 nDisplayValueIdx = 0;
OUString aParam, aBin;
@@ -585,7 +584,7 @@ void Qt5Instance::AllocFakeCmdlineArgs(std::unique_ptr<char* []>& rFakeArgv,
{
aFakeArgvFreeable.emplace_back(strdup("-display"));
osl_getCommandArg(nDisplayValueIdx, &aParam.pData);
- aDisplay = OUStringToOString(aParam, osl_getThreadTextEncoding());
+ OString aDisplay = OUStringToOString(aParam, osl_getThreadTextEncoding());
aFakeArgvFreeable.emplace_back(strdup(aDisplay.getStr()));
}
rFakeArgvFreeable.swap(aFakeArgvFreeable);
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) &&
diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx
index fc17cc080957..62dfcf94ce8c 100644
--- a/vcl/unx/generic/app/wmadaptor.cxx
+++ b/vcl/unx/generic/app/wmadaptor.cxx
@@ -532,7 +532,6 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
// check for GnomeWM
if( m_aWMAtoms[ WIN_SUPPORTING_WM_CHECK ] && m_aWMAtoms[ WIN_PROTOCOLS ] )
{
- ::Window aWMChild = None;
if( XGetWindowProperty( m_pDisplay,
m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
m_aWMAtoms[ WIN_SUPPORTING_WM_CHECK ],
@@ -549,10 +548,9 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
&& nItems != 0
)
{
- aWMChild = *reinterpret_cast< ::Window* >(pProperty);
+ ::Window aWMChild = *reinterpret_cast< ::Window* >(pProperty);
XFree( pProperty );
pProperty = nullptr;
- ::Window aCheckWindow = None;
GetGenericUnixSalData()->ErrorTrapPush();
if( XGetWindowProperty( m_pDisplay,
aWMChild,
@@ -573,7 +571,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
{
GetGenericUnixSalData()->ErrorTrapPush();
- aCheckWindow = *reinterpret_cast< ::Window* >(pProperty);
+ ::Window aCheckWindow = *reinterpret_cast< ::Window* >(pProperty);
XFree( pProperty );
pProperty = nullptr;
if( aCheckWindow == aWMChild )
@@ -733,7 +731,6 @@ bool WMAdaptor::getNetWmName()
if( m_aWMAtoms[ NET_SUPPORTING_WM_CHECK ] && m_aWMAtoms[ NET_WM_NAME ] )
{
- ::Window aWMChild = None;
if( XGetWindowProperty( m_pDisplay,
m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
m_aWMAtoms[ NET_SUPPORTING_WM_CHECK ],
@@ -750,10 +747,9 @@ bool WMAdaptor::getNetWmName()
&& nItems != 0
)
{
- aWMChild = *reinterpret_cast< ::Window* >(pProperty);
+ ::Window aWMChild = *reinterpret_cast< ::Window* >(pProperty);
XFree( pProperty );
pProperty = nullptr;
- ::Window aCheckWindow = None;
GetGenericUnixSalData()->ErrorTrapPush();
if( XGetWindowProperty( m_pDisplay,
aWMChild,
@@ -773,7 +769,7 @@ bool WMAdaptor::getNetWmName()
if ( ! GetGenericUnixSalData()->ErrorTrapPop( false ) )
{
GetGenericUnixSalData()->ErrorTrapPush();
- aCheckWindow = *reinterpret_cast< ::Window* >(pProperty);
+ ::Window aCheckWindow = *reinterpret_cast< ::Window* >(pProperty);
XFree( pProperty );
pProperty = nullptr;
if( aCheckWindow == aWMChild )
diff --git a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
index 1bbf8d3d5e05..aba06672eb3b 100644
--- a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
+++ b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
@@ -195,8 +195,6 @@ namespace cairo
**/
SurfaceSharedPtr X11Surface::getSimilar(int cairo_content_type, int width, int height ) const
{
- Pixmap hPixmap;
-
if( maSysData.pDisplay && maSysData.hDrawable )
{
XRenderPictFormat* pFormat;
@@ -217,7 +215,7 @@ namespace cairo
}
pFormat = XRenderFindStandardFormat( static_cast<Display*>(maSysData.pDisplay), nFormat );
- hPixmap = limitXCreatePixmap( static_cast<Display*>(maSysData.pDisplay), maSysData.hDrawable,
+ Pixmap hPixmap = limitXCreatePixmap( static_cast<Display*>(maSysData.pDisplay), maSysData.hDrawable,
width > 0 ? width : 1, height > 0 ? height : 1,
pFormat->depth );
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index 8d5dbbe15443..337454c2a868 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -239,8 +239,6 @@ inline GC X11SalGraphicsImpl::GetCopyGC()
GC X11SalGraphicsImpl::GetTrackingGC()
{
- const char dash_list[2] = {2, 2};
-
if( !mpTrackingGC )
{
XGCValues values;
@@ -256,6 +254,7 @@ GC X11SalGraphicsImpl::GetTrackingGC()
GCGraphicsExposures | GCForeground | GCFunction
| GCLineWidth | GCLineStyle,
&values );
+ const char dash_list[2] = {2, 2};
XSetDashes( mrParent.GetXDisplay(), mpTrackingGC, 0, dash_list, 2 );
}
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index b0a3f3cfcab0..1ca2697ee6a0 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -704,11 +704,11 @@ bool X11SalBitmap::Create(
css::uno::Reference< css::beans::XFastPropertySet > xFastPropertySet( rBitmapCanvas, css::uno::UNO_QUERY );
if( xFastPropertySet ) {
- sal_Int32 depth;
css::uno::Sequence< css::uno::Any > args;
if( xFastPropertySet->getFastPropertyValue(bMask ? 2 : 1) >>= args ) {
long pixmapHandle = {}; // spurious -Werror=maybe-uninitialized
+ sal_Int32 depth;
if( ( args[1] >>= pixmapHandle ) && ( args[2] >>= depth ) ) {
mbGrey = bMask;
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 03dfe8b39640..3d52797f5cec 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -1651,8 +1651,6 @@ void X11SalFrame::SetWindowState( const SalFrameState *pState )
// Request for position or size change
if (pState->mnMask & FRAMESTATE_MASK_GEOMETRY)
{
- tools::Rectangle aPosSize;
-
/* #i44325#
* if maximized, set restore size and guess maximized size from last time
* in state change below maximize window
@@ -1692,6 +1690,7 @@ void X11SalFrame::SetWindowState( const SalFrameState *pState )
else
{
bool bDoAdjust = false;
+ tools::Rectangle aPosSize;
// initialize with current geometry
if ((pState->mnMask & FRAMESTATE_MASK_GEOMETRY) != FRAMESTATE_MASK_GEOMETRY)
GetPosSize (aPosSize);
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 7081e4275557..879e2a5bbc5c 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2767,7 +2767,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar
{
/* TODO: all this functions needs improvements */
tools::Rectangle aEditRect = rControlRegion;
- gint indicator_size, indicator_spacing, point;
+ gint indicator_size, indicator_spacing;
if(((nType == ControlType::Checkbox) || (nType == ControlType::Radiobutton)) &&
nPart == ControlPart::Entire)
@@ -2811,7 +2811,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar
"indicator-size", &indicator_size,
nullptr );
- point = MAX(0, rControlRegion.GetHeight() - indicator_size);
+ gint point = MAX(0, rControlRegion.GetHeight() - indicator_size);
aEditRect = tools::Rectangle( Point( 0, point / 2),
Size( indicator_size, indicator_size ) );
}
diff --git a/vcl/unx/gtk3/gtk3salprn-gtk.cxx b/vcl/unx/gtk3/gtk3salprn-gtk.cxx
index 58fc5b21f100..dce0c36e76b7 100644
--- a/vcl/unx/gtk3/gtk3salprn-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salprn-gtk.cxx
@@ -408,7 +408,6 @@ GtkPrintDialog::impl_initCustomTab()
sal_Int32 nDependsOnValue = 0;
bool bUseDependencyRow = false;
bool bIgnore = false;
- GtkWidget* pGroup = nullptr;
bool bGtkInternal = false;
//Fix fdo#69381
@@ -527,6 +526,7 @@ GtkPrintDialog::impl_initCustomTab()
GtkWidget* pWidget = nullptr;
beans::PropertyValue* pVal = nullptr;
+ GtkWidget* pGroup = nullptr;
if (aCtrlType == "Bool" && pCurParent)
{
pWidget = gtk_check_button_new_with_mnemonic(
More information about the Libreoffice-commits
mailing list