Author: tfaber Date: Sat May 4 08:39:05 2013 New Revision: 58918
URL: http://svn.reactos.org/svn/reactos?rev=58918&view=rev Log: [ATL] - Simplify CComObject code. Fix warnings. Patch by Katayama Hirofumi MZ. CORE-7105 #resolve
Modified: trunk/reactos/lib/atl/atlcom.h trunk/reactos/lib/atl/statreg.h
Modified: trunk/reactos/lib/atl/atlcom.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/atl/atlcom.h?rev=58918&... ============================================================================== --- trunk/reactos/lib/atl/atlcom.h [iso-8859-1] (original) +++ trunk/reactos/lib/atl/atlcom.h [iso-8859-1] Sat May 4 08:39:05 2013 @@ -2,6 +2,7 @@ * ReactOS ATL * * Copyright 2009 Andrew Hill ash77@reactos.org + * Copyright 2013 Katayama Hirofumi MZ katayama.hirofumi.mz@gmail.com * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -134,39 +135,28 @@
virtual ~CComObject() { - CComObject<Base> *pThis; - - pThis = reinterpret_cast<CComObject<Base> *>(this); - pThis->FinalRelease(); + this->FinalRelease(); _pAtlModule->Unlock(); }
STDMETHOD_(ULONG, AddRef)() { - CComObject<Base> *pThis; - - pThis = reinterpret_cast<CComObject<Base> *>(this); - return pThis->InternalAddRef(); + return this->InternalAddRef(); }
STDMETHOD_(ULONG, Release)() { - CComObject<Base> *pThis; - ULONG l; - - pThis = reinterpret_cast<CComObject<Base> *>(this); - l = pThis->InternalRelease(); - if (l == 0) + ULONG newRefCount; + + newRefCount = this->InternalRelease(); + if (newRefCount == 0) delete this; - return l; + return newRefCount; }
STDMETHOD(QueryInterface)(REFIID iid, void **ppvObject) { - CComObject<Base> *pThis; - - pThis = reinterpret_cast<CComObject<Base> *>(this); - return pThis->_InternalQueryInterface(iid, ppvObject); + return this->_InternalQueryInterface(iid, ppvObject); }
static HRESULT WINAPI CreateInstance(CComObject<Base> **pp) @@ -283,11 +273,9 @@
STDMETHOD_(ULONG, AddRef)() { - CComObjectCached<Base> *pThis; ULONG newRefCount;
- pThis = reinterpret_cast<CComObjectCached<Base>*>(this); - newRefCount = pThis->InternalAddRef(); + newRefCount = this->InternalAddRef(); if (newRefCount == 2) _pAtlModule->Lock(); return newRefCount; @@ -295,11 +283,9 @@
STDMETHOD_(ULONG, Release)() { - CComObjectCached<Base> *pThis; ULONG newRefCount;
- pThis = reinterpret_cast<CComObjectCached<Base>*>(this); - newRefCount = pThis->InternalRelease(); + newRefCount = this->InternalRelease(); if (newRefCount == 0) delete this; else if (newRefCount == 1) @@ -309,10 +295,7 @@
STDMETHOD(QueryInterface)(REFIID iid, void **ppvObject) { - CComObjectCached<Base> *pThis; - - pThis = reinterpret_cast<CComObjectCached<Base>*>(this); - return pThis->_InternalQueryInterface(iid, ppvObject); + return this->_InternalQueryInterface(iid, ppvObject); } };
@@ -436,6 +419,11 @@ { public: _ATL_CREATORFUNC *m_pfnCreateInstance; + + virtual ~CComClassFactory() + { + } + public: STDMETHOD(CreateInstance)(LPUNKNOWN pUnkOuter, REFIID riid, void **ppvObj) {
Modified: trunk/reactos/lib/atl/statreg.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/atl/statreg.h?rev=58918... ============================================================================== --- trunk/reactos/lib/atl/statreg.h [iso-8859-1] (original) +++ trunk/reactos/lib/atl/statreg.h [iso-8859-1] Sat May 4 08:39:05 2013 @@ -63,6 +63,7 @@
hResult = ClearReplacements(); ATLASSERT(SUCCEEDED(hResult)); + (void)hResult; }
HRESULT STDMETHODCALLTYPE QueryInterface(const IID & /* riid */, void ** /* ppvObject */ )