[Libreoffice-commits] core.git: 2 commits - basic/qa cppu/source

Stephan Bergmann sbergman at redhat.com
Tue Mar 5 12:27:07 PST 2013


 basic/qa/cppunit/basic_coverage.cxx |   13 +++----------
 cppu/source/typelib/typelib.cxx     |    8 +++-----
 2 files changed, 6 insertions(+), 15 deletions(-)

New commits:
commit f4b218d16442f5daacf87b42e9cb1fb816bef4c0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Mar 5 21:20:25 2013 +0100

    *ppRet cannot become non-null there out of thin air
    
    Change-Id: Idd08a89dd0dcf05caeacc9e14a0a6ea10b433588

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 0c66661..445f824 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -23,6 +23,7 @@
 #endif
 
 #include <boost/unordered_map.hpp>
+#include <cassert>
 #include <list>
 #include <set>
 #include <vector>
@@ -250,6 +251,8 @@ inline void TypeDescriptor_Init_Impl::callChain(
     typelib_TypeDescription ** ppRet, rtl_uString * pName )
     SAL_THROW(())
 {
+    assert(ppRet != 0);
+    assert(*ppRet == 0);
     if (pCallbacks)
     {
         CallbackSet_Impl::const_iterator aIt = pCallbacks->begin();
@@ -262,11 +265,6 @@ inline void TypeDescriptor_Init_Impl::callChain(
             ++aIt;
         }
     }
-    if (*ppRet)
-    {
-        typelib_typedescription_release( *ppRet );
-        *ppRet = 0;
-    }
 }
 
 //__________________________________________________________________________________________________
commit ef8a6be49a7175bcfdb014dca9c3d6ec2961b4b9
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Mar 5 21:18:52 2013 +0100

    Do not CPPUNIT_FAIL (which throws exceptions) from a destructor
    
    ...this is a sure way to std::terminate
    
    Change-Id: I8753b1b1d6594829ea529462aa0369e4f2f623d4

diff --git a/basic/qa/cppunit/basic_coverage.cxx b/basic/qa/cppunit/basic_coverage.cxx
index d78a28f..fefdd4e 100644
--- a/basic/qa/cppunit/basic_coverage.cxx
+++ b/basic/qa/cppunit/basic_coverage.cxx
@@ -22,7 +22,6 @@ private:
     bool m_bError;
     int  m_nb_tests;
     int  m_nb_tests_ok;
-    int  m_nb_tests_ko;
     int  m_nb_tests_skipped;
     OUString m_sCurrentTest;
     void process_directory(OUString sDirName);
@@ -65,18 +64,13 @@ Coverage::Coverage()
     : m_bError(false)
     , m_nb_tests(0)
     , m_nb_tests_ok(0)
-    , m_nb_tests_ko(0)
     , m_nb_tests_skipped(0)
 {
 }
 
 Coverage::~Coverage()
 {
-    fprintf(stderr,"basic coverage Summary : skipped:%d pass:%d failed:%d\n", m_nb_tests_skipped, m_nb_tests_ok, m_nb_tests_ko );
-    if(m_nb_tests_ko)
-    {
-        CPPUNIT_FAIL("");
-    }
+    fprintf(stderr,"basic coverage Summary : skipped:%d pass:%d\n", m_nb_tests_skipped, m_nb_tests_ok );
 }
 
 void Coverage::test_start(OUString sFileName)
@@ -87,9 +81,8 @@ void Coverage::test_start(OUString sFileName)
 
 void Coverage::test_failed()
 {
-    m_nb_tests_ko += 1;
-    fprintf(stderr,"%s,FAIL\n", rtl::OUStringToOString( m_sCurrentTest, RTL_TEXTENCODING_UTF8 ).getStr() );
-
+    CPPUNIT_FAIL(
+        OUStringToOString(m_sCurrentTest, RTL_TEXTENCODING_UTF8).getStr());
 }
 
 void Coverage::test_success()


More information about the Libreoffice-commits mailing list