[commit] r2433 - trunk/GME/Mga
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Tue Feb 18 16:29:02 CST 2014
Author: ksmyth
Date: Tue Feb 18 16:29:02 2014
New Revision: 2433
Log:
FCO::get_RegistryValue: dont create a Registry only to throw it away
Modified:
trunk/GME/Mga/MgaAttribute.cpp
trunk/GME/Mga/MgaAttribute.h
trunk/GME/Mga/MgaFCO.cpp
Modified: trunk/GME/Mga/MgaAttribute.cpp
==============================================================================
--- trunk/GME/Mga/MgaAttribute.cpp Tue Feb 18 16:28:51 2014 (r2432)
+++ trunk/GME/Mga/MgaAttribute.cpp Tue Feb 18 16:29:02 2014 (r2433)
@@ -634,43 +634,46 @@
}
-STDMETHODIMP CMgaRegNode::get_Value(BSTR *pVal) {
- COMTRY {
- CHECK_OUTVARIANTPAR(pVal);
+void MgaRegNode_get_Value(CMgaProject* mgaproject, FCO * fco, CoreObj s, BSTR mypath, BSTR *pVal)
+{
+ do {
+ CComVariant attr = s[ATTRID_REGNODE];
+ CComPtr<ICoreDictionaryAttributeValue> dict;
+ COMTHROW(attr.pdispVal->QueryInterface(&dict));
+ VARIANT vmap;
+ COMTHROW(dict->get_Map(&vmap));
+ CMgaRegNode::map_type* map = (CMgaRegNode::map_type*)(void*)vmap.llVal;
- CoreObj s = fco->self;
- do {
- CComVariant attr = s[ATTRID_REGNODE];
- CComPtr<ICoreDictionaryAttributeValue> dict;
- COMTHROW(attr.pdispVal->QueryInterface(&dict));
- VARIANT vmap;
- COMTHROW(dict->get_Map(&vmap));
- map_type* map = (map_type*)(void*)vmap.llVal;
-
- map_type::iterator it = map->find(mypath);
- if (it != map->end()) {
- *pVal = CComBSTR(it->second).Detach();
- return S_OK;
- }
- if (!s.IsFCO())
- break;
- } while (s = s[ATTRID_DERIVED]);
-
- metaref_type mref = fco->self[ATTRID_META];
- if(mref) {
- CComQIPtr<IMgaMetaBase> m(mgaproject->FindMetaRef(mref));
- CComPtr<IMgaMetaRegNode> rn;
- HRESULT hr = m->get_RegistryNode(mypath, &rn);
- if(hr == S_OK) {
- COMTHROW(rn->get_Value(pVal));
- return S_OK;
- }
- else if(hr != E_NOTFOUND)
- COMTHROW(hr);
- }
- *pVal = NULL;
+ CMgaRegNode::map_type::iterator it = map->find(mypath);
+ if (it != map->end()) {
+ *pVal = CComBSTR(it->second).Detach();
+ return;
+ }
+ if (!s.IsFCO())
+ break;
+ } while (s = s[ATTRID_DERIVED]);
+
+ metaref_type mref = fco->self[ATTRID_META];
+ if(mref) {
+ CComQIPtr<IMgaMetaBase> m(mgaproject->FindMetaRef(mref));
+ CComPtr<IMgaMetaRegNode> rn;
+ HRESULT hr = m->get_RegistryNode(mypath, &rn);
+ if(hr == S_OK) {
+ COMTHROW(rn->get_Value(pVal));
+ return;
+ }
+ else if(hr != E_NOTFOUND)
+ COMTHROW(hr);
+ }
+ *pVal = NULL;
+}
- } COMCATCH(;)
+STDMETHODIMP CMgaRegNode::get_Value(BSTR *pVal) {
+ COMTRY {
+ CHECK_OUTVARIANTPAR(pVal);
+ CoreObj s = fco->self;
+ MgaRegNode_get_Value(mgaproject, fco, s, mypath, pVal);
+ } COMCATCH(;)
}
STDMETHODIMP CMgaRegNode::get_FCOValue(IMgaFCO **pVal) {
Modified: trunk/GME/Mga/MgaAttribute.h
==============================================================================
--- trunk/GME/Mga/MgaAttribute.h Tue Feb 18 16:28:51 2014 (r2432)
+++ trunk/GME/Mga/MgaAttribute.h Tue Feb 18 16:29:02 2014 (r2433)
@@ -16,6 +16,8 @@
}
};
+void MgaRegNode_get_Value(CMgaProject* mgaproject, FCO * fco, CoreObj s, BSTR mypath, BSTR *pVal);
+
/////////////////////////////////////////////////////////////////////////////
// CMgaAttribute
class ATL_NO_VTABLE CMgaAttribute :
Modified: trunk/GME/Mga/MgaFCO.cpp
==============================================================================
--- trunk/GME/Mga/MgaFCO.cpp Tue Feb 18 16:28:51 2014 (r2432)
+++ trunk/GME/Mga/MgaFCO.cpp Tue Feb 18 16:29:02 2014 (r2433)
@@ -823,11 +823,10 @@
} COMCATCH(;);
}
HRESULT FCO::get_RegistryValue( BSTR path, BSTR *pVal) {
- COMTRY { // no arg check, called methods will do that
+ COMTRY {
CheckRead();
- CComPtr<IMgaRegNode> node;
- COMTHROW(get_RegistryNode(path, &node));
- COMTHROW(node->get_Value(pVal));
+ CHECK_OUTVARIANTPAR(pVal);
+ MgaRegNode_get_Value(mgaproject, this, self, path, pVal);
} COMCATCH(;)
}
HRESULT FCO::put_RegistryValue( BSTR path, BSTR newval) {
More information about the gme-commit
mailing list