Kaydet (Commit) 06202a90 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1399266 Uncaught exception

Change-Id: I1066fda2258e6acbbbad23256f815975564e5e61
üst b13b78a9
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "o3tl/cow_wrapper.hxx" #include "o3tl/cow_wrapper.hxx"
#include "cppunit/extensions/HelperMacros.h" #include "cppunit/extensions/HelperMacros.h"
#include <assert.h>
/* Definition of Cow_Wrapper_Clients classes */ /* Definition of Cow_Wrapper_Clients classes */
...@@ -153,15 +154,12 @@ struct BogusRefCountPolicy ...@@ -153,15 +154,12 @@ struct BogusRefCountPolicy
static sal_uInt32 s_nEndOfScope; static sal_uInt32 s_nEndOfScope;
typedef sal_uInt32 ref_count_t; typedef sal_uInt32 ref_count_t;
static void incrementCount( ref_count_t& rCount ) { static void incrementCount( ref_count_t& rCount ) {
if(s_bShouldIncrement) assert(s_bShouldIncrement && "Ref-counting policy incremented when it should not have.");
{ ++rCount;
++rCount; s_bShouldIncrement = false;
s_bShouldIncrement = false;
}
else
CPPUNIT_FAIL("Ref-counting policy incremented when it should not have.");
} }
static bool decrementCount( ref_count_t& rCount ) { static bool decrementCount( ref_count_t& rCount ) {
assert((s_nEndOfScope || s_bShouldDecrement) && "Ref-counting policy decremented when it should not have.");
if(s_nEndOfScope) if(s_nEndOfScope)
{ {
--rCount; --rCount;
...@@ -172,8 +170,6 @@ struct BogusRefCountPolicy ...@@ -172,8 +170,6 @@ struct BogusRefCountPolicy
--rCount; --rCount;
s_bShouldDecrement = false; s_bShouldDecrement = false;
} }
else
CPPUNIT_FAIL("Ref-counting policy decremented when it should not have.");
return rCount != 0; return rCount != 0;
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment