[Libreoffice-commits] core.git: sw/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Sat Oct 19 09:22:25 UTC 2019


 sw/source/core/inc/fntcache.hxx     |    5 ++++-
 sw/source/core/txtnode/fntcache.cxx |    7 ++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 82f2b7fd80353758f35dee9d6e7e80a5e77eb526
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Oct 18 22:28:11 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Sat Oct 19 11:21:47 2019 +0200

    Avoid -fsanitize=nullptr-with-nonzero-offset
    
    (new with recent Clang 10 trunk)
    
    Change-Id: Ifeac10c2aecb6da4f1c87e565bb26dfccc11432a
    Reviewed-on: https://gerrit.libreoffice.org/81112
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx
index f46acd966a75..456c235d5ff7 100644
--- a/sw/source/core/inc/fntcache.hxx
+++ b/sw/source/core/inc/fntcache.hxx
@@ -20,6 +20,9 @@
 #ifndef INCLUDED_SW_SOURCE_CORE_INC_FNTCACHE_HXX
 #define INCLUDED_SW_SOURCE_CORE_INC_FNTCACHE_HXX
 
+#include <sal/config.h>
+
+#include <cstdint>
 #include <map>
 
 #include <vcl/font.hxx>
@@ -99,7 +102,7 @@ class SwFntObj : public SwCacheObj
     static MapMode *pPixMap;
 
 public:
-    SwFntObj( const SwSubFont &rFont, const void* nFontCacheId,
+    SwFntObj( const SwSubFont &rFont, std::uintptr_t nFontCacheId,
               SwViewShell const *pSh );
 
     virtual ~SwFntObj() override;
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 1809f631c380..6fa6b159705a 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -20,6 +20,7 @@
 #include <memory>
 #include <sal/config.h>
 
+#include <cstdint>
 #include <cstdlib>
 
 #include <i18nlangtag/mslangid.hxx>
@@ -171,8 +172,8 @@ void SwFntCache::Flush( )
     SwCache::Flush( );
 }
 
-SwFntObj::SwFntObj(const SwSubFont &rFont, const void* nFontCacheId, SwViewShell const *pSh)
-    : SwCacheObj(nFontCacheId)
+SwFntObj::SwFntObj(const SwSubFont &rFont, std::uintptr_t nFontCacheId, SwViewShell const *pSh)
+    : SwCacheObj(reinterpret_cast<void *>(nFontCacheId))
     , m_aFont(rFont)
     , m_pScrFont(nullptr)
     , m_pPrtFont(&m_aFont)
@@ -2373,7 +2374,7 @@ SwFntAccess::SwFntAccess( const void* & rnFontCacheId,
 SwCacheObj *SwFntAccess::NewObj( )
 {
     // "MagicNumber" used to identify Fonts
-    static sal_uInt8* fontCacheIdCounter = nullptr;
+    static std::uintptr_t fontCacheIdCounter = 0;
     // a new Font, a new "MagicNumber".
     return new SwFntObj( *static_cast<SwSubFont const *>(m_pOwner), ++fontCacheIdCounter, m_pShell );
 }


More information about the Libreoffice-commits mailing list