[Libreoffice-commits] .: 3 commits - dtrans/source embedserv/source o3tl/inc sal/Library_sal_textenc.mk sal/util shell/source tools/source xmerge/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Fri Jul 20 06:56:30 PDT 2012


 dtrans/source/win32/dtobj/XTDataObject.cxx              |   10 +---
 embedserv/source/inprocserv/dllentry.cxx                |    6 --
 o3tl/inc/o3tl/sorted_vector.hxx                         |   22 +-------
 sal/Library_sal_textenc.mk                              |    2 
 sal/util/sal_textenc/saltextenc.map                     |   40 ----------------
 shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx     |   36 +++++---------
 shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx |    3 -
 shell/source/win32/shlxthandler/shlxthdl.cxx            |    3 -
 tools/source/fsys/wntmsc.cxx                            |    5 --
 xmerge/source/activesync/XMergeFactory.cpp              |    6 --
 xmerge/source/activesync/XMergeSync.cpp                 |    6 --
 11 files changed, 21 insertions(+), 118 deletions(-)

New commits:
commit e5a0755bc2f8129cb854367740a02c859555c033
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jul 20 15:55:05 2012 +0200

    new does not return null
    
    Change-Id: Iea00f7c6435c6ae3ccbb2f97ab4407df8b86c54b

diff --git a/dtrans/source/win32/dtobj/XTDataObject.cxx b/dtrans/source/win32/dtobj/XTDataObject.cxx
index ec3d201..a28f866 100644
--- a/dtrans/source/win32/dtobj/XTDataObject.cxx
+++ b/dtrans/source/win32/dtobj/XTDataObject.cxx
@@ -496,10 +496,9 @@ STDMETHODIMP CXTDataObject::EnumFormatEtc(
     if ( DATADIR_GET == dwDirection )
     {
         *ppenumFormatetc = new CEnumFormatEtc( this, m_FormatEtcContainer );
-        if ( NULL != *ppenumFormatetc )
-            static_cast< LPUNKNOWN >( *ppenumFormatetc )->AddRef( );
+        static_cast< LPUNKNOWN >( *ppenumFormatetc )->AddRef( );
 
-        hr = ( NULL != *ppenumFormatetc ) ? S_OK : E_OUTOFMEMORY;
+        hr = S_OK;
     }
     else
         hr = E_INVALIDARG;
@@ -832,10 +831,9 @@ STDMETHODIMP CEnumFormatEtc::Clone( IEnumFORMATETC** ppenum )
         return E_INVALIDARG;
 
     *ppenum = new CEnumFormatEtc( m_lpUnkOuter, m_FormatEtcContainer );
-    if ( NULL != *ppenum )
-        static_cast< LPUNKNOWN >( *ppenum )->AddRef( );
+    static_cast< LPUNKNOWN >( *ppenum )->AddRef( );
 
-    return ( NULL != *ppenum ) ? S_OK : E_OUTOFMEMORY;
+    return S_OK;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embedserv/source/inprocserv/dllentry.cxx b/embedserv/source/inprocserv/dllentry.cxx
index 6a43fce..6daf9bf 100644
--- a/embedserv/source/inprocserv/dllentry.cxx
+++ b/embedserv/source/inprocserv/dllentry.cxx
@@ -186,9 +186,6 @@ extern "C" STDAPI INPROC_DLLPUBLIC DllGetClassObject( REFCLSID rclsid, REFIID ri
                 return E_NOINTERFACE;
 
             *ppv = new inprocserv::InprocEmbedProvider_Impl( rclsid );
-            if ( *ppv == NULL )
-                return E_OUTOFMEMORY;
-
             ((LPUNKNOWN)*ppv)->AddRef();
             return S_OK;
          }
@@ -316,9 +313,6 @@ STDMETHODIMP InprocEmbedProvider_Impl::CreateInstance(IUnknown FAR* punkOuter,
         return CLASS_E_NOAGGREGATION;
 
     InprocEmbedDocument_Impl* pEmbedDocument = new InprocEmbedDocument_Impl( m_guid );
-    if ( !pEmbedDocument )
-        return E_OUTOFMEMORY;
-
     pEmbedDocument->AddRef();
     HRESULT hr = pEmbedDocument->Init();
     if ( SUCCEEDED( hr ) )
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
index 9f37b3b..83df85f 100644
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
@@ -817,21 +817,16 @@ SCODE STDMETHODCALLTYPE COooFilterCF::CreateInstance(
     if ( 0 != pUnkOuter )
         return CLASS_E_NOAGGREGATION;
     pIUnk = new COooFilter();
-    if ( 0 != pIUnk )
+    if ( SUCCEEDED( pIUnk->QueryInterface( riid , ppvObject ) ) )
     {
-        if ( SUCCEEDED( pIUnk->QueryInterface( riid , ppvObject ) ) )
-        {
-            // Release extra refcount from QueryInterface
-            pIUnk->Release();
-        }
-        else
-        {
-            delete pIUnk;
-            return E_UNEXPECTED;
-        }
+        // Release extra refcount from QueryInterface
+        pIUnk->Release();
     }
     else
-        return E_OUTOFMEMORY;
+    {
+        delete pIUnk;
+        return E_UNEXPECTED;
+    }
     return S_OK;
 }
 
@@ -919,19 +914,14 @@ extern "C" SCODE STDMETHODCALLTYPE DllGetClassObject(
     }
     else
         return CLASS_E_CLASSNOTAVAILABLE;
-    if ( 0 != pResult )
+    if( SUCCEEDED( pResult->QueryInterface( iid, ppvObj ) ) )
+        // Release extra refcount from QueryInterface
+        pResult->Release();
+    else
     {
-        if( SUCCEEDED( pResult->QueryInterface( iid, ppvObj ) ) )
-            // Release extra refcount from QueryInterface
-            pResult->Release();
-        else
-        {
-            delete pImpl;
-            return E_UNEXPECTED;
-        }
+        delete pImpl;
+        return E_UNEXPECTED;
     }
-    else
-        return E_OUTOFMEMORY;
     return S_OK;
 }
 //F-------------------------------------------------------------------------
diff --git a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
index 21a2513..0097867 100644
--- a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
+++ b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
@@ -432,9 +432,6 @@ extern "C" STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
         return E_NOINTERFACE;
 
     IUnknown* pUnk = new CClassFactory( rclsid );
-    if ( 0 == pUnk )
-        return E_OUTOFMEMORY;
-
     *ppv = pUnk;
     return S_OK;
 }
diff --git a/shell/source/win32/shlxthandler/shlxthdl.cxx b/shell/source/win32/shlxthandler/shlxthdl.cxx
index 21257c7..b4e1d21 100644
--- a/shell/source/win32/shlxthandler/shlxthdl.cxx
+++ b/shell/source/win32/shlxthandler/shlxthdl.cxx
@@ -402,9 +402,6 @@ extern "C" STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
         OutputDebugStringFormat( "DllGetClassObject: Create CLSID_THUMBVIEWER_HANDLER\n" );
 
     IUnknown* pUnk = new CClassFactory(rclsid);
-    if (0 == pUnk)
-        return E_OUTOFMEMORY;
-
     *ppv = pUnk;
     return S_OK;
 }
diff --git a/tools/source/fsys/wntmsc.cxx b/tools/source/fsys/wntmsc.cxx
index 8093411..28593b7 100644
--- a/tools/source/fsys/wntmsc.cxx
+++ b/tools/source/fsys/wntmsc.cxx
@@ -510,10 +510,7 @@ HRESULT SHResolvePath( HWND hwndOwner, LPCTSTR pszPath, LPITEMIDLIST *ppidl )
     // First make a copy of the path
 
     pszPathCopy = new TCHAR[lstrlen(pszPath) + 1];
-    if ( pszPathCopy )
-        lstrcpy( pszPathCopy, pszPath );
-    else
-        return E_OUTOFMEMORY;
+    lstrcpy( pszPathCopy, pszPath );
 
     // Determine the first token
 
diff --git a/xmerge/source/activesync/XMergeFactory.cpp b/xmerge/source/activesync/XMergeFactory.cpp
index a2cb631..486d128 100644
--- a/xmerge/source/activesync/XMergeFactory.cpp
+++ b/xmerge/source/activesync/XMergeFactory.cpp
@@ -84,12 +84,6 @@ STDMETHODIMP CXMergeFactory::CreateInstance(IUnknown *pUnkOuter, REFIID iid, voi
     if (iid == IID_ICeFileFilter)
     {
         CXMergeFilter *pFilter = new CXMergeFilter();
-        if(pFilter == NULL)
-        {
-             *ppvObject = NULL;
-            return E_OUTOFMEMORY;
-        }
-
         HRESULT hr = pFilter->QueryInterface(iid, ppvObject);
         pFilter->Release();
 
diff --git a/xmerge/source/activesync/XMergeSync.cpp b/xmerge/source/activesync/XMergeSync.cpp
index f4f3946..8c8178c 100644
--- a/xmerge/source/activesync/XMergeSync.cpp
+++ b/xmerge/source/activesync/XMergeSync.cpp
@@ -56,12 +56,6 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 {
     // Create the factory object
     CXMergeFactory *pFactory = new CXMergeFactory();
-    if (pFactory == NULL)
-    {
-        *ppv = NULL;
-        return E_OUTOFMEMORY;
-    }
-
     HRESULT hr = pFactory->QueryInterface(riid, ppv);
     pFactory->Release();
 
commit 91a6ea5d6f75846983ab53ef477aa063786ac3fe
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jul 20 15:42:23 2012 +0200

    Unnecessary sorted_vector_compare
    
    Change-Id: I813629a2614f99035ab1b873ee34c203729c7367

diff --git a/o3tl/inc/o3tl/sorted_vector.hxx b/o3tl/inc/o3tl/sorted_vector.hxx
index 0386680..b3ffc4f 100644
--- a/o3tl/inc/o3tl/sorted_vector.hxx
+++ b/o3tl/inc/o3tl/sorted_vector.hxx
@@ -17,17 +17,6 @@
 namespace o3tl
 {
 
-/** Helper template */
-template <class Value, class Compare>
-class sorted_vector_compare : public Compare
-{
-public:
-    bool operator()(const Value& lhs, const Value& rhs) const
-    {
-        return Compare::operator()(lhs, rhs);
-    }
-};
-
 /** Represents a sorted vector of values.
 
     @tpl Value class of item to be stored in container
@@ -36,7 +25,6 @@ public:
 template <class Value, class Compare = std::less<Value> >
 class sorted_vector
     : private std::vector<Value>
-    , private sorted_vector_compare<Value, Compare>
 {
 private:
     typedef typename std::vector<Value> base_t;
@@ -44,7 +32,6 @@ private:
 public:
     typedef typename std::vector<Value>::const_iterator const_iterator;
     typedef typename std::vector<Value>::size_type size_type;
-    typedef sorted_vector_compare<Value, Compare> MyCompare;
 
     using base_t::clear;
     using base_t::erase;
@@ -113,8 +100,7 @@ public:
 
     const_iterator lower_bound( const Value& x ) const
     {
-        const MyCompare& me = *this;
-        return std::lower_bound( base_t::begin(), base_t::end(), x, me );
+        return std::lower_bound( base_t::begin(), base_t::end(), x, Compare() );
     }
 
     /* Searches the container for an element with a value of x
@@ -159,14 +145,12 @@ private:
     /** just makes the code easier to read */
     bool less_than(const Value& lhs, const Value& rhs) const
     {
-        const MyCompare& me = *this;
-        return me.operator()(lhs, rhs);
+        return Compare().operator()(lhs, rhs);
     }
 
     iterator lower_bound_nonconst( const Value& x )
     {
-        const MyCompare& me = *this;
-        return std::lower_bound( base_t::begin(), base_t::end(), x, me );
+        return std::lower_bound( base_t::begin(), base_t::end(), x, Compare() );
     }
 
     typename base_t::iterator begin_nonconst() { return base_t::begin(); }
commit 1ac4c2cf795e5bc2883ae0a76955e981fb1edee2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jul 20 15:23:45 2012 +0200

    saltextenc.map is unncessary
    
    ...as sal_textenc lib is not part of stable URE interface.
    
    Change-Id: I5aeacd7668cca36f900aede4012d508217f3ab46

diff --git a/sal/Library_sal_textenc.mk b/sal/Library_sal_textenc.mk
index 37c6cd9..3ad5dbf 100644
--- a/sal/Library_sal_textenc.mk
+++ b/sal/Library_sal_textenc.mk
@@ -27,8 +27,6 @@
 
 $(eval $(call gb_Library_Library,sal_textenc))
 
-$(eval $(call gb_Library_set_soversion_script,sal_textenc,3,$(SRCDIR)/sal/util/sal_textenc/saltextenc.map))
-
 $(eval $(call gb_Library_use_libraries,sal_textenc,\
 	sal \
 	$(gb_STDLIBS) \
diff --git a/sal/util/sal_textenc/saltextenc.map b/sal/util/sal_textenc/saltextenc.map
deleted file mode 100644
index 8e38ef0..0000000
--- a/sal/util/sal_textenc/saltextenc.map
+++ /dev/null
@@ -1,40 +0,0 @@
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Copyright (C) 2011 Red Hat, Inc., Stephan Bergmann <sbergman at redhat.com>
-#  (initial developer)
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-UDK_3_0_0 {
-    global:
-        _ZTI*; _ZTS*; # weak RTTI symbols for C++ exceptions
-        sal_getFullTextEncodingData;
-    local:
-        *;
-};
-
-# Unique libstdc++ symbols:
-GLIBCXX_3.4 {
-    global:
-        _ZGVNSt7num_put*; _ZNSt7num_put*;
-        _ZNSs4_Rep20_S_empty_rep_storageE;
-};


More information about the Libreoffice-commits mailing list