This patch removes some variableScope warnings from
http://libreoffice.boldandbusted.com, sending for review.
revol_
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 052a930..c0cd48f 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -489,7 +489,7 @@ NMSP_RTL::OUString SVGActionWriter::GetPathString( const PolyPolygon&
rPolyPoly,
for( long i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ )
{
const Polygon& rPoly = rPolyPoly[ (sal_uInt16) i ];
- sal_uInt16 n = 1, nSize = rPoly.GetSize();
+ sal_uInt16 nSize = rPoly.GetSize();
if( nSize > 1 )
{
@@ -498,6 +498,7 @@ NMSP_RTL::OUString SVGActionWriter::GetPathString( const PolyPolygon&
rPolyPoly,
aPathData += aComma;
aPathData += GetValueString( aPolyPoint.Y() );
sal_Char nCurrentMode = 0;
+ sal_uInt16 n = 1;
while( n < nSize )
{
@@ -1072,7 +1073,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
const NMSP_RTL::OUString* pStyle,
Color aTextColor )
{
- long nLen = rText.Len(), i;
+ long nLen = rText.Len();
if( nLen )
{
@@ -1102,7 +1103,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
{
const double fFactor = (double) nWidth / aNormSize.Width();
- for( i = 0; i < ( nLen - 1 ); i++ )
+ for(long i = 0; i < ( nLen - 1 ); i++ )
pDX[ i ] = FRound( pDX[ i ] * fFactor );
}
}
diff --git a/connectivity/workben/testmoz/mozthread.cxx b/connectivity/workben/testmoz/mozthread.cxx
index 4a76ce7..521ce5d 100755
--- a/connectivity/workben/testmoz/mozthread.cxx
+++ b/connectivity/workben/testmoz/mozthread.cxx
@@ -328,10 +328,10 @@ Reference< ::com::sun::star::sdbc::XConnection> TestConnected
int autoTest(Reference<XResultSet> &xRes)
{
- sal_Int32 nRows = 0;
printColumns(xRes);
if(xRes.is())
{
+ sal_Int32 nRows = 0;
while( xRes.is() && xRes->next())
{
nRows++;
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 7d74350..d0fece3 100755
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -2767,7 +2767,6 @@ void SchXMLExportHelper_Impl::exportSeries(
SvXMLElementExport* pSeries = NULL;
Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeqCnt(
xSource->getDataSequences());
- sal_Int32 nMainSequenceIndex = -1;
sal_Int32 nSeriesLength = 0;
sal_Int32 nAttachedAxis = chart::ChartAxisAssign::PRIMARY_Y;
sal_Bool bHasMeanValueLine = false;
@@ -2782,6 +2781,7 @@ void SchXMLExportHelper_Impl::exportSeries(
Reference< chart2::data::XDataSequence > xValuesSeq;
Reference< chart2::data::XDataSequence > xLabelSeq;
sal_Int32 nSeqIdx=0;
+ sal_Int32 nMainSequenceIndex = -1;
for( ; nSeqIdx<aSeqCnt.getLength(); ++nSeqIdx )
{
OUString aRole;
@@ -3360,9 +3360,6 @@ void SchXMLExportHelper_Impl::exportDataPoints(
::std::list< SchXMLDataPointStruct > aDataPointList;
- sal_Int32 nLastIndex = -1;
- sal_Int32 nCurrIndex = 0;
-
// collect elements
if( bVaryColorsByPoint && xColorScheme.is() )
{
@@ -3431,6 +3428,10 @@ void SchXMLExportHelper_Impl::exportDataPoints(
}
else
{
+
+ sal_Int32 nLastIndex = -1;
+ sal_Int32 nCurrIndex = 0;
+
for( nElement = 0; nElement < nSize; ++nElement )
{
aPropertyStates.clear();
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 154196d..9939e91 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -696,7 +696,6 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec
long nBottom1 = aSize.Height()/2;
long nBottom2 = aSize.Height()-1;
long nTop2 = nBottom1;
- long nTop1 = 0;
if ( !(aSize.Height() & 0x01) )
nBottom1--;
@@ -741,6 +740,7 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec
}
else
{
+ long nTop1 = 0;
aSize.Width() -= CalcZoom( GetDrawPixel( pDev, rStyleSettings.GetSpinSize() ) );
rSpinUpArea = Rectangle( aSize.Width(), nTop1, rOutSz.Width()-aDropDownSize.Width()-1,
nBottom1 );
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index e39d0af..02febe3 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -3548,12 +3548,8 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY,
{
long nCurX = nStartX;
long nCurY = nStartY;
- long nDiffX = 2;
long nDiffY = nHeight-1;
long nCount = nWidth;
- long nOffY = -1;
- long nFreq;
- long i;
long nPixWidth;
long nPixHeight;
sal_Bool bDrawPixAsRect;
@@ -3593,8 +3589,11 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY,
}
else
{
+ long nDiffX = 2;
+ long nOffY = -1;
+ long i;
nCurY += nDiffY;
- nFreq = nCount / (nDiffX+nDiffY);
+ long nFreq = nCount / (nDiffX+nDiffY);
while ( nFreq-- )
{
for( i = nDiffY; i; --i )
@@ -4851,7 +4850,6 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
// auf mehr als Zwei Zeilen gebrochen wird...
if ( xHyph.is() )
{
- sal_Unicode cAlternateReplChar = 0;
i18n::Boundary aBoundary = xBI->getWordBoundary( aText, nBreakPos,
rDefLocale, ::com::sun::star::i18n::WordType::DICTIONARY_WORD, sal_True );
// sal_uInt16 nWordStart = nBreakPos;
// sal_uInt16 nBreakPos_OLD = nBreakPos;
@@ -4923,6 +4921,8 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
DBG_ASSERT( ( nAltEnd - nAltStart ) == 1, "Alternate:
Falsche Annahme!" );
+ sal_Unicode cAlternateReplChar = 0;
+
if ( nTxtEnd > nTxtStart )
cAlternateReplChar = aAlt.GetChar( nAltStart );
Context
- [Libreoffice] [PATCH] cppcheck variableScope cleanliness · Kayo Hamid
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.