[commit] r2632 - in trunk/GME: Core Meta Mga
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Fri Apr 15 17:36:28 CDT 2016
Author: ksmyth
Date: Fri Apr 15 17:36:28 2016
New Revision: 2632
Log:
Fixes for _ATL_DEBUG_INTERFACES
Modified:
trunk/GME/Core/Core.cpp
trunk/GME/Core/CoreObject.h
trunk/GME/Core/StdAfx.h
trunk/GME/Meta/MgaMetaBase.cpp
trunk/GME/Meta/StdAfx.h
trunk/GME/Mga/MgaFCO.cpp
trunk/GME/Mga/MgaFCO.h
trunk/GME/Mga/MgaLibRefr.cpp
trunk/GME/Mga/MgaProject.cpp
trunk/GME/Mga/MgaTrukk.h
trunk/GME/Mga/StdAfx.h
Modified: trunk/GME/Core/Core.cpp
==============================================================================
--- trunk/GME/Core/Core.cpp Fri Apr 15 17:36:20 2016 (r2631)
+++ trunk/GME/Core/Core.cpp Fri Apr 15 17:36:28 2016 (r2632)
@@ -382,3 +382,14 @@
}
COMCATCH(;)
}
+
+#ifdef _ATL_DEBUG_INTERFACES
+bool IsQIThunk(IUnknown *p) {
+ // Is p a thunk?
+ // dynamic_cast can't work, since ATL::_QIThunk has no superclass (not even IUnknown)
+ // solution: compare virtual function tables
+ ATL::_QIThunk dummy((IUnknown*)(void*)1, L"dummy", IID_IUnknown, 0, false);
+
+ return *((int**)(void*)p) == *((int**)(void*)&dummy);
+}
+#endif
Modified: trunk/GME/Core/CoreObject.h
==============================================================================
--- trunk/GME/Core/CoreObject.h Fri Apr 15 17:36:20 2016 (r2631)
+++ trunk/GME/Core/CoreObject.h Fri Apr 15 17:36:28 2016 (r2632)
@@ -184,13 +184,10 @@
return pUnk;
}
-inline CCoreObject *CastToObject(IUnknown *p) {
- // Is p a thunk?
- // dynamic_cast can't work, since ATL::_QIThunk has no superclass (not even IUnknown)
- // solution: compare virtual function tables
- ATL::_QIThunk dummy((IUnknown*)(void*)1, L"dummy", IID_IUnknown, 0, false);
+bool IsQIThunk(IUnknown *p);
- if (*((int**)(void*)p) == *((int**)(void*)&dummy))
+inline CCoreObject *CastToObject(IUnknown *p) {
+ if (IsQIThunk(p))
return (CCoreObject*)(ICoreObject*)((ATL::_QIThunk *)(p))->m_pUnk;
else
return (CCoreObject*)(ICoreObject*)p;
Modified: trunk/GME/Core/StdAfx.h
==============================================================================
--- trunk/GME/Core/StdAfx.h Fri Apr 15 17:36:20 2016 (r2631)
+++ trunk/GME/Core/StdAfx.h Fri Apr 15 17:36:28 2016 (r2632)
@@ -5,6 +5,11 @@
#if !defined(AFX_STDAFX_H__9E9AAAD2_28B8_11D3_B36C_0060082DF884__INCLUDED_)
#define AFX_STDAFX_H__9E9AAAD2_28B8_11D3_B36C_0060082DF884__INCLUDED_
+#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS 1
+#ifdef _DEBUG
+// #define _ATL_DEBUG_INTERFACES 1
+#endif
+
#pragma once
#ifndef _SECURE_ATL
Modified: trunk/GME/Meta/MgaMetaBase.cpp
==============================================================================
--- trunk/GME/Meta/MgaMetaBase.cpp Fri Apr 15 17:36:20 2016 (r2631)
+++ trunk/GME/Meta/MgaMetaBase.cpp Fri Apr 15 17:36:28 2016 (r2632)
@@ -45,7 +45,6 @@
#ifdef _ATL_DEBUG_INTERFACES
IUnknown* pUnk = ((ATL::_QIThunk *)(ibase.p))->m_pUnk;
- pUnk = ((ATL::_QIThunk *)(pUnk))->m_pUnk; // this is needed if Core has _ATL_DEBUG_INTERFACES
CMgaMetaBase *base = (CMgaMetaBase *)(IMgaMetaBase*)(pUnk);
#else
CMgaMetaBase *base = static_cast<CMgaMetaBase*>((IMgaMetaBase*)ibase);
Modified: trunk/GME/Meta/StdAfx.h
==============================================================================
--- trunk/GME/Meta/StdAfx.h Fri Apr 15 17:36:20 2016 (r2631)
+++ trunk/GME/Meta/StdAfx.h Fri Apr 15 17:36:28 2016 (r2632)
@@ -5,6 +5,11 @@
#if !defined(AFX_STDAFX_H__0ADEEC74_D83A_11D3_B36B_005004D38590__INCLUDED_)
#define AFX_STDAFX_H__0ADEEC74_D83A_11D3_B36B_005004D38590__INCLUDED_
+#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS 1
+#ifdef _DEBUG
+// #define _ATL_DEBUG_INTERFACES 1
+#endif
+
#pragma once
#ifndef _SECURE_ATL
Modified: trunk/GME/Mga/MgaFCO.cpp
==============================================================================
--- trunk/GME/Mga/MgaFCO.cpp Fri Apr 15 17:36:20 2016 (r2631)
+++ trunk/GME/Mga/MgaFCO.cpp Fri Apr 15 17:36:28 2016 (r2632)
@@ -1276,3 +1276,10 @@
} COMCATCH_IN_TRANSACTION(;)
}
+#ifdef _ATL_DEBUG_INTERFACES
+bool IsQIThunk(IUnknown *p) {
+ ATL::_QIThunk dummy((IUnknown*)(void*)1, L"dummy", IID_IUnknown, 0, false);
+
+ return *((int**)(void*)p) == *((int**)(void*)&dummy);
+}
+#endif
Modified: trunk/GME/Mga/MgaFCO.h
==============================================================================
--- trunk/GME/Mga/MgaFCO.h Fri Apr 15 17:36:20 2016 (r2631)
+++ trunk/GME/Mga/MgaFCO.h Fri Apr 15 17:36:28 2016 (r2632)
@@ -634,6 +634,8 @@
#ifdef _ATL_DEBUG_INTERFACES
+bool IsQIThunk(IUnknown *p);
+
inline FCOPtr ObjForCore(ICoreObject *s) {
#else
inline FCO *ObjForCore(ICoreObject *s) {
@@ -642,6 +644,8 @@
if(!p) COMTHROW(E_MGA_MODULE_INCOMPATIBILITY);
#ifdef _ATL_DEBUG_INTERFACES
IUnknown* pUnk = ((ATL::_QIThunk *)(p.p))->m_pUnk;
+ while (IsQIThunk(pUnk))
+ pUnk = ((ATL::_QIThunk *)(pUnk))->m_pUnk;
return (FCO*)((ATL::CComContainedObject<FCO>*)pUnk);
#else
return (FCO *)(p.p);
Modified: trunk/GME/Mga/MgaLibRefr.cpp
==============================================================================
--- trunk/GME/Mga/MgaLibRefr.cpp Fri Apr 15 17:36:20 2016 (r2631)
+++ trunk/GME/Mga/MgaLibRefr.cpp Fri Apr 15 17:36:28 2016 (r2632)
@@ -422,9 +422,9 @@
CComQIPtr<IMgaConnection> conn( fco);
CComPtr<IMgaFCO> b_fco, d_fco;
- c = ObjForCore( p_base);
+ c = static_cast<FCO *>(ObjForCore( p_base));
if( c) c->getinterface( &b_fco);
- c = ObjForCore( p_derd);
+ c = static_cast<FCO *>(ObjForCore( p_derd));
if( c) c->getinterface( &d_fco);
CComQIPtr<IMgaModel> b_model( b_fco), d_model( d_fco);
if( conn && b_model && d_model)
Modified: trunk/GME/Mga/MgaProject.cpp
==============================================================================
--- trunk/GME/Mga/MgaProject.cpp Fri Apr 15 17:36:20 2016 (r2631)
+++ trunk/GME/Mga/MgaProject.cpp Fri Apr 15 17:36:28 2016 (r2632)
@@ -155,6 +155,8 @@
}
ASSERT(connstr);
COMTHROW(metapr.CoCreateInstance(OLESTR("Mga.MgaMetaProject")));
+ // #ifdef _ATL_DEBUG_INTERFACES
+ // COMTHROW(metapr.CoCreateInstance(OLESTR("Mga.MgaMetaProject"), NULL, CLSCTX_LOCAL_SERVER));
HRESULT hr = metapr->Open(connstr);
if (FAILED(hr))
{
@@ -1938,9 +1940,12 @@
#include <set>
#include "../core/CoreUtilities.h"
-bool std::less<metaobjidpair_type>::operator ()(const metaobjidpair_type &a,const metaobjidpair_type &b) const {
- if(a.metaid == b.metaid) return a.objid < b.objid;
- return a.metaid < b.metaid;
+bool
+#if _MSC_VER >= 1700
+constexpr
+#endif
+std::less<metaobjidpair_type>::operator ()(const metaobjidpair_type &a,const metaobjidpair_type &b) const {
+ return (a.metaid == b.metaid) ? a.objid < b.objid : a.metaid < b.metaid;
}
void ClearLocks(ICoreStorage * storage, std::set<metaobjidpair_type> &mset, short mi, long oi, bool clear) {
Modified: trunk/GME/Mga/MgaTrukk.h
==============================================================================
--- trunk/GME/Mga/MgaTrukk.h Fri Apr 15 17:36:20 2016 (r2631)
+++ trunk/GME/Mga/MgaTrukk.h Fri Apr 15 17:36:28 2016 (r2632)
@@ -117,15 +117,37 @@
struct coreobj_hashfunc : public stdext::hash_compare<CoreObj>
{
- size_t operator()(const CoreObj &ob) const
+#ifndef _ATL_DEBUG_INTERFACES
+ size_t operator()(const CoreObj &ob) const
{
return (size_t)ob.p;
}
- bool operator()(const CoreObj &oba,const CoreObj &obb) const
- {
+ bool operator()(const CoreObj &oba, const CoreObj &obb) const
+ {
// must be < logic, [ implemented based on COM_EQUAL's invokation ]
- return static_cast<IUnknown*>( const_cast<CoreObj&>( oba)) < static_cast<IUnknown*>( const_cast<CoreObj&>( obb));
+ return static_cast<IUnknown*>(const_cast<CoreObj&>(oba)) < static_cast<IUnknown*>(const_cast<CoreObj&>(obb));
+ }
+#else
+ size_t operator()(const CoreObj &ob) const
+ {
+ return (size_t)(IUnknown*)getUnknown(ob);
}
+ bool operator()(const CoreObj &oba, const CoreObj &obb) const
+ {
+ // must be < logic, [ implemented based on COM_EQUAL's invokation ]
+ return static_cast<IUnknown*>(getUnknown(oba)) < static_cast<IUnknown*>(getUnknown(obb));
+ }
+
+ IUnknownPtr getUnknown(const CoreObj &ob) const {
+ auto obj = const_cast<CoreObj&>(ob);
+ if (obj == nullptr) {
+ return nullptr;
+ }
+ IUnknownPtr pUnk;
+ obj->QueryInterface(&pUnk);
+ return pUnk;
+ }
+#endif
};
typedef stdext::hash_map<CoreObj, CoreObj, coreobj_hashfunc> coreobjpairhash;
Modified: trunk/GME/Mga/StdAfx.h
==============================================================================
--- trunk/GME/Mga/StdAfx.h Fri Apr 15 17:36:20 2016 (r2631)
+++ trunk/GME/Mga/StdAfx.h Fri Apr 15 17:36:28 2016 (r2632)
@@ -6,6 +6,10 @@
#if !defined(AFX_STDAFX_H__270B4F89_B17C_11D3_9AD1_00AA00B6FE26__INCLUDED_)
#define AFX_STDAFX_H__270B4F89_B17C_11D3_9AD1_00AA00B6FE26__INCLUDED_
+#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS 1
+#ifdef _DEBUG
+// #define _ATL_DEBUG_INTERFACES 1
+#endif
#pragma warning(3:4701) // Potentially uninitialized local variable 'name' used
More information about the gme-commit
mailing list