[Libreoffice-commits] .: 73 commits - automation/source codemaker/source comphelper/source connectivity/workben crashrep/source desktop/win32 dmake/getinp.c dmake/infer.c dmake/state.c dmake/unix dmake/win95 dmake/winnt editeng/source extensions/source extensions/test filter/source forms/source formula/source framework/source idlc/source lingucomponent/source odk/source oox/source registry/source rsc/source sal/osl sal/qa sal/workben sd/source setup_native/source sfx2/source shell/source slideshow/test soltools/javadep soltools/ldump svl/source svtools/source sw/source toolkit/source tools/source unotools/source vcl/aqua vcl/source vcl/unx vcl/win

Pierre-André Jacquod pjacquod at kemper.freedesktop.org
Fri Oct 7 06:57:53 PDT 2011


 automation/source/server/statemnt.cxx                             |    2 
 automation/source/testtool/objtest.cxx                            |  343 ----------
 codemaker/source/cppumaker/cpputype.cxx                           |    5 
 comphelper/source/misc/storagehelper.cxx                          |    2 
 connectivity/workben/testmoz/main.cxx                             |    5 
 crashrep/source/win32/soreport.cpp                                |   88 --
 desktop/win32/source/setup/setup.cpp                              |    5 
 dmake/getinp.c                                                    |    5 
 dmake/infer.c                                                     |    2 
 dmake/state.c                                                     |   60 -
 dmake/unix/runargv.c                                              |   30 
 dmake/win95/microsft/vpp40/runargv.c                              |   15 
 dmake/winnt/microsft/vpp40/runargv.c                              |   18 
 editeng/source/editeng/impedit3.cxx                               |    3 
 editeng/source/misc/txtrange.cxx                                  |   15 
 editeng/source/rtf/svxrtf.cxx                                     |    4 
 extensions/source/activex/main/so_activex.cpp                     |    3 
 extensions/source/scanner/sane.cxx                                |    4 
 extensions/test/ole/AxTestComponents/Basic.cpp                    |    3 
 filter/source/msfilter/escherex.cxx                               |   13 
 filter/source/msfilter/msdffimp.cxx                               |   44 -
 filter/source/msfilter/svdfppt.cxx                                |    9 
 forms/source/component/DatabaseForm.cxx                           |    2 
 forms/source/xforms/convert.cxx                                   |    2 
 formula/source/ui/dlg/formula.cxx                                 |   11 
 framework/source/classes/menumanager.cxx                          |    2 
 framework/source/uielement/menubarmanager.cxx                     |    2 
 idlc/source/astdump.cxx                                           |   71 --
 idlc/source/astinterface.cxx                                      |   39 -
 lingucomponent/source/spellcheck/spell/sspellimp.cxx              |    9 
 odk/source/unoapploader/win/unoapploader.c                        |    3 
 oox/source/export/shapes.cxx                                      |    7 
 registry/source/regimpl.cxx                                       |    9 
 rsc/source/res/rscclass.cxx                                       |    5 
 rsc/source/rscpp/cpp3.c                                           |    7 
 rsc/source/rscpp/cpp4.c                                           |   11 
 rsc/source/rscpp/cpp6.c                                           |    3 
 sal/osl/w32/security.c                                            |   34 
 sal/qa/osl/pipe/osl_Pipe.cxx                                      |  113 ---
 sal/workben/clipboardwben/testcopy/cbcpytest.cxx                  |   20 
 sal/workben/clipboardwben/testpaste/cbptest.cxx                   |    3 
 sal/workben/clipboardwben/testviewer/cbvtest.cxx                  |    3 
 sd/source/filter/ppt/pptin.cxx                                    |    4 
 sd/source/ui/animations/CustomAnimationList.cxx                   |    4 
 setup_native/source/win32/customactions/regactivex/regactivex.cxx |    7 
 sfx2/source/dialog/dinfdlg.cxx                                    |    2 
 shell/source/backends/gconfbe/gconfaccess.cxx                     |  152 ++--
 slideshow/test/demoshow.cxx                                       |    3 
 soltools/javadep/javadep.c                                        |   14 
 soltools/ldump/hashtbl.cxx                                        |   11 
 svl/source/items/szitem.cxx                                       |    2 
 svl/source/numbers/zforlist.cxx                                   |    2 
 svtools/source/contnr/imivctl1.cxx                                |    8 
 svtools/source/contnr/svimpbox.cxx                                |    3 
 svtools/source/filter/wmf/winwmf.cxx                              |    2 
 svtools/source/filter/wmf/wmfwr.cxx                               |    5 
 sw/source/core/doc/docredln.cxx                                   |    3 
 sw/source/core/layout/trvlfrm.cxx                                 |    3 
 sw/source/ui/uiview/view.cxx                                      |    2 
 toolkit/source/controls/controlmodelcontainerbase.cxx             |    6 
 toolkit/source/controls/formattedcontrol.cxx                      |    2 
 tools/source/memtools/table.cxx                                   |    2 
 unotools/source/config/fontcfg.cxx                                |    2 
 vcl/aqua/source/gdi/salatsuifontutils.cxx                         |    3 
 vcl/source/control/lstbox.cxx                                     |    2 
 vcl/source/fontsubset/ttcr.cxx                                    |   16 
 vcl/source/gdi/bitmap.cxx                                         |    4 
 vcl/source/gdi/bitmapex.cxx                                       |    4 
 vcl/unx/generic/app/wmadaptor.cxx                                 |   14 
 vcl/win/source/gdi/salbmp.cxx                                     |    2 
 vcl/win/source/gdi/salgdi2.cxx                                    |    8 
 vcl/win/source/gdi/salprn.cxx                                     |    3 
 72 files changed, 351 insertions(+), 978 deletions(-)

New commits:
commit 90645b9be8976681a2110ce40f7fb4f54b30edfa
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 17:24:43 2011 +0200

    do not check if unsigned is less than zero in in soltools/..hastbl.cxx

diff --git a/soltools/ldump/hashtbl.cxx b/soltools/ldump/hashtbl.cxx
index 712357f..ed17911 100644
--- a/soltools/ldump/hashtbl.cxx
+++ b/soltools/ldump/hashtbl.cxx
@@ -405,11 +405,12 @@ void* HashTableIterator::GetNext()
 
 void* HashTableIterator::GetPrev()
 {
-    if (m_lAt <= 0)
-        return NULL;
-
-    m_lAt--;
-    return FindValidObject(false /* backward */);
+    if (m_lAt)
+    {
+        --m_lAt;
+        return FindValidObject(false /* backward */);
+    }
+    return NULL;
 }
 
 void* HashTableIterator::FindValidObject(bool bForward)
commit d97b1a730547c6b40b07e20e6eccf3440b4b30b2
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 17:12:11 2011 +0200

    add missing braces for if statement, making correct scope

diff --git a/slideshow/test/demoshow.cxx b/slideshow/test/demoshow.cxx
index d591537..2432e37 100644
--- a/slideshow/test/demoshow.cxx
+++ b/slideshow/test/demoshow.cxx
@@ -487,9 +487,10 @@ IMPL_LINK( DemoWindow, updateHdl, Timer*, EMPTYARG )
     init();
 
     if( mxShow.is() )
+    {
         double nTimeout;
         mxShow->update(nTimeout);
-
+    }
     return 0;
 }
 
commit 4d08dfa3193a96676c911a44c54a3f512b9ebb03
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 14:37:15 2011 +0200

    cppcheck reduce scope of lingucomponent/...sspellimp.cxx

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 004d57e..2d7aa3d 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -447,7 +447,6 @@ Reference< XSpellAlternatives >
         {
             pMS = NULL;
             eEnc = RTL_TEXTENCODING_DONTKNOW;
-            int count = 0;
 
             if (rLocale == aDLocs[i])
             {
@@ -459,7 +458,7 @@ Reference< XSpellAlternatives >
             {
                 char ** suglst = NULL;
                 OString aWrd(OU2ENC(nWord,eEnc));
-                count = pMS->suggest(&suglst, (const char *) aWrd.getStr());
+                int count = pMS->suggest(&suglst, (const char *) aWrd.getStr());
 
                 if (count)
                 {
commit e47e88723cd3f330c158a224cd7ea42141ccd1dd
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 14:34:38 2011 +0200

    delete commented code from idlc/..astinterface.cxx

diff --git a/idlc/source/astinterface.cxx b/idlc/source/astinterface.cxx
index 5400036..e593592 100644
--- a/idlc/source/astinterface.cxx
+++ b/idlc/source/astinterface.cxx
@@ -142,7 +142,7 @@ sal_Bool AstInterface::dump(RegistryKey& rKey)
     typereg_Version version
         = (nBaseTypes <= 1 && nReferences == 0 && !m_bPublished
            ? TYPEREG_VERSION_0 : TYPEREG_VERSION_1);
-    {for (DeclList::const_iterator i(getIteratorBegin()); i != getIteratorEnd();
+    for (DeclList::const_iterator i(getIteratorBegin()); i != getIteratorEnd();
           ++i)
     {
         switch ((*i)->getNodeType()) {
@@ -151,7 +151,6 @@ sal_Bool AstInterface::dump(RegistryKey& rKey)
                 if (!increment(&nAttributes, "attributes")) {
                     return false;
                 }
-//                AstAttribute * attr = static_cast< AstAttribute * >(*i);
                 AstAttribute * attr = (AstAttribute *)(*i);
                 if (attr->isBound()) {
                     version = TYPEREG_VERSION_1;
@@ -203,7 +202,7 @@ sal_Bool AstInterface::dump(RegistryKey& rKey)
             OSL_ASSERT(false);
             break;
         }
-    }}
+    }
 
     OUString emptyStr;
     typereg::Writer aBlob(
@@ -213,7 +212,7 @@ sal_Bool AstInterface::dump(RegistryKey& rKey)
 
     sal_uInt16 superTypeIndex = 0;
     sal_uInt16 referenceIndex = 0;
-    {for (InheritedInterfaces::iterator i = m_inheritedInterfaces.begin();
+    for (InheritedInterfaces::iterator i = m_inheritedInterfaces.begin();
           i != m_inheritedInterfaces.end(); ++i)
     {
         if (i->isOptional()) {
@@ -230,23 +229,21 @@ sal_Bool AstInterface::dump(RegistryKey& rKey)
                     i->getInterface()->getRelativName(),
                     RTL_TEXTENCODING_UTF8));
         }
-    }}
+    }
 
     sal_uInt16 attributeIndex = 0;
     sal_uInt16 methodIndex = 0;
-    {for (DeclList::const_iterator i(getIteratorBegin()); i != getIteratorEnd();
+    for (DeclList::const_iterator i(getIteratorBegin()); i != getIteratorEnd();
           ++i)
     {
         switch ((*i)->getNodeType()) {
         case NT_attribute:
-//           static_cast< AstAttribute * >(*i)->dumpBlob(
 
             ((AstAttribute *)(*i))->dumpBlob(
                 aBlob, attributeIndex++, &methodIndex);
             break;
 
         case NT_operation:
-//            static_cast< AstOperation * >(*i)->dumpBlob(aBlob, methodIndex++);
             ((AstOperation *)(*i))->dumpBlob(aBlob, methodIndex++);
             break;
 
@@ -254,7 +251,7 @@ sal_Bool AstInterface::dump(RegistryKey& rKey)
             OSL_ASSERT(false);
             break;
         }
-    }}
+    }
 
     sal_uInt32 aBlobSize;
     void const * pBlob = aBlob.getBlob(&aBlobSize);
@@ -309,20 +306,20 @@ void AstInterface::checkInheritedInterfaceClashes(
             }
         }
         if (direct || !optional) {
-            {for (DeclList::const_iterator i(ifc->getIteratorBegin());
+            for (DeclList::const_iterator i(ifc->getIteratorBegin());
                   i != ifc->getIteratorEnd(); ++i)
             {
                 checkMemberClashes(
                     doubleDeclarations.members, *i, !mainOptional);
-            }}
-            {for (InheritedInterfaces::const_iterator i(
+            }
+            for (InheritedInterfaces::const_iterator i(
                       ifc->m_inheritedInterfaces.begin());
                   i != ifc->m_inheritedInterfaces.end(); ++i)
             {
                 checkInheritedInterfaceClashes(
                     doubleDeclarations, seenInterfaces, i->getResolved(),
                     false, i->isOptional(), mainOptional);
-            }}
+            }
         }
     }
 }
@@ -373,24 +370,24 @@ void AstInterface::addVisibleInterface(
         result.first->second = kind;
     }
     if (!optional && !seen) {
-        {for (DeclList::const_iterator i(ifc->getIteratorBegin());
+        for (DeclList::const_iterator i(ifc->getIteratorBegin());
               i != ifc->getIteratorEnd(); ++i)
         {
             m_visibleMembers.insert(
                 VisibleMembers::value_type(
                     (*i)->getLocalName(), VisibleMember(*i)));
-        }}
-        {for (InheritedInterfaces::const_iterator i(
+        }
+        for (InheritedInterfaces::const_iterator i(
                   ifc->m_inheritedInterfaces.begin());
               i != ifc->m_inheritedInterfaces.end(); ++i)
         {
             addVisibleInterface(i->getResolved(), false, i->isOptional());
-        }}
+        }
     }
 }
 
 void AstInterface::addOptionalVisibleMembers(AstInterface const * ifc) {
-    {for (DeclList::const_iterator i(ifc->getIteratorBegin());
+    for (DeclList::const_iterator i(ifc->getIteratorBegin());
           i != ifc->getIteratorEnd(); ++i)
     {
         VisibleMembers::iterator visible(
@@ -404,15 +401,15 @@ void AstInterface::addOptionalVisibleMembers(AstInterface const * ifc) {
             visible->second.optionals.insert(
                 VisibleMember::Optionals::value_type(ifc->getScopedName(), *i));
         }
-    }}
-    {for (InheritedInterfaces::const_iterator i(
+    }
+    for (InheritedInterfaces::const_iterator i(
               ifc->m_inheritedInterfaces.begin());
           i != ifc->m_inheritedInterfaces.end(); ++i)
     {
         if (!i->isOptional()) {
             addOptionalVisibleMembers(i->getResolved());
         }
-    }}
+    }
 }
 
 bool AstInterface::increment(sal_uInt16 * counter, char const * sort) const {
commit faeb15dd32c689f1e00716fedb4229af856706b3
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 14:30:43 2011 +0200

    cppcheck reduce scope of var in formula/..formula.cxx

diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index ab9026e..f82ee9b 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -478,8 +478,6 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
     const sal_Unicode sep = m_pHelper->getFunctionManager()->getSingleToken(IFunctionManager::eSep);
 
     xub_StrLen nFuncPos=STRING_NOTFOUND;    //@ Testwise
-    xub_StrLen nPrevFuncPos=1;
-    short  nBracketCount=0;
     sal_Bool   bFlag=sal_False;
     String aFormString = pMEdit->GetText();
     m_aFormulaHelper.GetCharClass()->toUpper( aFormString );
@@ -495,6 +493,8 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
         {
             xub_StrLen nTokPos=1;
             xub_StrLen nOldTokPos=1;
+            xub_StrLen nPrevFuncPos = 1;
+            short nBracketCount = 0;
             while ( pIter != pEnd )
             {
                 const sal_Int32 eOp = pIter->OpCode;
@@ -508,7 +508,8 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
                     aBtnMatrix.Check();
                 }
 
-                if ( eOp == m_aSpecialOpCodes[sheet::FormulaMapGroupSpecialOffset::PUSH].Token.OpCode || eOp == m_aSpecialOpCodes[sheet::FormulaMapGroupSpecialOffset::SPACES].Token.OpCode )
+                if ( eOp == m_aSpecialOpCodes[sheet::FormulaMapGroupSpecialOffset::PUSH].Token.OpCode ||
+                    eOp == m_aSpecialOpCodes[sheet::FormulaMapGroupSpecialOffset::SPACES].Token.OpCode )
                 {
                     const xub_StrLen n1=aFormString.Search(sep, nTokPos);
                     const xub_StrLen n2=aFormString.Search(')',nTokPos);
commit cbc1c6f0824f95a8d271edfdf4a6fe522388042b
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 14:25:27 2011 +0200

    cppcheck reduce scope of var in oox/...shapes.cxx

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index be72043..edb8e20 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -525,7 +525,6 @@ ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape )
     DBG(printf("custom shape type: %s ==> %s\n", USS( sShapeType ), sPresetShape));
     Sequence< PropertyValue > aGeometrySeq;
     sal_Int32 nAdjustmentValuesIndex = -1;
-    sal_Int32 nAdjustmentsWhichNeedsToBeConverted = 0;
 
     if( GETA( CustomShapeGeometry ) ) {
         DBG(printf("got custom shape geometry\n"));
@@ -564,7 +563,11 @@ ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape )
     pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
     WriteShapeTransformation( xShape, XML_a );
     if( nAdjustmentValuesIndex != -1 )
-        WritePresetShape( sPresetShape, eShapeType, bPredefinedHandlesUsed, nAdjustmentsWhichNeedsToBeConverted, aGeometrySeq[ nAdjustmentValuesIndex ] );
+    {
+        sal_Int32 nAdjustmentsWhichNeedsToBeConverted = 0;
+        WritePresetShape( sPresetShape, eShapeType, bPredefinedHandlesUsed,
+                          nAdjustmentsWhichNeedsToBeConverted, aGeometrySeq[ nAdjustmentValuesIndex ] );
+    }
     else
         WritePresetShape( sPresetShape );
     if( rXPropSet.is() )
commit 1fc34c75a8a2356ed03c52ca839a7ad771c51ba1
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 14:09:11 2011 +0200

    cppcheck scope reduction of var in soltools/...javadep.c

diff --git a/soltools/javadep/javadep.c b/soltools/javadep/javadep.c
index 351177a..ced9f38 100644
--- a/soltools/javadep/javadep.c
+++ b/soltools/javadep/javadep.c
@@ -198,15 +198,13 @@ read_utf8(const file_t *pfile)
      * Data is still in network byteorder
      */
 
-    utf8_t  a_utf8;
-    size_t  nread;
-
+    utf8_t a_utf8;
     a_utf8.pdata = NULL;
 
     a_utf8.nlen = read_uint16(pfile);
     if (a_utf8.nlen > 0) {
         a_utf8.pdata = xmalloc(a_utf8.nlen*sizeof(char));
-        nread = fread(a_utf8.pdata, a_utf8.nlen*sizeof(char), 1, pfile->pfs);
+        size_t nread = fread(a_utf8.pdata, a_utf8.nlen*sizeof(char), 1, pfile->pfs);
         if ( !nread ) {
             fclose(pfile->pfs);
             err_quit("%s: truncated class file", pfile->pname);
@@ -265,8 +263,7 @@ add_to_dependencies(struct growable *pdep,
                     const char *pclass_file)
 {
     /* create dependencies */
-    int i;
-    size_t nlen_filt, nlen_str, nlen_pdepstr;
+    size_t nlen_pdepstr;
     char *pstr, *ptrunc;
     char path[PATH_MAX+1];
     char cnp_class_file[PATH_MAX+1];
@@ -282,9 +279,10 @@ add_to_dependencies(struct growable *pdep,
             append_to_growable(pdep, strdup(pstr));
         }
     } else {
-        nlen_str    = strlen(pstr);
+        size_t nlen_str = strlen(pstr);
+        int i;
         for ( i = 0; i < pfilt->ncur; i++ ) {
-            nlen_filt   = strlen(pfilt->parray[i]);
+            size_t nlen_filt = strlen(pfilt->parray[i]);
             if ( nlen_filt + 1 + nlen_str > PATH_MAX )
                 err_quit("path to long");
             memcpy(path, pfilt->parray[i], nlen_filt);
commit 2dc8787d06cb8e12d9309c0cc149befc02c405aa
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 14:02:57 2011 +0200

    cppcheck reduce scope of var in vcl/unx/...wmadaptor.cxx

diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx
index b33349b..5dfc236 100644
--- a/vcl/unx/generic/app/wmadaptor.cxx
+++ b/vcl/unx/generic/app/wmadaptor.cxx
@@ -416,7 +416,6 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) :
                     if( pAtomNames[i] == NULL )
                         continue;
 
-                    int nProtocol = -1;
                     WMAdaptorProtocol aSearch;
                     aSearch.pProtocol = pAtomNames[i];
                     WMAdaptorProtocol* pMatch = (WMAdaptorProtocol*)
@@ -427,15 +426,13 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) :
                                  compareProtocol );
                     if( pMatch )
                     {
-                        nProtocol = pMatch->nProtocol;
-                        m_aWMAtoms[ nProtocol ] = pAtoms[ i ];
+                        m_aWMAtoms[ pMatch->nProtocol ] = pAtoms[ i ];
                         if( pMatch->nProtocol == NET_WM_STATE_STAYS_ON_TOP )
                             m_bEnableAlwaysOnTopWorks = true;
                     }
 #if OSL_DEBUG_LEVEL > 1
-                    fprintf( stderr, "  %s%s\n", pAtomNames[i], nProtocol != -1 ? "" : " (unsupported)" );
+                    fprintf( stderr, "  %s%s\n", pAtomNames[i], ((pMatch)&&(pMatch->nProtocol != -1)) ? "" : " (unsupported)" );
 #endif
-
                     XFree( pAtomNames[i] );
                 }
             }
@@ -672,7 +669,6 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
                     if( pAtomNames[i] == NULL )
                         continue;
 
-                    int nProtocol = -1;
                     WMAdaptorProtocol aSearch;
                     aSearch.pProtocol = pAtomNames[i];
                     WMAdaptorProtocol* pMatch = (WMAdaptorProtocol*)
@@ -683,8 +679,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
                                  compareProtocol );
                     if( pMatch )
                     {
-                        nProtocol = pMatch->nProtocol;
-                        m_aWMAtoms[ nProtocol ] = pAtoms[ i ];
+                        m_aWMAtoms[ pMatch->nProtocol ] = pAtoms[ i ];
                         if( pMatch->nProtocol == WIN_LAYER )
                             m_bEnableAlwaysOnTopWorks = true;
                     }
@@ -695,9 +690,8 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
                         m_nInitWinGravity = NorthWestGravity;
                     }
 #if OSL_DEBUG_LEVEL > 1
-                    fprintf( stderr, "  %s%s\n", pAtomNames[i], nProtocol != -1 ? "" : " (unsupported)" );
+                    fprintf( stderr, "  %s%s\n", pAtomNames[i], ((pMatch) && (pMatch->nProtocol != -1)) ? "" : " (unsupported)" );
 #endif
-
                     XFree( pAtomNames[i] );
                 }
             }
commit e9969a918f3b171833991f152f58baf7a0237e2f
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 13:07:47 2011 +0200

    cppcheck reduce scope of var in dmake/win95/runargv.c

diff --git a/dmake/win95/microsft/vpp40/runargv.c b/dmake/win95/microsft/vpp40/runargv.c
index fab9258..c482859 100644
--- a/dmake/win95/microsft/vpp40/runargv.c
+++ b/dmake/win95/microsft/vpp40/runargv.c
@@ -128,14 +128,13 @@ int pid;
 PUBLIC void
 Clean_up_processes()
 {
-   register int i;
-
-   if( _procs != NIL(PR) ) {
-      for( i=0; i<Max_proc; i++ )
-     if( _procs[i].pr_valid )
-        kill(_procs[i].pr_pid, SIGTERM);
-
-      while( Wait_for_child(TRUE, -1) != -1 );
+    if( _procs != NIL(PR) )
+    {
+        register int i;
+        for( i=0; i<Max_proc; i++ )
+            if( _procs[i].pr_valid )
+                kill(_procs[i].pr_pid, SIGTERM);
+        while( Wait_for_child(TRUE, -1) != -1 );
    }
 }
 
commit 070957a67757dad71a1f80bea1c763c7aef439e8
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 13:01:41 2011 +0200

    cppcheck reduce scope of var in dmake/winnt/...vpp40/runargv.c

diff --git a/dmake/winnt/microsft/vpp40/runargv.c b/dmake/winnt/microsft/vpp40/runargv.c
index 9042dfc..2ffef70 100644
--- a/dmake/winnt/microsft/vpp40/runargv.c
+++ b/dmake/winnt/microsft/vpp40/runargv.c
@@ -128,18 +128,16 @@ int pid;
 PUBLIC void
 Clean_up_processes()
 {
-   register int i;
-
-   if( _procs != NIL(PR) ) {
-      for( i=0; i<Max_proc; i++ )
-     if( _procs[i].pr_valid )
-        kill(_procs[i].pr_pid, SIGTERM);
-
-      while( Wait_for_child(TRUE, -1) != -1 );
-   }
+    if( _procs != NIL(PR) )
+    {
+        register int i;
+        for( i=0; i<Max_proc; i++ )
+            if( _procs[i].pr_valid )
+                kill(_procs[i].pr_pid, SIGTERM);
+        while( Wait_for_child(TRUE, -1) != -1 );
+    }
 }
 
-
 static void
 _add_child( pid, target, ignore, last )
 int pid;
commit 3f7fd933b3feab7924998e11b4a49c1d27c7fa2c
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 12:59:01 2011 +0200

    cppcheck reduce scope of var in dmake/state.c

diff --git a/dmake/state.c b/dmake/state.c
index 5179ead..569ceee 100644
--- a/dmake/state.c
+++ b/dmake/state.c
@@ -52,41 +52,39 @@ Read_state()
 {
    char *buf;
    char sizeb[20];
-   int  size;
    FILE *fp;
    KSTATEPTR sp;
 
-   if( (fp = Search_file(".KEEP_STATE", &_st_file)) != NIL(FILE) ) {
-      if( _my_fgets( sizeb, 20, fp ) ) {
-     size = atol(sizeb);
-     buf = MALLOC(size+2, char);
-
-     while( _my_fgets(buf, size, fp) ) {
-        TALLOC(sp, 1, KSTATE);
-        sp->st_name = DmStrDup(buf);
-        (void) Hash(buf, &sp->st_nkey);
-
-        if( _my_fgets(buf, size, fp) ) sp->st_count = atoi(buf);
-        if( _my_fgets(buf, size, fp) ) sp->st_dkey   = (uint32) atol(buf);
-
-        if( _my_fgets(buf, size, fp) )
-           sp->st_key = (uint32) atol(buf);
-        else {
-           FREE(sp);
-           break;
+    if( (fp = Search_file(".KEEP_STATE", &_st_file)) != NIL(FILE) )
+    {
+        if( _my_fgets( sizeb, 20, fp ) )
+        {
+            int size = atol(sizeb);
+            buf = MALLOC(size+2, char);
+
+            while( _my_fgets(buf, size, fp) )
+            {
+                TALLOC(sp, 1, KSTATE);
+                sp->st_name = DmStrDup(buf);
+                (void) Hash(buf, &sp->st_nkey);
+                if( _my_fgets(buf, size, fp) )
+                    sp->st_count = atoi(buf);
+                if( _my_fgets(buf, size, fp) )
+                    sp->st_dkey   = (uint32) atol(buf);
+                if( _my_fgets(buf, size, fp) )
+                    sp->st_key = (uint32) atol(buf);
+                else {
+                    FREE(sp);
+                    break;
+                }
+                if( _st_head == NIL(KSTATE) )
+                    _st_head = sp;
+                else
+                    _st_tail->st_next = sp;
+                _st_tail = sp;
+            }
+        FREE(buf);
         }
-
-        if( _st_head == NIL(KSTATE) )
-           _st_head = sp;
-        else
-           _st_tail->st_next = sp;
-
-        _st_tail = sp;
-     }
-
-     FREE(buf);
-      }
-
       Closefile();
    }
 }
commit 7bd7d37f58ee7dbc893201d57940cf851fa9dce1
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 12:55:00 2011 +0200

    cppcheck reduce scope in dmake/unix/runargv.c

diff --git a/dmake/unix/runargv.c b/dmake/unix/runargv.c
index 2ea22cb..4e87862 100644
--- a/dmake/unix/runargv.c
+++ b/dmake/unix/runargv.c
@@ -840,23 +840,25 @@ int pqid;
 PUBLIC void
 Clean_up_processes()
 {
-   register int i;
-   int ret;
+    int ret;
 
-   if( _procs != NIL(PR) ) {
+    if( _procs != NIL(PR) )
+    {
+      register int i;
       for( i=0; i<Max_proc; i++ )
-     if( _procs[i].pr_valid ) {
-#if !defined(USE_CREATEPROCESS)
-        if( (ret = kill(_procs[i].pr_pid, SIGTERM)) ) {
-           fprintf(stderr, "Killing of pid %d from pq[%d] failed with: %s - %d ret: %d\n",
-               _procs[i].pr_pid, i,
-               strerror(errno), SIGTERM, ret );
+        if( _procs[i].pr_valid )
+        {
+        #if !defined(USE_CREATEPROCESS)
+            if( (ret = kill(_procs[i].pr_pid, SIGTERM)) )
+            {
+                fprintf(stderr, "Killing of pid %d from pq[%d] failed with: %s - %d ret: %d\n",
+                        _procs[i].pr_pid, i, strerror(errno), SIGTERM, ret );
+            }
+        #else
+            TerminateProcess(_procs[i].pr_pid, 1);
+        #endif
         }
-#else
-     TerminateProcess(_procs[i].pr_pid, 1);
-#endif
-     }
-   }
+    }
 }
 
 
commit 347367d14ac8e3d7c25aaf50cc72593212d27f26
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 12:49:18 2011 +0200

    cppcheck scope reduction in dmake/infer.c

diff --git a/dmake/infer.c b/dmake/infer.c
index 02682bc..9f160d3 100644
--- a/dmake/infer.c
+++ b/dmake/infer.c
@@ -401,7 +401,6 @@ ICELLPTR *nnmp;
      int      ipush = 0;    /* flag for push on inferred prereq     */
      char     *name = NIL(char);        /* prerequisite name    */
      CELLPTR  meta = edge->cl_prq;
-     int      dmax_fix;
      int      trans;
      int      noinf;
      int      exists;
@@ -428,6 +427,7 @@ ICELLPTR *nnmp;
      if( name ) {
         /* Build the prerequisite name from the %-meta prerequisite given
          * for the %-meta rule. */
+        int dmax_fix;
         iprqh.ht_name = buildname( ic->ic_name, name, pdfa->dl_per );
         if((dmax_fix = (count_dots(name)-count_dots(meta->CE_NAME))) < 0)
            dmax_fix = 0;
commit 8fc65666ea32241f192eda8f8e4eb11e90c5fca3
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 12:47:16 2011 +0200

    cppcheck scope reduction in dmake/getinp.c

diff --git a/dmake/getinp.c b/dmake/getinp.c
index 1ac312a..419e625 100644
--- a/dmake/getinp.c
+++ b/dmake/getinp.c
@@ -731,7 +731,6 @@ int partcomp( char* lhs, int opcode )
     int     result, opsind;
     const int localopscount=4;
     char*   localops[] = { "==", "!=", "<=", ">=" };
-    int     lint, rint;
 
 #define EQUAL           0
 #define NOTEQUAL        1
@@ -817,8 +816,8 @@ int partcomp( char* lhs, int opcode )
                     if ( rhs && rhs[0] == '"' ) rhs++;
 
                     /* Empty strings evaluate to zero. */
-                    lint = lhs ? atoi( lhs ) : 0;
-                    rint = rhs ? atoi( rhs ) : 0;
+                    int lint = lhs ? atoi( lhs ) : 0;
+                    int rint = rhs ? atoi( rhs ) : 0;
                     result = ( lint >= rint ) ? TRUE : FALSE;
                     if ( opsind == LESS_EQUAL && lint != rint )
                         result = !result;
commit 2b6ef29f451c707c151025b85e87196c3602b44e
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 12:43:42 2011 +0200

    cppcheck reduce scope of var in automation/...objtest.cxx

diff --git a/automation/source/testtool/objtest.cxx b/automation/source/testtool/objtest.cxx
index 079e80f..dd1ceab 100644
--- a/automation/source/testtool/objtest.cxx
+++ b/automation/source/testtool/objtest.cxx
@@ -3021,7 +3021,6 @@ sal_Bool TestToolObj::ReturnResults( SvStream *pIn )
 {
 
     sal_uInt16 nId;
-    sal_uLong nClearSequence = 0;
     sal_Bool bSequenceOK = sal_True;
     CNames *pReverseControlsKontext = NULL;
 
@@ -3506,6 +3505,7 @@ sal_Bool TestToolObj::ReturnResults( SvStream *pIn )
     delete pRetStream;
     if ( bSequenceOK )
     {
+        sal_uLong nClearSequence = 0; // before a lot of code was deleted, this was a funct. global var.
         nSequence++;
         pShortNames->Invalidate( nClearSequence - KEEP_SEQUENCES );
     }
commit e9f3d1e50500a410a0f33c6a5ffc38207cd31ca6
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Mon Oct 3 12:41:10 2011 +0200

    delete dead code but leave FIXME tags behind

diff --git a/automation/source/testtool/objtest.cxx b/automation/source/testtool/objtest.cxx
index bcf9387..079e80f 100644
--- a/automation/source/testtool/objtest.cxx
+++ b/automation/source/testtool/objtest.cxx
@@ -160,22 +160,7 @@ sal_Bool ControlDef::operator == (const ControlItem &rPar)
 void ControlDef::Write( SvStream &aStream )
 {
     // FIXME: HELPID
-    #if 0
-    if ( pSons )
-        aStream.WriteByteString( String('*').Append( pData->Kurzname ), RTL_TEXTENCODING_UTF8 );
-    else
-        aStream.WriteByteString( pData->Kurzname, RTL_TEXTENCODING_UTF8 );
-    aStream << ((sal_uInt16)pData->aUId.HasNumeric());
-    if ( pData->aUId.HasString() )
-        aStream.WriteByteString( pData->aUId.GetStr(), RTL_TEXTENCODING_UTF8 );
-    else
-        aStream << static_cast<comm_UINT32>(pData->aUId.GetNum()); //GetNum() sal_uLong != comm_UINT32 on 64bit
-    if ( pSons )
-        for ( sal_uInt16 i = 0 ; pSons->Count() > i ; i++ )
-            ((ControlDef*)(*pSons)[i])->Write(aStream);
-    #else
     (void)aStream;
-    #endif
 }
 
 ControlDef::ControlDef(const String &Name, rtl::OString aUIdP )
@@ -251,14 +236,7 @@ String CRevNames::GetName( rtl::OString aUId )
     else
     {
         // FIXME: HELPID
-        #if 0
-        if ( aUId.Matches( UID_ACTIVE ) )
-            return CUniString("Active");
-        else
-            return GEN_RES_STR1( S_NAME_NOT_THERE, aUId.GetText() );
-        #else
         return String();
-        #endif
     }
 }
 
@@ -603,11 +581,7 @@ void TestToolObj::InitTestToolObj()
         pMeth->SetName( pRCommands->GetObject( i )->pData->Kurzname );
         pMeth->SetUserData( ID_RemoteCommand );
         // FIXME: HELPID
-        #if 0
-        pMeth->nValue = pRCommands->GetObject( i )->pData->aUId.GetNum();
-        #else
         pMeth->nValue = 0;
-        #endif
         Insert( pMeth );
         StartListening( pMeth->GetBroadcaster(), sal_True );
     }
@@ -888,14 +862,8 @@ void TestToolObj::ReadNames( String Filename, CNames *&pNames, CNames *&pUIds, s
         }
         else
         {
-
             // FIXME: HELPID
-            #if 0
-            if (aShortname.CompareIgnoreCaseToAscii("*Active") == COMPARE_EQUAL)
-                aUId = rtl::OString( UID_ACTIVE );
-            else
-            #endif
-                if ( !bUnoName && !bMozillaName )
+            if ( !bUnoName && !bMozillaName )
             {   // get the ID from the Hid.Lst
                 ControlDef WhatName(aLongname,rtl::OString());
                 if (pUIds->Seek_Entry(&WhatName,&nElement))
@@ -909,39 +877,22 @@ void TestToolObj::ReadNames( String Filename, CNames *&pNames, CNames *&pUIds, s
             else
             {
                 // FIXME: HELPID
-                #if 0
-                if ( bUnoName )
-                    aUId = rtl::OString( aLongname );
-                else if ( bMozillaName )
-                    aUId = rtl::OString( aLongname );
-                else
-                {
-                    OSL_FAIL("Unknown URL schema");
-                }
-                #endif
             }
-
-
-
             if (aShortname.GetChar(0) == '*' || bIsFlat)     // global short name (dialogue name or SId)
             {
                 if (!bIsFlat)
                     aShortname.Erase(0,1);
-
-                   pNewDef = new ControlDef(aShortname,aUId);
-
+                pNewDef = new ControlDef(aShortname,aUId);
                 if (!bIsFlat)
                 {
                     pNewDef->Sons( new CNames() );
-
-                       pNewDef2 = new ControlDef(aShortname,aUId);
+                    pNewDef2 = new ControlDef(aShortname,aUId);
                     if (!pNewDef->SonInsert( pNewDef2 ))         // enter dialogue into its own namespace
                     {
                         delete pNewDef2;
                         OSL_FAIL(" !!!! ACHTUNG !!!!  Fehler beim einf�gen in leere Liste!");
                     }
                 }
-
                 const ControlItem *pItem = pNewDef;
                 if (! pNames->Insert(pItem))
                 {
@@ -985,7 +936,6 @@ void TestToolObj::ReadNames( String Filename, CNames *&pNames, CNames *&pUIds, s
     Stream.Close();
 }
 
-
 void TestToolObj::AddName(String &aBisher, String &aNeu )
 {
     String aSl( '/' );
@@ -996,7 +946,6 @@ void TestToolObj::AddName(String &aBisher, String &aNeu )
     }
 }
 
-
 void TestToolObj::ReadFlat( String Filename, CNames *&pNames, sal_Bool bSortByName )
 //  if bSortByName == sal_False, sort by UId (ControlItemUId instead of ControlDef)
 {
@@ -1028,13 +977,13 @@ void TestToolObj::ReadFlat( String Filename, CNames *&pNames, sal_Bool bSortByNa
     while (!Stream.IsEof())
     {
         nLineNr++;
-
         Stream.ReadByteStringLine(aLine, RTL_TEXTENCODING_IBM_850);
         aLine.EraseLeadingChars();
         aLine.EraseTrailingChars();
         while ( aLine.SearchAscii("  ") != STRING_NOTFOUND )
             aLine.SearchAndReplaceAllAscii("  ",UniString(' '));
-        if (aLine.Len() == 0) continue;
+        if (aLine.Len() == 0)
+            continue;
 
         if ( (aLine.GetTokenCount(cMyDelim) < 2 || aLine.GetTokenCount(cMyDelim) > 3) && aLine.CompareIgnoreCaseToAscii("*Active") != COMPARE_EQUAL )
         {
@@ -1141,7 +1090,6 @@ void TestToolObj::WaitForAnswer ()
         }
     }
 
-
     if ( !bReturnOK )
     {
         ADD_ERROR(ERR_EXEC_TIMEOUT,GEN_RES_STR1(S_TIMOUT_WAITING, String::CreateFromInt64(nSequence)));
@@ -1173,7 +1121,6 @@ IMPL_LINK( TestToolObj, CallDialogHandler, Application*, EMPTYARG )
     ((StarBASIC*)GetParent())->Call( aHandlerName );
     nSequence = nRememberSequence;
 
-
     nWindowHandlerCallLevel--;
     return 0;
 }
@@ -1370,9 +1317,6 @@ sal_Bool TestToolObj::ReadNamesBin( String Filename, CNames *&pSIds, CNames *&pC
             String aStrId;
             aStream.ReadByteString( aStrId, RTL_TEXTENCODING_UTF8 );
             // FIXME: HELPID
-            #if 0
-            aUId = rtl::OString( aStrId );
-            #endif
         }
         else
         {
@@ -1385,12 +1329,11 @@ sal_Bool TestToolObj::ReadNamesBin( String Filename, CNames *&pSIds, CNames *&pC
         {
             if (!bIsFlat)
                 aName.Erase(0,1);
-              pNewDef = new ControlDef(aName,aUId);
+            pNewDef = new ControlDef(aName,aUId);
 
             if (!bIsFlat)
             {
                 pNewDef->Sons(new CNames());
-
                 pNewDef2 = new ControlDef(aName,aUId);
                 if (!pNewDef->SonInsert(pNewDef2))          // enter dialogue into its own namespace
                 {
@@ -1419,7 +1362,7 @@ sal_Bool TestToolObj::ReadNamesBin( String Filename, CNames *&pSIds, CNames *&pC
             }
             else
             {
-                   pNewDef = new ControlDef(aName,aUId);
+                pNewDef = new ControlDef(aName,aUId);
                 if (! pFatherDef->SonInsert(pNewDef))
                 {
                     delete pNewDef;
@@ -1427,8 +1370,6 @@ sal_Bool TestToolObj::ReadNamesBin( String Filename, CNames *&pSIds, CNames *&pC
                 }
             }
         }
-
-
         nAnz--;
         if ( !nAnz && bIsFlat )     // We have read all slots
         {
@@ -1436,8 +1377,6 @@ sal_Bool TestToolObj::ReadNamesBin( String Filename, CNames *&pSIds, CNames *&pC
             pNames = pControls; // Now read the controls
             bIsFlat = sal_False;    // Controls *do* have children
         }
-
-
         GetpApp()->Reschedule();
     }
     {
@@ -2004,7 +1943,7 @@ void TestToolObj::SFX_NOTIFY( SfxBroadcaster&, const TypeId&,
                         {
                             pImpl->pNextReturn = ((SbxTransportMethod*)pVar);
                                                         // FIXME: HELPID
-                            aNextReturnId = rtl::OString();// ((SbxTransportMethod*)pVar)->nValue );
+                            aNextReturnId = rtl::OString();
                         }
                         if ( SingleCommandBlock )
                             EndBlock();
@@ -2077,16 +2016,13 @@ void TestToolObj::SFX_NOTIFY( SfxBroadcaster&, const TypeId&,
                                     In->GenCmdControl (pMember->GetULong(),
                                         (sal_uInt16)((SbxTransportMethod*)pVar)->nValue, rPar);
                                                                 // FIXME: HELPID
-                                    aNextReturnId = rtl::OString();// pMember->GetULong() );
+                                    aNextReturnId = rtl::OString();
                                 }
                                 else
                                 {
                                     In->GenCmdControl (pMember->GetString(),
                                         (sal_uInt16)((SbxTransportMethod*)pVar)->nValue, rPar);
                                     // FIXME: HELPID
-                                    #if 0
-                                    aNextReturnId = rtl::OString( pMember->GetString() );
-                                    #endif
                                 }
                             }
 
@@ -2629,12 +2565,7 @@ SbxVariable* TestToolObj::Find( const String& aStr, SbxClassType aType)
 
             // Will be set on method-child further down
             // FIXME: HELPID
-            #if 0
-            if ( pWhatName->pData->aUId.HasNumeric() )
-                pImpl->pControlsObj->SetUserData( ID_Control );
-            else
-            #endif
-                pImpl->pControlsObj->SetUserData( ID_StringControl );
+            pImpl->pControlsObj->SetUserData( ID_StringControl );
 
             pShortNames->Insert(pWhatName->pData->Kurzname,pWhatName->pData->aUId,nSequence);
 
@@ -2647,13 +2578,6 @@ SbxVariable* TestToolObj::Find( const String& aStr, SbxClassType aType)
                 pMember = pID;
             }
             // FIXME: HELPID
-            #if 0
-            if ( pWhatName->pData->aUId.HasNumeric() )
-                pMember->PutULong(pWhatName->pData->aUId.GetNum());
-            else
-                pMember->PutString(pWhatName->pData->aUId.GetStr());
-            #endif
-
             pMember = pImpl->pControlsObj->Find(CUniString("name"),SbxCLASS_DONTCARE);
             if ( pMember != NULL )
                 pMember->PutString(pWhatName->pData->Kurzname);
@@ -2673,19 +2597,6 @@ SbxVariable* TestToolObj::Find( const String& aStr, SbxClassType aType)
             pMyVar->SetName( pWhatName->pData->Kurzname );
 
             // FIXME: HELPID
-            #if 0
-            if ( pWhatName->pData->aUId.HasNumeric() )
-            {
-                pMyVar->SetUserData( ID_Dispatch );
-                pMyVar->nValue = pWhatName->pData->aUId.GetNum();
-                pShortNames->Insert( aStr, pWhatName->pData->aUId, nSequence );
-            }
-            else
-            {
-                pMyVar->SetUserData( ID_UNODispatch );
-                pMyVar->aUnoSlot = pWhatName->pData->aUId.GetStr();
-            }
-            #endif
             return pMyVar;
         }
 
@@ -2702,12 +2613,6 @@ SbxVariable* TestToolObj::Find( const String& aStr, SbxClassType aType)
                 pReturn->SetName( pWhatName->pData->Kurzname );
 
                 // FIXME: HELPID
-                #if 0
-                if ( pWhatName->pData->aUId.HasNumeric() )
-                    pReturn->PutULong(pWhatName->pData->aUId.GetNum());
-                else
-                    pReturn->PutString(pWhatName->pData->aUId.GetStr());
-                #endif
                 return pReturn;
             }
         }
@@ -3137,18 +3042,12 @@ sal_Bool TestToolObj::ReturnResults( SvStream *pIn )
                 String aUStrId;     // UniqueStringID Used for Mozilla Integration
                 pRetStream->Read( aUStrId );
                 // FIXME: HELPID
-                #if 0
-                aUId = rtl::OString( aUStrId );
-                #endif
             }
             else
             {
                 comm_UINT32 nUId;
                 pRetStream->Read( nUId );
                 // FIXME: HELPID
-                #if 0
-                aUId = rtl::OString( nUId );
-                #endif
             }
             pRetStream->Read(nParams);
 
@@ -3178,18 +3077,6 @@ sal_Bool TestToolObj::ReturnResults( SvStream *pIn )
                 case RET_Sequence:
                     {
                         // FIXME: HELPID
-                        #if 0
-                        sal_uLong nUId = aUId.GetNum();
-                        if ( nSequence != nUId )
-                        {
-                            bSequenceOK = sal_False;
-                            ADD_ERROR(SbxERR_BAD_ACTION, GEN_RES_STR2(S_RETURN_SEQUENCE_MISSMATCH, String::CreateFromInt64(nUId), String::CreateFromInt64(nSequence)) );
-                        }
-                        else
-                        {
-                            nClearSequence = nUId;
-                        }
-                        #endif
                     }
                     break;
                 case RET_Value:
@@ -3248,9 +3135,6 @@ sal_Bool TestToolObj::ReturnResults( SvStream *pIn )
 
                         WinInfoRec *pWinInfo = new WinInfoRec;
                         // FIXME: HELPID
-                        #if 0
-                        pWinInfo->aUId = aUId.GetText();
-                        #endif
                         pWinInfo->nRType = (sal_uInt16)nLNr1;   // just sal_uLong for Transport, data is always USHORT
                         pWinInfo->aRName = aString1;
                         pWinInfo->bIsReset = bBool1;
@@ -3303,185 +3187,18 @@ sal_Bool TestToolObj::ReturnResults( SvStream *pIn )
 
 
                         // FIXME: HELPID
-                        #if 0
-                        if ( aUId.HasString() )
-                        {   // use the String ID since there is no LongName in hid.lst
-                            pWinInfo->aLangname = aUId.GetStr();
-                        }
-                        else
-                        {
-                            if ( m_pReverseUIds )
-                            {
-                                sal_uInt16 nNr;
-                                ControlItem *pNewItem = new ControlItemUId( String(), aUId );
-                                if ( m_pReverseUIds->Seek_Entry(pNewItem,&nNr) )
-                                    pWinInfo->aLangname = m_pReverseUIds->GetObject(nNr)->pData->Kurzname;
-                                delete pNewItem;
-                            }
-                        }
-                        #endif
-
                         aWinInfoHdl.Call( pWinInfo );
-
                         delete pWinInfo;
                     }
                     break;
                 case RET_ProfileInfo:
                     {
                         // FIXME: HELPID
-                        #if 0
-                        sal_uLong nUId = aUId.GetNum();
-                        if ( nParams & PARAM_STR_1 )
-                        {
-                            DirEntry FilePath = pImpl->aLogFileBase + DirEntry(DirEntry(aLogFileName).GetBase().AppendAscii(".prf"));
-                            SvFileStream aStrm( FilePath.GetFull(), STREAM_STD_WRITE );
-                            if( aStrm.IsOpen() )
-                            {
-                                aString1.ConvertLineEnd(LINEEND_CRLF);
-                                aStrm.Seek(STREAM_SEEK_TO_END);
-                                aStrm << ByteString( aString1, RTL_TEXTENCODING_UTF8 ).GetBuffer();
-                                aStrm.Close();
-                            }
-                        }
-                        if ( nParams & PARAM_UINT32_1 )
-                        {
-                            switch ( nUId )
-                            {
-                                case S_ProfileReset:    // nLNr1 = Anzahl Borders
-                                {
-                                    pImpl->nNumBorders = (sal_uInt16)nLNr1;     // Borders are 0 to 4
-                                    sal_uInt16 i;
-                                    for ( i=0 ; i<4 ; i++ )
-                                        pImpl->naValBorders[i] = 0;
-
-                                    for ( i=0 ; i<5 ; i++ )
-                                    {
-                                        pImpl->naNumEntries[i] = 0;
-                                        pImpl->naRemoteTime[i] = 0;
-                                        pImpl->naLocalTime[i] = 0;
-                                    }
-                                    break;
-                                }
-                                case S_ProfileBorder1:  // nLNr1 = Border1 in ms
-                                case S_ProfileBorder2:  // nLNr1 = Border2 in ms
-                                case S_ProfileBorder3:  // nLNr1 = Border3 in ms
-                                case S_ProfileBorder4:  // nLNr1 = Border4 in ms
-                                {
-                                    pImpl->naValBorders[ nUId - S_ProfileBorder1 ] = nLNr1;
-                                    break;
-                                }
-                                case S_ProfileTime:     // nLNr1 = remote Zeit des Befehls
-                                {
-                                    sal_uInt16 i;
-                                    for ( i=0 ; i<pImpl->nNumBorders &&
-                                        pImpl->naValBorders[i] <= nLNr1 ; i++ ) {};
-
-                                    pImpl->naNumEntries[ i ]++;
-                                    pImpl->naRemoteTime[ i ] += nLNr1;
-                                    pImpl->naLocalTime[ i ] += Time::GetSystemTicks() - pImpl->LocalStarttime;
-
-    #if OSL_DEBUG_LEVEL > 1
-                                    if ( nLNr1 > (Time::GetSystemTicks() - pImpl->LocalStarttime) )
-                                    {
-                                        String aLine = CUniString("Testtoolzeit(").Append(String::CreateFromInt64(Time::GetSystemTicks() - pImpl->LocalStarttime)).AppendAscii(") kleiner Officezeit(").Append(String::CreateFromInt64(nLNr1)).AppendAscii(")\n");
-                                        DirEntry FilePath = pImpl->aLogFileBase + DirEntry(DirEntry(aLogFileName).GetBase().AppendAscii(".prf"));
-                                        SvFileStream aStrm( FilePath.GetFull(), STREAM_STD_WRITE );
-                                        if( aStrm.IsOpen() )
-                                        {
-                                            aLine.ConvertLineEnd(LINEEND_CRLF);
-                                            aStrm.Seek(STREAM_SEEK_TO_END);
-                                            aStrm << ByteString( aLine, RTL_TEXTENCODING_UTF8 ).GetBuffer();
-                                            aStrm.Close();
-                                        }
-                                    }
-    #endif
-
-                                    break;
-                                }
-                                case S_ProfileDump:     // Gibt die daten aus.
-                                {
-                                    if ( pImpl->nNumBorders == 0 )  // Also keine alte R�ckmeldung vom Office
-                                        break;
-                                    DirEntry FilePath = pImpl->aLogFileBase + DirEntry(DirEntry(aLogFileName).GetBase().AppendAscii(".prf"));
-                                    SvFileStream aStrm( FilePath.GetFull(), STREAM_STD_WRITE );
-                                    if( aStrm.IsOpen() )
-                                    {
-                                        String aProfile;
-                                        sal_uInt16 i;
-
-                                        aProfile += String().Expand(15);
-                                        for ( i=0 ; i<pImpl->nNumBorders ; i++ )
-                                            aProfile += (CUniString("< ").Append(String::CreateFromInt64(pImpl->naValBorders[i]))).Expand(20);
-
-                                        aProfile += (CUniString(">= ").Append(TTFormat::ms2s(pImpl->naValBorders[pImpl->nNumBorders-1])));
-
-                                        aProfile += '\n';
-
-                                        aProfile += CUniString("Ereignisse").Expand(15);
-                                        for ( i=0 ; i<=pImpl->nNumBorders ; i++ )
-                                            aProfile += TTFormat::ms2s(pImpl->naNumEntries[i]).Expand(20);
-
-                                        aProfile += '\n';
-
-                                        aProfile += CUniString("Server Zeit").Expand(15);
-                                        for ( i=0 ; i<=pImpl->nNumBorders ; i++ )
-                                            aProfile += TTFormat::ms2s(pImpl->naRemoteTime[i]).Expand(20);
-
-                                        aProfile += '\n';
-
-                                        aProfile += CUniString("Testtool Zeit").Expand(15);
-                                        for ( i=0 ; i<=pImpl->nNumBorders ; i++ )
-                                            aProfile += TTFormat::ms2s(pImpl->naLocalTime[i]).Expand(20);
-
-                                        aProfile += '\n';
-
-                                        aProfile += CUniString("Overhead p.e.").Expand(15);
-                                        for ( i=0 ; i<=pImpl->nNumBorders ; i++ )
-                                        {
-                                            if ( pImpl->naNumEntries[i] > 0 )
-                                                aProfile += TTFormat::ms2s((pImpl->naLocalTime[i]-pImpl->naRemoteTime[i])/pImpl->naNumEntries[i]).Expand(20);
-                                            else
-                                                aProfile += CUniString( "??" ).Expand(20);
-                                        }
-
-                                        aProfile += '\n';
-
-                                        aProfile.ConvertLineEnd(LINEEND_CRLF);
-                                        aStrm.Seek(STREAM_SEEK_TO_END);
-                                        aStrm << ByteString( aProfile, RTL_TEXTENCODING_UTF8 ).GetBuffer();
-                                        aStrm.Close();
-                                    }
-                                    break;
-                                }
-                                default:
-                                    OSL_TRACE("Unbekannter Sub Return Code bei Profile: %hu", nUId );
-                                    break;
-                            }
-                        }
-                        #endif
                     }
                     break;
                 case RET_DirectLoging:
                     {
                         // FIXME: HELPID
-                        #if 0
-                        sal_uLong nUId = aUId.GetNum();
-                        switch ( nUId )
-                        {
-                        case S_AssertError:
-                            {
-                                ADD_ASSERTION_LOG( aString1 );
-                            }
-                            break;
-                        case S_QAError:
-                            {
-                                ADD_QA_ERROR_LOG( aString1 );
-                            }
-                            break;
-                        default:
-                            ;
-                        }
-                        #endif
                     }
                     break;
                 case RET_MacroRecorder:
@@ -3754,18 +3471,12 @@ sal_Bool TestToolObj::ReturnResults( SvStream *pIn )
                 String aUStrId;     // UniqueStringID Used for Mozilla Integration
                 pRetStream->Read( aUStrId );
                 // FIXME: HELPID
-                #if 0
-                aUId = rtl::OString( aUStrId );
-                #endif
             }
             else
             {
                 comm_UINT32 nUId;
                 pRetStream->Read( nUId );
                 // FIXME: HELPID
-                #if 0
-                aUId = rtl::OString( nUId );
-                #endif
             }
             pRetStream->Read( aString );
             ReplaceNumbers (aString);
@@ -3812,14 +3523,8 @@ String TestToolObj::GetMethodName( sal_uLong nMethodId )
     if ( Controls::pClasses )
     {
         // FIXME: HELPID
-        #if 0
-        for ( nElement = 0 ; nElement < Controls::pClasses->Count() ; nElement++ )
-            if ( Controls::pClasses->GetObject(nElement)->pData->aUId.Matches( nMethodId ) )
-                return Controls::pClasses->GetObject(nElement)->pData->Kurzname;
-        #else
         (void)nElement;
         (void)nMethodId;
-        #endif
     }
     return String();
 }
@@ -3832,14 +3537,8 @@ String TestToolObj::GetKeyName( sal_uInt16 nKeyCode )
     if ( CmdStream::pKeyCodes )
     {
         // FIXME: HELPID
-        #if 0
-        for ( nElement = 0 ; nElement < CmdStream::pKeyCodes->Count() ; nElement++ )
-            if ( CmdStream::pKeyCodes->GetObject(nElement)->pData->aUId.Matches( nKeyCode ) )
-                return CmdStream::pKeyCodes->GetObject(nElement)->pData->Kurzname;
-        #else
         (void)nElement;
         (void)nKeyCode;
-        #endif
     }
     return CUniString( "UnknownKeyCode" );
 }
@@ -3887,16 +3586,7 @@ static ControlDefLoad const arRes_Type [] =
             if ( pRCommands )
             {
                 // FIXME: HELPID
-                #if 0
-                for ( nElement = 0 ; nElement < pRCommands->Count() ; nElement++ )
-                    if ( pRCommands->GetObject(nElement)->pData->aUId.Matches( nNumber ) )
-                    {
-                        aResult = pRCommands->GetObject(nElement)->pData->Kurzname;
-                        nElement = pRCommands->Count();
-                    }
-                #else
                 (void)nElement;
-                #endif
             }
         }
         if ( aType.CompareTo(TypeKenn ) == COMPARE_EQUAL )
@@ -3909,16 +3599,7 @@ static ControlDefLoad const arRes_Type [] =
             if ( pRTypes )
             {
                 // FIXME: HELPID
-                #if 0
-                for ( nElement = 0 ; nElement < pRTypes->Count() ; nElement++ )
-                    if ( pRTypes->GetObject(nElement)->pData->aUId.Matches( nNumber ) )
-                    {
-                        aResult = pRTypes->GetObject(nElement)->pData->Kurzname;
-                        nElement = pRTypes->Count();
-                    }
-                #else
                 (void)nElement;
-                #endif
             }
         }
         if ( aType.CompareTo(SlotKenn ) == COMPARE_EQUAL )
@@ -4056,7 +3737,7 @@ SbxVariable* Controls::Find( const String& aStr, SbxClassType aType)
     {
         pMethodVar->SetName(aStr);
         // FIXME: HELPID
-        sal_uLong nUId = 0;//pClasses->GetObject(nElement)->pData->aUId.GetNum();
+        sal_uLong nUId = 0;
         pMethodVar->nValue = nUId;
 
          pMethodVar->SetUserData( GetUserData() );
commit 84ca0da2803c4f74ab34b6606c65d99d62e0fc4a
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 18:33:47 2011 +0200

    cppcheck reduce scope of var in vcl/...bitmapex.cxx

diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 0db0df7..efbe603 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -729,8 +729,6 @@ void BitmapEx::Draw( OutputDevice* pOutDev,
 BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize)
 {
     Point aEmptyPoint(0,0);
-    sal_Int32 imgNewWidth = 0;
-    sal_Int32 imgNewHeight = 0;
     double imgposX = 0;
     double imgposY = 0;
     BitmapEx  aRet = aBitmap;
@@ -740,6 +738,8 @@ BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize
     Size aScaledSize;
     if (imgOldWidth >= aStandardSize || imgOldHeight >= aStandardSize)
     {
+        sal_Int32 imgNewWidth = 0;
+        sal_Int32 imgNewHeight = 0;
         if (imgOldWidth >= imgOldHeight)
         {
             imgNewWidth = aStandardSize;
commit 7f8c23462e92cf34caddb213d1c0b60720503c8d
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 18:31:00 2011 +0200

    cppcheck reduce scope of var in unotools/...fontcfg.cxx

diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index c97f6fd..3726f73 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -963,7 +963,6 @@ void FontSubstConfiguration::fillSubstVector( const com::sun::star::uno::Referen
         if( aAny.getValueTypeClass() == TypeClass_STRING )
         {
             const OUString* pLine = (const OUString*)aAny.getValue();
-            sal_Int32 nIndex = 0;
             sal_Int32 nLength = pLine->getLength();
             if( nLength )
             {
@@ -978,6 +977,7 @@ void FontSubstConfiguration::fillSubstVector( const com::sun::star::uno::Referen
                 rSubstVector.clear();
                 // optimize performance, heap fragmentation
                 rSubstVector.reserve( nTokens );
+                sal_Int32 nIndex = 0;
                 while( nIndex != -1 )
                 {
                     OUString aSubst( pLine->getToken( 0, ';', nIndex ) );
commit 1649892a9e35ee990eed7fef1feebe79a51492ba
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 18:29:09 2011 +0200

    cppcheck reduce scope of var in toolkit/...fomrattedcontrol.cxx

diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx
index fc8b49d..b931614 100644
--- a/toolkit/source/controls/formattedcontrol.cxx
+++ b/toolkit/source/controls/formattedcontrol.cxx
@@ -345,7 +345,6 @@ namespace toolkit
         if ( BASEPROPERTY_EFFECTIVE_DEFAULT == nPropId && rValue.hasValue() )
         {
             double dVal = 0;
-            sal_Int32  nVal = 0;
             ::rtl::OUString sVal;
             sal_Bool bStreamed = (rValue >>= dVal);
             if ( bStreamed )
@@ -354,6 +353,7 @@ namespace toolkit
             }
             else
             {
+                sal_Int32  nVal = 0;
                 bStreamed = (rValue >>= nVal);
                 if ( bStreamed )
                 {
commit 6841f2ff69c7e877937f5ae76836d02ade7120e2
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 18:27:17 2011 +0200

    cppcheck reduce scope of var in toolkit/...controlmodelcontainerbase.cxx

diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx
index 1d752f9..a211389 100644
--- a/toolkit/source/controls/controlmodelcontainerbase.cxx
+++ b/toolkit/source/controls/controlmodelcontainerbase.cxx
@@ -783,11 +783,11 @@ void SAL_CALL ControlModelContainerBase::setGroup( const Sequence< Reference< XC
 ////----- XInitialization -------------------------------------------------------------------
 void SAL_CALL ControlModelContainerBase::initialize (const Sequence<Any>& rArguments) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
 {
-    sal_Int16 nPageId = -1;
     if ( rArguments.getLength() == 1 )
     {
-         if ( !( rArguments[ 0 ] >>= nPageId ))
-             throw lang::IllegalArgumentException();
+        sal_Int16 nPageId = -1;
+        if ( !( rArguments[ 0 ] >>= nPageId ))
+            throw lang::IllegalArgumentException();
         m_nTabPageId = nPageId;
     }
     else
commit 5f6c37b1ebd5c77311b5474e1243091faf147244
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 17:57:05 2011 +0200

    cppcheck reduce scope of var in shell/...gconfaccess.cxx

diff --git a/shell/source/backends/gconfbe/gconfaccess.cxx b/shell/source/backends/gconfbe/gconfaccess.cxx
index 9b93c73..e3190a0 100644
--- a/shell/source/backends/gconfbe/gconfaccess.cxx
+++ b/shell/source/backends/gconfbe/gconfaccess.cxx
@@ -109,7 +109,6 @@ static OUString xdg_user_dir_lookup (const char *type)
 {
     char *config_home;
     char *p;
-    int relative;
     bool bError = false;
 
     osl::Security aSecurity;
@@ -121,112 +120,101 @@ static OUString xdg_user_dir_lookup (const char *type)
 
     if (!aSecurity.getHomeDir( aHomeDirURL ) )
     {
-    osl::FileBase::getFileURLFromSystemPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/tmp")), aDocumentsDirURL);
-    return aDocumentsDirURL;
+        osl::FileBase::getFileURLFromSystemPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/tmp")), aDocumentsDirURL);
+        return aDocumentsDirURL;
     }
 
     config_home = getenv ("XDG_CONFIG_HOME");
     if (config_home == NULL || config_home[0] == 0)
     {
-    aConfigFileURL = OUString(aHomeDirURL);
-    aConfigFileURL += OUString(RTL_CONSTASCII_USTRINGPARAM("/.config/user-dirs.dirs"));
+        aConfigFileURL = OUString(aHomeDirURL);
+        aConfigFileURL += OUString(RTL_CONSTASCII_USTRINGPARAM("/.config/user-dirs.dirs"));
     }
     else
     {
-    aConfigFileURL = OUString::createFromAscii(config_home);
-    aConfigFileURL += OUString(RTL_CONSTASCII_USTRINGPARAM("/user-dirs.dirs"));
+        aConfigFileURL = OUString::createFromAscii(config_home);
+        aConfigFileURL += OUString(RTL_CONSTASCII_USTRINGPARAM("/user-dirs.dirs"));
     }
 
     if(osl_File_E_None == osl_openFile(aConfigFileURL.pData, &handle, osl_File_OpenFlag_Read))
     {
-    rtl::ByteSequence seq;
-    while (osl_File_E_None == osl_readLine(handle , (sal_Sequence **)&seq))
-    {
-        /* Remove newline at end */
-        int len = seq.getLength();
-        if(len>0 && seq[len-1] == '\n')
-        seq[len-1] = 0;
-
-        p = (char *)seq.getArray();
-
-        while (*p == ' ' || *p == '\t')
-        p++;
-
-        if (strncmp (p, "XDG_", 4) != 0)
-        continue;
-        p += 4;
-        if (strncmp (p, type, strlen (type)) != 0)
-        continue;
-        p += strlen (type);
-        if (strncmp (p, "_DIR", 4) != 0)
-        continue;
-        p += 4;
-
-        while (*p == ' ' || *p == '\t')
-        p++;
-
-        if (*p != '=')
-        continue;
-        p++;
-
-        while (*p == ' ' || *p == '\t')
-        p++;
-
-        if (*p != '"')
-        continue;
-        p++;
-
-        relative = 0;
-        if (strncmp (p, "$HOME/", 6) == 0)
-        {
-        p += 6;
-        relative = 1;
-        }
-        else if (*p != '/')
-        continue;
-
-        if (relative)
-        {
-        aUserDirBuf = OUStringBuffer(aHomeDirURL);
-        aUserDirBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/" ) );
-        }
-        else
-        {
-        aUserDirBuf = OUStringBuffer();
-        }
-
-        while (*p && *p != '"')
+        rtl::ByteSequence seq;
+        while (osl_File_E_None == osl_readLine(handle , (sal_Sequence **)&seq))
         {
-        if ((*p == '\\') && (*(p+1) != 0))
+            /* Remove newline at end */
+            int relative = 0;
+            int len = seq.getLength();
+            if(len>0 && seq[len-1] == '\n')
+                seq[len-1] = 0;
+
+            p = (char *)seq.getArray();
+            while (*p == ' ' || *p == '\t')
+                p++;
+            if (strncmp (p, "XDG_", 4) != 0)
+                continue;
+            p += 4;
+            if (strncmp (p, type, strlen (type)) != 0)
+                continue;
+            p += strlen (type);
+            if (strncmp (p, "_DIR", 4) != 0)
+                continue;
+            p += 4;
+            while (*p == ' ' || *p == '\t')
+                p++;
+            if (*p != '=')
+                continue;
             p++;
-        aUserDirBuf.append((sal_Unicode)*p++);
-        }
-    }
-      osl_closeFile(handle);
+            while (*p == ' ' || *p == '\t')
+                p++;
+            if (*p != '"')
+                continue;
+            p++;
+            if (strncmp (p, "$HOME/", 6) == 0)
+            {
+                p += 6;
+                relative = 1;
+            }
+            else if (*p != '/')
+                continue;
+            if (relative)
+            {
+                aUserDirBuf = OUStringBuffer(aHomeDirURL);
+                aUserDirBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/" ) );
+            }
+            else
+            {
+                aUserDirBuf = OUStringBuffer();
+            }
+            while (*p && *p != '"')
+            {
+                if ((*p == '\\') && (*(p+1) != 0))
+                    p++;
+                aUserDirBuf.append((sal_Unicode)*p++);
+            }
+        }//end of while
+        osl_closeFile(handle);
     }
     else
-    bError = true;
-
+        bError = true;
     if (aUserDirBuf.getLength()>0 && !bError)
     {
-    aDocumentsDirURL = aUserDirBuf.makeStringAndClear();
-    osl::Directory aDocumentsDir( aDocumentsDirURL );
-    if( osl::FileBase::E_None == aDocumentsDir.open() )
-        return aDocumentsDirURL;
+        aDocumentsDirURL = aUserDirBuf.makeStringAndClear();
+        osl::Directory aDocumentsDir( aDocumentsDirURL );
+        if( osl::FileBase::E_None == aDocumentsDir.open() )
+            return aDocumentsDirURL;
     }
-
     /* Special case desktop for historical compatibility */
     if (strcmp (type, "DESKTOP") == 0)
     {
-    aUserDirBuf = OUStringBuffer(aHomeDirURL);
-    aUserDirBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/Desktop" ) );
-    return aUserDirBuf.makeStringAndClear();
+        aUserDirBuf = OUStringBuffer(aHomeDirURL);
+        aUserDirBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/Desktop" ) );
+        return aUserDirBuf.makeStringAndClear();
     }
     else
     {
-    aUserDirBuf = OUStringBuffer(aHomeDirURL);
-    aUserDirBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/Documents" ) );
-    return aUserDirBuf.makeStringAndClear();
+        aUserDirBuf = OUStringBuffer(aHomeDirURL);
+        aUserDirBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/Documents" ) );
+        return aUserDirBuf.makeStringAndClear();
     }
 }
 
commit b88e1f5cd1f1a5f963240bf9ed4e2a05f17a7511
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 17:45:09 2011 +0200

    cppcheck reduce scope of var in sfx2/... dinfdlg.cxx

diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 40467b5..43b3436 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1965,7 +1965,6 @@ bool CustomPropertiesWindow::IsLineValid( CustomPropertyLine* pLine ) const
     if ( sValue.Len() == 0 )
         return true;
 
-    double fDummy = 0.0;
     sal_uInt32 nIndex = 0xFFFFFFFF;
     if ( CUSTOM_TYPE_NUMBER == nType )
         nIndex = const_cast< SvNumberFormatter& >(
@@ -1977,6 +1976,7 @@ bool CustomPropertiesWindow::IsLineValid( CustomPropertyLine* pLine ) const
     if ( nIndex != 0xFFFFFFFF )
     {
         sal_uInt32 nTemp = nIndex;
+        double fDummy = 0.0;
         bIsValid = const_cast< SvNumberFormatter& >(
             m_aNumberFormatter ).IsNumberFormat( sValue, nIndex, fDummy ) != sal_False;
         if ( bIsValid && nTemp != nIndex )
commit 3251b313193196c9512c950da740757c46a07ddd
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 17:42:35 2011 +0200

    cppcheck reduce scope of var in setup_native/...regactivex.cxx

diff --git a/setup_native/source/win32/customactions/regactivex/regactivex.cxx b/setup_native/source/win32/customactions/regactivex/regactivex.cxx
index 8e1ca28..7552e86 100644
--- a/setup_native/source/win32/customactions/regactivex/regactivex.cxx
+++ b/setup_native/source/win32/customactions/regactivex/regactivex.cxx
@@ -305,15 +305,14 @@ BOOL MakeInstallFor64Bit( MSIHANDLE hMSI )
 //----------------------------------------------------------
 extern "C" UINT __stdcall InstallActiveXControl( MSIHANDLE hMSI )
 {
-    int nOldInstallMode = 0;
-    int nInstallMode = 0;
-    int nDeinstallMode = 0;
-
     INSTALLSTATE current_state;
     INSTALLSTATE future_state;
 
     if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_o_Activexcontrol", &current_state, &future_state ) )
     {
+        int nOldInstallMode = 0;
+        int nInstallMode = 0;
+        int nDeinstallMode = 0;
         BOOL bInstallForAllUser = MakeInstallForAllUsers( hMSI );
         BOOL bInstallFor64Bit = MakeInstallFor64Bit( hMSI );
 
commit 69cc1ee085ebb5c35c09f50127d00ad90495d563
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 16:29:25 2011 +0200

    cppcheck reduce scope of var in sal/... cbptest.cxx and cbvtest.cxx

diff --git a/sal/workben/clipboardwben/testpaste/cbptest.cxx b/sal/workben/clipboardwben/testpaste/cbptest.cxx
index 442b372..73507d9 100644
--- a/sal/workben/clipboardwben/testpaste/cbptest.cxx
+++ b/sal/workben/clipboardwben/testpaste/cbptest.cxx
@@ -259,7 +259,6 @@ BOOL InitInstance( HINSTANCE hInstance, int nCmdShow )
 LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
     int         wmId;
-    int         wmEvent;
     PAINTSTRUCT ps;
     HDC         hdc;
     TCHAR       szHello[MAX_LOADSTRING];
@@ -271,7 +270,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
     {
         case WM_COMMAND:
             wmId    = LOWORD(wParam);
-            wmEvent = HIWORD(wParam);
+            int wmEvent = HIWORD(wParam);
             // Menüauswahlen analysieren:
             switch( wmId )
             {
diff --git a/sal/workben/clipboardwben/testviewer/cbvtest.cxx b/sal/workben/clipboardwben/testviewer/cbvtest.cxx
index 1368b34..6cf74c5 100644
--- a/sal/workben/clipboardwben/testviewer/cbvtest.cxx
+++ b/sal/workben/clipboardwben/testviewer/cbvtest.cxx
@@ -202,7 +202,6 @@ BOOL InitInstance( HINSTANCE hInstance, int nCmdShow )
 LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
     int         wmId;
-    int         wmEvent;
     PAINTSTRUCT ps;
     HDC         hdc;
     WCHAR       szHello[MAX_LOADSTRING];
@@ -218,7 +217,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 
         case WM_COMMAND:
             wmId    = LOWORD(wParam);
-            wmEvent = HIWORD(wParam);
+            int wmEvent = HIWORD(wParam);
             // Menüauswahlen analysieren:
             switch( wmId )
             {
commit 44f8989af2a114f690bea1cb92ad74435c63ffe9
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 16:26:57 2011 +0200

    cppcheck reduce scope of var in sal/...cbcpytest.cxx

diff --git a/sal/workben/clipboardwben/testcopy/cbcpytest.cxx b/sal/workben/clipboardwben/testcopy/cbcpytest.cxx
index b9f3b64..5db57ef 100644
--- a/sal/workben/clipboardwben/testcopy/cbcpytest.cxx
+++ b/sal/workben/clipboardwben/testcopy/cbcpytest.cxx
@@ -107,23 +107,6 @@ int APIENTRY WinMain(HINSTANCE hInstance,
     HACCEL  hAccelTable;
     HRESULT hr = E_FAIL;
 
-    /*
-    g_hEvent = CreateEvent( 0,
-                            FALSE,
-                            FALSE,
-                            NULL
-                          );
-
-    g_bEnd = FALSE;
-
-    _beginthreadex( ThreadProc,
-                    0,
-                    NULL,
-                    0,
-                    0,
-                    NULL );
-    */
-
     // it's important to initialize ole
     // in order to use the clipboard
 #ifdef USE_MTACB
@@ -247,7 +230,6 @@ BOOL InitInstance( HINSTANCE hInstance, int nCmdShow )
 LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
     int         wmId;
-    int         wmEvent;
     PAINTSTRUCT ps;
     HDC         hdc;
     TCHAR       szHello[MAX_LOADSTRING];
@@ -259,7 +241,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
     {
         case WM_COMMAND:
             wmId    = LOWORD(wParam);
-            wmEvent = HIWORD(wParam);
+            int wmEvent = HIWORD(wParam);
             // Menüauswahlen analysieren:
             switch( wmId )
             {
commit b07fff32c683f55e6410712880b5302baa44da73
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 16:22:24 2011 +0200

    cppcheck reduce scope in sal/...osl_Pipe.cxx

diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx
index 8ca5bc0..a393e4b 100644
--- a/sal/qa/osl/pipe/osl_Pipe.cxx
+++ b/sal/qa/osl/pipe/osl_Pipe.cxx
@@ -471,22 +471,6 @@ namespace osl_Pipe
         inline sal_Bool SAL_CALL isValid() const;
         isValid( ) has not been implemented under the following platforms, please refer to osl/pipe.hxx
     */
-    /*class isValid : public CppUnit::TestFixture
-      {
-      public:
-      sal_Bool bRes, bRes1;
-
-      void isValid_001( )
-      {
-      CPPUNIT_ASSERT_MESSAGE( "#test comment#: isValid() has not been implemented on all platforms.",
-      sal_False );
-      }
-
-      SAL_CPPUNIT_TEST_SUITE( isValid );
-      CPPUNIT_TEST( isValid_001 );
-      SAL_CPPUNIT_TEST_SUITE_END( );
-      };*/ // class isValid
-
 
     /** testing the method:
         inline sal_Bool SAL_CALL operator==( const Pipe& rPipe ) const;
@@ -574,23 +558,6 @@ namespace osl_Pipe
         inline oslPipeError SAL_CALL accept(StreamPipe& Connection);
         please refer to StreamPipe::recv
     */
-   /* class accept : public CppUnit::TestFixture
-    {
-    public:
-        sal_Bool bRes, bRes1;
-
-        void accept_001( )
-            {
-
-                // CPPUNIT_ASSERT_MESSAGE( "#test comment#: accept, untested.", 1 == 1 );
-                //CPPUNIT_ASSERT_STUB();
-            }
-
-        SAL_CPPUNIT_TEST_SUITE( accept );
-        CPPUNIT_TEST( accept_001 );
-        SAL_CPPUNIT_TEST_SUITE_END( );
-    };*/ // class accept
-
 
     /** testing the method:
         inline oslPipeError SAL_CALL getError() const;
@@ -599,27 +566,6 @@ namespace osl_Pipe
     {
     public:
         sal_Bool bRes, bRes1;
-        /*
-          PipeError[]= {
-          { 0,                     osl_Pipe_E_None                      },      // no error
-          { EPROTOTYPE,    osl_Pipe_E_NoProtocol            },  // Protocol wrong type for socket
-          { ENOPROTOOPT,           osl_Pipe_E_NoProtocol            },  // Protocol not available
-          { EPROTONOSUPPORT, osl_Pipe_E_NoProtocol              },      // Protocol not supported
-          { ESOCKTNOSUPPORT, osl_Pipe_E_NoProtocol              },      // Socket type not supported
-          { EPFNOSUPPORT,          osl_Pipe_E_NoProtocol        },      // Protocol family not supported
-          { EAFNOSUPPORT,          osl_Pipe_E_NoProtocol        },      // Address family not supported by
-          // protocol family
-          { ENETRESET,     osl_Pipe_E_NetworkReset              },      // Network dropped connection because
-          // of reset
-          { ECONNABORTED,          osl_Pipe_E_ConnectionAbort   },      // Software caused connection abort
-          { ECONNRESET,    osl_Pipe_E_ConnectionReset   },      // Connection reset by peer
-          { ENOBUFS,       osl_Pipe_E_NoBufferSpace     },      // No buffer space available
-          { ETIMEDOUT,     osl_Pipe_E_TimedOut                  },      // Connection timed out
-          { ECONNREFUSED,          osl_Pipe_E_ConnectionRefused },      // Connection refused
-          { -1,            osl_Pipe_E_invalidError              }
-          };
-          did not define osl_Pipe_E_NotFound, osl_Pipe_E_AlreadyExists
-        */
 
         void getError_001( )
             {
@@ -695,10 +641,8 @@ namespace osl_Pipe
     CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::create);
     CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::clear);
     CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::assign);
-//CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::isValid);
     CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::isEqual);
     CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::close);
-    //CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::accept);
     CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::getError);
     CPPUNIT_TEST_SUITE_REGISTRATION(osl_Pipe::getHandle);
 // -----------------------------------------------------------------------------
@@ -814,7 +758,6 @@ namespace osl_StreamPipe
 
                 bRes = aNoAcquirePipe.is( );
                 aPipe.clear( );
-                // bRes1 = aNoAcquirePipe.is( );
 
                 CPPUNIT_ASSERT_MESSAGE( "#test comment#: test constructor with no aquire of handle, only validation test, do not know how to test no acquire.",
                                         sal_True == bRes );
@@ -836,62 +779,18 @@ namespace osl_StreamPipe
         inline StreamPipe& SAL_CALL operator=(const Pipe& pipe);
         mindy: not implementated in osl/pipe.hxx, so remove the cases
     */
-    /*
-       class assign : public CppUnit::TestFixture
-       {
-       public:
-       sal_Bool bRes, bRes1;
-
-       void assign_ref( )
-       {
-       ::osl::StreamPipe aPipe, aPipe1;
-       aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
-       aPipe1 = aPipe;
-       bRes = aPipe1.is( );
-       bRes1 = aPipe == aPipe1;
-       aPipe.close( );
-       aPipe1.close( );
-
-       CPPUNIT_ASSERT_MESSAGE( "#test comment#: test assign with reference.",
-       sal_True == bRes && sal_True == bRes1 );
-       }
-
-       void assign_handle( )
-       {
-       ::osl::StreamPipe * pPipe = new ::osl::StreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
-       ::osl::StreamPipe * pAssignPipe = new ::osl::StreamPipe;
-       *pAssignPipe = pPipe->getHandle( );
-
-       bRes = pAssignPipe->is( );
-       bRes1 = ( *pPipe == *pAssignPipe );
-       pPipe->close( );
-
-       delete pAssignPipe;
-
-       CPPUNIT_ASSERT_MESSAGE( "#test comment#: test assign with handle., seems not implemented under (LINUX)(W32)",
-       sal_True == bRes && sal_True == bRes1  );
-       }
-
-       SAL_CPPUNIT_TEST_SUITE( assign );
-       CPPUNIT_TEST( assign_ref );
-       CPPUNIT_TEST( assign_handle );
-       SAL_CPPUNIT_TEST_SUITE_END( );
-       };*/ // class assign
-
 
     /** wait _nSec seconds.
      */
     void thread_sleep( sal_uInt32 _nSec )
     {
         /// print statement in thread process must use fflush() to force display.
-        // printf("wait %d seconds. ", _nSec );
         fflush(stdout);
 
         TimeValue nTV;
         nTV.Seconds = _nSec;
         nTV.Nanosec = 0;
         osl_waitThread(&nTV);
-        // printf("done\n" );
     }
     // test read/write & send/recv data to pipe
     // -----------------------------------------------------------------------------
@@ -908,8 +807,6 @@ namespace osl_StreamPipe
     protected:
         void SAL_CALL run( )
             {
-                sal_Int32 nChars = 0;
-
                 printf("open pipe\n");
                 ::osl::StreamPipe aSenderPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );  // test::uniquePipeName(aTestPipeName) is a string = "TestPipe"
                 if ( aSenderPipe.is() == sal_False )
@@ -919,7 +816,7 @@ namespace osl_StreamPipe
                 else
                 {
                     printf("read\n");
-                    nChars = aSenderPipe.read( buf, m_pTestString1.getLength() + 1 );
+                    sal_Int32 nChars = aSenderPipe.read( buf, m_pTestString1.getLength() + 1 );
                     if ( nChars < 0 )
                     {
                         printf("read failed! \n");
@@ -938,13 +835,10 @@ namespace osl_StreamPipe
 
     };
 
-    // -----------------------------------------------------------------------------
-
     class Pipe_DataSource_Thread : public Thread
     {
     public:
         sal_Char buf[256];
-        //::osl::StreamPipe aListenPipe;  //( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
         ::osl::Pipe aListenPipe;
         ::osl::StreamPipe aConnectionPipe;
         Pipe_DataSource_Thread( )
@@ -961,7 +855,6 @@ namespace osl_StreamPipe
             {
                 //create pipe.
                 sal_Int32 nChars;
-                //::osl::StreamPipe aListenPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
                 printf("listen\n");
                 if ( aListenPipe.is() == sal_False )
                 {
@@ -969,8 +862,6 @@ namespace osl_StreamPipe
                 }
                 else
                 {
-                    //::osl::StreamPipe aConnectionPipe;
-
                     //start server and wait for connection.
                     printf("accept\n");
                     if ( osl_Pipe_E_None != aListenPipe.accept( aConnectionPipe ) )
@@ -994,9 +885,7 @@ namespace osl_StreamPipe
                         printf("server receive failed! \n");
                         return;
                     }
-                    //thread_sleep( 2 );
                     printf("received message is: %s\n", buf );
-                    //aConnectionPipe.close();
                 }
             }
     };
commit 04028b90252888848c0fc911ea3ad3aa49d9a5b5
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 16:15:09 2011 +0200

    cppcheck reduce scope of var in sal/... security.c

diff --git a/sal/osl/w32/security.c b/sal/osl/w32/security.c
index 053d39f..ac53875 100644
--- a/sal/osl/w32/security.c
+++ b/sal/osl/w32/security.c
@@ -469,37 +469,6 @@ sal_Bool SAL_CALL osl_getHomeDir(oslSecurity Security, rtl_uString **pustrDirect
         }
         else
         {
-#if 0
-            if (pSecImpl->m_hToken)
-            {
-                DWORD  nInfoBuffer = 512;
-                UCHAR* pInfoBuffer = malloc(nInfoBuffer);
-
-                while (!GetTokenInformation(pSecImpl->m_hToken, TokenUser,
-                                               pInfoBuffer, nInfoBuffer, &nInfoBuffer))
-                {
-                    if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
-                        pInfoBuffer = realloc(pInfoBuffer, nInfoBuffer);
-                    else
-                    {
-                        free(pInfoBuffer);
-                        pInfoBuffer = NULL;
-                        break;
-                    }
-                }
-
-                /* not implemented */
-                OSL_ASSERT(sal_False);
-
-                if (pInfoBuffer)
-                {
-                    /* if (EqualSid() ... */
-
-                }
-            }
-            else
-#endif
-
                 bSuccess = (sal_Bool)(GetSpecialFolder(&ustrSysDir, CSIDL_PERSONAL) &&
                                      (osl_File_E_None == osl_getFileURLFromSystemPath(ustrSysDir, pustrDirectory)));
         }
@@ -579,7 +548,6 @@ sal_Bool SAL_CALL osl_loadUserProfile(oslSecurity Security)
         LPFNLOADUSERPROFILE     fLoadUserProfile    = NULL;
         LPFNUNLOADUSERPROFILE   fUnloadUserProfile  = NULL;
         HANDLE                  hAccessToken        = ((oslSecurityImpl*)Security)->m_hToken;
-        DWORD                   nError              = 0;
 
         /* try to create user profile */
         if ( !hAccessToken )
@@ -621,7 +589,7 @@ sal_Bool SAL_CALL osl_loadUserProfile(oslSecurity Security)
                     bOk = TRUE;
                 }
                 else
-                    nError = GetLastError();
+                    DWORD nError = GetLastError();
 
                 rtl_uString_release(buffer);
             }
commit 0921457488898b43152e33d1184929f7436aeeb4
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 15:49:43 2011 +0200

    cppcheck reduce scope of var in rsc/...cpp3.c/cpp4.c/cpp6.c

diff --git a/rsc/source/rscpp/cpp3.c b/rsc/source/rscpp/cpp3.c
index 7f9c8ad..b9ed7a9 100644
--- a/rsc/source/rscpp/cpp3.c
+++ b/rsc/source/rscpp/cpp3.c
@@ -449,7 +449,6 @@ void initdefines()
         register char           **pp;
         register char           *tp;
         register DEFBUF         *dp;
-        int                     i;
         time_t                  tvec;
 
 #if !defined( WNT ) && !defined(G3)
@@ -476,8 +475,10 @@ void initdefines()
          * notices this and calls the appropriate routine.
          * DEF_NOARGS is one greater than the first "magic" definition.
          */
-        if (nflag < 2) {
-            for (pp = magic, i = DEF_NOARGS; *pp != NULL; pp++) {
+        if (nflag < 2)
+        {
+            int i = DEF_NOARGS;
+            for (pp = magic; *pp != NULL; pp++) {
                 dp = defendel(*pp, FALSE);
                 dp->nargs = --i;
             }
diff --git a/rsc/source/rscpp/cpp4.c b/rsc/source/rscpp/cpp4.c
index 3f5e03a..af8995b 100644
--- a/rsc/source/rscpp/cpp4.c
+++ b/rsc/source/rscpp/cpp4.c
@@ -554,12 +554,9 @@ void expstuff(DEFBUF* tokenp)
  * Stuff the macro body, replacing formal parameters by actual parameters.
  */
 {
-        register int    c;                      /* Current character    */
         register char   *inp;                   /* -> repl string       */
         register char   *defp;                  /* -> macro output buff */
-        int             size;                   /* Actual parm. size    */
         char            *defend;                /* -> output buff end   */
-        int             string_magic;           /* String formal hack   */
         FILEINFO        *file;                  /* Funny #include       */
     extern FILEINFO *getfile();
 
@@ -568,6 +565,7 @@ void expstuff(DEFBUF* tokenp)
         defp = file->buffer;                    /* -> output buffer     */
         defend = defp + (NBUFF - 1);            /* Note its end         */
         if (inp != NULL) {
+            register int c;                      /* Current character    */
             while ((c = (*inp++ & 0xFF)) != EOS) {
 #ifdef SOLAR
                 if (c == DEL) {
@@ -575,14 +573,15 @@ void expstuff(DEFBUF* tokenp)
 #else
                 if (c >= MAC_PARM && c <= (MAC_PARM + PAR_MAC)) {
 #endif
-                    string_magic = (c == (MAC_PARM + PAR_MAC));
+                    int string_magic = (c == (MAC_PARM + PAR_MAC));
                     if (string_magic)
                         c = (*inp++ & 0xFF);
                     /*
                      * Replace formal parameter by actual parameter string.
                      */
-                    if ((c -= MAC_PARM) < nargs) {
-                        size = strlen(parlist[c]);
+                    if ((c -= MAC_PARM) < nargs)
+                    {
+                        int size = strlen(parlist[c]);
                         if ((defp + size) >= defend)
                             goto nospace;
                         /*
diff --git a/rsc/source/rscpp/cpp6.c b/rsc/source/rscpp/cpp6.c
index cb628ba..6c021fb 100644
--- a/rsc/source/rscpp/cpp6.c
+++ b/rsc/source/rscpp/cpp6.c
@@ -278,7 +278,6 @@ catenate()
  * and return FALSE.
  */
 {
-        register int            c;
         register char           *token1;
 
 #if OK_CONCAT
@@ -288,7 +287,7 @@ catenate()
         }
         else {
             token1 = savestring(token);         /* Save first token     */
-            c = macroid(get());                 /* Scan next token      */
+            register int c = macroid(get());                 /* Scan next token      */
             switch(type[c]) {                   /* What was it?         */
             case LET:                           /* An identifier, ...   */
                 if (strlen(token1) + strlen(token) >= NWORK)
commit fb2fe60773654c17e366aa6857dbcf975cb9edb0
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 15:38:08 2011 +0200

    cppcheck reduce scope of var in rsc/...rscclass.cxx

diff --git a/rsc/source/res/rscclass.cxx b/rsc/source/res/rscclass.cxx
index 8060c32..9f29cec 100644
--- a/rsc/source/res/rscclass.cxx
+++ b/rsc/source/res/rscclass.cxx
@@ -659,7 +659,6 @@ sal_Bool RscClass::IsValueDflt( CLASS_DATA pData, sal_uInt32 nEle )
 *************************************************************************/
 sal_Bool RscClass::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
 {
-    sal_uInt32  i = 0;
     RSCINST aTmpI;
     RSCINST aDfltI;
 
@@ -668,7 +667,7 @@ sal_Bool RscClass::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
 
     if( pDef )
     {
-        for( i = 0; i < nEntries; i++ )
+        for( sal_uInt32 i = 0; i < nEntries; i++ )
         {
             aTmpI = GetInstData( rInst.pData, i, sal_True );
             if( aTmpI.IsInst() )
@@ -1073,7 +1072,6 @@ RscSysDepend::RscSysDepend( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper )
 ERRTYPE RscSysDepend::WriteSysDependRc( const RSCINST & rInst, RscWriteRc & rMem,
                 RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra, sal_Bool bFirst )
 {
-    sal_uInt32  nId = 0xFFFFFFFF;
     ERRTYPE     aError;
     RSCINST     aFileName;
 
@@ -1088,6 +1086,7 @@ ERRTYPE RscSysDepend::WriteSysDependRc( const RSCINST & rInst, RscWriteRc & rMem
         rMem.Put( sal_uInt32(0) );
 
         // Identifier schreiben
+        sal_uInt32  nId = 0xFFFFFFFF;
         if( aTmpMem.Size() && pTC && (*aTmpMem.GetUTF8( 0 ) != '\0') )
         {
             nId = pTC->PutSysName( rInst.pClass->GetTypId(),
commit 7cec8f6208c7db3959e7d9e7249d8c6981be129c
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 15:34:50 2011 +0200

    cppcheck reduce scope of var in registry/...regimpl.cxx

diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index fd1bb90..ea021b4 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -1278,13 +1278,13 @@ RegError ORegistry::mergeModuleValue(OStoreStream& rTargetValue,
                                      RegistryTypeReader& reader,
                                      RegistryTypeReader& reader2)
 {
-    sal_uInt16                  index = 0;
-
     std::set< OUString > nameSet;
     sal_uInt32 count = checkTypeReaders(reader, reader2, nameSet);
 
     if (count != reader.getFieldCount())
     {
+        sal_uInt16 index = 0;
+
         RegistryTypeWriter writer(reader.getTypeClass(),
                                   reader.getTypeName(),
                                   reader.getSuperTypeName(),
@@ -1292,8 +1292,7 @@ RegError ORegistry::mergeModuleValue(OStoreStream& rTargetValue,
                                   0,
                                   0);
 
-        sal_uInt16 i;
-        for (i=0 ; i < reader.getFieldCount(); i++)
+        for (sal_uInt16 i=0 ; i < reader.getFieldCount(); i++)
         {
             writer.setFieldData(index,
                                reader.getFieldName(i),
@@ -1304,7 +1303,7 @@ RegError ORegistry::mergeModuleValue(OStoreStream& rTargetValue,
                                reader.getFieldConstValue(i));
             index++;
         }
-        for (i=0 ; i < reader2.getFieldCount(); i++)
+        for (sal_uInt16 i=0 ; i < reader2.getFieldCount(); i++)
         {
             if (nameSet.find(reader2.getFieldName(i)) == nameSet.end())
             {
commit 595de860c7a3fb274d2cf432bd1fa04a008503a0
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 15:28:24 2011 +0200

    cppcheck reduce scope of var in odk/..unoapploader.c

diff --git a/odk/source/unoapploader/win/unoapploader.c b/odk/source/unoapploader/win/unoapploader.c
index 762b554..990b002 100644
--- a/odk/source/unoapploader/win/unoapploader.c
+++ b/odk/source/unoapploader/win/unoapploader.c
@@ -81,7 +81,6 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
     char* value = NULL;
     char* envstr = NULL;
     char* cmdline = NULL;
-    int size;
     STARTUPINFO startup_info;
     PROCESS_INFORMATION process_info;
     BOOL bCreate;
@@ -230,7 +229,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
          * note that this only affects the environment variable of the current
          * process, the command processor's environment is not changed
          */
-        size = strlen( ENVVARNAME ) + strlen( "=" ) + strlen( path ) + 1;
+        int size = strlen( ENVVARNAME ) + strlen( "=" ) + strlen( path ) + 1;
         if ( value != NULL )
             size += strlen( PATHSEPARATOR ) + strlen( value );
         envstr = (char*) malloc( size );
commit 329841d0189c939a072c004dc96230d1e9f30050
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 15:25:52 2011 +0200

    cppcheck reduce scope in linguacomponent/...sspellimp.cxx

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 31bcadc..004d57e 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -422,8 +422,6 @@ Reference< XSpellAlternatives >
 
     Hunspell* pMS = NULL;
     rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
-    int count = 0;
-    int numsug = 0;
 
     // first handle smart quotes (single and double)
     OUStringBuffer rBuf(rWord);
@@ -442,14 +440,14 @@ Reference< XSpellAlternatives >
     if (n)
     {
         sal_Int16 nLang = LocaleToLanguage( rLocale );
+        int numsug = 0;
 
         Sequence< OUString > aStr( 0 );
-
-        for (int i =0; i < numdict; i++)
+        for (int i = 0; i < numdict; i++)
         {
             pMS = NULL;
             eEnc = RTL_TEXTENCODING_DONTKNOW;
-            count = 0;
+            int count = 0;
 
             if (rLocale == aDLocs[i])
             {
commit 25cd5ef3de74c9c0b0cd739e479a256110a99ddc
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 15:17:58 2011 +0200

    remove dead code in astdump.cxx (in idlc dir).

diff --git a/idlc/source/astdump.cxx b/idlc/source/astdump.cxx
index cf8f33e..9941e5e 100644
--- a/idlc/source/astdump.cxx
+++ b/idlc/source/astdump.cxx
@@ -254,83 +254,64 @@ sal_Bool AstService::dump(RegistryKey& rKey)
     sal_uInt16 constructorIndex = 0;
     sal_uInt16 propertyIndex = 0;
     sal_uInt16 referenceIndex = 0;
-    {for (DeclList::const_iterator i(getIteratorBegin()); i != getIteratorEnd();
-          ++i)
+    for (DeclList::const_iterator i(getIteratorBegin()); i != getIteratorEnd(); ++i)
     {
         switch ((*i)->getNodeType()) {
         case NT_operation:
-//           static_cast< AstOperation * >(*i)->dumpBlob(
-            ((AstOperation *)(*i))->dumpBlob(
-                writer, constructorIndex++);
+            ((AstOperation *)(*i))->dumpBlob(writer, constructorIndex++);
             break;
 
         case NT_property:
-//            static_cast< AstAttribute * >(*i)->dumpBlob(
-            ((AstAttribute *)(*i))->dumpBlob(
-                writer, propertyIndex++, 0);
+            ((AstAttribute *)(*i))->dumpBlob(writer, propertyIndex++, 0);
             break;
 
         case NT_interface_member:
-            {
-//               AstInterfaceMember * decl = static_cast< AstInterfaceMember *>(*i);
-                AstInterfaceMember * decl = (AstInterfaceMember *)(*i);
-                writer.setReferenceData(
-                    referenceIndex++, decl->getDocumentation(), RT_REF_SUPPORTS,
-                    (decl->isOptional()
-                     ? RT_ACCESS_OPTIONAL : RT_ACCESS_INVALID),
-                    rtl::OStringToOUString(
-                        decl->getRealInterface()->getRelativName(),
-                        RTL_TEXTENCODING_UTF8));
-                break;
-            }
+        {
+            AstInterfaceMember * decl = (AstInterfaceMember *)(*i);
+            writer.setReferenceData(
+                referenceIndex++, decl->getDocumentation(), RT_REF_SUPPORTS,
+                (decl->isOptional() ? RT_ACCESS_OPTIONAL : RT_ACCESS_INVALID),
+                rtl::OStringToOUString( decl->getRealInterface()->getRelativName(),
+                                        RTL_TEXTENCODING_UTF8));
+            break;
+        }
 
         case NT_service_member:
-            if (getNodeType() == NT_service) {
-//              AstServiceMember * decl = static_cast< AstServiceMember * >(*i);
+            if (getNodeType() == NT_service)
+            {
                 AstServiceMember * decl = (AstServiceMember *)(*i);
-                writer.setReferenceData(
-                    referenceIndex++, decl->getDocumentation(), RT_REF_EXPORTS,
-                    (decl->isOptional()
-                     ? RT_ACCESS_OPTIONAL : RT_ACCESS_INVALID),
-                    rtl::OStringToOUString(
-                        decl->getRealService()->getRelativName(),
-                        RTL_TEXTENCODING_UTF8));
+                writer.setReferenceData(referenceIndex++, decl->getDocumentation(), RT_REF_EXPORTS,
+                    (decl->isOptional() ? RT_ACCESS_OPTIONAL : RT_ACCESS_INVALID),
+                    rtl::OStringToOUString(decl->getRealService()->getRelativName(),
+                                           RTL_TEXTENCODING_UTF8));
             }
             break;
 
         case NT_observes:
             {
-//              AstObserves * decl = static_cast< AstObserves * >(*i);
                 AstObserves * decl = (AstObserves *)(*i);
-                writer.setReferenceData(
-                    referenceIndex++, decl->getDocumentation(), RT_REF_OBSERVES,
+                writer.setReferenceData(referenceIndex++, decl->getDocumentation(), RT_REF_OBSERVES,
                     RT_ACCESS_INVALID,
-                    rtl::OStringToOUString(
-                        decl->getRealInterface()->getRelativName(),
-                        RTL_TEXTENCODING_UTF8));
+                    rtl::OStringToOUString( decl->getRealInterface()->getRelativName(),
+                                            RTL_TEXTENCODING_UTF8));
                 break;
             }
 
         case NT_needs:
             {
-//              AstNeeds * decl = static_cast< AstNeeds * >(*i);
                 AstNeeds * decl = (AstNeeds *)(*i);
-                writer.setReferenceData(
-                    referenceIndex++, decl->getDocumentation(), RT_REF_NEEDS,
+                writer.setReferenceData( referenceIndex++, decl->getDocumentation(), RT_REF_NEEDS,
                     RT_ACCESS_INVALID,
-                    rtl::OStringToOUString(
-                        decl->getRealService()->getRelativName(),
-                        RTL_TEXTENCODING_UTF8));
+                    rtl::OStringToOUString( decl->getRealService()->getRelativName(),
+                                            RTL_TEXTENCODING_UTF8));
                 break;
             }
 
         default:
-            OSL_ASSERT(
-                (*i)->getNodeType() == NT_interface
-                || (*i)->getNodeType() == NT_typedef);
+            OSL_ASSERT( (*i)->getNodeType() == NT_interface || (*i)->getNodeType() == NT_typedef);
             break;
         }
-    }}
+    }
     if (m_defaultConstructor) {
         writer.setMethodData(
             constructorIndex++, emptyStr, RT_MODE_TWOWAY,
commit 9ef6565f18343ec4f6fd010a74cf2be045a3e670
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 15:06:53 2011 +0200

    cppcheck scope reduction in framework/.. menubarmanager.cxx

diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 3de401d..b66c7fd 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1369,10 +1369,10 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
                          AddonMenuManager::HasAddonMenuElements() )
                 {
                     // Create addon popup menu if there exist elements and this is the tools popup menu
-                    sal_uInt16      nCount   = 0;
                     AddonMenu*  pSubMenu = AddonMenuManager::CreateAddonMenu( rFrame );
                     if ( pSubMenu && ( pSubMenu->GetItemCount() > 0 ))
                     {
+                        sal_uInt16 nCount = 0;
                         if ( pPopup->GetItemType( nCount-1 ) != MENUITEM_SEPARATOR )
                             pPopup->InsertSeparator();
 
commit 260c5f70b707b82db016afa6e7c209c23a10bd1d
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 15:05:02 2011 +0200

    cppcheck scope reduction in framework/... menumanager.cxx

diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx
index 80519d5..edf9d2d 100644
--- a/framework/source/classes/menumanager.cxx
+++ b/framework/source/classes/menumanager.cxx
@@ -184,10 +184,10 @@ MenuManager::MenuManager(
                     aItemCommand.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(aSlotSpecialToolsMenu)) ) &&
                     AddonMenuManager::HasAddonMenuElements() )
                 {
-                    sal_uInt16      nCount   = 0;
                     AddonMenu*  pSubMenu = AddonMenuManager::CreateAddonMenu( rFrame );
                     if ( pSubMenu && ( pSubMenu->GetItemCount() > 0 ))
                     {
+                        sal_uInt16 nCount = 0;
                         if ( pPopupMenu->GetItemType( nCount-1 ) != MENUITEM_SEPARATOR )
                             pPopupMenu->InsertSeparator();
 
commit b94d6e85c54e21431d25cc579de30ad58759b5a2
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 15:03:07 2011 +0200

    cppcheck reduce scope of var in forms/...convert.cxx

diff --git a/forms/source/xforms/convert.cxx b/forms/source/xforms/convert.cxx
index f0db80b..4fa4250 100644
--- a/forms/source/xforms/convert.cxx
+++ b/forms/source/xforms/convert.cxx
@@ -388,9 +388,9 @@ namespace
             if ( sFractional.getLength() > 2 )
                 // our precision is HundrethSeconds - it's all a css.util.Time can hold
                 sFractional = sFractional.copy( 0, 2 );
-            sal_Int32 nFractional = 0;
             if ( sFractional.getLength() )
             {
+                sal_Int32 nFractional = 0;
                 if ( StringTokenizer( sFractional, 0 ).getNextToken().toInt32( nFractional ) )
                 {
                     aTime.HundredthSeconds = (sal_uInt16)nFractional;
commit b24adf82ce21ac91851a73c84680447a16feb53b
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Oct 2 15:01:26 2011 +0200

    cppcheck scope reduction in forms/...DatabaseForm.cxx

diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index ebe7361..f61fde2 100644
--- a/forms/source/component/DatabaseForm.cxx

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list