summaryrefslogtreecommitdiff
path: root/vcl/source/gdi
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-27 14:06:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-28 08:55:28 +0200
commitd2d85921605415908c553e84db654628f9f0c0b1 (patch)
tree161816623c32febde1c62d524fa1ef0a20a1aeda /vcl/source/gdi
parent26c82e22bf4f077022ae88d0a7f8ad0fa6d2a5ba (diff)
loplugin:oncevar in vcl
Change-Id: I37a6dacda12e1c2910737d74aa344c7e2e195aeb Reviewed-on: https://gerrit.libreoffice.org/39328 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r--vcl/source/gdi/CommonSalLayout.cxx2
-rw-r--r--vcl/source/gdi/alpha.cxx3
-rw-r--r--vcl/source/gdi/bitmap.cxx3
-rw-r--r--vcl/source/gdi/jobset.cxx4
-rw-r--r--vcl/source/gdi/pdfextoutdevdata.cxx4
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx9
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx6
-rw-r--r--vcl/source/gdi/pngwrite.cxx3
-rw-r--r--vcl/source/gdi/svmconverter.cxx4
9 files changed, 14 insertions, 24 deletions
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 54a8dc312398..cbd30a0e6ba2 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -848,7 +848,7 @@ void CommonSalLayout::ApplyDXArray(ImplLayoutArgs& rArgs)
Point aPos(pGlyphIter->maLinearPos.X() - nTotalWidth, 0);
int nCharPos = pGlyphIter->mnCharPos;
- int nFlags = GlyphItem::IS_IN_CLUSTER | GlyphItem::IS_RTL_GLYPH;
+ int const nFlags = GlyphItem::IS_IN_CLUSTER | GlyphItem::IS_RTL_GLYPH;
while (nCopies--)
{
GlyphItem aKashida(nCharPos, nKashidaIndex, aPos, nFlags, nKashidaWidth);
diff --git a/vcl/source/gdi/alpha.cxx b/vcl/source/gdi/alpha.cxx
index 6d628405373b..4f3200bbe41c 100644
--- a/vcl/source/gdi/alpha.cxx
+++ b/vcl/source/gdi/alpha.cxx
@@ -89,7 +89,6 @@ bool AlphaMask::Replace( const Bitmap& rMask, sal_uInt8 cReplaceTransparency )
{
Bitmap::ScopedReadAccess pMaskAcc( const_cast<Bitmap&>(rMask) );
AlphaMask::ScopedWriteAccess pAcc(*this);
- bool bRet = false;
if( pMaskAcc && pAcc )
{
@@ -103,7 +102,7 @@ bool AlphaMask::Replace( const Bitmap& rMask, sal_uInt8 cReplaceTransparency )
if( pMaskAcc->GetPixel( nY, nX ) == aMaskWhite )
pAcc->SetPixel( nY, nX, aReplace );
}
- return bRet;
+ return false;
}
bool AlphaMask::Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency )
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index 71d5d73f15ab..f8aa444d8091 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -154,7 +154,8 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries )
{
if( !aGreyPalette16.GetEntryCount() )
{
- sal_uInt8 cGrey = 0, cGreyInc = 17;
+ sal_uInt8 cGrey = 0;
+ sal_uInt8 const cGreyInc = 17;
aGreyPalette16.SetEntryCount( 16 );
diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index ecea840d2393..3117cee7f574 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -322,8 +322,6 @@ SvStream& WriteJobSetup( SvStream& rOStream, const JobSetup& rJobSetup )
rOStream.WriteUInt16( nLen );
else
{
- sal_uInt16 nSystem = JOBSET_FILE605_SYSTEM;
-
const ImplJobSetup& rJobData = rJobSetup.ImplGetConstData();
Impl364JobSetupData aOldJobData;
sal_uInt16 nOldJobDataSize = sizeof( aOldJobData );
@@ -344,7 +342,7 @@ SvStream& WriteJobSetup( SvStream& rOStream, const JobSetup& rJobSetup )
strncpy( aOldData.cDriverName, aDriverByteName.getStr(), 31 );
int nPos = rOStream.Tell();
rOStream.WriteUInt16( 0 );
- rOStream.WriteUInt16( nSystem );
+ rOStream.WriteUInt16( JOBSET_FILE605_SYSTEM );
rOStream.WriteBytes( &aOldData, sizeof( aOldData ) );
rOStream.WriteBytes( &aOldJobData, nOldJobDataSize );
rOStream.WriteBytes( rJobData.GetDriverData(), rJobData.GetDriverDataLen() );
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index 67061939df3d..4fd05336e1f6 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -799,8 +799,6 @@ void PDFExtOutDevData::EndGroup( const Graphic& rGraphic,
// Avoids expensive de-compression and re-compression of large images.
bool PDFExtOutDevData::HasAdequateCompression( const Graphic &rGraphic ) const
{
- bool bReduceResolution = false;
-
assert(rGraphic.IsLink() &&
(rGraphic.GetLink().GetType() == GfxLinkType::NativeJpg ||
rGraphic.GetLink().GetType() == GfxLinkType::NativePng ||
@@ -820,7 +818,7 @@ bool PDFExtOutDevData::HasAdequateCompression( const Graphic &rGraphic ) const
rGraphic.GetLink().GetDataSize();
if ( GetIsLosslessCompression() )
- return !bReduceResolution && !GetIsReduceImageResolution();
+ return !GetIsReduceImageResolution();
else
{
static const struct {
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index bd46a9289057..f45dd1685b64 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -7490,7 +7490,7 @@ sal_Int32 PDFWriterImpl::emitOutputIntent()
aLine.append( " 0 obj\n"
"<</Type/OutputIntent/S/GTS_PDFA1/OutputConditionIdentifier");
- OUString aComment( "sRGB IEC61966-2.1" );
+ OUString const aComment( "sRGB IEC61966-2.1" );
appendLiteralStringEncrypt( aComment ,nOIObject, aLine );
aLine.append("/DestOutputProfile ");
aLine.append( nICCObject );
@@ -8453,7 +8453,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
bool bVertical = m_aCurrentPDFState.m_aFont.IsVertical();
int nGlyphs;
int nIndex = 0;
- int nMinCharPos = 0, nMaxCharPos = rText.getLength()-1;
+ int nMaxCharPos = rText.getLength()-1;
double fXScale = 1.0;
double fSkew = 0.0;
sal_Int32 nPixelFontHeight = m_pReferenceDevice->mpFontInstance->maFontSelData.mnHeight;
@@ -8584,7 +8584,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
{
// default case: 1 glyph is one unicode
aCodeUnitsPerGlyph.push_back(1);
- if (pGlyphs[i]->mnCharPos >= nMinCharPos && pGlyphs[i]->mnCharPos <= nMaxCharPos)
+ if (pGlyphs[i]->mnCharPos >= 0 && pGlyphs[i]->mnCharPos <= nMaxCharPos)
{
int nChars = 1;
// try to handle ligatures and such
@@ -12783,8 +12783,7 @@ void PDFWriterImpl::addInternalStructureContainer( PDFStructureElement& rEle )
std::list< sal_Int32 > aNewChildren;
// add Div in RoleMap, in case no one else did (TODO: is it needed? Is it dangerous?)
- OStringBuffer aNameBuf( "Div" );
- OString aAliasName( aNameBuf.makeStringAndClear() );
+ OString aAliasName( "Div" );
m_aRoleMap[ aAliasName ] = getStructureTag( PDFWriter::Division );
while( rEle.m_aKids.size() > ncMaxPDFArraySize )
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index d76d787f173e..aa405d3a6b5f 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -188,13 +188,12 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
aMask = aBitmapEx.GetMask();
}
Graphic aGraphic( aBitmapEx.GetBitmap() );
- sal_Int32 nColorMode = 0;
Sequence< PropertyValue > aFilterData( 2 );
aFilterData[ 0 ].Name = "Quality";
aFilterData[ 0 ].Value <<= sal_Int32(i_rContext.m_nJPEGQuality);
aFilterData[ 1 ].Name = "ColorMode";
- aFilterData[ 1 ].Value <<= nColorMode;
+ aFilterData[ 1 ].Value <<= sal_Int32(0);
try
{
@@ -204,12 +203,11 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
uno::Reference< graphic::XGraphicProvider > xGraphicProvider( graphic::GraphicProvider::create(xContext) );
uno::Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() );
uno::Reference < io::XOutputStream > xOut( xStream->getOutputStream() );
- OUString aMimeType("image/jpeg");
uno::Sequence< beans::PropertyValue > aOutMediaProperties( 3 );
aOutMediaProperties[0].Name = "OutputStream";
aOutMediaProperties[0].Value <<= xOut;
aOutMediaProperties[1].Name = "MimeType";
- aOutMediaProperties[1].Value <<= aMimeType;
+ aOutMediaProperties[1].Value <<= OUString("image/jpeg");
aOutMediaProperties[2].Name = "FilterData";
aOutMediaProperties[2].Value <<= aFilterData;
xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties );
diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx
index 68a66800b13b..c3f07eb06538 100644
--- a/vcl/source/gdi/pngwrite.cxx
+++ b/vcl/source/gdi/pngwrite.cxx
@@ -362,12 +362,11 @@ void PNGWriterImpl::ImplWritepHYs(const BitmapEx& rBmpEx)
if (aPrefSize.Width() && aPrefSize.Height() && mnWidth && mnHeight)
{
ImplOpenChunk(PNGCHUNK_pHYs);
- sal_uInt8 nMapUnit = 1;
sal_uInt32 nPrefSizeX = static_cast<sal_uInt32>(100000.0 / (static_cast<double>(aPrefSize.Width()) / mnWidth) + 0.5);
sal_uInt32 nPrefSizeY = static_cast<sal_uInt32>(100000.0 / (static_cast<double>(aPrefSize.Height()) / mnHeight) + 0.5);
ImplWriteChunk(nPrefSizeX);
ImplWriteChunk(nPrefSizeY);
- ImplWriteChunk(nMapUnit);
+ ImplWriteChunk(sal_uInt8(1)); // nMapUnit
}
}
}
diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 56fa5330b363..fe7cfe2e3509 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -304,9 +304,7 @@ bool ImplWriteUnicodeComment( SvStream& rOStm, const OUString& rString )
if ( nStringLen )
{
sal_uInt32 nSize = ( nStringLen << 1 ) + 4;
- sal_uInt16 nType = GDI_UNICODE_COMMENT;
-
- rOStm.WriteUInt16( nType ).WriteUInt32( nSize );
+ rOStm.WriteUInt16( GDI_UNICODE_COMMENT ).WriteUInt32( nSize );
write_uInt16s_FromOUString(rOStm, rString);
}
return nStringLen != 0;