chart2/source/view/charttypes/Splines.cxx      |    4 ++--
 cui/source/options/optcolor.cxx                |    3 +--
 sdext/source/pdfimport/pdfparse/pdfentries.cxx |    2 +-
 soltools/support/simstr.cxx                    |    2 +-
 svtools/source/svhtml/parhtml.cxx              |    3 +--
 vcl/source/gdi/gdimtf.cxx                      |    2 +-
 vcl/source/gdi/pdfwriter_impl.cxx              |    2 +-
 writerfilter/source/dmapper/GraphicHelpers.cxx |    1 -
 xml2cmp/source/support/sistr.cxx               |    2 +-
 xmloff/source/style/fonthdl.cxx                |    6 +++---
 10 files changed, 12 insertions(+), 15 deletions(-)

New commits:
commit c53812a1b7c45b1b5a4a341b178c40602c7dcbf7
Author: Julien Nabet <serval2...@yahoo.fr>
Date:   Sun May 20 15:25:00 2012 +0200

    Some cppcheck cleaning
    
    Change-Id: Ic30cdeffabec1eb1a6c153ac450a3d28064ef534

diff --git a/chart2/source/view/charttypes/Splines.cxx 
b/chart2/source/view/charttypes/Splines.cxx
index 6c0c877..5f29c41 100644
--- a/chart2/source/view/charttypes/Splines.cxx
+++ b/chart2/source/view/charttypes/Splines.cxx
@@ -807,7 +807,7 @@ void SplineCalculater::CalculateBSplines(
         {
             // search for first non-zero downwards
             r = c;
-            while ( aMatN[r][c-aShift[r]] == 0 &&  r < n)
+            while ( r < n && aMatN[r][c-aShift[r]] == 0 )
             {
                 ++r;
             }
@@ -847,7 +847,7 @@ void SplineCalculater::CalculateBSplines(
                 // eliminate forward, examine row c+1 to n-1 (worst case)
                 // stop if first non-zero element in row has an higher column 
as c
                 // look at nShift for that, elements in nShift are equal or 
increasing
-                for ( r = c+1; aShift[r]<=c && r < n; ++r)
+                for ( r = c+1; r < n && aShift[r]<=c ; ++r)
                 {
                     fEliminate = aMatN[r][0];
                     if (fEliminate != 0.0) // else accidentally zero, nothing 
to do
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index c42ba08..25b6596 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -1327,8 +1327,7 @@ IMPL_LINK(ColorConfigCtrl_Impl, ScrollHdl, ScrollBar*, 
pScrollBar)
     {
         nLastVisible++;
         //skip gaps where no controls exist for the related ColorConfigEntry
-        while(!aScrollWindow.aCheckBoxes[nLastVisible] && 
!aScrollWindow.aColorBoxes[nLastVisible] &&
-                nLastVisible < nCount - 1 )
+        while((nLastVisible < (nCount - 1)) && 
!aScrollWindow.aCheckBoxes[nLastVisible] && 
!aScrollWindow.aColorBoxes[nLastVisible])
             nLastVisible++;
         if ( nLastVisible < nCount )
         {
diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx 
b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
index 0d650c9..04d5022 100644
--- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
@@ -180,7 +180,7 @@ OUString PDFName::getFilteredName() const
     unsigned int nLen = m_aName.getLength();
     for( unsigned int i = 0; i < nLen; i++ )
     {
-        if( pStr[i] == '#' && i < nLen - 3 )
+        if( (i < nLen - 3) && pStr[i] == '#' )
         {
             sal_Char rResult = 0;
             i++;
diff --git a/soltools/support/simstr.cxx b/soltools/support/simstr.cxx
index 72efdc4..d1e0f41 100644
--- a/soltools/support/simstr.cxx
+++ b/soltools/support/simstr.cxx
@@ -651,7 +651,7 @@ Simstr::is_no_text() const
       return true;
 
    int i;
-   for (i = 0; sz[i] <= 32 && i < len; i++) ;
+   for (i = 0; i < len && sz[i] <= 32 ; i++) ;
    if (i < len)
         return false;
     return true;
diff --git a/svtools/source/svhtml/parhtml.cxx 
b/svtools/source/svhtml/parhtml.cxx
index 1c5b350..d1c588c 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -1966,8 +1966,7 @@ bool HTMLParser::IsHTMLFormat( const sal_Char* pHeader,
 
     // <HTML> somewhere in the first 80 characters of the document
     nStart = 
sCmp.indexOfL(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_html));
-    if( nStart != -1 &&
-        nStart>0 && '<'==sCmp[nStart-1] &&
+    if( nStart>0 && '<'==sCmp[nStart-1] &&
         nStart+4 < sCmp.getLength() && '>'==sCmp[nStart+4] )
         return true;
 
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 93be21a..da073f6 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -392,7 +392,6 @@ void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos )
     {
         MetaAction* pAction = GetCurAction();
         const size_t nObjCount = aList.size();
-        size_t  i  = 0;
         size_t  nSyncCount = ( pOut->GetOutDevType() == OUTDEV_WINDOW ) ? 
0x000000ff : 0xffffffff;
 
         if( nPos > nObjCount )
@@ -409,6 +408,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos )
         OSL_TRACE("GDIMetaFile::Play on device of size: %d x %d", 
pOut->GetOutputSizePixel().Width(), pOut->GetOutputSizePixel().Height());
 
         if( !ImplPlayWithRenderer( pOut, Point(0,0), 
pOut->GetOutputSizePixel() ) ) {
+            size_t  i  = 0;
             for( size_t nCurPos = nCurrentActionElement; nCurPos < nPos; 
nCurPos++ )
             {
                 if( !Hook() )
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 953dc65..797159e 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -3297,7 +3297,7 @@ std::map< sal_Int32, sal_Int32 > 
PDFWriterImpl::emitEmbeddedFont( const ImplFont
             std::list< int > aSections;
             std::list< int >::const_iterator it;
             int nIndex = 0;
-            while( pFontData[nIndex] == 0x80 && nIndex < nFontLen-1 )
+            while( (nIndex < nFontLen-1) && pFontData[nIndex] == 0x80 )
             {
                 aSections.push_back( nIndex );
                 if( pFontData[nIndex+1] == 0x03 )
diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx 
b/writerfilter/source/dmapper/GraphicHelpers.cxx
index 31cded9..7b3ae3f 100644
--- a/writerfilter/source/dmapper/GraphicHelpers.cxx
+++ b/writerfilter/source/dmapper/GraphicHelpers.cxx
@@ -208,7 +208,6 @@ sal_Int32 WrapHandler::getWrapMode( )
                 }
             }
             break;
-            break;
         case 
NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_topAndBottom:
             nMode = com::sun::star::text::WrapTextMode_NONE;
             break;
diff --git a/xml2cmp/source/support/sistr.cxx b/xml2cmp/source/support/sistr.cxx
index 1a59ea7..626633e 100644
--- a/xml2cmp/source/support/sistr.cxx
+++ b/xml2cmp/source/support/sistr.cxx
@@ -275,7 +275,7 @@ Simstr::is_no_text() const
       return true;
 
    int i;
-   for (i = 0; sz[i] <= 32 && i < len; i++) ;
+   for (i = 0; i < len && sz[i] <= 32 ; i++) ;
    if (i < len)
         return false;
     return true;
diff --git a/xmloff/source/style/fonthdl.cxx b/xmloff/source/style/fonthdl.cxx
index 31abfa3..3d58197 100644
--- a/xmloff/source/style/fonthdl.cxx
+++ b/xmloff/source/style/fonthdl.cxx
@@ -94,7 +94,7 @@ sal_Bool XMLFontFamilyNamePropHdl::importXML( const OUString& 
rStrImpValue, uno:
             nLast--;
 
         // skip leading blanks
-        while( sal_Unicode(' ') == rStrImpValue[nFirst] && nFirst <= nLast )
+        while(nFirst <= nLast && sal_Unicode(' ') == rStrImpValue[nFirst])
             nFirst++;
 
         // remove quotes
@@ -158,11 +158,11 @@ sal_Bool XMLFontFamilyNamePropHdl::exportXML( OUString& 
rStrExpValue, const uno:
             nLast--;
 
             // skip trailing blanks
-            while( sal_Unicode(' ') == aStrFamilyName[nLast] && nLast > nFirst 
)
+            while(  nLast > nFirst && sal_Unicode(' ') == 
aStrFamilyName[nLast] )
                 nLast--;
 
             // skip leading blanks
-            while( sal_Unicode(' ') == aStrFamilyName[nFirst] && nFirst <= 
nLast )
+            while( nFirst <= nLast && sal_Unicode(' ') == 
aStrFamilyName[nFirst] )
                 nFirst++;
 
             if( nFirst <= nLast )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to