Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hello,

Cppcheck reported this:
[source/inprocserv/inprocembobj.cxx:783] ->
[source/inprocserv/inprocembobj.cxx:784]: (performance) Variable 'hr' is
reassigned a value before the old one has been used

Here are the lines:
    778         HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject,
(void**)&pOleObject );
    779 
    780         ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance
problem
    781         if ( SUCCEEDED( hr ) && pOleObject )
    782         {
    783             hr = pOleObject->Close( dwSaveOption );
    784             hr = CoDisconnectObject(
(IUnknown*)(IPersistStorage*)this, 0 );
    785         }

(see
http://opengrok.libreoffice.org/xref/core/embedserv/source/inprocserv/inprocembobj.cxx#778)
Moreover, the result of CoDisconnectObject isn't tested too.

I thought about adding after 783 and 784 (so after both lines) this:
if( !SUCCEEDED( hr ) ) return hr;

What do you think?

Julien



--
View this message in context: 
http://nabble.documentfoundation.org/No-test-on-the-return-of-pOleObject-Close-in-embedserv-source-inprocserv-inprocembobj-cxx-tp4025755.html
Sent from the Dev mailing list archive at Nabble.com.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.