[Libreoffice-commits] core.git: 2 commits - cui/source embedserv/source vcl/source winaccessibility/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 1 16:57:13 UTC 2019


 cui/source/customize/SvxNotebookbarConfigPage.cxx             |   12 ++++----
 embedserv/source/embed/docholder.cxx                          |   15 ++--------
 vcl/source/window/NotebookBarAddonsMerger.cxx                 |    8 ++++-
 winaccessibility/source/service/AccContainerEventListener.cxx |    8 ++---
 winaccessibility/source/service/AccObject.cxx                 |    2 -
 winaccessibility/source/service/AccObjectWinManager.cxx       |    8 ++---
 winaccessibility/source/service/AccTopWindowListener.cxx      |    6 ++--
 7 files changed, 29 insertions(+), 30 deletions(-)

New commits:
commit 6115082b5ff93db323246e535baaeef405978aca
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Oct 1 10:41:53 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Oct 1 18:56:15 2019 +0200

    loplugin:loopvartoosmall (clang-cl)
    
    Change-Id: I682fccecd94d1d1524fcb12e93f5d53b0c94ea03
    Reviewed-on: https://gerrit.libreoffice.org/79935
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/cui/source/customize/SvxNotebookbarConfigPage.cxx b/cui/source/customize/SvxNotebookbarConfigPage.cxx
index a8dcfb6e334b..4ab507ed4824 100644
--- a/cui/source/customize/SvxNotebookbarConfigPage.cxx
+++ b/cui/source/customize/SvxNotebookbarConfigPage.cxx
@@ -25,6 +25,8 @@
 #include <vcl/svapp.hxx>
 
 #include <algorithm>
+#include <cstddef>
+
 #include <helpids.h>
 #include <strings.hrc>
 
@@ -64,7 +66,7 @@ static bool isCategoryAvailable(const OUString& sClassId, const OUString& sUIIte
 static OUString charToString(const char* cString)
 {
     OUStringBuffer aString;
-    for (unsigned long i = 0; i < strlen(cString); i++)
+    for (std::size_t i = 0; i < strlen(cString); i++)
     {
         aString.append(cString[i]);
     }
@@ -458,7 +460,7 @@ void SvxNotebookbarConfigPage::SelectElement()
 
     if (m_xTopLevelListBox->get_count() == 1)
     {
-        for (unsigned long nIdx = 0; nIdx < aCategoryList.size(); nIdx++)
+        for (std::size_t nIdx = 0; nIdx < aCategoryList.size(); nIdx++)
             m_xTopLevelListBox->append(aCategoryList[nIdx].sUIItemId,
                                        aCategoryList[nIdx].sDisplayName);
     }
@@ -468,7 +470,7 @@ void SvxNotebookbarConfigPage::SelectElement()
         nStart = 1;
 
     std::vector<NotebookbarEntries> aTempEntries;
-    for (unsigned long nIdx = nStart; nIdx < aEntries.size(); nIdx++)
+    for (std::size_t nIdx = nStart; nIdx < aEntries.size(); nIdx++)
     {
         if (aEntries[nIdx].sClassId == "svtlo-ManagedMenuButton")
         {
@@ -477,7 +479,7 @@ void SvxNotebookbarConfigPage::SelectElement()
             sal_Int32 rPos = 1;
             sActiveCategory = aEntries[nIdx].sUIItemId.getToken(rPos, ':', rPos);
             FillFunctionsList(aGtkEntries, aCategoryList, sActiveCategory);
-            for (unsigned long Idx = 0; Idx < aGtkEntries.size(); Idx++)
+            for (std::size_t Idx = 0; Idx < aGtkEntries.size(); Idx++)
                 aTempEntries.push_back(aGtkEntries[Idx]);
             aGtkEntries.clear();
         }
@@ -489,7 +491,7 @@ void SvxNotebookbarConfigPage::SelectElement()
     aTempEntries.clear();
 
     sal_Int64 nId = 0;
-    for (unsigned long nIdx = 0; nIdx < aEntries.size(); nIdx++)
+    for (std::size_t nIdx = 0; nIdx < aEntries.size(); nIdx++)
     {
         OUString sId(OUString::number(nId));
         m_xContentsListBox->insert(nIdx, sId);
diff --git a/vcl/source/window/NotebookBarAddonsMerger.cxx b/vcl/source/window/NotebookBarAddonsMerger.cxx
index 01c8bbd0977e..1bd4547e5987 100644
--- a/vcl/source/window/NotebookBarAddonsMerger.cxx
+++ b/vcl/source/window/NotebookBarAddonsMerger.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <cstddef>
+
 #include <vcl/NotebookBarAddonsMerger.hxx>
 #include <vcl/commandinfoprovider.hxx>
 #include <vcl/vclenum.hxx>
@@ -118,7 +122,7 @@ void NotebookBarAddonsMerger::MergeNotebookBarAddons(
     unsigned long nIter = 0;
     sal_uInt16 nPriorityIdx = aImageVec.size();
     css::uno::Sequence<css::uno::Sequence<css::beans::PropertyValue>> aExtension;
-    for (unsigned long nIdx = 0; nIdx < aNotebookBarAddonsItem.aAddonValues.size(); nIdx++)
+    for (std::size_t nIdx = 0; nIdx < aNotebookBarAddonsItem.aAddonValues.size(); nIdx++)
     {
         aExtension = aNotebookBarAddonsItem.aAddonValues[nIdx];
 
@@ -154,7 +158,7 @@ void NotebookBarAddonsMerger::MergeNotebookBarMenuAddons(
     std::vector<Image> aImageVec = aNotebookBarAddonsItem.aImageValues;
     unsigned long nIter = 0;
     css::uno::Sequence<css::uno::Sequence<css::beans::PropertyValue>> aExtension;
-    for (unsigned long nIdx = 0; nIdx < aNotebookBarAddonsItem.aAddonValues.size(); nIdx++)
+    for (std::size_t nIdx = 0; nIdx < aNotebookBarAddonsItem.aAddonValues.size(); nIdx++)
     {
         aExtension = aNotebookBarAddonsItem.aAddonValues[nIdx];
 
commit a2ab2b31b8b8f1fd17d7d6c8f68e5adc1e8d381d
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Oct 1 10:40:07 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Oct 1 18:56:06 2019 +0200

    loplugin:referencecasting (clang-cl)
    
    Change-Id: Ie534212b09b92a02b377d0bb348e11c96bf61786
    Reviewed-on: https://gerrit.libreoffice.org/79934
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx
index b1164869f91b..1f1f619cd302 100644
--- a/embedserv/source/embed/docholder.cxx
+++ b/embedserv/source/embed/docholder.cxx
@@ -679,11 +679,8 @@ void DocumentHolder::CloseFrame()
         }
         catch( const uno::Exception& ) {
         }
-    else {
-        uno::Reference<lang::XComponent> xComp(m_xFrame, uno::UNO_QUERY);
-        if (xComp.is())
-            xComp->dispose();
-    }
+    else if (m_xFrame.is())
+        m_xFrame->dispose();
 
     m_xFrame.clear();
 }
@@ -758,13 +755,10 @@ uno::Reference< frame::XFrame2 > DocumentHolder::DocumentFrame()
     {
         uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory));
 
-        uno::Reference<frame::XFrame> xFrame(xDesktop,uno::UNO_QUERY);
-
         // the frame will be registered on desktop here, later when the document
         // is loaded into the frame in ::show() method the terminate listener will be removed
         // this is so only for outplace activation
-        if( xFrame.is() )
-            m_xFrame.set( xFrame->findFrame( "_blank", 0 ), uno::UNO_QUERY );
+        m_xFrame.set( xDesktop->findFrame( "_blank", 0 ), uno::UNO_QUERY );
 
         uno::Reference< util::XCloseBroadcaster > xBroadcaster(
             m_xFrame, uno::UNO_QUERY );
@@ -871,8 +865,7 @@ void DocumentHolder::resizeWin( const SIZEL& rNewSize )
 
     if ( m_xFrame.is() && aDocLock.GetEmbedDocument() )
     {
-        uno::Reference< awt::XWindow > xWindow(
-            m_xFrame->getContainerWindow(), uno::UNO_QUERY );
+        uno::Reference< awt::XWindow > xWindow = m_xFrame->getContainerWindow();
         uno::Reference< awt::XView > xView( xWindow, uno::UNO_QUERY );
 
         if ( xWindow.is() && xView.is() )
diff --git a/winaccessibility/source/service/AccContainerEventListener.cxx b/winaccessibility/source/service/AccContainerEventListener.cxx
index 8ae4653beb88..36f5e12b80fa 100644
--- a/winaccessibility/source/service/AccContainerEventListener.cxx
+++ b/winaccessibility/source/service/AccContainerEventListener.cxx
@@ -369,13 +369,13 @@ void AccContainerEventListener::FireStateFocusedChange(bool enable)
             //for editable combobox, send focus event on only edit control,
             bool bSendFocusOnCombobox = true;
             //send focused event to the first text child
-            Reference<XAccessibleContext> mxContext(m_xAccessible.get()->getAccessibleContext(), UNO_QUERY);
+            Reference<XAccessibleContext> mxContext = m_xAccessible.get()->getAccessibleContext();
             if(mxContext.is())
             {
                 Reference<XAccessible> mxChild = mxContext->getAccessibleChild(0);
                 if(mxChild.is())
                 {
-                    Reference<XAccessibleContext> mxChildContext(mxChild->getAccessibleContext(),UNO_QUERY);
+                    Reference<XAccessibleContext> mxChildContext = mxChild->getAccessibleContext();
                     short childrole = mxChildContext->getAccessibleRole();
                     if (childrole == AccessibleRole::TEXT)
                     {
@@ -483,7 +483,7 @@ void AccContainerEventListener::HandleSelectionChangedWithinEvent(const Any& /*o
 
 void AccContainerEventListener::UpdateAllChildrenState(XAccessible* pXAccessible)
 {
-    Reference<css::accessibility::XAccessibleContext> xContext(pXAccessible->getAccessibleContext(),UNO_QUERY);
+    Reference<css::accessibility::XAccessibleContext> xContext = pXAccessible->getAccessibleContext();
     if(!xContext.is())
     {
         return;
@@ -539,7 +539,7 @@ void  AccContainerEventListener::HandleNameChangedEvent( Any name )
             Reference<XAccessible> mxChild = mxContext->getAccessibleChild(0);
             if(mxChild.is())
             {
-                Reference<XAccessibleContext> mxChildContext(mxChild->getAccessibleContext(),UNO_QUERY);
+                Reference<XAccessibleContext> mxChildContext = mxChild->getAccessibleContext();
                 short childrole = mxChildContext->getAccessibleRole();
                 if (childrole == AccessibleRole::TEXT)
                 {
diff --git a/winaccessibility/source/service/AccObject.cxx b/winaccessibility/source/service/AccObject.cxx
index c909b5919836..bf71d8617596 100644
--- a/winaccessibility/source/service/AccObject.cxx
+++ b/winaccessibility/source/service/AccObject.cxx
@@ -336,7 +336,7 @@ void AccObject::UpdateValue()
         return ;
     }
 
-    Reference< XAccessibleValue > pRValue(m_xAccContextRef.get(),UNO_QUERY);
+    Reference< XAccessibleValue > pRValue(m_xAccContextRef,UNO_QUERY);
     Any pAny;
     if( pRValue.is() )
     {
diff --git a/winaccessibility/source/service/AccObjectWinManager.cxx b/winaccessibility/source/service/AccObjectWinManager.cxx
index 5ce418f4b68a..b56db56d4bab 100644
--- a/winaccessibility/source/service/AccObjectWinManager.cxx
+++ b/winaccessibility/source/service/AccObjectWinManager.cxx
@@ -763,7 +763,7 @@ void AccObjectWinManager::SaveTopWindowHandle(HWND hWnd, css::accessibility::XAc
 AccObjectWinManager::CreateAccEventListener(XAccessible* pXAcc)
 {
     ::rtl::Reference<AccEventListener> pRet;
-    Reference<XAccessibleContext> xContext(pXAcc->getAccessibleContext(),UNO_QUERY);
+    Reference<XAccessibleContext> xContext = pXAcc->getAccessibleContext();
     if(xContext.is())
     {
         switch( xContext->getAccessibleRole() )
@@ -1020,7 +1020,7 @@ bool AccObjectWinManager::IsContainer(XAccessible* pAccessible)
     {
         if(pAccessible)
         {
-            Reference<XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+            Reference<XAccessibleContext> xContext = pAccessible->getAccessibleContext();
             if(xContext.is())
             {
                 switch( xContext->getAccessibleRole() )
@@ -1090,7 +1090,7 @@ bool AccObjectWinManager::IsStateManageDescendant(XAccessible* pAccessible)
 {
     if(pAccessible)
     {
-        Reference<XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+        Reference<XAccessibleContext> xContext = pAccessible->getAccessibleContext();
         if(xContext.is())
         {
             Reference< XAccessibleStateSet > pRState = xContext->getAccessibleStateSet();
@@ -1204,7 +1204,7 @@ bool AccObjectWinManager::IsSpecialToolboItem(css::accessibility::XAccessible* p
 short AccObjectWinManager::GetRole(css::accessibility::XAccessible* pXAcc)
 {
     assert(pXAcc != nullptr);
-    Reference<css::accessibility::XAccessibleContext> xContext(pXAcc->getAccessibleContext(),UNO_QUERY);
+    Reference<css::accessibility::XAccessibleContext> xContext = pXAcc->getAccessibleContext();
     if(xContext.is())
     {
         return xContext->getAccessibleRole();
diff --git a/winaccessibility/source/service/AccTopWindowListener.cxx b/winaccessibility/source/service/AccTopWindowListener.cxx
index e697fe368c08..9a3071086324 100644
--- a/winaccessibility/source/service/AccTopWindowListener.cxx
+++ b/winaccessibility/source/service/AccTopWindowListener.cxx
@@ -65,7 +65,7 @@ void AccTopWindowListener::HandleWindowOpened( css::accessibility::XAccessible*
     {
         systemdata = nullptr;
     }
-    Reference<css::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+    Reference<css::accessibility::XAccessibleContext> xContext = pAccessible->getAccessibleContext();
     if(!xContext.is())
         return;
 
@@ -136,7 +136,7 @@ void AccTopWindowListener::windowOpened( const css::lang::EventObject& e )
  */
 void AccTopWindowListener::AddAllListeners(css::accessibility::XAccessible* pAccessible, css::accessibility::XAccessible* pParentXAcc, HWND pWND)
 {
-    Reference<css::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+    Reference<css::accessibility::XAccessibleContext> xContext = pAccessible->getAccessibleContext();
     if(!xContext.is())
     {
         return;
@@ -209,7 +209,7 @@ void AccTopWindowListener::windowClosed( const css::lang::EventObject& e )
     if ( pAccessible == nullptr)
         return;
 
-    Reference<css::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+    Reference<css::accessibility::XAccessibleContext> xContext = pAccessible->getAccessibleContext();
     if(!xContext.is())
     {
         return;


More information about the Libreoffice-commits mailing list