[Libreoffice-commits] .: 2 commits - dmake/dbug dmake/msdos dmake/unix dmake/win95 dmake/winnt embeddedobj/source embeddedobj/test extensions/source extensions/test framework/source l10ntools/source

Michael Meeks michael at kemper.freedesktop.org
Tue Jun 12 04:08:38 PDT 2012


 dmake/dbug/malloc/testmlc.c                        |    4 ----
 dmake/msdos/dstrlwr.c                              |    2 --
 dmake/unix/runargv.c                               |    3 +--
 dmake/win95/microsft/vpp40/runargv.c               |    1 -
 dmake/winnt/microsft/vpp40/runargv.c               |    1 -
 embeddedobj/source/msole/xdialogcreator.cxx        |   14 ++++++--------
 embeddedobj/test/Container1/nativelib/nativeview.c |    7 +++++++
 extensions/source/nsplugin/source/so_env.cxx       |   11 +++++------
 extensions/test/ole/OleClient/clientTest.cxx       |    1 -
 framework/source/services/autorecovery.cxx         |   17 +++++++++--------
 l10ntools/source/help/HelpLinker.cxx               |    7 +++++--
 11 files changed, 33 insertions(+), 35 deletions(-)

New commits:
commit d2a02df2f9725a1884131c0ab415a2b122a44420
Author: Martyn Russell <martyn at lanedo.com>
Date:   Thu Jun 7 19:19:49 2012 +0100

    cppcheck: Avoid unused variables code warnings
    
    Change-Id: I51ba83c5356f2eb33ed09f6516de9f004678bc8f

diff --git a/dmake/dbug/malloc/testmlc.c b/dmake/dbug/malloc/testmlc.c
index 16e1173..a0fd728 100644
--- a/dmake/dbug/malloc/testmlc.c
+++ b/dmake/dbug/malloc/testmlc.c
@@ -44,10 +44,6 @@ char **argv;
     int cnt;            /* number of allocated objects */
     int nm = 0;         /* number of mallocs */
     int nre = 0;            /* number of reallocs */
-    int nal;            /* number of allocated objects */
-    int nfre;           /* number of free list objects */
-    long alm;           /* memory in allocated objects */
-    long frem;          /* memory in free list */
     long startsize;         /* size at loop start */
     long endsize;           /* size at loop exit */
     long maxiter = 0;       /* real max # iterations */
diff --git a/dmake/msdos/dstrlwr.c b/dmake/msdos/dstrlwr.c
index 64027eb..79c5848 100644
--- a/dmake/msdos/dstrlwr.c
+++ b/dmake/msdos/dstrlwr.c
@@ -31,8 +31,6 @@ dstrlwr(entry, target)
 char *entry;
 char *target;
 {
-   char *p;
-
    if (STOBOOL(DcacheRespCase))
       return;
 
diff --git a/dmake/unix/runargv.c b/dmake/unix/runargv.c
index 0e41c18..4a98254 100644
--- a/dmake/unix/runargv.c
+++ b/dmake/unix/runargv.c
@@ -844,8 +844,6 @@ int pqid;
 PUBLIC void
 Clean_up_processes()
 {
-    int ret;
-
     if( _procs != NIL(PR) )
     {
       register int i;
@@ -853,6 +851,7 @@ Clean_up_processes()
         if( _procs[i].pr_valid )
         {
         #if !defined(USE_CREATEPROCESS)
+	    int ret;
             if( (ret = kill(_procs[i].pr_pid, SIGTERM)) )
             {
                 fprintf(stderr, "Killing of pid %d from pq[%d] failed with: %s - %d ret: %d\n",
diff --git a/dmake/win95/microsft/vpp40/runargv.c b/dmake/win95/microsft/vpp40/runargv.c
index c482859..309e745 100644
--- a/dmake/win95/microsft/vpp40/runargv.c
+++ b/dmake/win95/microsft/vpp40/runargv.c
@@ -181,7 +181,6 @@ int pid;
 int status;
 {
    register int i;
-   register PR *pp;
    char     *dir;
 
    for( i=0; i<Max_proc; i++ )
diff --git a/dmake/winnt/microsft/vpp40/runargv.c b/dmake/winnt/microsft/vpp40/runargv.c
index 2ffef70..6184209 100644
--- a/dmake/winnt/microsft/vpp40/runargv.c
+++ b/dmake/winnt/microsft/vpp40/runargv.c
@@ -180,7 +180,6 @@ int pid;
 int status;
 {
    register int i;
-   register PR *pp;
    char     *dir;
 
    for( i=0; i<Max_proc; i++ )
diff --git a/embeddedobj/test/Container1/nativelib/nativeview.c b/embeddedobj/test/Container1/nativelib/nativeview.c
index 6952fe9..0de1018 100644
--- a/embeddedobj/test/Container1/nativelib/nativeview.c
+++ b/embeddedobj/test/Container1/nativelib/nativeview.c
@@ -76,7 +76,14 @@ JNIEXPORT jlong JNICALL Java_embeddedobj_test_NativeView_getNativeWindow
     JAWT                          awt     ;
     JAWT_DrawingSurface*          ds      ;
     JAWT_DrawingSurfaceInfo*      dsi     ;
+#ifdef WNT
     JAWT_Win32DrawingSurfaceInfo* dsi_win ;
+#else
+    // FIXME: Where is dsi_x11 defined?
+    // Added below because I'm guessing this test breaks
+    //
+    // JAWT_X11DrawingSurfaceInfo*dsi_x11 ;
+#endif
     jlong                         drawable;
 
     /* Get the AWT */
diff --git a/extensions/test/ole/OleClient/clientTest.cxx b/extensions/test/ole/OleClient/clientTest.cxx
index 00e2a25..2949cc5 100644
--- a/extensions/test/ole/OleClient/clientTest.cxx
+++ b/extensions/test/ole/OleClient/clientTest.cxx
@@ -116,7 +116,6 @@ bool doParameterTest(const Reference<XInvocation> & inv)
     Sequence<Any> seqOut;
 
     Any arArgs[2];
-    Any arValue[2];
     Any arArgs1[4];
 
     NamedArgument arg1(OUString(L"val1"), makeAny((sal_Int32) 123));
diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx
index a95c56b..6d150a8 100644
--- a/l10ntools/source/help/HelpLinker.cxx
+++ b/l10ntools/source/help/HelpLinker.cxx
@@ -642,8 +642,11 @@ void HelpLinker::link() throw( HelpProcessingException )
             const std::string &additionalFileKey = enumer->first;
 
             fs::path fsAdditionalFileName( additionalFileName, fs::native );
-                std::string aNativeStr = fsAdditionalFileName.native_file_string();
-            HCDBG(const char* pStr = aNativeStr.c_str(); std::cerr << pStr << std::endl);
+            HCDBG({
+                    std::string aNativeStr = fsAdditionalFileName.native_file_string();
+                    const char* pStr = aNativeStr.c_str();
+                    std::cerr << pStr << std::endl;
+            });
 
             fs::path fsTargetName( indexDirParentName / additionalFileKey );
 
commit 4019acf2974b58210ffc1b1975720553e7b5d337
Author: Martyn Russell <martyn at lanedo.com>
Date:   Thu Jun 7 18:35:07 2012 +0100

    cppcheck: avoid unreachable code warnings
    
    Change-Id: I1d126eb10bfebc747d4bb6d153b80abe73a1e81e

diff --git a/embeddedobj/source/msole/xdialogcreator.cxx b/embeddedobj/source/msole/xdialogcreator.cxx
index 935aa29..c5e8a5f 100644
--- a/embeddedobj/source/msole/xdialogcreator.cxx
+++ b/embeddedobj/source/msole/xdialogcreator.cxx
@@ -288,15 +288,14 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia
     else
         throw ucb::CommandAbortedException();
 
-#else
-    throw lang::NoSupportException(); // TODO:
-#endif
-
     OSL_ENSURE( aObjectInfo.Object.is(), "No object was created!\n" );
     if ( !aObjectInfo.Object.is() )
         throw uno::RuntimeException();
 
     return aObjectInfo;
+#else
+    throw lang::NoSupportException(); // TODO:
+#endif
 }
 
 //-------------------------------------------------------------------------
@@ -312,7 +311,6 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceInitF
     embed::InsertedObjectInfo aObjectInfo;
 
 #ifdef WNT
-
     if ( !xStorage.is() )
         throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
                                             uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
@@ -341,15 +339,15 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceInitF
     aObjectInfo.Object = xResult;
 
     // TODO/LATER: in case of iconifie object the icon should be stored in aObjectInfo
-#else
-    throw lang::NoSupportException(); // TODO:
-#endif
 
     OSL_ENSURE( aObjectInfo.Object.is(), "No object was created!\n" );
     if ( !aObjectInfo.Object.is() )
         throw uno::RuntimeException();
 
     return aObjectInfo;
+#else
+    throw lang::NoSupportException(); // TODO:
+#endif
 }
 
 //-------------------------------------------------------------------------
diff --git a/extensions/source/nsplugin/source/so_env.cxx b/extensions/source/nsplugin/source/so_env.cxx
index b196a33..37d8ee3 100644
--- a/extensions/source/nsplugin/source/so_env.cxx
+++ b/extensions/source/nsplugin/source/so_env.cxx
@@ -255,7 +255,7 @@ int findReadSversion(void** aResult, int /*bWnt*/, const char* /*tag*/, const ch
       return 0;
 
     /* .. now in $HOME */
-#endif
+#endif // LINUX
     sprintf(lnkFileName, "%s/.mozilla/plugins/libnpsoplugin%s", getenv("HOME"), SAL_DLLEXTENSION);
 #ifdef LINUX
     ssize_t len = readlink(lnkFileName, realFileName, NPP_PATH_MAX-1);
@@ -267,18 +267,17 @@ int findReadSversion(void** aResult, int /*bWnt*/, const char* /*tag*/, const ch
     realFileName[len] = '\0';
 
     if (NULL == (pTempZero = strstr(realFileName, "/program/libnpsoplugin" SAL_DLLEXTENSION)))
-#else
+#else  // LINUX
     if ((0 > readlink(lnkFileName, realFileName, NPP_PATH_MAX)) ||
         (NULL == (pTempZero = strstr(realFileName, "/program/libnpsoplugin" SAL_DLLEXTENSION))))
-#endif
+#endif // LINUX
     {
         *realFileName = 0;
         return -1;
     }
     *pTempZero = 0;
     return 0;
-#endif
-#ifdef WNT
+#elif defined WNT // UNIX
     static char realFileName[NPP_PATH_MAX] = {0};
     *aResult = realFileName;
     HKEY hKey;
@@ -316,7 +315,7 @@ int findReadSversion(void** aResult, int /*bWnt*/, const char* /*tag*/, const ch
     *pTempZero = 0;
     debug_fprintf(NSP_LOG_APPEND, "realFileName is %s\n", realFileName);
     return 0;
-#endif
+#endif // UNIX
 }
 
 // Return the install dir path of staroffice, return value like "/home/build/staroffice"
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 3249d03..a5e2bd2 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -1331,11 +1331,11 @@ void AutoRecovery::implts_flushConfigItem(const AutoRecovery::TDocumentInfo& rIn
             css::uno::Reference< css::util::XChangesBatch > xFlush(xCFG, css::uno::UNO_QUERY_THROW);
             xFlush->commitChanges();
 
-            #ifdef TRIGGER_FULL_DISC_CHECK
+#ifdef TRIGGER_FULL_DISC_CHECK
             throw css::uno::Exception();
-            #endif
-
+#else  // TRIGGER_FULL_DISC_CHECK
             nRetry = 0;
+#endif // TRIGGER_FULL_DISC_CHECK
         }
         catch(const css::uno::Exception&)
         {
@@ -2363,12 +2363,13 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString&
         {
             xDocRecover->storeToRecoveryFile( rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList() );
 
-            #ifdef TRIGGER_FULL_DISC_CHECK
+#ifdef TRIGGER_FULL_DISC_CHECK
             throw css::uno::Exception();
-            #endif
+#else  // TRIGGER_FULL_DISC_CHECK
 
             bError = sal_False;
             nRetry = 0;
+#endif // TRIGGER_FULL_DISC_CHECK
         }
         catch(const css::uno::Exception&)
         {
@@ -3454,10 +3455,9 @@ void AutoRecovery::implts_verifyCacheAgainstDesktopDocumentList()
 //-----------------------------------------------
 sal_Bool AutoRecovery::impl_enoughDiscSpace(sal_Int32 nRequiredSpace)
 {
-    #ifdef SIMULATE_FULL_DISC
+#ifdef SIMULATE_FULL_DISC
     return sal_False;
-    #endif
-
+#else  // SIMULATE_FULL_DISC
     // In case an error occures and we are not able to retrieve the needed information
     // it's better to "disable" the feature ShowErrorOnFullDisc !
     // Otherwhise we start a confusing process of error handling ...
@@ -3478,6 +3478,7 @@ sal_Bool AutoRecovery::impl_enoughDiscSpace(sal_Int32 nRequiredSpace)
 
     sal_uInt64 nFreeMB = (nFreeSpace/1048576);
     return (nFreeMB >= (sal_uInt64)nRequiredSpace);
+#endif // SIMULATE_FULL_DISC
 }
 
 //-----------------------------------------------


More information about the Libreoffice-commits mailing list