Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


The attached patch fixes lots of cppcheck warnings in the components
repository.

By the way, did anybody review my latest pyuno patch update? Or am I not
patient enough :)

--Andreas Becker

-- 
All my code in this e-mail is under LGPLv3+/MPL.
From 965ff54b77b5ee87758d9bc1fe5c9c906192effd Mon Sep 17 00:00:00 2001
From: Andreas Becker <atayoohoo@googlemail.com>
Date: Thu, 28 Apr 2011 00:59:28 +0200
Subject: [PATCH] fixed cppcheck warnings

---
 .../source/standard/vclxaccessibletoolbox.cxx      |    4 +-
 automation/source/miniapp/testapp.cxx              |    1 +
 automation/source/miniapp/testapp.hxx              |    1 -
 automation/source/testtool/httprequest.cxx         |   24 ++--
 basctl/source/basicide/basidesh.cxx                |   12 +-
 crashrep/source/unx/main.cxx                       |   16 +--
 crashrep/source/win32/base64.cpp                   |    2 -
 cui/source/dialogs/multipat.cxx                    |    2 +-
 cui/source/dialogs/thesdlg.cxx                     |    2 +-
 cui/source/options/dbregister.cxx                  |    2 +-
 cui/source/options/treeopt.cxx                     |    4 +-
 cui/source/tabpages/chardlg.cxx                    |    2 +-
 extensions/source/bibliography/datman.cxx          |    5 +-
 extensions/source/ole/oleobjw.cxx                  |   22 +--
 extensions/source/ole/oleobjw.hxx                  |    2 +-
 forms/source/component/refvaluecomponent.cxx       |    2 +-
 package/source/zippackage/ZipPackageStream.cxx     |    4 +-
 .../shellextensions/copyextensiondata.cxx          |   10 +-
 .../shellextensions/registerextensions.cxx         |  171 ++------------------
 xmlsecurity/tools/demo/performance.cxx             |   27 ++--
 20 files changed, 71 insertions(+), 244 deletions(-)

diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx 
b/accessibility/source/standard/vclxaccessibletoolbox.cxx
index b720a2d..d2addb4 100644
--- a/accessibility/source/standard/vclxaccessibletoolbox.cxx
+++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx
@@ -391,7 +391,7 @@ void VCLXAccessibleToolBox::UpdateItem_Impl( sal_Int32 _nPos, sal_Bool _bItemAdd
                 if ( pItem )
                 {
                     sal_Int32 nIndex = pItem->getIndexInParent( );
-                    nIndex += _bItemAdded ? +1 : -1;
+                    nIndex += (_bItemAdded ? +1 : -1);
                     pItem->setIndexInParent( nIndex );
                 }
             }
@@ -400,7 +400,7 @@ void VCLXAccessibleToolBox::UpdateItem_Impl( sal_Int32 _nPos, sal_Bool _bItemAdd
                 if ( pWindowItem )
                 {
                     sal_Int32 nIndex = pWindowItem->getIndexInParent( );
-                    nIndex += _bItemAdded ? +1 : -1;
+                    nIndex += (_bItemAdded ? +1 : -1);
                     pWindowItem->setIndexInParent( nIndex );
                 }
             }
diff --git a/automation/source/miniapp/testapp.cxx b/automation/source/miniapp/testapp.cxx
index a76e215..ef5d356 100644
--- a/automation/source/miniapp/testapp.cxx
+++ b/automation/source/miniapp/testapp.cxx
@@ -157,6 +157,7 @@ MyApp aApp;
 MyApp::MyApp()
 {
     pMainWin = NULL;
+    pMyDispatcher = NULL;
 }
 
 void MyApp::Property( ApplicationProperty& rProp )
diff --git a/automation/source/miniapp/testapp.hxx b/automation/source/miniapp/testapp.hxx
index c11e551..5441a6d 100644
--- a/automation/source/miniapp/testapp.hxx
+++ b/automation/source/miniapp/testapp.hxx
@@ -86,7 +86,6 @@ public:
 
 class MyApp : public Application
 {
-    PopupMenu  *MyMenu;
     Timer aCommandTimer;
     PlugInDispatcher *pMyDispatcher;
 
diff --git a/automation/source/testtool/httprequest.cxx b/automation/source/testtool/httprequest.cxx
index eab7b4b..7fdeed8 100644
--- a/automation/source/testtool/httprequest.cxx
+++ b/automation/source/testtool/httprequest.cxx
@@ -45,15 +45,18 @@ void HttpRequest::Init()
 }
 
 HttpRequest::HttpRequest()
-: nStatus( HTTP_INIT )
-, nResultId( 0 )
-, pStream( NULL )
-{}
+    : nStatus(HTTP_INIT), nResultId(0),
+      pStream(NULL), pOutSocket(NULL)
+{
+}
 
 HttpRequest::~HttpRequest()
 {
     delete pStream;
     pStream = NULL;
+
+    delete pOutSocket;
+    pOutSocket = NULL;
 }
 
 void HttpRequest::SetRequest( ByteString aHost, ByteString aPath, sal_uInt16 nPort )
@@ -95,18 +98,14 @@ sal_Bool HttpRequest::Execute()
     aTV.Nanosec = 0;
 
     pOutSocket = new osl::ConnectorSocket();
-    if ( pOutSocket->connect( aConnectAddr, &aTV ) == osl_Socket_Ok )
-    {
-//             pOutSocket->setTcpNoDelay( 1 );
-    }
-    else
+    if ( pOutSocket->connect( aConnectAddr, &aTV ) != osl_Socket_Ok )
     {
         delete pOutSocket;
+        pOutSocket = NULL;
         nStatus = HTTP_REQUEST_ERROR;
         return sal_False;
     }
 
-
     SendString( pOutSocket, "GET " );
     if ( aProxyHost.Len() )
     {
@@ -218,14 +217,11 @@ void HttpRequest::Abort()
     if ( pOutSocket )
     {
         nStatus = HTTP_REQUEST_ERROR;
-          pOutSocket->shutdown();
+        pOutSocket->shutdown();
         pOutSocket->close();
     }
 }
 
-
-
-
 SvMemoryStream* HttpRequest::GetBody()
 {
     return pStream;
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index f4a0e35..7c90d17 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -998,15 +998,15 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, String 
aLibName,
     {
         ContainerListenerImpl* pListener = static_cast< ContainerListenerImpl* >( 
m_xLibListener.get() );
 
-        if ( pListener )
-            pListener->removeContainerListener( m_aCurDocument, m_aCurLibName );
-
         m_aCurDocument = rDocument;
-
-        pListener->addContainerListener( m_aCurDocument, aLibName );
-
         m_aCurLibName = aLibName;
 
+        if ( pListener )
+        {
+            pListener->removeContainerListener( m_aCurDocument, m_aCurLibName );
+            pListener->addContainerListener( m_aCurDocument, aLibName );
+        }
+
         if ( bUpdateWindows )
             UpdateWindows();
 
diff --git a/crashrep/source/unx/main.cxx b/crashrep/source/unx/main.cxx
index 3606d34..9982558 100644
--- a/crashrep/source/unx/main.cxx
+++ b/crashrep/source/unx/main.cxx
@@ -316,7 +316,7 @@ bool SendHTTPRequest(
     bool success = false;
 
     struct hostent *hp;
-    
+
     if ( pszProxyServer )
         hp = gethostbyname( pszProxyServer );
     else
@@ -324,7 +324,7 @@ bool SendHTTPRequest(
 
     if ( hp )
     {
-        SOCKET s = socket( AF_INET, SOCK_STREAM, 0 );
+        SOCKET s = socket( AF_INET, SOCK_STREAM, 0 );
 
         if ( s )
         {
@@ -484,12 +484,9 @@ static void WriteSOAPRequest( FILE *fp )
 
 struct RequestParams
 {
-    bool    success;
-    FILE       *fpin;
+    FILE *fpin;
     const char *pServer;
-    unsigned short uPort;
     const char *pProxyServer;
-    unsigned short uProxyPort;
 };
 
 
@@ -540,9 +537,8 @@ bool send_crash_report( const boost::unordered_map< string, string >& rSettings
 
 static bool append_file( const char *filename, string& rString )
 {
-    char       buf[1024];      
-    bool       bSuccess = false;
-    
+    char buf[1024];
+
     FILE *fp = fopen( filename, "r" );
     if ( fp )
     {
@@ -553,7 +549,7 @@ static bool append_file( const char *filename, string& rString )
         }
         fclose( fp );
     }
-    
+
     return true;
 }
 
diff --git a/crashrep/source/win32/base64.cpp b/crashrep/source/win32/base64.cpp
index 3f2e852..15fdc0c 100644
--- a/crashrep/source/win32/base64.cpp
+++ b/crashrep/source/win32/base64.cpp
@@ -34,7 +34,6 @@ static const char base64_tab[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrst
 
 extern "C" size_t base64_encode( FILE *fin, FILE *fout )
 {
-    size_t nBytesRead = 0;
     size_t nLineLength = 0;
     size_t nBytesWritten = 0;
 
@@ -46,7 +45,6 @@ extern "C" size_t base64_encode( FILE *fin, FILE *fout )
 
         memset( in_buffer, 0, sizeof(in_buffer) );
         nBytes = fread( in_buffer, 1, sizeof(in_buffer), fin );
-        nBytesRead += nBytes;
 
         if ( nBytes )
         {
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
index f53b4f0..d2cae86 100644
--- a/cui/source/dialogs/multipat.cxx
+++ b/cui/source/dialogs/multipat.cxx
@@ -294,7 +294,7 @@ void SvxMultiPathDialog::SetPath( const String& rPath )
         if ( pImpl->bIsRadioButtonMode )
         {
             String sEntry( '\t' );
-            sEntry += bIsSystemPath ? sSystemPath : sPath;
+            sEntry += (bIsSystemPath ? sSystemPath : sPath);
             SvLBoxEntry* pEntry = aRadioLB.InsertEntry( sEntry );
             String* pURL = new String( sPath );
             pEntry->SetUserData( pURL );
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx
index e3b1664..910a76c 100644
--- a/cui/source/dialogs/thesdlg.cxx
+++ b/cui/source/dialogs/thesdlg.cxx
@@ -398,7 +398,7 @@ void SvxThesaurusDialog_Impl::LookUp_Impl()
 
     aLookUpText = OUString( aText );
     if (aLookUpText.getLength() > 0 &&
-            (aLookUpHistory.size() == 0 || aLookUpText != aLookUpHistory.top()))
+            (aLookUpHistory.empty() == 0 || aLookUpText != aLookUpHistory.top()))
         aLookUpHistory.push( aLookUpText );
 
     m_bWordFound = UpdateAlternativesBox_Impl();
diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
index 50cb59e..094826f 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -279,7 +279,7 @@ void DbRegistrationOptionsPage::FillUserData()
     aUserData += ';';
     HeaderBarItemBits nBits    = pHeaderBar->GetItemBits( ITEMID_TYPE );
     sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
-    aUserData += bUp ? '1' : '0';
+    aUserData += (bUp ? '1' : '0');
     SetUserData( aUserData );
 }
 // -----------------------------------------------------------------------
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index afa039e..e84eedb 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -2191,7 +2191,7 @@ void OfaTreeOptionsDialog::ResizeTreeLB( void )
     while( pEntry )
     {
         long n = aTreeLB.GetTextWidth( aTreeLB.GetEntryText( static_cast< SvLBoxEntry* >( pEntry ) 
) );
-        n += ( nDepth == 0 )? nIndent0 : nIndent1;
+        n += ((nDepth == 0) ? nIndent0 : nIndent1);
 
         if( n > nDelta )
             nDelta = n;
@@ -2778,4 +2778,4 @@ void ExtensionsTabPage::SavePage()
     DispatchAction( C2U("ok") );
 }
 
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 92f3589..8ca6435 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -3627,7 +3627,7 @@ sal_Bool SvxCharPositionPage::FillItemSet( SfxItemSet& rSet )
         else
         {
             nEsc = (short)m_aHighLowEdit.Denormalize( m_aHighLowEdit.GetValue() );
-            nEsc *= bHigh ? 1 : -1;
+            nEsc *= (bHigh ? 1 : -1);
         }
         nEscProp = (sal_uInt8)m_aFontSizeEdit.Denormalize( m_aFontSizeEdit.GetValue() );
     }
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index c0e5ac5..fe17033 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -118,14 +118,13 @@ Reference< XConnection > getConnection(const ::rtl::OUString& _rURL)
         {
             xDataSource = Reference< XDataSource > (Reference< XNamingService > (xNamingContext, 
UNO_QUERY)->getRegisteredObject(_rURL), UNO_QUERY);
         }
-        catch(Exception eEx)
+        catch(Exception &)
         {
-            (void) eEx;        // make compiler happy
             OSL_FAIL("Exception caught in ODatabaseContext::getRegisteredObject()");
         }
     }
     // build the connection from the data source
-    Reference< XConnection >   xConn;
+    Reference< XConnection > xConn;
     if (xDataSource.is())
     {
         // need user/pwd for this
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index 3a6933c..17bf271 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -1366,7 +1366,6 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const ::rtl::OUString& 
aNa
         scoped_array<CComVariant> ptrRefArgs; // referenced arguments
         CComVariant * arArgs = NULL;
         CComVariant * arRefArgs = NULL;
-        bool bVarargParam = false;
 
         dispparams.cArgs = aParams.getLength();
 
@@ -1758,8 +1757,6 @@ Any  IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
     CComVariant * arArgs = NULL;
     CComVariant * arRefArgs = NULL;
     sal_Int32 revIndex = 0;
-    bool bVarargParam = false;
-
 
     //Set the array of DISPIDs for named args if it is a property put operation.
     //If there are other named arguments another array is set later on.
@@ -1906,24 +1903,15 @@ Any  IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
             if ( i < nUnoArgs)
                 anyArg= Params.getConstArray()[i];
 
-            //Test if the current parameter is a "vararg" parameter.
-            if (bVarargParam || (aFuncDesc->cParamsOpt == -1 &&
-                                aFuncDesc->cParams == (i + 1)))
-            {   //This parameter is from the variable argument list. There is no
-                //type info available, except that it must be a VARIANT
-                bVarargParam = true;
-            }
-
             unsigned short paramFlags = PARAMFLAG_FOPT | PARAMFLAG_FIN;
             VARTYPE varType = VT_VARIANT;
-            if ( ! bVarargParam)
+            if (aFuncDesc->cParamsOpt != -1 || aFuncDesc->cParams != (i + 1))
             {
-                paramFlags =
-                    aFuncDesc->lprgelemdescParam[i].paramdesc.wParamFlags;
-                varType = getElementTypeDesc(
-                    & aFuncDesc->lprgelemdescParam[i].tdesc);
+                paramFlags = aFuncDesc->lprgelemdescParam[i].paramdesc.wParamFlags;
+                varType = getElementTypeDesc(&aFuncDesc->lprgelemdescParam[i].tdesc);
             }
-            //Make sure that there is a UNO parameter for every
+
+            // Make sure that there is a UNO parameter for every
             // expected parameter. If there is no UNO parameter where the
             // called function expects one, then it must be optional. Otherwise
             // its a UNO programming error.
diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx
index 44bc67d..f6e295b 100644
--- a/extensions/source/ole/oleobjw.hxx
+++ b/extensions/source/ole/oleobjw.hxx
@@ -148,7 +148,7 @@ public:
     virtual ::sal_Bool SAL_CALL hasMember( const ::rtl::OUString& aName ) throw 
(::com::sun::star::uno::RuntimeException);
 
 
-    Any  IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
+    Any  invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
                             const OUString& sFuncName,
                             const Sequence< Any >& Params,
                             Sequence< sal_Int16 >& OutParamIndex,
diff --git a/forms/source/component/refvaluecomponent.cxx 
b/forms/source/component/refvaluecomponent.cxx
index 6928e1c..c7095bc 100644
--- a/forms/source/component/refvaluecomponent.cxx
+++ b/forms/source/component/refvaluecomponent.cxx
@@ -260,7 +260,7 @@ namespace frm
                 }
                 else if ( bStringExchange )
                 {
-                    aExternalValue <<= m_bSupportSecondRefValue ? m_sNoCheckReferenceValue : 
::rtl::OUString();
+                    aExternalValue <<= (m_bSupportSecondRefValue ? m_sNoCheckReferenceValue : 
::rtl::OUString());
                 }
                 break;
             }
diff --git a/package/source/zippackage/ZipPackageStream.cxx 
b/package/source/zippackage/ZipPackageStream.cxx
index ce72beb..d6d7b4f 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -750,7 +750,7 @@ Any SAL_CALL ZipPackageStream::getPropertyValue( const OUString& PropertyName )
     }
     else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Encrypted" ) ) )
     {
-        aAny <<= ( m_nStreamMode == PACKAGE_STREAM_RAW ) ? sal_True : bToBeEncrypted;
+        aAny <<= ((m_nStreamMode == PACKAGE_STREAM_RAW) ? sal_True : bToBeEncrypted);
         return aAny;
     }
     else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "WasEncrypted" ) ) )
@@ -765,7 +765,7 @@ Any SAL_CALL ZipPackageStream::getPropertyValue( const OUString& PropertyName )
     }
     else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EncryptionKey" ) ) )
     {
-        aAny <<= !xEncryptionData.is() ? Sequence < sal_Int8 > () : xEncryptionData->aKey;
+        aAny <<= (!xEncryptionData.is() ? Sequence < sal_Int8 > () : xEncryptionData->aKey);
         return aAny;
     }
     else
diff --git a/setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx 
b/setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx
index 253fa7a..1929646 100644
--- a/setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx
@@ -80,7 +80,6 @@ extern "C" UINT __stdcall copyExtensionData(MSIHANDLE handle) {
     std::_tstring sSourceDir = GetMsiProperty( handle, TEXT("SourceDir") );
     std::_tstring sExtensionDir = sSourceDir + TEXT("extension\\");
     std::_tstring sPattern = sExtensionDir + TEXT("*.oxt");
-    // std::_tstring mystr;
 
     // Finding all oxt files in sExtensionDir
 
@@ -91,7 +90,6 @@ extern "C" UINT __stdcall copyExtensionData(MSIHANDLE handle) {
     if ( hFindOxt != INVALID_HANDLE_VALUE )
     {
         bool fNextFile = false;
-        bool fSuccess = true;
         bool bFailIfExist = true;
 
         std::_tstring sDestDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") );
@@ -101,9 +99,9 @@ extern "C" UINT __stdcall copyExtensionData(MSIHANDLE handle) {
         std::_tstring sShareDir = sDestDir + TEXT("share");
         std::_tstring sExtDir = sShareDir + TEXT("\\extension");
         std::_tstring sExtInstDir = sExtDir + TEXT("\\install");
-        bool bDir = CreateDirectory(sShareDir.c_str(), NULL);
-        bDir = CreateDirectory(sExtDir.c_str(), NULL);
-        bDir = CreateDirectory(sExtInstDir.c_str(), NULL);
+        CreateDirectory(sShareDir.c_str(), NULL);
+        CreateDirectory(sExtDir.c_str(), NULL);
+        CreateDirectory(sExtInstDir.c_str(), NULL);
 
         do
         {
@@ -112,7 +110,7 @@ extern "C" UINT __stdcall copyExtensionData(MSIHANDLE handle) {
             std::_tstring sSourceFile = sExtensionDir + sOxtFile;
             std::_tstring sDestFile = sShareInstallDir + sOxtFile;
 
-            fSuccess = CopyFile( sSourceFile.c_str(), sDestFile.c_str(), bFailIfExist );
+            CopyFile( sSourceFile.c_str(), sDestFile.c_str(), bFailIfExist );
 
             fNextFile = FindNextFile( hFindOxt, &aFindFileData );
 
diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx 
b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
index bca824b..f5790b2 100644
--- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
@@ -55,119 +55,6 @@
 #include <tchar.h>
 #include <string>
 
-/** creates a temporary folder with a unique name.
-
-    The returned string is a file URL.
-*/
-// static std::_tstring createTempFolder()
-// {
-//     BOOL bExist = FALSE;
-//     TCHAR szTempName[MAX_PATH]; 
-//     do
-//     {
-//         bExist = FALSE;
-//         // Get the temp path.
-//         TCHAR lpPathBuffer[MAX_PATH];
-//         DWORD dwRetVal = GetTempPath(MAX_PATH, lpPathBuffer);
-//         if (dwRetVal > MAX_PATH || (dwRetVal == 0))
-//         {
-//             //fprintf (stderr, "GetTempPath failed with error %d.\n", GetLastError());
-//             return TEXT("");
-//         }          
-//         // Create a temporary file.
-//         UINT uRetVal = GetTempFileName(lpPathBuffer, // directory for tmp files
-//                                        "upg",        // temp file name prefix 
-//                                        0,            // create unique name 
-//                                        szTempName);  // buffer for name 
-//         if (uRetVal == 0)
-//         {
-//             //fprintf (stderr, "GetTempFileName failed with error %d.\n", GetLastError());
-//             return TEXT("");
-//         }
-//         //Delete the file
-//         BOOL bDel = DeleteFile(szTempName);    
-//         if (FALSE == bDel)
-//         {
-//             //fprintf(stderr, "Could not delete temp file. Error %d.\n", GetLastError());
-//             return TEXT("");
-//         }
-//         // Create the directory
-//         BOOL bDir = CreateDirectory(szTempName, NULL);
-//         if (FALSE == bDir)
-//         {
-//             DWORD error =GetLastError();
-//             if (ERROR_ALREADY_EXISTS == error)
-//             {
-//                 bExist = TRUE;
-//             }
-//             else
-//             {
-//                 //fprintf(stderr, "CreateDirectory failed with error %d.\n", error);
-//                 return TEXT("");
-//             }
-//         }
-//     } while(bExist);
-    
-//     std::_tstring cur(szTempName);
-//     //make a file URL from the path
-//     std::_tstring ret(TEXT("file:///"));
-//     for (std::_tstring::iterator i = cur.begin(); i != cur.end(); i++)
-//     {
-//         if (*i == '\\')
-//             ret.append(TEXT("/"));
-//         else
-//             ret.push_back(*i);
-//     }
-// //    MessageBox(NULL, ret.c_str(), "createTempFolder", MB_OK);
-//     return ret.c_str();
-// }
-
-/** deletes the temporary folder.
-    The argument must be a file URL.
-*/
-// static void deleteTempFolder(const std::_tstring& sTempFolder)
-// {
-//     if (sTempFolder.size() == 0)
-//         return;
-//     //convert the file URL to a path
-//     const std::_tstring path(sTempFolder.substr(8));
-//     std::_tstring path2;
-// //    MessageBox(NULL, path.c_str(), "del1", MB_OK);        
-//     for (std::_tstring::const_iterator i = path.begin(); i != path.end(); i++)
-//     {
-//         if (*i == '/')
-//             path2.append(TEXT("\\"));
-//         else
-//             path2.push_back(*i);
-//     }
-
-//     //We need a null terminated string with two nulls in the end
-//     //for the SHFILEOPSTRUCT
-//     const TCHAR * szTemp = path2.c_str();
-//     size_t size = path2.size();
-//     TCHAR * szTemp2 = new TCHAR[size + 2];
-//     ZeroMemory(szTemp2, (size + 2) * sizeof(TCHAR));
-//     memcpy(szTemp2, szTemp, size * sizeof(TCHAR));   
-    
-// //    MessageBox(NULL, szTemp2, "del3", MB_OK);
-//     SHFILEOPSTRUCT operation = 
-//         {
-//             NULL,
-//             FO_DELETE,
-//             szTemp2, 
-//             NULL,
-//             FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR,
-//             FALSE,
-//             NULL,
-//             NULL
-//         };
-
-//     SHFileOperation( &operation);
-//     delete [] szTemp2;
-// }
-
-
-
 static std::_tstring GetMsiProperty( MSIHANDLE handle, const std::_tstring& sProperty )
 {
     std::_tstring result;
@@ -189,8 +76,6 @@ static std::_tstring GetMsiProperty( MSIHANDLE handle, const std::_tstring& sPro
 /* creates a child process which is specified in lpCommand.
 
   out_exitCode is the exit code of the child process
-  
-
 **/
 static BOOL ExecuteCommand( LPCTSTR lpCommand, DWORD * out_exitCode)
 {
@@ -217,10 +102,10 @@ static BOOL ExecuteCommand( LPCTSTR lpCommand, DWORD * out_exitCode)
     if ( fSuccess )
     {
         WaitForSingleObject( pi.hProcess, INFINITE );
-        
+
         if (!GetExitCodeProcess( pi.hProcess, out_exitCode))
             fSuccess = FALSE;
-        
+
         CloseHandle( pi.hProcess );
         CloseHandle( pi.hThread );
     }
@@ -251,8 +136,7 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
             std::_tstring sParentDir = TEXT("..");
 
             mystr = "Current short file: " + sFileName;
-            // MessageBox(NULL, mystr.c_str(), "Current Content", MB_OK);
-        
+
             if (( strcmp(sFileName.c_str(),sCurrentDir.c_str()) != 0 ) &&
                 ( strcmp(sFileName.c_str(),sParentDir.c_str()) != 0 ))
             {
@@ -264,12 +148,10 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
                     if ( fSuccess )
                     {
                         mystr = "Successfully removed content of dir " + sCompleteFileName;
-                        // MessageBox(NULL, mystr.c_str(), "Removed Directory", MB_OK);
                     }
                     else
                     {
                         mystr = "An error occurred during removing content of " + 
sCompleteFileName;
-                        // MessageBox(NULL, mystr.c_str(), "Error removing directory", MB_OK);
                     }
                 }
                 else
@@ -278,12 +160,10 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
                     if ( fSuccess )
                     {
                         mystr = "Successfully removed file " + sCompleteFileName;
-                        // MessageBox(NULL, mystr.c_str(), "Removed File", MB_OK);
                     }
                     else
                     {
                         mystr = "An error occurred during removal of file " + sCompleteFileName;
-                        // MessageBox(NULL, mystr.c_str(), "Error removing file", MB_OK);
                     }
                 }
             }
@@ -312,7 +192,7 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
             bDirectoryRemoved = false;
         }
     }
-    
+
     return bDirectoryRemoved;
 }
 
@@ -325,7 +205,6 @@ extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle)
     WIN32_FIND_DATA aFindFileData;
 
     mystr = "unopkg file: " + sUnoPkgFile;
-    //MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
 
     // Find unopkg.exe
     HANDLE hFindUnopkg = FindFirstFile( sUnoPkgFile.c_str(), &aFindFileData );
@@ -335,29 +214,11 @@ extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle)
         // unopkg.exe exists in program directory
         std::_tstring sCommand = sUnoPkgFile + " sync";
         mystr = "Command: " + sCommand;
-        //MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
-        
+
         DWORD exitCode = 0;
-        bool fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode);
-        
-//         if ( fSuccess )
-//         {
-//             mystr = "Executed successfully!";
-//             MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
-//         }
-//         else
-//         {
-//             mystr = "An error occurred during execution!";
-//             MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
-//         }
-        
+        ExecuteCommand( sCommand.c_str(), & exitCode);
         FindClose( hFindUnopkg );
     }
-//     else
-//     {
-//         mystr = "Error: Did not find " + sUnoPkgFile;
-//         MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
-//     }
 
     return ERROR_SUCCESS;
 }
@@ -374,10 +235,9 @@ extern "C" UINT __stdcall RemoveExtensions(MSIHANDLE handle)
     DWORD nValueSize = sizeof(szValue);
     HKEY  hKey;
     std::_tstring sInstDir;
-    
+
     std::_tstring sProductKey = GetMsiProperty( handle, TEXT("FINDPRODUCT") );
-    //MessageBox( NULL, sProductKey.c_str(), "Titel", MB_OK );
-    
+
     if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER,  sProductKey.c_str(), &hKey ) )
     {
         if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, 
(LPBYTE)szValue, &nValueSize ) )
@@ -402,19 +262,8 @@ extern "C" UINT __stdcall RemoveExtensions(MSIHANDLE handle)
     // Removing complete directory "Basis\presets\bundled"
 
     std::_tstring sCacheDir = sInstDir + TEXT("share\\prereg\\bundled");
-    
-    bool fSuccess = RemoveCompleteDirectory( sCacheDir );
-
-//     if ( fSuccess )
-//     {
-//         mystr = "Executed successfully!";
-//          MessageBox(NULL, mystr.c_str(), "Main methode", MB_OK);
-//     }
-//     else
-//     {
-//         mystr = "An error occurred during execution!";
-//         MessageBox(NULL, mystr.c_str(), "Main methode", MB_OK);
-//     }
+
+    RemoveCompleteDirectory( sCacheDir );
 
     return ERROR_SUCCESS;
 }
diff --git a/xmlsecurity/tools/demo/performance.cxx b/xmlsecurity/tools/demo/performance.cxx
index c30a573..6612658 100644
--- a/xmlsecurity/tools/demo/performance.cxx
+++ b/xmlsecurity/tools/demo/performance.cxx
@@ -176,7 +176,7 @@ protected:
     
     int m_nSecurityId;
 
-private:       
+private:
     int getNextSecurityId() const;
 
 protected:
@@ -244,7 +244,7 @@ public:
 
 struct AncestorEvent
 {
-    AncestorEvent( sal_Int32 nAttrNum ):aAttributeList(nAttrNum){};
+    AncestorEvent(sal_Int32 nAttrNum) : aAttributeList(nAttrNum), bIsStartElement(false) {};
     
     bool bIsStartElement;
     rtl::OUString ouName;
@@ -357,29 +357,32 @@ private:
         const com::sun::star::uno::Reference<
             com::sun::star::xml::sax::XDocumentHandler >& xDocumentHandler);
     
-    void XSecTester::sendAncestorStartElementEvent(
+    void sendAncestorStartElementEvent(
         const rtl::OUString& ouName, 
         const com::sun::star::uno::Sequence<
             com::sun::star::xml::csax::XMLAttribute >& xAttrList,
         const com::sun::star::uno::Reference<
             com::sun::star::xml::sax::XDocumentHandler >& xDocumentHandler) const;
-        
-    void XSecTester::sendAncestorEndElementEvent(
+
+    void sendAncestorEndElementEvent(
         const rtl::OUString& ouName,
         const com::sun::star::uno::Reference<
             com::sun::star::xml::sax::XDocumentHandler >& xDocumentHandler) const;
-        
-    std::vector< AncestorEvent* >::const_iterator XSecTester::checkAncestorStartElementEvent( 
+
+    std::vector< AncestorEvent* >::const_iterator checkAncestorStartElementEvent(
         const std::vector< AncestorEvent* >::const_iterator& ii,
         const com::sun::star::uno::Reference<
             com::sun::star::xml::sax::XDocumentHandler >& xDocumentHandler) const;
-    
+
 public:
-    XSecTester(const com::sun::star::uno::Reference<
-        com::sun::star::lang::XMultiServiceFactory >& rxMSF)
-        :mxMSF( rxMSF ){};
+    XSecTester(const com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory >& 
rxMSF)
+        : mxMSF(rxMSF), m_bIsExporting(false), m_bIsBlocking(false),
+          m_bIsInsideCollectedElement(false), m_bIsSAXEventKeeperOnTheSAXChain(false)
+    {
+    };
+
     virtual ~XSecTester(){};
-    
+
     /* XSignatureCreationResultListener */
     virtual void SAL_CALL signatureCreated( 
         sal_Int32 securityId, 
-- 
1.7.4.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.