[Libreoffice-commits] core.git: cui/source include/sfx2

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 1 12:06:14 UTC 2020


 cui/source/dialogs/linkdlg.cxx |    6 +++---
 include/sfx2/lnkbase.hxx       |    3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit b57d04083a807c96e03d75655c206d4f2c415104
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Apr 1 13:05:01 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Apr 1 14:05:37 2020 +0200

    fix ubsan after 7d6c67d323a87f1006d84c2a95b45dfbfb03c0c8
    
    ubsan exposed some bugs in
        commit 7d6c67d323a87f1006d84c2a95b45dfbfb03c0c8
        Date:   Mon Mar 30 15:11:55 2020 +0200
        convert enum to scoped in SvBaseLink
    where I had converted the bit operations incorrectly
    
    Change-Id: I85bc0f0d69c34d9d714f983f82d4d26dd967f892
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91484
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index 6a830e5580c1..bd6225ac89a1 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -184,7 +184,7 @@ void SvBaseLinksDlg::LinksSelectHdl(weld::TreeView* pSvTabListBox)
         OUString sType, sLink;
         OUString *pLinkNm = &sLink, *pFilter = nullptr;
 
-        if( isClientType(pLink->GetObjType()) )
+        if( isClientFileType(pLink->GetObjType()) )
         {
             m_xRbAutomatic->set_sensitive(false);
             m_xRbManual->set_active(true);
@@ -226,7 +226,7 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, AutomaticClickHdl, weld::Button&, void )
 {
     int nPos;
     SvBaseLink* pLink = GetSelEntry( &nPos );
-    if( pLink && !isClientType( pLink->GetObjType() ) &&
+    if( pLink && !isClientFileType( pLink->GetObjType() ) &&
         SfxLinkUpdateMode::ALWAYS != pLink->GetUpdateMode() )
         SetType( *pLink, nPos, SfxLinkUpdateMode::ALWAYS );
 }
@@ -235,7 +235,7 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, ManualClickHdl, weld::Button&, void )
 {
     int nPos;
     SvBaseLink* pLink = GetSelEntry( &nPos );
-    if( pLink && !isClientType( pLink->GetObjType() ) &&
+    if( pLink && !isClientFileType( pLink->GetObjType() ) &&
         SfxLinkUpdateMode::ONCALL != pLink->GetUpdateMode())
         SetType( *pLink, nPos, SfxLinkUpdateMode::ONCALL );
 }
diff --git a/include/sfx2/lnkbase.hxx b/include/sfx2/lnkbase.hxx
index c3b981afebfe..ca29ebe3547e 100644
--- a/include/sfx2/lnkbase.hxx
+++ b/include/sfx2/lnkbase.hxx
@@ -65,7 +65,8 @@ constexpr bool isClientType(SvBaseLinkObjectType t)
 }
 constexpr bool isClientFileType(SvBaseLinkObjectType t)
 {
-    return static_cast<int>(t) & static_cast<int>(SvBaseLinkObjectType::ClientFile);
+    auto check = static_cast<int>(SvBaseLinkObjectType::ClientFile);
+    return (static_cast<int>(t) & check) == check;
 }
 
 struct BaseLink_Impl;


More information about the Libreoffice-commits mailing list