From fb4c82b541f4e5b50d644bd56a52f1428691c7e4 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 18 Dec 2010 19:07:05 +0000 Subject: cppcheck: can reduce the scope of this variable --- vcl/source/gdi/pdfwriter_impl.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 2f671880eb9a..a6d349706b00 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -4551,7 +4551,6 @@ we check in the following sequence: // extract target file type INetURLObject aDocumentURL( m_aContext.BaseURL ); INetURLObject aTargetURL( rLink.m_aURL ); - sal_Int32 nChangeFileExtensionToPDF = 0; sal_Int32 nSetGoToRMode = 0; sal_Bool bTargetHasPDFExtension = sal_False; INetProtocol eTargetProtocol = aTargetURL.GetProtocol(); @@ -4590,18 +4589,19 @@ we check in the following sequence: { if( m_aContext.ConvertOOoTargetToPDFTarget ) { -//examine the file type (.odm .odt. .odp, odg, ods) + sal_Int32 bChangeFileExtensionToPDF = false; + //examine the file type (.odm .odt. .odp, odg, ods) if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odm" ) ) ) ) - nChangeFileExtensionToPDF++; + bChangeFileExtensionToPDF = true; if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odt" ) ) ) ) - nChangeFileExtensionToPDF++; + bChangeFileExtensionToPDF = true; else if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odp" ) ) ) ) - nChangeFileExtensionToPDF++; + bChangeFileExtensionToPDF = true; else if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odg" ) ) ) ) - nChangeFileExtensionToPDF++; + bChangeFileExtensionToPDF = true; else if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ods" ) ) ) ) - nChangeFileExtensionToPDF++; - if( nChangeFileExtensionToPDF ) + bChangeFileExtensionToPDF = true; + if( bChangeFileExtensionToPDF ) aTargetURL.setExtension(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf" ) ) ); } //check if extension is pdf, see if GoToR should be forced -- cgit