[Libreoffice-commits] .: 7 commits - sal/cppunittester solenv/inc sot/source svx/inc svx/source test/inc test/source unusedcode.easy

Caolán McNamara caolan at kemper.freedesktop.org
Sat Oct 1 07:35:49 PDT 2011


 sal/cppunittester/cppunittester.cxx          |    6 ++++--
 solenv/inc/settings.mk                       |    2 +-
 sot/source/sdstor/stgelem.cxx                |   14 ++++++++++----
 sot/source/sdstor/stgelem.hxx                |    3 ++-
 svx/inc/svx/svdmodel.hxx                     |    5 -----
 svx/inc/svx/svdotext.hxx                     |    5 -----
 svx/source/accessibility/lookupcolorname.cxx |    2 +-
 svx/source/svdraw/svdmodel.cxx               |    8 --------
 svx/source/svdraw/svdotext.cxx               |    7 -------
 test/inc/test/filters-test.hxx               |    3 +--
 test/source/filters-test.cxx                 |    9 +++------
 unusedcode.easy                              |   10 ----------
 12 files changed, 22 insertions(+), 52 deletions(-)

New commits:
commit 3954b6603354bcd4f3f15ba7feb18e1b7801558b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 1 15:34:52 2011 +0100

    spit out timing info

diff --git a/test/inc/test/filters-test.hxx b/test/inc/test/filters-test.hxx
index 6c82944..ab83c55 100644
--- a/test/inc/test/filters-test.hxx
+++ b/test/inc/test/filters-test.hxx
@@ -42,8 +42,7 @@ enum filterStatus
 
 /*
  * NOTE, any files beginning with CVE- will be assumed to be encrypted using
- * arcfour with key 0x435645, this is just to silence panicky
- * virus/malware-checkers
+ * arcfour with key 0x435645, this is to silence panicky virus/malware-checkers
  *
  * e.g.  m[de]crypt --bare -a arcfour -o hex -k 435645 -s 3
  */
diff --git a/test/source/filters-test.cxx b/test/source/filters-test.cxx
index f80fd43..1cb085d 100644
--- a/test/source/filters-test.cxx
+++ b/test/source/filters-test.cxx
@@ -113,8 +113,7 @@ void FiltersTest::recursiveScan(const rtl::OUString &rFilter, const rtl::OUStrin
 
             //output name early, so in the case of a hang, the name of
             //the hanging input file is visible
-            if (nExpected == test::indeterminate)
-                fprintf(stderr, "%s,", aRes.getStr());
+            fprintf(stderr, "%s,", aRes.getStr());
             sal_uInt32 nStartTime = osl_getGlobalTimer();
             bool bRes = load(rFilter, sURL, rUserData);
             sal_uInt32 nEndTime = osl_getGlobalTimer();
@@ -122,12 +121,10 @@ void FiltersTest::recursiveScan(const rtl::OUString &rFilter, const rtl::OUStrin
             if (bCVE)
                 CPPUNIT_ASSERT(osl::FileBase::E_None == osl::File::remove(sTmpFile));
 
+            fprintf(stderr, "%s,%"SAL_PRIuUINT32"\n",
+                bRes?"Pass":"Fail",nEndTime-nStartTime);
             if (nExpected == test::indeterminate)
-            {
-                fprintf(stderr, "%s,%"SAL_PRIuUINT32"\n",
-                    bRes?"Pass":"Fail",nEndTime-nStartTime);
                 continue;
-            }
             CPPUNIT_ASSERT_MESSAGE(aRes.getStr(), bRes == nExpected);
         }
     }
commit 542c93d10d56bef6c9d10ef35c62163b91537a8f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 1 15:34:08 2011 +0100

    Document that this is known as StructuredStorageDirectoryEntry in the spec

diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index 26091e0..d5ba9f5 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -40,6 +40,8 @@
 #include "stgdir.hxx"
 #include "stgio.hxx"
 
+static const sal_uInt16 nMaxLegalStr = 31;
+
 static sal_uInt8 cStgSignature[ 8 ] = { 0xD0,0xCF,0x11,0xE0,0xA1,0xB1,0x1A,0xE1 };
 
 ////////////////////////////// struct ClsId  /////////////////////////////
@@ -255,7 +257,7 @@ sal_Bool StgEntry::SetName( const String& rName )
 {
     // I don't know the locale, so en_US is hopefully fine
     aName = ToUpperUnicode( rName );
-    aName.Erase( 31 );
+    aName.Erase( nMaxLegalStr );
 
     int i;
     for( i = 0; i < aName.Len() && i < 32; i++ )
@@ -346,9 +348,13 @@ sal_Bool StgEntry::Load( const void* pFrom )
     sal_uInt16 n = nNameLen;
     if( n )
         n = ( n >> 1 ) - 1;
-    if( n > 31 || (nSize < 0 && cType != STG_STORAGE) )
+
+    if (n > nMaxLegalStr)
+        return sal_False;
+
+    if (nSize < 0 && cType != STG_STORAGE)
     {
-        // the size makes no sence for the substorage
+        // the size makes no sense for the substorage
         // TODO/LATER: actually the size should be an unsigned value, but in this case it would mean a stream of more than 2Gb
         return sal_False;
     }
@@ -356,7 +362,7 @@ sal_Bool StgEntry::Load( const void* pFrom )
     aName = String( nName, n );
     // I don't know the locale, so en_US is hopefully fine
     aName = ToUpperUnicode( aName );
-    aName.Erase( 31 );
+    aName.Erase( nMaxLegalStr );
 
     return sal_True;
 }
diff --git a/sot/source/sdstor/stgelem.hxx b/sot/source/sdstor/stgelem.hxx
index e4e839c..7792608 100644
--- a/sot/source/sdstor/stgelem.hxx
+++ b/sot/source/sdstor/stgelem.hxx
@@ -117,9 +117,10 @@ class StgStream;
 
 #define STGENTRY_SIZE 128
 
+//StructuredStorageDirectoryEntry
 class StgEntry {                        // directory enty
     sal_uInt16  nName[ 32 ];                // 00 name as WCHAR
-    sal_Int16   nNameLen;                   // 40 size of name in bytes including 00H
+    sal_uInt16  nNameLen;                   // 40 size of name in bytes including 00H
     sal_uInt8   cType;                      // 42 entry type
     sal_uInt8   cFlags;                     // 43 0 or 1 (tree balance?)
     sal_Int32   nLeft;                      // 44 left node entry
commit 6017ef25201a2bd0189de15ce35ff050d7c90fce
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 1 15:31:12 2011 +0100

    update removed list

diff --git a/unusedcode.easy b/unusedcode.easy
index cbb01ae..cd328c4 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -2004,15 +2004,6 @@ binfilter::_SwFtnIdxs::Insert(binfilter::SwTxtFtn* const&, unsigned short&)
 binfilter::_SwFtnIdxs::Insert(binfilter::SwTxtFtn* const*, unsigned short)
 binfilter::_SwFtnIdxs::Insert(binfilter::_SwFtnIdxs const*, unsigned short, unsigned short)
 binfilter::_SwFtnIdxs::Remove(binfilter::SwTxtFtn* const&, unsigned short)
-binfilter::_SwPamRanges::Insert(binfilter::SwPamRange const&)
-binfilter::_SwPamRanges::Insert(binfilter::SwPamRange const&, unsigned short&)
-binfilter::_SwPamRanges::Insert(binfilter::SwPamRange const*, unsigned short)
-binfilter::_SwPamRanges::Insert(binfilter::_SwPamRanges const*, unsigned short, unsigned short)
-binfilter::_SwPamRanges::Remove(binfilter::SwPamRange const&, unsigned short)
-binfilter::_SwPamRanges::Remove(unsigned short, unsigned short)
-binfilter::_SwPamRanges_SAR::Replace(binfilter::SwPamRange const&, unsigned short)
-binfilter::_SwPamRanges_SAR::Replace(binfilter::SwPamRange const*, unsigned short, unsigned short)
-binfilter::_SwPamRanges_SAR::_ForEach(unsigned short, unsigned short, unsigned char (*)(binfilter::SwPamRange const&, void*), void*)
 binfilter::_SwRedlineTbl::Insert(binfilter::SwRedline* const*, unsigned short)
 binfilter::_SwRedlineTbl::Insert(binfilter::_SwRedlineTbl const*, unsigned short, unsigned short)
 binfilter::_SwRedlineTbl::Remove(binfilter::SwRedline* const&, unsigned short)
commit 572f5fc11f69c5a9d9e888118978f3f9fa683e65
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 1 00:07:27 2011 +0100

    comment typos

diff --git a/solenv/inc/settings.mk b/solenv/inc/settings.mk
index 553d665..753decb 100644
--- a/solenv/inc/settings.mk
+++ b/solenv/inc/settings.mk
@@ -1034,7 +1034,7 @@ EXTMAXPROCESS*=$(MAXPROCESS)
 GDBTRACE=gdb -nx --command=$(SOLARENV)/bin/gdbtrycatchtrace --args
 
 #use with export VALGRIND=memcheck, that method of invocation is used because
-#hunspell will aslo run its own unit tests under valgrind when this variable is
+#hunspell will also run its own unit tests under valgrind when this variable is
 #set.
 .IF "$(VALGRIND)" != ""
 VALGRINDTOOL=valgrind --tool=$(VALGRIND) --num-callers=50
diff --git a/svx/source/accessibility/lookupcolorname.cxx b/svx/source/accessibility/lookupcolorname.cxx
index 6a03ac3..b64e066 100644
--- a/svx/source/accessibility/lookupcolorname.cxx
+++ b/svx/source/accessibility/lookupcolorname.cxx
@@ -75,7 +75,7 @@ ColorNameMap::ColorNameMap() {
         xNA = css::uno::Reference< css::container::XNameAccess >(xColorTable, css::uno::UNO_QUERY);
         if (xNA.is())
         {
-            // Look the solar mutex here as workarround for missing lock in
+            // Lock the solar mutex here as workarround for missing lock in
             // called function.
             SolarMutexGuard aGuard;
             aNames = xNA->getElementNames();
commit 86429cef8d910fe4fb98a44d5b631025e785baad
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 1 00:06:47 2011 +0100

    callcatcher: freshly unused code

diff --git a/svx/inc/svx/svdmodel.hxx b/svx/inc/svx/svdmodel.hxx
index b8c2e3d..af2a336 100644
--- a/svx/inc/svx/svdmodel.hxx
+++ b/svx/inc/svx/svdmodel.hxx
@@ -359,11 +359,6 @@ public:
 
     SdrOutliner&         GetDrawOutliner(const SdrTextObj* pObj=NULL) const;
 
-    /** returns a new created and non shared outliner.
-        The outliner will not get updated when the SdrModel is changed.
-    */
-    boost::shared_ptr< SdrOutliner > CreateDrawOutliner(const SdrTextObj* pObj=NULL);
-
     SdrOutliner&         GetHitTestOutliner() const { return *pHitTestOutliner; }
     const SdrTextObj*    GetFormattingTextObj() const;
     // Die TextDefaults (Font,Hoehe,Farbe) in ein Set putten
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 6d50fae..5f89813 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -851,14 +851,6 @@ SdrOutliner& SdrModel::GetDrawOutliner(const SdrTextObj* pObj) const
     return *pDrawOutliner;
 }
 
-boost::shared_ptr< SdrOutliner > SdrModel::CreateDrawOutliner(const SdrTextObj* pObj)
-{
-    boost::shared_ptr< SdrOutliner > xDrawOutliner( SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this ) );
-    ImpSetOutlinerDefaults(xDrawOutliner.get(), sal_True);
-    xDrawOutliner->SetTextObj(pObj);
-    return xDrawOutliner;
-}
-
 const SdrTextObj* SdrModel::GetFormattingTextObj() const
 {
     if (pDrawOutliner!=NULL) {
commit 8f0a419942c84aae46dbf637781dc953b0d67d9d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Sep 30 22:13:01 2011 +0100

    callcatcher: unused CreateDrawOutliner

diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx
index c1fca7d..b86fa01 100644
--- a/svx/inc/svx/svdotext.hxx
+++ b/svx/inc/svx/svdotext.hxx
@@ -608,11 +608,6 @@ public:
         Also checks for one empty paragraph.
     */
     static bool HasTextImpl( SdrOutliner* pOutliner );
-
-    /** returns a new created and non shared outliner.
-        The outliner will not get updated when the SdrModel is changed.
-    */
-    boost::shared_ptr< SdrOutliner > CreateDrawOutliner();
 };
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 46cb749..1f77182 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1279,13 +1279,6 @@ SdrOutliner& SdrTextObj::ImpGetDrawOutliner() const
     return rOutl;
 }
 
-boost::shared_ptr< SdrOutliner > SdrTextObj::CreateDrawOutliner()
-{
-    boost::shared_ptr< SdrOutliner > xDrawOutliner( pModel->CreateDrawOutliner(this) );
-    ImpInitDrawOutliner( *(xDrawOutliner.get()) );
-    return xDrawOutliner;
-}
-
 // Extracted from Paint()
 void SdrTextObj::ImpSetupDrawOutlinerForPaint( bool             bContourFrame,
                                                SdrOutliner&     rOutliner,
diff --git a/unusedcode.easy b/unusedcode.easy
index b613cdb..cbb01ae 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -669,7 +669,6 @@ SdrPaintView::getColorConfig() const
 SdrPaintWindow::HideOverlay(Region const&)
 SdrPolyEditView::ShutMarkedObjects()
 SdrSnapView::SnapRect(Rectangle const&, SdrPageView const*, long&, long&) const
-SdrTextObj::CreateDrawOutliner()
 SdrTextObj::GetTextHidden() const
 SdrTextObj::IsTextAnimationAllowed() const
 SdrTextObj::NbcResizeTextAttributes(Fraction const&, Fraction const&)
commit 68b1861ace1c1dec33555d68c0a3b9279dd712c7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Sep 30 22:09:50 2011 +0100

    easier to find leaks if the test harness doesn't leak

diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx
index c1904b4..f80f450 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -59,6 +59,7 @@
 #include "cppunit/portability/Stream.h"
 
 #include "boost/noncopyable.hpp"
+#include "boost/ptr_container/ptr_vector.hpp"
 
 namespace {
 
@@ -172,6 +173,7 @@ SAL_IMPLEMENT_MAIN() {
 #endif
 
     CppUnit::TestResult result;
+    boost::ptr_vector<osl::Module> modules;
     cppunittester::LibreOfficeProtector *throw_protector = 0;
     std::string args;
     std::string testlib;
@@ -199,8 +201,8 @@ SAL_IMPLEMENT_MAIN() {
         }
         rtl::OUString lib(getArgument(index + 1));
         rtl::OUString sym(getArgument(index + 2));
-        oslGenericFunction fn = (new osl::Module(lib, SAL_LOADMODULE_GLOBAL))
-            ->getFunctionSymbol(sym);
+        modules.push_back(new osl::Module(lib, SAL_LOADMODULE_GLOBAL));
+        oslGenericFunction fn = modules.back().getFunctionSymbol(sym);
         throw_protector = fn == 0
             ? 0
             : (*reinterpret_cast< cppunittester::ProtectorFactory * >(fn))();


More information about the Libreoffice-commits mailing list