[Libreoffice-commits] core.git: 6 commits - configmgr/source svx/source ucb/source xmloff/source xmlsecurity/source

Caolán McNamara caolanm at redhat.com
Tue Feb 10 13:47:19 PST 2015


 configmgr/source/childaccess.cxx                              |    5 
 svx/source/svdraw/svdviter.cxx                                |   95 +--
 ucb/source/ucp/ftp/test.cxx                                   |   67 --
 ucb/source/ucp/ftp/test.py                                    |   42 -
 ucb/source/ucp/ftp/test_activedatasink.cxx                    |   54 -
 ucb/source/ucp/ftp/test_activedatasink.hxx                    |   83 --
 ucb/source/ucp/ftp/test_ftpurl.cxx                            |  279 ----------
 ucb/source/ucp/ftp/test_ftpurl.hxx                            |   31 -
 ucb/source/ucp/ftp/test_multiservicefac.cxx                   |  103 ---
 ucb/source/ucp/ftp/test_multiservicefac.hxx                   |   89 ---
 xmloff/source/text/txtexppr.cxx                               |    4 
 xmloff/source/text/txtimp.cxx                                 |    2 
 xmloff/source/text/txtparae.cxx                               |    6 
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |   15 
 14 files changed, 57 insertions(+), 818 deletions(-)

New commits:
commit 61b8596f1114d7b9b6ebcaedf125eeb8821d2c9f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 10 10:53:10 2015 +0000

    cppcheck: assertWithSideEffect
    
    Change-Id: I6601e857394d7b460a105e851529350a62d1a2a6

diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx
index 259d968..a9771ff 100644
--- a/configmgr/source/childaccess.cxx
+++ b/configmgr/source/childaccess.cxx
@@ -92,8 +92,9 @@ ChildAccess::ChildAccess(
 }
 
 Path ChildAccess::getAbsolutePath() {
-    assert(getParentAccess().is());
-    Path path(getParentAccess()->getAbsolutePath());
+    rtl::Reference< Access > parent(getParentAccess());
+    assert(parent.is());
+    Path path(parent->getAbsolutePath());
     path.push_back(name_);
     return path;
 }
commit 33c2688e91164e162e38aca5bc1d066b6063b5fd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 10 10:50:12 2015 +0000

    rearrange this a little, no logic change
    
    Change-Id: Ia5dd68ab8b7e4fe93caf0e79a27922abf02b97b6

diff --git a/svx/source/svdraw/svdviter.cxx b/svx/source/svdraw/svdviter.cxx
index f7bc700..1078dc7 100644
--- a/svx/source/svdraw/svdviter.cxx
+++ b/svx/source/svdraw/svdviter.cxx
@@ -70,71 +70,62 @@ SdrViewIter::SdrViewIter(const SdrObject* pObject, bool bNoMasterPage)
 
 bool SdrViewIter::ImpCheckPageView(SdrPageView* pPV) const
 {
-    if(mpPage)
-    {
-        bool bMaster(mpPage->IsMasterPage());
-        SdrPage* pPg = pPV->GetPage();
+    if(!mpPage)
+        return true;
 
-        if(pPg == mpPage)
+    bool bMaster(mpPage->IsMasterPage());
+    SdrPage* pPg = pPV->GetPage();
+
+    if(pPg == mpPage)
+    {
+        if(mpObject)
         {
-            if(mpObject)
-            {
-                // Looking for an object? First, determine if it visible in
-                // this PageView.
-                SetOfByte aObjLay;
-                mpObject->getMergedHierarchyLayerSet(aObjLay);
-                aObjLay &= pPV->GetVisibleLayers();
-                return !aObjLay.IsEmpty();
-            }
-            else
-            {
-                return true;
-            }
+            // Looking for an object? First, determine if it visible in
+            // this PageView.
+            SetOfByte aObjLay;
+            mpObject->getMergedHierarchyLayerSet(aObjLay);
+            aObjLay &= pPV->GetVisibleLayers();
+            return !aObjLay.IsEmpty();
         }
         else
         {
-            if(!mbNoMasterPage && bMaster && (!mpObject || !mpObject->IsNotVisibleAsMaster()))
+            return true;
+        }
+    }
+    else if(!mbNoMasterPage && bMaster && (!mpObject || !mpObject->IsNotVisibleAsMaster()))
+    {
+        if(pPg->TRG_HasMasterPage())
+        {
+            SdrPage& rMasterPage = pPg->TRG_GetMasterPage();
+
+            if(&rMasterPage == mpPage)
             {
-                if(pPg->TRG_HasMasterPage())
+                // the page we're looking for is a master page in this PageView
+                if(mpObject)
                 {
-                    SdrPage& rMasterPage = pPg->TRG_GetMasterPage();
-
-                    if(&rMasterPage == mpPage)
+                    // Looking for an object? First, determine if it visible in
+                    // this PageView.
+                    SetOfByte aObjLay;
+                    mpObject->getMergedHierarchyLayerSet(aObjLay);
+                    aObjLay &= pPV->GetVisibleLayers();
+                    aObjLay &= pPg->TRG_GetMasterPageVisibleLayers();
+
+                    if(!aObjLay.IsEmpty())
                     {
-                        // the page we're looking for is a master page in this PageView
-                        if(mpObject)
-                        {
-                            // Looking for an object? First, determine if it visible in
-                            // this PageView.
-                            SetOfByte aObjLay;
-                            mpObject->getMergedHierarchyLayerSet(aObjLay);
-                            aObjLay &= pPV->GetVisibleLayers();
-                            aObjLay &= pPg->TRG_GetMasterPageVisibleLayers();
-
-                            if(!aObjLay.IsEmpty())
-                            {
-                                return true;
-                            } // else, look at the next master page of this page...
-                        }
-                        else
-                        {
-                            return true;
-                        }
-                    }
+                        return true;
+                    } // else, look at the next master page of this page...
+                }
+                else
+                {
+                    return true;
                 }
             }
-
-            // master page forbidden or no fitting master page found
-            return false;
         }
     }
-    else
-    {
-        return true;
-    }
-}
-
 
+    // master page forbidden or no fitting master page found
+    return false;
+}
 
 SdrView* SdrViewIter::ImpFindView()
 {
commit 7d83d0fe0400b17311c0da5072bf9a4dafb5a250
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 10 10:46:33 2015 +0000

    drop some unbuilt test code
    
    Change-Id: I7e0651ccb248034bafffb1c46e6266fa396eede1

diff --git a/ucb/source/ucp/ftp/test.cxx b/ucb/source/ucp/ftp/test.cxx
deleted file mode 100644
index 6141e2c..0000000
--- a/ucb/source/ucp/ftp/test.cxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-/**************************************************************************
-                                TODO
- **************************************************************************
-
- *************************************************************************/
-
-#include "test_ftpurl.hxx"
-#include <stdio.h>
-#include <unistd.h>
-
-
-
-int main(int argc,char* argv[])
-{
-
-    typedef int (*INT_FUNC)(void);
-    INT_FUNC tests[] = { test_ftpurl,
-                   test_ftpparent,
-                   test_ftpproperties,
-                   test_ftpopen,
-                   test_ftplist,
-                   0 };  // don't remove ending zero
-
-    int err_level = 0;
-
-    fprintf(stderr,"-------       Testing       ----------\n");
-
-    int i = -1;
-    do {
-        INT_FUNC f = tests[++i];
-        if(f) {
-            err_level += (*f)();
-            fprintf(stderr,".");
-        } else
-            break;
-    } while(true);
-
-    if(err_level) {
-        fprintf(stderr,"number of failed tests: %d\n",err_level);
-        fprintf(stderr,"----------------------------------\n");
-    } else
-        fprintf(stderr,"no errors\n");
-
-    return err_level;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/ftp/test.py b/ucb/source/ucp/ftp/test.py
deleted file mode 100644
index 0f00c52..0000000
--- a/ucb/source/ucp/ftp/test.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#/usr/bin/env python
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-#   Licensed to the Apache Software Foundation (ASF) under one or more
-#   contributor license agreements. See the NOTICE file distributed
-#   with this work for additional information regarding copyright
-#   ownership. The ASF licenses this file to you under the Apache
-#   License, Version 2.0 (the "License"); you may not use this file
-#   except in compliance with the License. You may obtain a copy of
-#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-import re,os
-
-def grep(pattern,dirname,names):
-	for name in names:
-		filename = os.path.join(dirname,name)
-		if os.path.isfile(filename):
-			lines = open(filename,"r").readlines()
-			for line in lines:
-				if pattern.search(line):
-					print filename
-					break
-
-
-def find(pattern,directory = "."):
-	os.path.walk(directory,grep,re.compile(pattern))
-
-	
-if __name__ == "__main__":
-	import sys
-	if len(sys.argv) == 2:
-		find(sys.argv[1])
-	elif len(sys.argv) == 2:
-		find(sys.argv[2],sys.argv[1])
diff --git a/ucb/source/ucp/ftp/test_activedatasink.cxx b/ucb/source/ucp/ftp/test_activedatasink.cxx
deleted file mode 100644
index 0faa118..0000000
--- a/ucb/source/ucp/ftp/test_activedatasink.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-/**************************************************************************
-                                TODO
- **************************************************************************
-
- *************************************************************************/
-
-#include "test_activedatasink.hxx"
-
-
-using namespace test_ftp;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::io;
-
-
-Any SAL_CALL Test_ActiveDataSink::queryInterface( const Type& rType ) throw( RuntimeException ) {
-    Any aRet = ::cppu::queryInterface(rType,
-                                      (static_cast< XActiveDataSink* >(this)));
-
-    return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
-}
-
-
-
-void SAL_CALL Test_ActiveDataSink::acquire( void ) throw() {
-    OWeakObject::acquire();
-}
-
-
-
-void SAL_CALL Test_ActiveDataSink::release( void ) throw() {
-    OWeakObject::release();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/ftp/test_activedatasink.hxx b/ucb/source/ucp/ftp/test_activedatasink.hxx
deleted file mode 100644
index 7d9a90f..0000000
--- a/ucb/source/ucp/ftp/test_activedatasink.hxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-/**************************************************************************
-                                TODO
- **************************************************************************
-
- *************************************************************************/
-#ifndef INCLUDED_UCB_SOURCE_UCP_FTP_TEST_ACTIVEDATASINK_HXX
-#define INCLUDED_UCB_SOURCE_UCP_FTP_TEST_ACTIVEDATASINK_HXX
-
-#include <cppuhelper/weak.hxx>
-#include <cppuhelper/queryinterface.hxx>
-#include <com/sun/star/io/XActiveDataSink.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-
-namespace test_ftp {
-
-
-    class Test_ActiveDataSink
-        : public cppu::OWeakObject,
-          public com::sun::star::io::XActiveDataSink
-    {
-    public:
-
-        // XInterface
-
-        virtual com::sun::star::uno::Any SAL_CALL
-        queryInterface( const com::sun::star::uno::Type& rType )
-            throw( com::sun::star::uno::RuntimeException );
-
-
-        virtual void SAL_CALL acquire( void ) throw();
-
-        virtual void SAL_CALL release( void ) throw();
-
-
-        // XActiveDataSink
-
-        virtual void SAL_CALL
-        setInputStream(const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& aStream )
-            throw(com::sun::star::uno::RuntimeException)
-        {
-            m_xInputStream = aStream;
-        }
-
-
-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL
-        getInputStream(  )
-            throw(::com::sun::star::uno::RuntimeException)
-        {
-            return m_xInputStream;
-        }
-
-
-    private:
-
-        com::sun::star::uno::Reference<com::sun::star::io::XInputStream> m_xInputStream;
-
-    };
-
-}
-
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/ftp/test_ftpurl.cxx b/ucb/source/ucp/ftp/test_ftpurl.cxx
deleted file mode 100644
index b93d2b0..0000000
--- a/ucb/source/ucp/ftp/test_ftpurl.cxx
+++ /dev/null
@@ -1,279 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include <com/sun/star/ucb/OpenMode.hpp>
-#include "ftpurl.hxx"
-#include "ftploaderthread.hxx"
-#include "ftphandleprovider.hxx"
-#include "debughelper.hxx"
-#include <vector>
-
-struct ServerInfo {
-    OUString host;
-    OUString port;
-    OUString username;
-    OUString password;
-    OUString account;
-};
-
-
-class FTPHandleProviderI
-    : public ftp::FTPHandleProvider {
-
-public:
-
-    FTPHandleProviderI()
-        : p(new ftp::FTPLoaderThread) {
-    }
-
-    ~FTPHandleProviderI() {
-        delete p;
-    }
-
-    virtual CURL* handle() {
-        return p->handle();
-    }
-
-    bool forHost(const OUString& host,
-                 const OUString& port,
-                 const OUString& username,
-                 OUString& password,
-                 OUString& account)
-    {
-        for(unsigned int i = 0; i < m_ServerInfo.size(); ++i)
-            if(host == m_ServerInfo[i].host &&
-               port == m_ServerInfo[i].port &&
-               username == m_ServerInfo[i].username ) {
-                password = m_ServerInfo[i].password;
-                account = m_ServerInfo[i].account;
-                return true;
-            }
-
-        return false;
-    }
-
-    virtual bool setHost(const OUString& host,
-                         const OUString& port,
-                         const OUString& username,
-                         const OUString& password,
-                         const OUString& account)
-    {
-        ServerInfo inf;
-        inf.host = host;
-        inf.port = port;
-        inf.username = username;
-        inf.password = password;
-        inf.account = account;
-
-        bool present(false);
-        for(unsigned int i = 0; i < m_ServerInfo.size(); ++i)
-            if(host == m_ServerInfo[i].host &&
-               port == m_ServerInfo[i].port) {
-                m_ServerInfo[i] = inf;
-                present = true;
-            }
-
-        if(!present)
-            m_ServerInfo.push_back(inf);
-
-        return !present;
-
-    }
-
-
-private:
-
-    std::vector<ServerInfo> m_ServerInfo;
-    ftp::FTPLoaderThread *p;
-};
-
-
-
-// Here are some test for the parsing of an url.
-
-#define TESTURL \
-{  \
-ftp::FTPURL url(OUString::createFromAscii(ascii),&prov); \
-if(!url.username().equalsAscii(n)) {\
-++number_of_errors;   \
-err_msg("wrong username: ",url.username());  \
-}}
-
-int test_ftpurl(void) {
-    const char* name = "test_ftpurl";
-    int number_of_errors = 0;
-
-    FTPHandleProviderI prov;
-    char* ascii,*n,*p;
-
-    ascii = "ftp://abi:psswd@host/eins/../drei", n = "abi", p = "psswd";
-    TESTURL;
-
-    ascii = "ftp://:psswd@host:22/eins/../drei", n = "anonymous", p = "psswd";
-    TESTURL;
-
-    ascii = "ftp://host/bla/../../test/", n = "anonymous", p = "";
-    TESTURL;
-
-    if(number_of_errors)
-    {
-        fprintf(stderr,"errors in %s: %d\n",name,number_of_errors);
-    }
-    return number_of_errors;
-}
-
-
-int test_ftplist(void) {
-    int number_of_errors = 0;
-    const char* name = "test_ftplist";
-
-    FTPHandleProviderI provider;
-
-    ftp::FTPURL url(
-        OUString( "ftp://abi:psswd@abi-1/dir"),
-        &provider);
-
-    std::vector<ftp::FTPDirentry> vec =
-        url.list(com::sun::star::ucb::OpenMode::ALL);
-
-    if(vec.size() != 3)
-        ++number_of_errors;
-
-    if(!(vec[0].m_aName == "dir1" && vec[1].m_aName == "dir2" && vec[2].m_aName == "file1" ))
-       ++number_of_errors;
-
-    if(number_of_errors)
-    {
-        fprintf(stderr,"errors in %s: %d\n",name,number_of_errors);
-    }
-    return number_of_errors;
-}
-
-
-#define TESTPARENT   \
-    {   \
-        ftp::FTPURL url(OUString::createFromAscii(ascii),&prov);  \
-        urlStr = url.parent();          \
-        if(!urlStr.equalsAscii(expect)) \
-            ++number_of_errors;  \
-    }
-
-
-int test_ftpparent(void) {
-    int number_of_errors = 0;
-    const char* name = "test_ftpparent";
-    FTPHandleProviderI prov;
-
-    OUString urlStr;
-    char *ascii,*expect;
-
-    ascii = "ftp://abi:psswd@abi-1/file";
-    expect = "ftp://abi:psswd@abi-1/";
-    TESTPARENT;
-
-    ascii = "ftp://abi:psswd@abi-1/dir/../file";
-    expect = "ftp://abi:psswd@abi-1/";
-    TESTPARENT;
-
-    ascii = "ftp://abi:psswd@abi-1/..";
-    expect = "ftp://abi:psswd@abi-1/../..";
-    TESTPARENT;
-
-    ascii = "ftp://abi:psswd@abi-1/../../dir";
-    expect = "ftp://abi:psswd@abi-1/../..";
-    TESTPARENT;
-
-    ascii = "ftp://abi:psswd@abi-1/";
-    expect = "ftp://abi:psswd@abi-1/..";
-    TESTPARENT;
-
-    if(number_of_errors)
-    {
-        fprintf(stderr,"errors in %s: %d\n",name,number_of_errors);
-    }
-    return number_of_errors;
-}
-
-
-int test_ftpproperties(void) {
-    int number_of_errors = 0;
-    FTPHandleProviderI provider;
-
-    ftp::FTPURL url(
-        OUString( "ftp://abi:psswd@abi-1/file"),
-        &provider);
-
-    ftp::FTPDirentry ade(url.direntry());
-
-    if(!(ade.m_aName == "file" && ade.isFile()))
-        ++number_of_errors;
-
-    if(number_of_errors)
-    {
-        const char* name = "test_ftpproperties";
-        fprintf(stderr,"errors in %s: %d\n",name,number_of_errors);
-    }
-    return number_of_errors;
-}
-
-
-int test_ftpopen(void)
-{
-    int number_of_errors = 0;
-
-    FTPHandleProviderI provider;
-    ftp::FTPURL url(
-        OUString( "ftp://abi:psswd@abi-1/file"),
-        &provider);
-
-    FILE* file = url.open();
-    if(file) {
-        int nbuf;
-        const int bffsz = 256;
-        char buff[bffsz];
-        char *dest = (char*) malloc(sizeof(char));
-        dest[0] = 0;
-        do {
-            memset((void*)buff, 0, bffsz);
-            fread(buff,bffsz-1,1,file);
-            nbuf = strlen(buff);
-            int ndest = strlen(dest);
-            dest = (char*)realloc(dest,ndest + nbuf + 1);
-            strncat(dest,buff,nbuf);
-        } while(nbuf == bffsz-1);
-        fclose(file);
-
-        const char* expected = "You are now looking at the filecontent.\n";
-        if(strcmp(expected,dest))
-            ++number_of_errors;
-        free(dest);
-    } else
-        ++number_of_errors;
-
-    if(number_of_errors)
-    {
-        const char* name = "test_ftpopen";
-        fprintf(stderr,"errors in %s: %d\n",name,number_of_errors);
-    }
-    return number_of_errors;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/ftp/test_ftpurl.hxx b/ucb/source/ucp/ftp/test_ftpurl.hxx
deleted file mode 100644
index de9f80d..0000000
--- a/ucb/source/ucp/ftp/test_ftpurl.hxx
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_UCB_SOURCE_UCP_FTP_TEST_FTPURL_HXX
-#define INCLUDED_UCB_SOURCE_UCP_FTP_TEST_FTPURL_HXX
-
-extern int test_ftpurl(void);
-extern int test_ftpproperties(void);
-extern int test_ftpopen(void);
-extern int test_ftplist(void);
-extern int test_ftpparent(void);
-
-#endif // INCLUDED_UCB_SOURCE_UCP_FTP_TEST_FTPURL_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/ftp/test_multiservicefac.cxx b/ucb/source/ucp/ftp/test_multiservicefac.cxx
deleted file mode 100644
index d7b42bd..0000000
--- a/ucb/source/ucp/ftp/test_multiservicefac.cxx
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-/**************************************************************************
-                                TODO
- **************************************************************************
-
- *************************************************************************/
-#include "test_multiservicefac.hxx"
-
-
-using namespace test_ftp;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-
-
-Any SAL_CALL
-Test_MultiServiceFactory::queryInterface(
-    const Type& rType
-)
-    throw(
-        RuntimeException
-    )
-{
-    Any aRet = ::cppu::queryInterface(rType, (static_cast< XMultiServiceFactory* >( this )) );
-
-    return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
-
-}
-
-
-void SAL_CALL Test_MultiServiceFactory::acquire( void ) throw()
-{
-    OWeakObject::acquire();
-}
-
-
-void SAL_CALL Test_MultiServiceFactory::release( void ) throw()
-{
-    OWeakObject::release();
-}
-
-        // XMultiServiceFactory
-
- Reference<
-XInterface > SAL_CALL
-Test_MultiServiceFactory::createInstance(
-    const OUString& aServiceSpecifier
-)
-    throw (
-        Exception,
-        RuntimeException
-    )
-{
-    return Reference<
-        XInterface >(0);
-}
-
-
-Reference<
-XInterface > SAL_CALL
-Test_MultiServiceFactory::createInstanceWithArguments(
-    const OUString& ServiceSpecifier,
-    const Sequence
-    < Any >& Arguments
-)
-    throw (
-        Exception,
-        RuntimeException
-    )
-{
-    return Reference<
-        XInterface >(0);
-}
-
-Sequence< OUString > SAL_CALL
-Test_MultiServiceFactory::getAvailableServiceNames(
-)
-    throw (
-        RuntimeException
-    )
-{
-    return Sequence< OUString >(0);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/ftp/test_multiservicefac.hxx b/ucb/source/ucp/ftp/test_multiservicefac.hxx
deleted file mode 100644
index 4bb98fe..0000000
--- a/ucb/source/ucp/ftp/test_multiservicefac.hxx
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-/**************************************************************************
-                                TODO
- **************************************************************************
-
- *************************************************************************/
-#ifndef INCLUDED_UCB_SOURCE_UCP_FTP_TEST_MULTISERVICEFAC_HXX
-#define INCLUDED_UCB_SOURCE_UCP_FTP_TEST_MULTISERVICEFAC_HXX
-
-#include <cppuhelper/weak.hxx>
-#include <cppuhelper/queryinterface.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-
-namespace test_ftp {
-
-    class Test_MultiServiceFactory
-        : public cppu::OWeakObject,
-          public com::sun::star::lang::XMultiServiceFactory
-    {
-    public:
-
-        // XInterface
-
-        virtual com::sun::star::uno::Any SAL_CALL
-        queryInterface( const com::sun::star::uno::Type& rType )
-            throw( com::sun::star::uno::RuntimeException );
-
-
-        virtual void SAL_CALL acquire( void ) throw();
-
-        virtual void SAL_CALL release( void ) throw();
-
-        // XMultiServiceFactory
-
-        virtual ::com::sun::star::uno::Reference<
-        ::com::sun::star::uno::XInterface > SAL_CALL
-        createInstance(
-            const OUString& aServiceSpecifier
-        )
-            throw (
-                ::com::sun::star::uno::Exception,
-                ::com::sun::star::uno::RuntimeException
-            );
-
-        virtual
-        ::com::sun::star::uno::Reference<
-        ::com::sun::star::uno::XInterface > SAL_CALL
-        createInstanceWithArguments(
-            const OUString& ServiceSpecifier,
-            const ::com::sun::star::uno::Sequence
-            < ::com::sun::star::uno::Any >& Arguments
-        )
-            throw (
-                ::com::sun::star::uno::Exception,
-                ::com::sun::star::uno::RuntimeException
-            );
-
-        virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
-        getAvailableServiceNames(
-        )
-            throw (
-                ::com::sun::star::uno::RuntimeException
-            );
-    };
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit b279f8a655bd2e0b82e3096e28efafa63c895ceb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 10 10:37:55 2015 +0000

    cppcheck: cstyleCast
    
    Change-Id: I0b5caeac629527112e3c7129b274b076da467d8d

diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx
index dbe9f0c2..8709afb 100644
--- a/xmloff/source/text/txtexppr.cxx
+++ b/xmloff/source/text/txtexppr.cxx
@@ -49,7 +49,7 @@ void XMLTextExportPropertySetMapper::handleElementItem(
         sal_uInt32 nIdx ) const
 {
     XMLTextExportPropertySetMapper *pThis =
-           ((XMLTextExportPropertySetMapper *)this);
+           const_cast<XMLTextExportPropertySetMapper*>(this);
 
     switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
     {
@@ -133,7 +133,7 @@ void XMLTextExportPropertySetMapper::handleSpecialItem(
         sal_uInt32 nIdx ) const
 {
     XMLTextExportPropertySetMapper *pThis =
-           ((XMLTextExportPropertySetMapper *)this);
+           const_cast<XMLTextExportPropertySetMapper*>(this);
 
     switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
     {
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 7be2493..f69baba 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -2660,7 +2660,7 @@ bool XMLTextImportHelper::IsInFrame() const
 
     // are we currently in a text frame? yes, if the cursor has a
     // TextFrame property and it's non-NULL
-    Reference<XPropertySet> xPropSet(((XMLTextImportHelper *)this)->GetCursor(), UNO_QUERY);
+    Reference<XPropertySet> xPropSet(const_cast<XMLTextImportHelper*>(this)->GetCursor(), UNO_QUERY);
     if (xPropSet.is())
     {
         if (xPropSet->getPropertySetInfo()->hasPropertyByName(s_TextFrame))
commit bf0c43f0d26be225ea630a8846e77ff39dfc6703
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 10 10:37:13 2015 +0000

    cppcheck: variableScope
    
    Change-Id: I8a2262e6e27f0ea5f43837d5a10cb23525fe6ca5

diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index ddd8a71..231e614 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -2829,12 +2829,14 @@ void XMLTextParagraphExport::exportAnyTextFrame(
 
             bool bIsUICharStyle;
             bool bHasAutoStyle = false;
-            bool bDummy;
 
             OUString sStyle;
 
             if( bAddCharStyles )
-                   sStyle = FindTextStyleAndHyperlink( *pRangePropSet, bDummy, bIsUICharStyle, bHasAutoStyle );
+            {
+                bool bDummy;
+                sStyle = FindTextStyleAndHyperlink( *pRangePropSet, bDummy, bIsUICharStyle, bHasAutoStyle );
+            }
             else
                 bIsUICharStyle = false;
 
commit 6e44e13a983f7328787dffe2d8529dd2681f5c43
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 10 10:27:25 2015 +0000

    cppcheck: variableScope
    
    Change-Id: Ibdea832c607494d5d6b36b3655a0af7de540d0c7

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index b59e9a0..8a14ed4 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -299,22 +299,17 @@ SECKEYPrivateKey* SecurityEnvironment_NssImpl :: getPriKey( unsigned int positio
 void SecurityEnvironment_NssImpl::updateSlots()
 {
     //In case new tokens are present then we can obtain the corresponding slot
-    PK11SlotList * soltList = NULL;
-    PK11SlotListElement * soltEle = NULL;
-    PK11SlotInfo * pSlot = NULL;
-       PK11SymKey * pSymKey = NULL;
-
     osl::MutexGuard guard(m_mutex);
 
     m_Slots.clear();
     m_tSymKeyList.clear();
 
-    soltList = PK11_GetAllTokens( CKM_INVALID_MECHANISM, PR_FALSE, PR_FALSE, NULL ) ;
+    PK11SlotList * soltList = PK11_GetAllTokens( CKM_INVALID_MECHANISM, PR_FALSE, PR_FALSE, NULL ) ;
     if( soltList != NULL )
     {
-        for( soltEle = soltList->head ; soltEle != NULL; soltEle = soltEle->next )
+        for (PK11SlotListElement* soltEle = soltList->head ; soltEle != NULL; soltEle = soltEle->next)
         {
-            pSlot = soltEle->slot ;
+            PK11SlotInfo * pSlot = soltEle->slot ;
 
             if(pSlot != NULL)
             {
@@ -333,7 +328,7 @@ void SecurityEnvironment_NssImpl::updateSlots()
 //              By doing this, the encryption may fail if a smart card is being used which does not
 //              support this key generation.
 //
-                pSymKey = PK11_KeyGen( pSlot , CKM_DES3_CBC, NULL, 128, NULL ) ;
+                PK11SymKey * pSymKey = PK11_KeyGen( pSlot , CKM_DES3_CBC, NULL, 128, NULL ) ;
 //              if( pSymKey == NULL )
 //              {
 //                  PK11_FreeSlot( pSlot ) ;
@@ -354,10 +349,8 @@ void SecurityEnvironment_NssImpl::updateSlots()
             }// end of if(pSlot != NULL)
         }// end of for
     }// end of if( soltList != NULL )
-
 }
 
-
 Sequence< Reference < XCertificate > >
 SecurityEnvironment_NssImpl::getPersonalCertificates() throw( SecurityException , RuntimeException, std::exception )
 {


More information about the Libreoffice-commits mailing list