[Libreoffice-commits] .: 2 commits - basegfx/source svl/source svtools/source tools/source
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Fri Apr 22 02:52:40 PDT 2011
basegfx/source/polygon/b2dpolypolygoncutter.cxx | 4 ++--
svl/source/numbers/zformat.cxx | 2 +-
svtools/source/control/ruler.cxx | 6 +++---
svtools/source/control/toolbarmenu.cxx | 2 +-
svtools/source/filter.vcl/filter/sgvmain.cxx | 3 +--
svtools/source/filter.vcl/filter/sgvspln.cxx | 16 +++++++---------
svtools/source/filter.vcl/filter/sgvtext.cxx | 2 +-
svtools/source/filter.vcl/igif/gifread.cxx | 4 ++--
tools/source/inet/inetstrm.cxx | 2 +-
9 files changed, 19 insertions(+), 22 deletions(-)
New commits:
commit 5b008d93c36cc44d642b37d2b2173b7e473e9586
Author: Kayo Hamid <kayo.hamid at gekkolinux.com.br>
Date: Fri Apr 22 11:34:11 2011 +0200
cppcheck variableScope
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index eff1a1c..8252d0c 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -3548,11 +3548,11 @@ sal_Bool SvNumberformat::ImpGetNumberOutput(double fNumber,
sal_uInt16 i, j;
xub_StrLen k;
String sStr;
- long nPrecExp;
sal_Bool bInteger = sal_False;
if ( rInfo.nThousand != FLAG_STANDARD_IN_FORMAT )
{ // special formatting only if no GENERAL keyword in format code
const sal_uInt16 nThousand = rInfo.nThousand;
+ long nPrecExp;
for (i = 0; i < nThousand; i++)
{
if (fNumber > _D_MIN_M_BY_1000)
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 2202d3e..1dc1bad 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -467,13 +467,10 @@ void Ruler::ImplInvertLines( sal_Bool bErase )
void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
{
- long n = 0;
long nTick3 = aImplRulerUnitTab[mnUnitIndex].nTick3;
long nTickCount = aImplRulerUnitTab[mnUnitIndex].nTick1;
Size aPixSize = maVirDev.LogicToPixel( Size( nTick3, nTick3 ), maMapMode );
long nTickWidth;
- long nX;
- long nY;
sal_Bool bNoTicks = sal_False;
//Amelia
@@ -569,6 +566,9 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
if ( !bNoTicks )
{
+ long nX;
+ long nY;
+ long n = 0;
long nTxtWidth2;
long nTxtHeight2 = GetTextHeight()/2;
long nTick = 0;
diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx
index a8a3e67..b157579 100644
--- a/svtools/source/control/toolbarmenu.cxx
+++ b/svtools/source/control/toolbarmenu.cxx
@@ -1081,12 +1081,12 @@ void ToolbarMenu::MouseMove( const MouseEvent& rMEvt )
void ToolbarMenu::implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown )
{
- long nY = 0;
long nMouseY = rMEvt.GetPosPixel().Y();
Size aOutSz = GetOutputSizePixel();
if ( ( nMouseY >= 0 ) && ( nMouseY < aOutSz.Height() ) )
{
bool bHighlighted = sal_False;
+ long nY = 0;
const int nEntryCount = mpImpl->maEntryVector.size();
int nEntry;
diff --git a/svtools/source/filter.vcl/filter/sgvmain.cxx b/svtools/source/filter.vcl/filter/sgvmain.cxx
index 5767e6b..28f167b 100644
--- a/svtools/source/filter.vcl/filter/sgvmain.cxx
+++ b/svtools/source/filter.vcl/filter/sgvmain.cxx
@@ -768,7 +768,6 @@ void CircType::Draw(OutputDevice& rOut)
void BmapType::Draw(OutputDevice& rOut)
{
//ifstream aInp;
- unsigned char nSgfTyp;
sal_uInt16 nVersion;
String aStr(
reinterpret_cast< char const * >(&Filename[ 1 ]),
@@ -778,7 +777,7 @@ void BmapType::Draw(OutputDevice& rOut)
SvStream* pInp = ::utl::UcbStreamHelper::CreateStream( aFNam.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
if ( pInp )
{
- nSgfTyp=CheckSgfTyp( *pInp,nVersion);
+ unsigned char nSgfTyp=CheckSgfTyp( *pInp,nVersion);
switch(nSgfTyp) {
case SGF_BITIMAGE: {
GraphicFilter aFlt;
diff --git a/svtools/source/filter.vcl/filter/sgvspln.cxx b/svtools/source/filter.vcl/filter/sgvspln.cxx
index 6221264..30ae1ac 100644
--- a/svtools/source/filter.vcl/filter/sgvspln.cxx
+++ b/svtools/source/filter.vcl/filter/sgvspln.cxx
@@ -807,9 +807,6 @@ sal_Bool CalcSpline(Polygon& rPoly, sal_Bool Periodic, sal_uInt16& n,
*************************************************************************/
sal_Bool Spline2Poly(Polygon& rSpln, sal_Bool Periodic, Polygon& rPoly)
{
- short MinKoord=-32000; // zur Vermeidung
- short MaxKoord=32000; // von Ueberlaeufen
-
double* ax; // Koeffizienten der Polynome
double* ay;
double* bx;
@@ -820,19 +817,20 @@ sal_Bool Spline2Poly(Polygon& rSpln, sal_Bool Periodic, Polygon& rPoly)
double* dy;
double* tv;
- double Step; // Schrittweite fuer t
- double dt1,dt2,dt3; // Delta t, y, ^3
- double t;
sal_Bool bEnde; // Teilpolynom zu Ende?
sal_uInt16 n; // Anzahl der zu zeichnenden Teilpolynome
sal_uInt16 i; // aktuelles Teilpolynom
sal_Bool bOk; // noch alles ok?
- sal_uInt16 PolyMax=16380;// Maximale Anzahl von Polygonpunkten
- long x,y;
bOk=CalcSpline(rSpln,Periodic,n,ax,ay,bx,by,cx,cy,dx,dy,tv);
if (bOk) {
- Step =10;
+ short MinKoord=-32000; // zur Vermeidung
+ short MaxKoord=32000; // von Ueberlaeufen
+ double Step =10;
+ double dt1,dt2,dt3; // Delta t, y, ^3
+ double t;
+ sal_uInt16 PolyMax=16380;// Maximale Anzahl von Polygonpunkten
+ long x,y;
rPoly.SetSize(1);
rPoly.SetPoint(Point(short(ax[0]),short(ay[0])),0); // erster Punkt
diff --git a/svtools/source/filter.vcl/filter/sgvtext.cxx b/svtools/source/filter.vcl/filter/sgvtext.cxx
index d8b9f5a..17b776d 100644
--- a/svtools/source/filter.vcl/filter/sgvtext.cxx
+++ b/svtools/source/filter.vcl/filter/sgvtext.cxx
@@ -765,7 +765,6 @@ UCHAR ProcessChar(OutputDevice& rOut, UCHAR* TBuf, ProcChrSta& R, ObjTextType& A
sal_uInt16& nChars, sal_uInt16 Rest,
short* Line, UCHAR* cLine)
{
- sal_uInt16 KernDist=0; // Wert fuer Kerning
sal_uInt16 ChrWidth;
UCHAR c;
UCHAR c1;
@@ -775,6 +774,7 @@ UCHAR ProcessChar(OutputDevice& rOut, UCHAR* TBuf, ProcChrSta& R, ObjTextType& A
AbsEnd=(c==AbsatzEnd || c==TextEnd);
if (AbsEnd==sal_False) {
+ sal_uInt16 KernDist=0; // Wert fuer Kerning
R.OutCh=ConvertTextChar(c); // von HardTrenn nach '-', ...
R.Kapt=(R.Attrib.Schnitt & TextKaptBit) !=0 && UpcasePossible(R.OutCh);
if (R.Kapt) R.OutCh=Upcase(R.OutCh);
diff --git a/svtools/source/filter.vcl/igif/gifread.cxx b/svtools/source/filter.vcl/igif/gifread.cxx
index 2b84c2f..5fc6f6b 100644
--- a/svtools/source/filter.vcl/igif/gifread.cxx
+++ b/svtools/source/filter.vcl/igif/gifread.cxx
@@ -451,7 +451,7 @@ void GIFReader::FillImages( HPBYTE pBytes, sal_uLong nCount )
{
if( bInterlaced )
{
- long nT1, nT2;
+ long nT1;
// falls Interlaced, werden die Zeilen kopiert
if( nLastInterCount )
@@ -489,7 +489,7 @@ void GIFReader::FillImages( HPBYTE pBytes, sal_uLong nCount )
if( nT1 >= nImageHeight )
{
- nT2 = nImageY - ( ( nImageHeight + 7 ) >> 3 );
+ long nT2 = nImageY - ( ( nImageHeight + 7 ) >> 3 );
nT1 = ( nT2 << 3 ) + 4;
nLastInterCount = 3;
diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx
index cdb796c..3217959 100644
--- a/tools/source/inet/inetstrm.cxx
+++ b/tools/source/inet/inetstrm.cxx
@@ -1686,9 +1686,9 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize)
for( pOldPos = pChar = (const sal_Char *) pMsgBuffer->GetData(); nBufSize--;
pChar++ )
{
- int status;
if( *pChar == '\r' || *pChar == '\n' )
{
+ int status;
if( aDelim.CompareTo (pOldPos, aDelim.Len())
!= COMPARE_EQUAL &&
aClose.CompareTo (pOldPos, aClose.Len())
commit 95926b697322065d83bdb042229ab234771ea837
Author: Kayo Hamid <kayo.hamid at gekkolinux.com.br>
Date: Fri Apr 22 11:31:13 2011 +0200
cppcheck inefficient checking for emptiness
From cppcheck: Using xxxx.empty() instead of xxxx.size() can be faster.
xxxx.size() can take linear time but xxxx.empty() is guaranteed to take
constant time
diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
index 5163f1e..5f38815 100644
--- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx
+++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
@@ -933,7 +933,7 @@ namespace basegfx
// first step: prepareForPolygonOperation and simple merge of non-overlapping
// PolyPolygons for speedup; this is possible for the wanted OR-operation
- if(aInput.size())
+ if(!aInput.empty())
{
std::vector< basegfx::B2DPolyPolygon > aResult;
aResult.reserve(aInput.size());
@@ -942,7 +942,7 @@ namespace basegfx
{
const basegfx::B2DPolyPolygon aCandidate(prepareForPolygonOperation(aInput[a]));
- if(aResult.size())
+ if(!aResult.empty())
{
const B2DRange aCandidateRange(aCandidate.getB2DRange());
bool bCouldMergeSimple(false);
More information about the Libreoffice-commits
mailing list