[Libreoffice-commits] .: 3 commits - solenv/gbuild svl/source svx/inc svx/source ucbhelper/inc ucbhelper/source unusedcode.easy

Caolán McNamara caolan at kemper.freedesktop.org
Mon Oct 24 02:48:37 PDT 2011


 solenv/gbuild/gbuild.mk             |   23 +++++++++-
 svl/source/misc/inettype.cxx        |   81 ++++++++++++++----------------------
 svx/inc/svx/svdobj.hxx              |   12 -----
 svx/source/svdraw/svdobj.cxx        |   45 --------------------
 ucbhelper/inc/ucbhelper/content.hxx |    7 ---
 ucbhelper/source/client/content.cxx |   33 --------------
 unusedcode.easy                     |    6 --
 7 files changed, 55 insertions(+), 152 deletions(-)

New commits:
commit c67a343bd9b4777b459e6e40a25155284b3c1163
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 24 09:01:58 2011 +0100

    don't leak contenttype registrations

diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx
index 9a752c7..b599334 100644
--- a/svl/source/misc/inettype.cxx
+++ b/svl/source/misc/inettype.cxx
@@ -30,6 +30,7 @@
 #include "precompiled_svl.hxx"
 #include <tools/table.hxx>
 #include <tools/wldcrd.hxx>
+#include <rtl/instance.hxx>
 #include <svl/inettype.hxx>
 #include <svl/svl.hrc>
 
@@ -82,20 +83,18 @@ struct ExtensionMapEntry: public UniString
 //============================================================================
 class Registration
 {
-    static Registration * m_pRegistration;
-
     Table m_aTypeIDMap; // map TypeID to TypeName, Presentation
     SvStringsSort m_aTypeNameMap; // map TypeName to TypeID, Extension
     SvStringsSort m_aExtensionMap; // map Extension to TypeID
     sal_uInt32 m_nNextDynamicID;
 
-public:
+private:
+    template<typename T, typename Unique> friend class rtl::Static;
+
     Registration(): m_nNextDynamicID(CONTENT_TYPE_LAST + 1) {}
 
     ~Registration();
-
-    static inline void deinitialize();
-
+public:
     static inline TypeIDMapEntry * getEntry(INetContentType eTypeID);
 
     static TypeNameMapEntry * getExtensionEntry(UniString const & rTypeName);
@@ -118,21 +117,17 @@ public:
 
 };
 
-// static
-inline void Registration::deinitialize()
+namespace
 {
-    delete m_pRegistration;
-    m_pRegistration = 0;
+    struct theRegistration
+        : public rtl::Static< Registration, theRegistration > {};
 }
 
 // static
 inline TypeIDMapEntry * Registration::getEntry(INetContentType eTypeID)
 {
-    return
-        m_pRegistration ?
-            static_cast< TypeIDMapEntry * >(m_pRegistration->
-                                                m_aTypeIDMap.Get(eTypeID)) :
-            0;
+    return static_cast< TypeIDMapEntry * >(theRegistration::get().
+                                                m_aTypeIDMap.Get(eTypeID));
 }
 
 //============================================================================
@@ -527,9 +522,6 @@ MediaTypeEntry const aStaticPresentationMap[]
 //
 //============================================================================
 
-// static
-Registration * Registration::m_pRegistration = 0;
-
 //============================================================================
 Registration::~Registration()
 {
@@ -553,16 +545,14 @@ Registration::~Registration()
 TypeNameMapEntry * Registration::getExtensionEntry(UniString const &
                                                        rTypeName)
 {
-    if (m_pRegistration)
-    {
-        UniString aTheTypeName = rTypeName;
-        aTheTypeName.ToLowerAscii();
-        sal_uInt16 nPos;
-        if (m_pRegistration->m_aTypeNameMap.Seek_Entry(&aTheTypeName, &nPos))
-            return static_cast< TypeNameMapEntry * >(m_pRegistration->
-                                                         m_aTypeNameMap.
-                                                             GetObject(nPos));
-    }
+    UniString aTheTypeName = rTypeName;
+    aTheTypeName.ToLowerAscii();
+    sal_uInt16 nPos;
+    Registration &rRegistration = theRegistration::get();
+    if (rRegistration.m_aTypeNameMap.Seek_Entry(&aTheTypeName, &nPos))
+        return static_cast< TypeNameMapEntry * >(rRegistration.
+                                                     m_aTypeNameMap.
+                                                         GetObject(nPos));
     return 0;
 }
 
@@ -576,14 +566,13 @@ INetContentType Registration::RegisterContentType(UniString const & rTypeName,
                                                   UniString const *
                                                       pSystemFileType)
 {
-    if (!m_pRegistration)
-        m_pRegistration = new Registration;
+    Registration &rRegistration = theRegistration::get();
 
     DBG_ASSERT(GetContentType(rTypeName) == CONTENT_TYPE_UNKNOWN,
                "Registration::RegisterContentType(): Already registered");
 
     INetContentType eTypeID
-        = INetContentType(m_pRegistration->m_nNextDynamicID++);
+        = INetContentType(rRegistration.m_nNextDynamicID++);
     UniString aTheTypeName = rTypeName;
     aTheTypeName.ToLowerAscii();
 
@@ -592,20 +581,20 @@ INetContentType Registration::RegisterContentType(UniString const & rTypeName,
     pTypeIDMapEntry->m_aPresentation = rPresentation;
     if (pSystemFileType)
         pTypeIDMapEntry->m_aSystemFileType = *pSystemFileType;
-    m_pRegistration->m_aTypeIDMap.Insert(eTypeID, pTypeIDMapEntry);
+    rRegistration.m_aTypeIDMap.Insert(eTypeID, pTypeIDMapEntry);
 
     TypeNameMapEntry * pTypeNameMapEntry = new TypeNameMapEntry(aTheTypeName);
     if (pExtension)
         pTypeNameMapEntry->m_aExtension = *pExtension;
     pTypeNameMapEntry->m_eTypeID = eTypeID;
-    m_pRegistration->m_aTypeNameMap.Insert(pTypeNameMapEntry);
+    rRegistration.m_aTypeNameMap.Insert(pTypeNameMapEntry);
 
     if (pExtension)
     {
         ExtensionMapEntry * pExtensionMapEntry
             = new ExtensionMapEntry(*pExtension);
         pExtensionMapEntry->m_eTypeID = eTypeID;
-        m_pRegistration->m_aExtensionMap.Insert(pExtensionMapEntry);
+        rRegistration.m_aExtensionMap.Insert(pExtensionMapEntry);
     }
 
     return eTypeID;
@@ -615,14 +604,13 @@ INetContentType Registration::RegisterContentType(UniString const & rTypeName,
 // static
 INetContentType Registration::GetContentType(UniString const & rTypeName)
 {
-    if (!m_pRegistration)
-        m_pRegistration = new Registration;
+    Registration &rRegistration = theRegistration::get();
 
     UniString aTheTypeName = rTypeName;
     aTheTypeName.ToLowerAscii();
     sal_uInt16 nPos;
-    return m_pRegistration->m_aTypeNameMap.Seek_Entry(&aTheTypeName, &nPos) ?
-               static_cast< TypeNameMapEntry * >(m_pRegistration->
+    return rRegistration.m_aTypeNameMap.Seek_Entry(&aTheTypeName, &nPos) ?
+               static_cast< TypeNameMapEntry * >(rRegistration.
                                                      m_aTypeNameMap.
                                                          GetObject(nPos))->
                    m_eTypeID :
@@ -633,11 +621,10 @@ INetContentType Registration::GetContentType(UniString const & rTypeName)
 // static
 UniString Registration::GetContentType(INetContentType eTypeID)
 {
-    if (!m_pRegistration)
-        m_pRegistration = new Registration;
+    Registration &rRegistration = theRegistration::get();
 
     TypeIDMapEntry * pEntry
-        = static_cast< TypeIDMapEntry * >(m_pRegistration->
+        = static_cast< TypeIDMapEntry * >(rRegistration.
                                               m_aTypeIDMap.Get(eTypeID));
     return pEntry ? pEntry->m_aTypeName : UniString();
 }
@@ -646,11 +633,10 @@ UniString Registration::GetContentType(INetContentType eTypeID)
 // static
 UniString Registration::GetPresentation(INetContentType eTypeID)
 {
-    if (!m_pRegistration)
-        m_pRegistration = new Registration;
+    Registration &rRegistration = theRegistration::get();
 
     TypeIDMapEntry * pEntry
-        = static_cast< TypeIDMapEntry * >(m_pRegistration->
+        = static_cast< TypeIDMapEntry * >(rRegistration.
                                               m_aTypeIDMap.Get(eTypeID));
     return pEntry ? pEntry->m_aPresentation : UniString();
 }
@@ -660,15 +646,14 @@ UniString Registration::GetPresentation(INetContentType eTypeID)
 INetContentType Registration::GetContentType4Extension(UniString const &
                                                            rExtension)
 {
-    if (!m_pRegistration)
-        m_pRegistration = new Registration;
+    Registration &rRegistration = theRegistration::get();
 
     sal_uInt16 nPos;
-    return m_pRegistration->
+    return rRegistration.
                    m_aExtensionMap.
                        Seek_Entry(const_cast< UniString * >(&rExtension),
                                   &nPos) ?
-               static_cast< ExtensionMapEntry * >(m_pRegistration->
+               static_cast< ExtensionMapEntry * >(rRegistration.
                                                       m_aExtensionMap.
                                                           GetObject(nPos))->
                    m_eTypeID :
diff --git a/unusedcode.easy b/unusedcode.easy
index 685c292..e7a71b0 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -1,4 +1,3 @@
-(anonymous namespace)::Registration::~Registration()
 (anonymous namespace)::getState(std::__debug::vector<cppcanvas::internal::OutDevState, std::allocator<cppcanvas::internal::OutDevState> > const&)
 (anonymous namespace)::writeInfo(com::sun::star::uno::Reference<com::sun::star::registry::XRegistryKey> const&, rtl::OUString const&, rtl::OUString const&)
 AtomDocument::AtomDocument(AtomPubSession*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)
commit ccd38a0de63bd4289470fa286a53b79d23fe2b28
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 24 09:01:07 2011 +0100

    make --enable-layout have effect under gbuild

diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk
index 1cc7243..03110a5 100644
--- a/solenv/gbuild/gbuild.mk
+++ b/solenv/gbuild/gbuild.mk
@@ -214,8 +214,6 @@ gb_CPUDEFS += -D$(CPUNAME)
 
 gb_GLOBALDEFS := \
 	-D_REENTRANT \
-	-DENABLE_LAYOUT_EXPERIMENTAL=0 \
-	-DENABLE_LAYOUT=0 \
 	-DOSL_DEBUG_LEVEL=$(gb_DEBUGLEVEL) \
 	-DSUPD=$(UPD) \
 	-DVCL \
@@ -223,6 +221,27 @@ gb_GLOBALDEFS := \
 	$(gb_COMPILERDEFS) \
 	$(gb_CPUDEFS) \
 
+
+ifeq ($(strip $(ENABLE_LAYOUT)),TRUE)
+gb_GLOBALDEFS += \
+	-DENABLE_LAYOUT=1 \
+
+else
+gb_GLOBALDEFS += \
+	-DENABLE_LAYOUT=0 \
+
+endif
+
+ifeq ($(strip $(ENABLE_LAYOUT_EXPERIMENTAL)),TRUE)
+gb_GLOBALDEFS += \
+	-DENABLE_LAYOUT_EXPERIMENTAL=1 \
+
+else
+gb_GLOBALDEFS += \
+	-DENABLE_LAYOUT_EXPERIMENTAL=0 \
+
+endif
+
 ifeq ($(gb_PRODUCT),$(true))
 gb_GLOBALDEFS += \
 	-DPRODUCT \
commit 7dca83c77cf20c943a338882b626e2b68d85ea77
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 22 10:47:54 2011 +0100

    callcatcher: remove some unused methods

diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx
index 72964cf..4cdf86c 100644
--- a/svx/inc/svx/svdobj.hxx
+++ b/svx/inc/svx/svdobj.hxx
@@ -308,7 +308,6 @@ public:
     SfxBroadcaster*             pBroadcast;    // Broadcaster, falls dieses Obj referenziert wird (bVirtObj=sal_True). Auch fuer Konnektoren etc.
     SdrObjUserDataList*         pUserDataList; // applikationsspeziefische Daten
     SdrGluePointList*           pGluePoints;   // Klebepunkte zum Ankleben von Objektverbindern
-    AutoTimer*                  pAutoTimer;
 
     // #i68101#
     // object name, title and description
@@ -316,9 +315,6 @@ public:
     String                      aObjTitle;
     String                      aObjDescription;
 
-    // Name to be used by applications
-    XubString                   aHTMLName;
-
 public:
     TYPEINFO();
     SdrObjPlusData();
@@ -613,10 +609,6 @@ public:
     void SetDescription(const String& rStr);
     String GetDescription() const;
 
-    // support for HTMLName
-    void SetHTMLName(const String& rStr);
-    String GetHTMLName() const;
-
     // Fuer Gruppenobjekte
     sal_Bool IsGroupObject() const { return GetSubList()!=NULL; }
     virtual SdrObjList* GetSubList() const;
@@ -657,10 +649,6 @@ public:
     */
     void SetNavigationPosition (const sal_uInt32 nPosition);
 
-    const AutoTimer* GetAutoTimer() const { return pPlusData!=NULL ? pPlusData->pAutoTimer : NULL; }
-    AutoTimer* GetAutoTimer() { return pPlusData!=NULL ? pPlusData->pAutoTimer : NULL; }
-    AutoTimer* ForceAutoTimer();
-
     // #111111#
     // To make clearer that this method may trigger RecalcBoundRect and thus may be
     // expensive and somtimes problematic (inside a bigger object change You will get
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 77e458f..99a877a 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -239,8 +239,7 @@ TYPEINIT0(SdrObjPlusData);
 SdrObjPlusData::SdrObjPlusData():
     pBroadcast(NULL),
     pUserDataList(NULL),
-    pGluePoints(NULL),
-    pAutoTimer(NULL)
+    pGluePoints(NULL)
 {
 }
 
@@ -249,7 +248,6 @@ SdrObjPlusData::~SdrObjPlusData()
     if (pBroadcast   !=NULL) delete pBroadcast;
     if (pUserDataList!=NULL) delete pUserDataList;
     if (pGluePoints  !=NULL) delete pGluePoints;
-    if (pAutoTimer   !=NULL) delete pAutoTimer;
 }
 
 SdrObjPlusData* SdrObjPlusData::Clone(SdrObject* pObj1) const
@@ -278,13 +276,6 @@ SdrObjPlusData* SdrObjPlusData::Clone(SdrObject* pObj1) const
     pNeuPlusData->aObjTitle = aObjTitle;
     pNeuPlusData->aObjDescription = aObjDescription;
 
-    if (pAutoTimer!=NULL) {
-        pNeuPlusData->pAutoTimer=new AutoTimer;
-        // Handler, etc. nicht mitkopieren!
-    }
-
-    // For HTMLName: Do not clone, leave uninitialized (empty string)
-
     return pNeuPlusData;
 }
 
@@ -640,13 +631,6 @@ void SdrObject::DelReference(SdrVirtObj& rVrtObj)
     RemoveListener(rVrtObj);
 }
 
-AutoTimer* SdrObject::ForceAutoTimer()
-{
-    ImpForcePlusData();
-    if (pPlusData->pAutoTimer==NULL) pPlusData->pAutoTimer=new AutoTimer;
-    return pPlusData->pAutoTimer;
-}
-
 bool SdrObject::HasRefPoint() const
 {
     return sal_False;
@@ -803,30 +787,6 @@ String SdrObject::GetDescription() const
     return String();
 }
 
-void SdrObject::SetHTMLName(const String& rStr)
-{
-    if(rStr.Len() && !pPlusData)
-    {
-        ImpForcePlusData();
-    }
-
-    if(pPlusData && pPlusData->aObjName != rStr)
-    {
-        pPlusData->aHTMLName = rStr;
-        SetChanged();
-    }
-}
-
-String SdrObject::GetHTMLName() const
-{
-    if(pPlusData)
-    {
-        return pPlusData->aHTMLName;
-    }
-
-    return String();
-}
-
 sal_uInt32 SdrObject::GetOrdNum() const
 {
     if (pObjList!=NULL) {
@@ -837,9 +797,6 @@ sal_uInt32 SdrObject::GetOrdNum() const
     return nOrdNum;
 }
 
-
-
-
 sal_uInt32 SdrObject::GetNavigationPosition (void)
 {
     if (pObjList!=NULL && pObjList->RecalcNavigationPositions())
diff --git a/ucbhelper/inc/ucbhelper/content.hxx b/ucbhelper/inc/ucbhelper/content.hxx
index 8ba43b0..e49999b 100644
--- a/ucbhelper/inc/ucbhelper/content.hxx
+++ b/ucbhelper/inc/ucbhelper/content.hxx
@@ -110,13 +110,6 @@ protected:
                ::com::sun::star::uno::RuntimeException,
                ::com::sun::star::uno::Exception );
 
-    ::com::sun::star::uno::Any createCursorAny( const ::com::sun::star::uno::Sequence<
-                                                sal_Int32 >& rPropertyHandles,
-                                                ResultSetInclude eMode )
-            throw( ::com::sun::star::ucb::CommandAbortedException,
-               ::com::sun::star::uno::RuntimeException,
-               ::com::sun::star::uno::Exception );
-
 public:
     /**
       * Constructor.
diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx
index 53bda72..2e72cf6 100644
--- a/ucbhelper/source/client/content.cxx
+++ b/ucbhelper/source/client/content.cxx
@@ -790,39 +790,6 @@ Any Content::createCursorAny( const Sequence< rtl::OUString >& rPropertyNames,
 }
 
 //=========================================================================
-Any Content::createCursorAny( const Sequence< sal_Int32 >& rPropertyHandles,
-                              ResultSetInclude eMode )
-    throw( CommandAbortedException, RuntimeException, Exception )
-{
-    sal_Int32 nCount = rPropertyHandles.getLength();
-    Sequence< Property > aProps( nCount );
-    Property* pProps = aProps.getArray();
-    const sal_Int32* pHandles = rPropertyHandles.getConstArray();
-    for ( sal_Int32 n = 0; n < nCount; ++n )
-    {
-        Property& rProp = pProps[ n ];
-        rProp.Name   = rtl::OUString(); // n/a
-        rProp.Handle = pHandles[ n ];
-    }
-
-    OpenCommandArgument2 aArg;
-    aArg.Mode       = ( eMode == INCLUDE_FOLDERS_ONLY )
-                        ? OpenMode::FOLDERS
-                        : ( eMode == INCLUDE_DOCUMENTS_ONLY )
-                            ? OpenMode::DOCUMENTS : OpenMode::ALL;
-    aArg.Priority   = 0; // unused
-    aArg.Sink       = Reference< XInterface >(); // unused
-    aArg.Properties = aProps;
-
-    Command aCommand;
-    aCommand.Name     = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("open"));
-    aCommand.Handle   = -1; // n/a
-    aCommand.Argument <<= aArg;
-
-    return m_xImpl->executeCommand( aCommand );
-}
-
-//=========================================================================
 Reference< XResultSet > Content::createCursor(
                             const Sequence< rtl::OUString >& rPropertyNames,
                             ResultSetInclude eMode )
diff --git a/unusedcode.easy b/unusedcode.easy
index 1cdb047..685c292 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -365,7 +365,6 @@ SVGExport::GetGlyphPlacement() const
 SVGExport::IsUseGradient() const
 SVGExport::popClip()
 SVGExport::pushClip(basegfx::B2DPolyPolygon const&)
-SVGFilter::implImport(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)
 SalColormap::SalColormap(BitmapPalette const&)
 SalColormap::SetPalette(BitmapPalette const&)
 SalDisplay::IsLocal()
@@ -479,7 +478,6 @@ ScDocument::IsLoadingMedium() const
 ScDocument::ValidNewTabName(std::__debug::vector<String, std::allocator<String> > const&) const
 ScExternalRefManager::setCacheTableReferencedPermanently(unsigned short, rtl::OUString const&, unsigned long)
 ScFilterDetect::impl_createFactory(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> const&)
-ScFiltersTest::testVba()
 ScFormulaCell::ScFormulaCell()
 ScGridWindow::InvertSimple(short, int, short, int, unsigned char, unsigned char)
 ScHTMLColOffset::Insert(ScHTMLColOffset const*, unsigned short, unsigned short)
@@ -618,10 +616,7 @@ SdrObjEditView::Paste(Window*, unsigned long)
 SdrObjEditView::Yank(unsigned long)
 SdrObjFactory::MakeNewObjUserData(unsigned int, unsigned short, SdrObject*)
 SdrObject::ClearObjectItem(unsigned short)
-SdrObject::ForceAutoTimer()
 SdrObject::FreeGlobalDrawObjectItemPool()
-SdrObject::GetHTMLName() const
-SdrObject::SetHTMLName(String const&)
 SdrOle2Obj::SdrOle2Obj(svt::EmbeddedObjectRef const&, String const&, bool)
 SdrOle2Obj::SdrOle2Obj(svt::EmbeddedObjectRef const&, bool)
 SdrPage::AddComment(sdr::Comment const&)


More information about the Libreoffice-commits mailing list