[Libreoffice-commits] core.git: o3tl/qa

Stephan Bergmann sbergman at redhat.com
Sun Aug 30 13:40:42 PDT 2015


 o3tl/qa/cow_wrapper_clients.cxx |    4 ++--
 o3tl/qa/cow_wrapper_clients.hxx |    4 ++--
 o3tl/qa/test-cow_wrapper.cxx    |   26 +++++++++++++-------------
 3 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit c952516a2821dd7077691e88ebcb7cba36aae97a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Aug 30 22:40:08 2015 +0200

    loplugin:implicitboolconversion
    
    Change-Id: Id4561abb96ee8244d4c0b0c9dfce0e2cab1d8b85

diff --git a/o3tl/qa/cow_wrapper_clients.cxx b/o3tl/qa/cow_wrapper_clients.cxx
index 3cea257..82c73f1 100644
--- a/o3tl/qa/cow_wrapper_clients.cxx
+++ b/o3tl/qa/cow_wrapper_clients.cxx
@@ -219,8 +219,8 @@ bool cow_wrapper_client4::operator<( const cow_wrapper_client4& rRHS ) const
     return maImpl < rRHS.maImpl;
 }
 
-bool BogusRefCountPolicy::s_bShouldIncrement = 0;
-bool BogusRefCountPolicy::s_bShouldDecrement = 0;
+bool BogusRefCountPolicy::s_bShouldIncrement = false;
+bool BogusRefCountPolicy::s_bShouldDecrement = false;
 sal_uInt32 BogusRefCountPolicy::s_nEndOfScope = 0;
 
 cow_wrapper_client5::cow_wrapper_client5() :
diff --git a/o3tl/qa/cow_wrapper_clients.hxx b/o3tl/qa/cow_wrapper_clients.hxx
index f438c06..8ca04f8 100644
--- a/o3tl/qa/cow_wrapper_clients.hxx
+++ b/o3tl/qa/cow_wrapper_clients.hxx
@@ -152,7 +152,7 @@ struct BogusRefCountPolicy
         if(s_bShouldIncrement)
         {
             ++rCount;
-            s_bShouldIncrement = 0;
+            s_bShouldIncrement = false;
         }
         else
             CPPUNIT_FAIL("Ref-counting policy incremented when it should not have.");
@@ -167,7 +167,7 @@ struct BogusRefCountPolicy
         if(s_bShouldDecrement)
         {
             --rCount;
-            s_bShouldDecrement = 0;
+            s_bShouldDecrement = false;
         }
         else
             CPPUNIT_FAIL("Ref-counting policy decremented when it should not have.");
diff --git a/o3tl/qa/test-cow_wrapper.cxx b/o3tl/qa/test-cow_wrapper.cxx
index 7100355..7c61da6 100644
--- a/o3tl/qa/test-cow_wrapper.cxx
+++ b/o3tl/qa/test-cow_wrapper.cxx
@@ -174,23 +174,23 @@ public:
                                    aTestObj2.use_count() == 1 );
 
             // the following should increment
-            BogusRefCountPolicy::s_bShouldIncrement = 1;
+            BogusRefCountPolicy::s_bShouldIncrement = true;
             cow_wrapper_client5 aTestObj3( aTestObj2 );
             CPPUNIT_ASSERT_MESSAGE("s_bShouldIncrement == 0",
-                                   BogusRefCountPolicy::s_bShouldIncrement == 0 );
+                                   !BogusRefCountPolicy::s_bShouldIncrement );
 
             CPPUNIT_ASSERT_MESSAGE("aTestObj3.use_count() == 2",
                                    aTestObj3.use_count() == 2 );
             {
                 cow_wrapper_client5 aTestObj4;
                 // the following should decrement the lvalue and then increment the rvalue
-                BogusRefCountPolicy::s_bShouldIncrement = 1;
-                BogusRefCountPolicy::s_bShouldDecrement = 1;
+                BogusRefCountPolicy::s_bShouldIncrement = true;
+                BogusRefCountPolicy::s_bShouldDecrement = true;
                 aTestObj4 = aTestObj2;
                 CPPUNIT_ASSERT_MESSAGE("s_bShouldIncrement == 0",
-                                       BogusRefCountPolicy::s_bShouldIncrement == 0 );
+                                       !BogusRefCountPolicy::s_bShouldIncrement );
                 CPPUNIT_ASSERT_MESSAGE("s_bShouldDecrement == 0",
-                                       BogusRefCountPolicy::s_bShouldDecrement == 0 );
+                                       !BogusRefCountPolicy::s_bShouldDecrement );
 
                 CPPUNIT_ASSERT_MESSAGE("aTestObj2.use_count() == 3",
                                        aTestObj2.use_count() == 3 );
@@ -206,21 +206,21 @@ public:
                                        aTestObj2 == aTestObj4 );
 
                 // only decrement the lvalue before assignment
-                BogusRefCountPolicy::s_bShouldDecrement = 1;
+                BogusRefCountPolicy::s_bShouldDecrement = true;
                 aTestObj4 = cow_wrapper_client5( 4 );
                 CPPUNIT_ASSERT_MESSAGE("s_bShouldIncrement == 0",
-                                       BogusRefCountPolicy::s_bShouldIncrement == 0 );
+                                       !BogusRefCountPolicy::s_bShouldIncrement );
 
                 // only one call should be made to the ref counting policy's
                 // decrementing function at the end of the scope
-                BogusRefCountPolicy::s_bShouldDecrement = 1;
+                BogusRefCountPolicy::s_bShouldDecrement = true;
             }
             CPPUNIT_ASSERT_MESSAGE("s_bShouldDecrement == 0",
-                                   BogusRefCountPolicy::s_bShouldDecrement == 0 );
+                                   !BogusRefCountPolicy::s_bShouldDecrement );
 
             // self assignment
             // aTestObj2 is defunct afterwards, one decrement happens
-            BogusRefCountPolicy::s_bShouldDecrement = 1;
+            BogusRefCountPolicy::s_bShouldDecrement = true;
             aTestObj3 = std::move( aTestObj2 );
             CPPUNIT_ASSERT_MESSAGE("aTestObj2.use_count() == 0",
                                    aTestObj2.use_count() == 0 );
@@ -230,10 +230,10 @@ public:
             cow_wrapper_client5 aTestObj5;
 
             // only decrement the lvalue before assignment
-            BogusRefCountPolicy::s_bShouldDecrement = 1;
+            BogusRefCountPolicy::s_bShouldDecrement = true;
             aTestObj3 = std::move( aTestObj5 );
             CPPUNIT_ASSERT_MESSAGE("s_bShouldDecrement == 0",
-                                   BogusRefCountPolicy::s_bShouldDecrement == 0);
+                                   !BogusRefCountPolicy::s_bShouldDecrement);
 
             // one call should be made to the ref-counting policy's
             // decrementing function at the end of the scope. Only


More information about the Libreoffice-commits mailing list