[Libreoffice-commits] core.git: connectivity/source include/tools

Noel Grandin noel.grandin at collabora.co.uk
Sat Apr 22 20:05:38 UTC 2017


 connectivity/source/drivers/dbase/dindexnode.cxx |    4 ++--
 connectivity/source/inc/dbase/dindexnode.hxx     |    5 +++--
 include/tools/ref.hxx                            |   11 ++++++-----
 3 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit 4d12bbef79b26d2c371d3b968690b46717c31045
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Apr 21 16:35:19 2017 +0200

    revert bits of "remove some old MSVC workarounds"
    
    in commit 841e1a6f3619054ecc9240e061cd83d4e41d1ca9, since MSVC 2015
    still does not pack heterogenous bitfields tightly
    
    Change-Id: I251c797492762cbd2381496b2f2c6c3223d563c6
    Reviewed-on: https://gerrit.libreoffice.org/36800
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx
index 81451234052d..0130de2905d0 100644
--- a/connectivity/source/drivers/dbase/dindexnode.cxx
+++ b/connectivity/source/drivers/dbase/dindexnode.cxx
@@ -66,7 +66,7 @@ ONDXKey::ONDXKey(double aVal, sal_uInt32 nRec)
 // index page
 ONDXPage::ONDXPage(ODbaseIndex& rInd, sal_uInt32 nPos, ONDXPage* pParent)
     : nRefCount(0)
-    , bNoDelete(true)
+    , bNoDelete(1)
     , nPagePos(nPos)
     , bModified(false)
     , nCount(0)
@@ -110,7 +110,7 @@ void ONDXPage::QueryDelete()
 
             ppNodes[i] = ONDXNode();
         }
-        bNoDelete = true;
+        bNoDelete = 1;
 
         nCount = 0;
         aParent.Clear();
diff --git a/connectivity/source/inc/dbase/dindexnode.hxx b/connectivity/source/inc/dbase/dindexnode.hxx
index d1a7c24e3255..00c359cbfad6 100644
--- a/connectivity/source/inc/dbase/dindexnode.hxx
+++ b/connectivity/source/inc/dbase/dindexnode.hxx
@@ -120,7 +120,8 @@ namespace connectivity
             // work around a clang 3.5 optimization bug: if the bNoDelete is *first*
             // it mis-compiles "if (--nRefCount == 0)" and never deletes any object
             unsigned int    nRefCount : 31;
-            bool            bNoDelete : 1;
+            // the only reason this is not bool is because MSVC cannot handle mixed type bitfields
+            unsigned int    bNoDelete : 1;
             sal_uInt32      nPagePos;       // Position in the index file
             bool            bModified : 1;
             sal_uInt16      nCount;
@@ -189,7 +190,7 @@ namespace connectivity
                     {
                         assert( nRefCount < (1 << 30) && "Do not add refs to dead objects" );
                         if( bNoDelete )
-                            bNoDelete = false;
+                            bNoDelete = 0;
                         ++nRefCount;
                     }
 
diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx
index 5116c73bd5b5..bb32d486339e 100644
--- a/include/tools/ref.hxx
+++ b/include/tools/ref.hxx
@@ -122,21 +122,22 @@ class TOOLS_DLLPUBLIC SvRefBase
     // work around a clang 3.5 optimization bug: if the bNoDelete is *first*
     // it mis-compiles "if (--nRefCount == 0)" and never deletes any object
     unsigned int nRefCount : 31;
-    bool bNoDelete : 1;
+    // the only reason this is not bool is because MSVC cannot handle mixed type bitfields
+    unsigned int bNoDelete : 1;
 
 protected:
     virtual         ~SvRefBase();
 
 public:
-                    SvRefBase() : nRefCount(0), bNoDelete(true) {}
+                    SvRefBase() : nRefCount(0), bNoDelete(1) {}
 
-                    SvRefBase(const SvRefBase &) : nRefCount(0), bNoDelete(true) {}
+                    SvRefBase(const SvRefBase &) : nRefCount(0), bNoDelete(1) {}
 
     SvRefBase &     operator = ( const SvRefBase & )
                     { return *this; }
 
     void            RestoreNoDelete()
-                    { bNoDelete = true; }
+                    { bNoDelete = 1; }
 
     void            AddNextRef()
                     {
@@ -148,7 +149,7 @@ public:
                     {
                         assert( nRefCount < (1 << 30) && "Do not add refs to dead objects" );
                         if( bNoDelete )
-                            bNoDelete = false;
+                            bNoDelete = 0;
                         ++nRefCount;
                     }
 


More information about the Libreoffice-commits mailing list