[commit] r1687 - in trunk/GME: Common ConstraintManager Core GMEActiveBrowser Gme Meta Mga MgaUtil ObjectInspector Parser Search

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Tue Nov 15 13:34:02 CST 2011


Author: ksmyth
Date: Tue Nov 15 13:34:02 2011
New Revision: 1687

Log:
COMTHROW BSTR append, other COM methods. /analyze fixes

Modified:
   trunk/GME/Common/CommonError.cpp
   trunk/GME/Common/CommonSmart.cpp
   trunk/GME/Common/CommonSmart.h
   trunk/GME/Common/CommonStl.h
   trunk/GME/ConstraintManager/GMEViolationDialog.cpp
   trunk/GME/Core/CoreAttribute.cpp
   trunk/GME/Core/CoreBinFile.cpp
   trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.cpp
   trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.cpp
   trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.cpp
   trunk/GME/GMEActiveBrowser/InheritanceTreeCtrl.cpp
   trunk/GME/GMEActiveBrowser/MgaContext.h
   trunk/GME/GMEActiveBrowser/MgaMap.cpp
   trunk/GME/Gme/GMEOLEData.cpp
   trunk/GME/Gme/GMEOLEIt.cpp
   trunk/GME/Meta/MetaUtilities.cpp
   trunk/GME/Meta/MetaUtilities.h
   trunk/GME/Mga/MgaAttribute.cpp
   trunk/GME/Mga/MgaCheck.cpp
   trunk/GME/Mga/MgaFCO.cpp
   trunk/GME/Mga/MgaFolder.cpp
   trunk/GME/Mga/MgaLibOps.cpp
   trunk/GME/Mga/MgaLibOps.h
   trunk/GME/Mga/MgaLibRefr.cpp
   trunk/GME/Mga/MgaLibRefr.h
   trunk/GME/Mga/MgaProject.cpp
   trunk/GME/Mga/MgaTerritory.cpp
   trunk/GME/MgaUtil/CompDlg.cpp
   trunk/GME/MgaUtil/MakeClosure.cpp
   trunk/GME/MgaUtil/MgaRegistrar.cpp
   trunk/GME/MgaUtil/MgaResolver.cpp
   trunk/GME/ObjectInspector/InPlaceManager.cpp
   trunk/GME/ObjectInspector/ObjectInspectorCtl.cpp
   trunk/GME/ObjectInspector/Preference.cpp
   trunk/GME/Parser/GUIDCreate.cpp
   trunk/GME/Parser/Helper.cpp
   trunk/GME/Parser/MgaDumper.cpp
   trunk/GME/Parser/MgaParser.cpp
   trunk/GME/Parser/MgaParserBC.cpp
   trunk/GME/Parser/MgaParserClosureHelper.cpp
   trunk/GME/Parser/MgaParserSC.cpp
   trunk/GME/Search/SearchAlg.cpp
   trunk/GME/Search/SearchCtl.cpp

Modified: trunk/GME/Common/CommonError.cpp
==============================================================================
--- trunk/GME/Common/CommonError.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Common/CommonError.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -144,9 +144,9 @@
 	{
 		CComBSTR d(desc);
 		if( desc != NULL )
-			d.Append(OLESTR(" :"));
+			COMTHROW(d.Append(L" :"));
 
-		d.Append(desc2);
+		COMTHROW(d.Append(desc2));
 		SetErrorInfo(d);
 	}
 }

Modified: trunk/GME/Common/CommonSmart.cpp
==============================================================================
--- trunk/GME/Common/CommonSmart.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Common/CommonSmart.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -105,6 +105,8 @@
 	
 	*p = SysAllocString(q);
 	CoTaskMemFree(q);
+	if (*p == NULL)
+		HR_THROW(E_OUTOFMEMORY);
 }
 
 // --------------------------- CComSafeArray
@@ -529,6 +531,11 @@
 
 	v->bstrVal = SysAllocStringLen(b, SysStringLen(b));
 	v->vt = VT_BSTR;
+	if (v->bstrVal == NULL && b != NULL)
+	{
+		v->vt = VT_EMPTY;
+		COMTHROW(E_OUTOFMEMORY);
+	}
 }
 
 void CopyTo(IDispatch *p, VARIANT *v)
@@ -627,7 +634,11 @@
 	}
 
 	if( v.vt == VT_BSTR )
+	{
 		*a = SysAllocStringLen(v.bstrVal, SysStringLen(v.bstrVal));
+		if (*a == NULL && v.bstrVal != NULL)
+			COMTHROW(E_OUTOFMEMORY);
+	}
 	else if( v.vt != VT_EMPTY )
 	{
 		CComVariant w;

Modified: trunk/GME/Common/CommonSmart.h
==============================================================================
--- trunk/GME/Common/CommonSmart.h	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Common/CommonSmart.h	Tue Nov 15 13:34:02 2011	(r1687)
@@ -189,8 +189,11 @@
 {
 	ASSERT( q != NULL );
 
-	if(*q) SysFreeString(*q);
+	if (*q)
+		SysFreeString(*q);
 	*q = SysAllocStringLen(p, SysStringLen(p));
+	if (*q == NULL && p != NULL)
+		COMTHROW(E_OUTOFMEMORY);
 }
 
 inline void CopyTo(const CComBstrObj &b, BSTR *q) { CopyTo(b.p, q); }

Modified: trunk/GME/Common/CommonStl.h
==============================================================================
--- trunk/GME/Common/CommonStl.h	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Common/CommonStl.h	Tue Nov 15 13:34:02 2011	(r1687)
@@ -33,6 +33,8 @@
 {
 	int l = GetCharLength(b);
 	char *tmp = (char*)malloc(l);
+	if (tmp == NULL)
+		COMTHROW(E_OUTOFMEMORY);
 	CopyTo(b, tmp, l);
 	s.assign(tmp, l);
 	free(tmp);
@@ -42,6 +44,8 @@
 {
 	int l = GetCharLength(v);
 	char *tmp = (char*)malloc(l);
+	if (tmp == NULL)
+		COMTHROW(E_OUTOFMEMORY);
 	CopyTo(v, tmp, l);
 	s.assign(tmp, l);
 	free(tmp);
@@ -75,7 +79,11 @@
 inline void CopyTo(bstr_const_iterator i, bstr_const_iterator e, CComBstrObj &b)
 {
 	ASSERT( i <= e );
-	b.Attach(SysAllocStringLen(i, e - i));
+	BSTR tmpb = SysAllocStringLen(i, e - i);
+	if (tmpb == NULL)
+		COMTHROW(E_OUTOFMEMORY);
+
+	b.Attach(tmpb);
 }
 
 // --------------------------- bindata

Modified: trunk/GME/ConstraintManager/GMEViolationDialog.cpp
==============================================================================
--- trunk/GME/ConstraintManager/GMEViolationDialog.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/ConstraintManager/GMEViolationDialog.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -437,12 +437,12 @@
 				CComBSTR bstr, id, nm;
 				COMTHROW( fco->get_ID( &id));
 				COMTHROW( fco->get_Name( &nm));
-				bstr.Append(_T("Constraint Violation: <A HREF=\"mga:"));
-				bstr.AppendBSTR( id);
-				bstr.Append(_T("\">"));
-				bstr.AppendBSTR( nm);
-				bstr.Append(_T("</A>: "));
-				bstr.Append(item.spConstraint.Ptr()->GetMessage().c_str());
+				COMTHROW(bstr.Append(_T("Constraint Violation: <A HREF=\"mga:")));
+				COMTHROW(bstr.AppendBSTR( id));
+				COMTHROW(bstr.Append(_T("\">")));
+				COMTHROW(bstr.AppendBSTR( nm));
+				COMTHROW(bstr.Append(_T("</A>: ")));
+				COMTHROW(bstr.Append(item.spConstraint.Ptr()->GetMessage().c_str()));
 				COMTHROW(m_oleapp->ConsoleMessage(bstr, MSG_ERROR));
 			}
 			catch(hresult_exception &)// in case the constraint is not attached to any fco in the metamodel

Modified: trunk/GME/Core/CoreAttribute.cpp
==============================================================================
--- trunk/GME/Core/CoreAttribute.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Core/CoreAttribute.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -1538,7 +1538,7 @@
 			// lph: Return last committed value.  Previously returned last set value (commented below).
 			ICoreStorage *storage = SetStorageThisAttribute();
 			ASSERT( storage != NULL );
-			storage->get_AttributeValue(p);
+			COMTHROW(storage->get_AttributeValue(p));
 
 			//ASSERT( values.size() >= 2 );
 			//UserCopyTo(*(++values.begin()), p);

Modified: trunk/GME/Core/CoreBinFile.cpp
==============================================================================
--- trunk/GME/Core/CoreBinFile.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Core/CoreBinFile.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -375,7 +375,7 @@
 	ASSERT( metaproject != NULL );
 
 	CComVariant tmp;
-	metaproject->get_GUID(PutOut(tmp));
+	COMTHROW(metaproject->get_GUID(PutOut(tmp)));
 	CopyTo(tmp, metaprojectid);
 }
 

Modified: trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.cpp
==============================================================================
--- trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -352,7 +352,7 @@
 
 	// Setting Project name
 	CComBSTR bszProjectName;
-	pMgaContext->m_ccpProject->get_Name(&bszProjectName);
+	COMTHROW(pMgaContext->m_ccpProject->get_Name(&bszProjectName));
 	m_strProjectName=bszProjectName;
 
 	// Getting RootFolder
@@ -867,7 +867,7 @@
 					rectSelectedList.AddTail(new CRect( rectItem));
 
 					// Append to the selected FCO list
-					ccpSelectedFCOs->Append( ccpMgaFCO);
+					COMTHROW(ccpSelectedFCOs->Append( ccpMgaFCO));
 				}
 			}
 			else if ( ObjectProxy.m_TypeInfo == OBJTYPE_FOLDER )
@@ -884,7 +884,7 @@
 					rectSelectedList.AddTail( new CRect( rectItem));
 
 					// Append to the selected FCO list
-					ccpSelectedFolders->Append( ccpMgaFolder);
+					COMTHROW(ccpSelectedFolders->Append( ccpMgaFolder));
 				}
 			}
 		}		
@@ -952,7 +952,7 @@
 					rectSelectedList.AddTail( new CRect( rectItem));
 					
 					// Append to the selected FCO list
-					ccpSelectedFCOs->Append( ccpMgaFCO);
+					COMTHROW(ccpSelectedFCOs->Append( ccpMgaFCO));
 				}
 			}
 			else if ( ObjectProxy.m_TypeInfo == OBJTYPE_FOLDER )
@@ -970,7 +970,7 @@
 						rectSelectedList.AddTail( new CRect( rectItem));
 						
 						// Append to the selected FCO list
-						ccpSelectedFolders->Append( ccpMgaFolder);
+						COMTHROW(ccpSelectedFolders->Append( ccpMgaFolder));
 						is_any_folder_selected = true;
 					}
 				}
@@ -1179,7 +1179,7 @@
 					rectSelectedList.AddTail( new CRect( rectItem));
 					
 					// Append to the selected FCO list
-					ccpSelectedFCOs->Append( ccpMgaFCO);
+					COMTHROW(ccpSelectedFCOs->Append( ccpMgaFCO));
 				}
 			}
 			else if ( ObjectProxy.m_TypeInfo == OBJTYPE_FOLDER )
@@ -1197,7 +1197,7 @@
 						rectSelectedList.AddTail( new CRect( rectItem));
 						
 						// Append to the selected FCO list
-						ccpSelectedFolders->Append( ccpMgaFolder);
+						COMTHROW(ccpSelectedFolders->Append( ccpMgaFolder));
 						is_any_folder_selected = true;
 					}
 				}
@@ -1320,7 +1320,7 @@
 					rectSelectedList.AddTail(new CRect(rectItem));
 					
 					// Append to the selected FCO list
-					ccpSelectedFCOs->Append(ccpMgaFCO);
+					COMTHROW(ccpSelectedFCOs->Append(ccpMgaFCO));
 				}
 			}
 			else if ( ObjectProxy.m_TypeInfo == OBJTYPE_FOLDER )
@@ -1337,7 +1337,7 @@
 					rectSelectedList.AddTail( new CRect( rectItem));
 
 					// Append to the selected FCO list
-					ccpSelectedFolders->Append( ccpMgaFolder);
+					COMTHROW(ccpSelectedFolders->Append( ccpMgaFolder));
 				}
 			}
 			else
@@ -1595,7 +1595,8 @@
 					}
 
 					CComBSTR msg( L"Library attached: ");
-					msg.Append( dlg.m_strConnString); msg.Append( L" (Note: Constraint Manager was turned off during attach to speed it up.)");
+					COMTHROW(msg.Append( dlg.m_strConnString));
+					COMTHROW(msg.Append( L" (Note: Constraint Manager was turned off during attach to speed it up.)"));
 					Utils::put2Console( Utils::get_GME( pMgaContext->m_ccpProject)
 						, msg
 						, MSG_INFO);
@@ -1763,7 +1764,7 @@
 	if( IDYES == AfxMessageBox( deps, MB_YESNO))
 	{
 		//p_ccpFolder->PutReadOnlyAccess( VARIANT_FALSE);
-		p_ccpFolder->DestroyObject();
+		COMTHROW(p_ccpFolder->DestroyObject());
 		return true;
 	}
 
@@ -2310,7 +2311,7 @@
 			pMgaContext->BeginTransaction();
 			CComPtr<IMgaProject> project = pMgaContext->m_ccpProject;
 			COMTHROW(project->GetFCOByID(bId, &fiitem));
-			fiitem.QueryInterface(&iitem);
+			COMTHROW(fiitem.QueryInterface(&iitem));
 			item.push_back(Id);
 			itemcount++;
 			do
@@ -2551,7 +2552,7 @@
 				CMgaContext* pMgaContext=&pApp->m_CurrentProject.m_MgaContext;
 				
 				short nRedoSize,nUndoSize;
-				pMgaContext->m_ccpProject->UndoRedoSize(&nUndoSize,&nRedoSize);
+				COMTHROW(pMgaContext->m_ccpProject->UndoRedoSize(&nUndoSize,&nRedoSize));
 
 				if( nRedoSize > 0)
 				{
@@ -2567,7 +2568,7 @@
 				CMgaContext* pMgaContext=&pApp->m_CurrentProject.m_MgaContext;
 				
 				short nRedoSize,nUndoSize;
-				pMgaContext->m_ccpProject->UndoRedoSize(&nUndoSize,&nRedoSize);
+				COMTHROW(pMgaContext->m_ccpProject->UndoRedoSize(&nUndoSize,&nRedoSize));
 
 				if( nUndoSize > 0)
 				{
@@ -4091,13 +4092,14 @@
 			{
 				if( it->second.size() > 1) // duplicates found
 				{
-					if( msg.Length() > 0) msg.Append( _T("\n\n"));
-					msg.AppendBSTR( it->first);
-					msg.Append( _T("\nShared by multiple toplevel libraries:"));
+					if (msg.Length() > 0)
+						COMTHROW(msg.Append( _T("\n\n")));
+					COMTHROW(msg.AppendBSTR( it->first));
+					COMTHROW(msg.Append( _T("\nShared by multiple toplevel libraries:")));
 					for( unsigned int i = 0; i < it->second.size(); ++i)
 					{
-						msg.Append( _T("\n\t"));
-						msg.AppendBSTR( it->second[i]);
+						COMTHROW(msg.Append( _T("\n\t")));
+						COMTHROW(msg.AppendBSTR( it->second[i]));
 					}
 				}
 			}

Modified: trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.cpp
==============================================================================
--- trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -277,7 +277,7 @@
 			if(ccpMgaObject) // succesful conversion
 			{
 				CComBSTR IDObj;
-				ccpMgaObject->get_ID(&IDObj);
+				COMTHROW(ccpMgaObject->get_ID(&IDObj));
 
 				// Get Object id and item state in the registry
 				CString strID(IDObj);				
@@ -377,7 +377,7 @@
 			if(ccpMgaObject) // succesful conversion
 			{
 				CComBSTR IDObj;
-				ccpMgaObject->get_ID(&IDObj);
+				COMTHROW(ccpMgaObject->get_ID(&IDObj));
 
 				// Put Object id and item state in the registry
 				CString strID(IDObj);
@@ -441,7 +441,7 @@
 			if(ccpMgaObject) // succesful conversion
 			{
 				CComBSTR IDObj;
-				ccpMgaObject->get_ID(&IDObj);
+				COMTHROW(ccpMgaObject->get_ID(&IDObj));
 
 				// Put Object id and item state in the buffer
 				CString strID(IDObj);
@@ -499,7 +499,7 @@
 			if(ccpMgaObject) // succesful conversion
 			{
 				CComBSTR IDObj;
-				ccpMgaObject->get_ID(&IDObj);
+				COMTHROW(ccpMgaObject->get_ID(&IDObj));
 
 				// Get Object id and item state from the map
 				CString strID(IDObj);
@@ -926,8 +926,8 @@
 							{
 								CComBSTR msg( L"Object '"), nm;
 								COMTHROW( MGACOLL_ITER->get_Name( &nm));
-								msg.Append( nm);
-								msg.Append( _T("' could not be derived. Some of its ancestors or descendants may be already derived! [Error code E_MGA_NOT_DERIVABLE]"));
+								COMTHROW(msg.Append( nm));
+								COMTHROW(msg.Append( _T("' could not be derived. Some of its ancestors or descendants may be already derived! [Error code E_MGA_NOT_DERIVABLE]")));
 								Utils::put2Console( Utils::get_GME( pMgaContext->m_ccpProject), msg, MSG_ERROR);
 									pMgaContext->AbortTransaction();//COMTHROW( hr);
 								return FALSE;//break; // although it was inside a MGACOLL_ITERATE, we aborted the trans
@@ -951,8 +951,8 @@
 							{
 								CComBSTR msg( L"Object '"), nm;
 								COMTHROW( MGACOLL_ITER->get_Name( &nm));
-								msg.Append( nm);
-								msg.Append( L"' could not be derived. Some of its ancestors or descendants may be already derived! [Error code E_MGA_NOT_DERIVABLE]");
+								COMTHROW(msg.Append( nm));
+								COMTHROW(msg.Append( L"' could not be derived. Some of its ancestors or descendants may be already derived! [Error code E_MGA_NOT_DERIVABLE]"));
 								Utils::put2Console( Utils::get_GME( pMgaContext->m_ccpProject), msg, MSG_ERROR);
 									pMgaContext->AbortTransaction();//COMTHROW( hr);
 								return FALSE;//break; // although it was inside a MGACOLL_ITERATE, we aborted the trans
@@ -1169,8 +1169,8 @@
 								{
 									CComBSTR msg( L"Object '"), nm;
 									COMTHROW( ccpFCO->get_Name( &nm));
-									msg.Append( nm);
-									msg.Append( L"' could not be derived. Some of its ancestors or descendants may be already derived! [Error code E_MGA_NOT_DERIVABLE]");
+									COMTHROW(msg.Append( nm));
+									COMTHROW(msg.Append( L"' could not be derived. Some of its ancestors or descendants may be already derived! [Error code E_MGA_NOT_DERIVABLE]"));
 									Utils::put2Console( Utils::get_GME( pMgaContext->m_ccpProject), msg, MSG_ERROR);
 
 									pMgaContext->AbortTransaction();//COMTHROW( hr);

Modified: trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.cpp
==============================================================================
--- trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -379,7 +379,7 @@
 			CComQIPtr<IMgaObject> ccpMgaObject(pUnknown);
 			
 			ASSERT(ccpMgaObject!=NULL);
-			ccpSelectedObjects->Append(ccpMgaObject);
+			COMTHROW(ccpSelectedObjects->Append(ccpMgaObject));
 
 			hItem=pTreeCtrl->GetNextSelectedItem(hItem);
 		}
@@ -387,7 +387,7 @@
 
 		pMgaContext->CommitTransaction();
 	}
-	catch (hresult_exception)
+	catch (hresult_exception& )
 	{
 		pMgaContext->AbortTransaction();
 	}

Modified: trunk/GME/GMEActiveBrowser/InheritanceTreeCtrl.cpp
==============================================================================
--- trunk/GME/GMEActiveBrowser/InheritanceTreeCtrl.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/GMEActiveBrowser/InheritanceTreeCtrl.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -159,7 +159,7 @@
 			if(ccpMgaObject) // succesful conversion
 			{
 				CComBSTR IDObj;
-				ccpMgaObject->get_ID(&IDObj);
+				COMTHROW(ccpMgaObject->get_ID(&IDObj));
 
 				// Put Object id and item state in the buffer
 				CString strID(IDObj);
@@ -217,7 +217,7 @@
 			if(ccpMgaObject) // succesful conversion
 			{
 				CComBSTR IDObj;
-				ccpMgaObject->get_ID(&IDObj);
+				COMTHROW(ccpMgaObject->get_ID(&IDObj));
 
 				// Get Object id and item state from the map
 				CString strID(IDObj);

Modified: trunk/GME/GMEActiveBrowser/MgaContext.h
==============================================================================
--- trunk/GME/GMEActiveBrowser/MgaContext.h	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/GMEActiveBrowser/MgaContext.h	Tue Nov 15 13:34:02 2011	(r1687)
@@ -65,7 +65,8 @@
 
 	static void put2Console( CComPtr<IGMEOLEApp> gme, CComBSTR msg, msgtype_enum typ)
 	{
-		if(gme) gme->ConsoleMessage( msg, typ);
+		if(gme)
+			gme->ConsoleMessage( msg, typ);
 	}
 };
 

Modified: trunk/GME/GMEActiveBrowser/MgaMap.cpp
==============================================================================
--- trunk/GME/GMEActiveBrowser/MgaMap.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/GMEActiveBrowser/MgaMap.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -193,9 +193,8 @@
 	  IUnknownPtr punkptr(nKey);
 
 	  punk = punkptr;
-	  BSTR oid = NULL;
-	  mgao->get_ID(&oid);
-	  _bstr_t boid(oid, false);
+	  _bstr_t boid;
+	  COMTHROW(mgao->get_ID(boid.GetAddress()));
 	  _bstr_t bid = Id;
 	  if (bid == boid)
 	  {

Modified: trunk/GME/Gme/GMEOLEData.cpp
==============================================================================
--- trunk/GME/Gme/GMEOLEData.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Gme/GMEOLEData.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -280,31 +280,31 @@
 		CComPtr<IGMEOLEApp> t_GME = CGMEDataSource::get_GME( t_project);
 		
 		CComBSTR msg, done;
-		done.Append(_T("Done."));
+		COMTHROW(done.Append(_T("Done.")));
 		if( ver == _T("0"))
 		{
-			msg.Append(_T("Inserting XML data..."));
+			COMTHROW(msg.Append(_T("Inserting XML data...")));
 			if( t_GME) COMTHROW( t_GME->ConsoleMessage( msg, MSG_INFO));
 			COMTHROW( parser->ParseFCOs(target, PutInBstr(filename)) );
 			if( t_GME) COMTHROW( t_GME->ConsoleMessage( done, MSG_INFO));
 		}
 		else if( ver == _T("4"))
 		{
-			msg.Append(_T("Inserting XML SmartCopied data..."));
+			COMTHROW(msg.Append(_T("Inserting XML SmartCopied data...")));
 			if( t_GME) COMTHROW( t_GME->ConsoleMessage( msg, MSG_INFO));
 			COMTHROW( parser->ParseClos4( target, PutInBstr(filename), merge?MERGE:ADDITION ));
 			if( t_GME) COMTHROW( t_GME->ConsoleMessage( done, MSG_INFO));
 		}
 		else if ( ver == _T("1") || ver == _T(""))
 		{
-			msg.Append(_T("Inserting XML CopyClosured data..."));
+			COMTHROW(msg.Append(_T("Inserting XML CopyClosured data...")));
 			if( t_GME) COMTHROW( t_GME->ConsoleMessage( msg, MSG_INFO));
 			COMTHROW( parser->ParseClos1(target, PutInBstr(filename)) );
 			if( t_GME) COMTHROW( t_GME->ConsoleMessage( done, MSG_INFO));
 		}
 		else
 		{
-			msg.Append(_T("Error: Unknown clipboard closure format"));
+			COMTHROW(msg.Append(_T("Error: Unknown clipboard closure format")));
 			if( t_GME) COMTHROW( t_GME->ConsoleMessage( msg, MSG_INFO));
 
 			ASSERT(0);
@@ -656,7 +656,7 @@
 {
 	CComPtr<IDispatch> p;
 	if( project != NULL ) {
-		project.QueryInterface(&p);
+		COMTHROW(project.QueryInterface(&p));
 	}
 
 	return p.Detach();

Modified: trunk/GME/Gme/GMEOLEIt.cpp
==============================================================================
--- trunk/GME/Gme/GMEOLEIt.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Gme/GMEOLEIt.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -271,10 +271,10 @@
 	CComBSTR to_connect_as_src = roleNameOf( p_srcRole1);
 	CComBSTR to_connect_as_dst = roleNameOf( p_dstRole1);
 
-	to_connect_as_src.Append(_T(" "));
-	to_connect_as_src.AppendBSTR( roleNameOf( p_srcRole2)); // now we have a path like: "model port" composed of roles
-	to_connect_as_dst.Append(_T(" "));
-	to_connect_as_dst.AppendBSTR( roleNameOf( p_dstRole2));
+	COMTHROW(to_connect_as_src.Append(_T(" ")));
+	COMTHROW(to_connect_as_src.AppendBSTR( roleNameOf( p_srcRole2))); // now we have a path like: "model port" composed of roles
+	COMTHROW(to_connect_as_dst.Append(_T(" ")));
+	COMTHROW(to_connect_as_dst.AppendBSTR( roleNameOf( p_dstRole2)));
 
 	return connMetaRolePtrInBetween( p_model, to_connect_as_src, to_connect_as_dst);
 }
@@ -2679,8 +2679,9 @@
 				CComBSTR nm;
 				COMTHROW( tfco->get_Name( &nm));
 				TRACE( _T("setselectedFCO input collection: %s"), nm);
-				if( !string_res.Length() == 0) string_res.Append(_T(" "));
-				string_res.AppendBSTR( nm);
+				if (!string_res.Length() == 0) 
+					COMTHROW(string_res.Append(_T(" ")));
+				COMTHROW(string_res.AppendBSTR( nm));
 			}
 		}
 	}

Modified: trunk/GME/Meta/MetaUtilities.cpp
==============================================================================
--- trunk/GME/Meta/MetaUtilities.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Meta/MetaUtilities.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -381,7 +381,7 @@
 	if( nmspc && nmspc.Length() > 0) // some namespace is set
 	{
 		bool nm_match = false;
-		nmspc.Append( L"::");
+		COMTHROW(nmspc.Append( L"::"));
 		unsigned int nms_len = nmspc.Length();
 		unsigned int pin_len = pIn.Length();
 		if( nms_len < pin_len
@@ -390,7 +390,7 @@
 			unsigned int i = nms_len;
 			while( i < pin_len)
 			{
-				truncated_name.Append( pIn[i]);
+				COMTHROW(truncated_name.Append( pIn[i]));
 				++i;
 			}
 

Modified: trunk/GME/Meta/MetaUtilities.h
==============================================================================
--- trunk/GME/Meta/MetaUtilities.h	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Meta/MetaUtilities.h	Tue Nov 15 13:34:02 2011	(r1687)
@@ -531,9 +531,9 @@
 		else if( m_nmspc.Length() > 0)
 		{
 			CComBSTR longername;
-			longername.AppendBSTR( m_nmspc);
-			longername.Append( _T("::"));
-			longername.AppendBSTR( pUnknownFormat);
+			COMTHROW(longername.AppendBSTR( m_nmspc));
+			COMTHROW(longername.Append( _T("::")));
+			COMTHROW(longername.AppendBSTR( pUnknownFormat));
 			return pFullNmInParadigm == longername;
 		}
 		else

Modified: trunk/GME/Mga/MgaAttribute.cpp
==============================================================================
--- trunk/GME/Mga/MgaAttribute.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Mga/MgaAttribute.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -165,9 +165,10 @@
 				CComQIPtr<IMgaMetaAttribute> ma(mgaproject->FindMetaRef(mref));
 				CComBSTR name;
 				COMTHROW(ma->get_Name(&name));
-				CComBSTR desc = "ATTR,";
-				desc.Append(name);
-				desc.Append(",Cleared");
+				CComBSTR desc = L"ATTR,";
+				COMTHROW(desc.Append(name));
+				COMTHROW(desc.Append(L",Cleared"));
+				// FIXME: COMTHROW?
 				fco->PreNotify(OBJEVENT_PRE_STATUS, CComVariant(desc));
 				//---------------------------------------------------------------------------------------
 				COMTHROW(ITER->Delete());
@@ -205,9 +206,9 @@
 					CComQIPtr<IMgaMetaAttribute> ma(mgaproject->FindMetaRef(mref));
 					CComBSTR name;
 					COMTHROW(ma->get_Name(&name));
-					CComBSTR desc = "ATTR,";
-					desc.Append(name);
-					desc.Append(",Defined");
+					CComBSTR desc = L"ATTR,";
+					COMTHROW(desc.Append(name));
+					COMTHROW(desc.Append(L",Defined"));
 					fco->PreNotify(OBJEVENT_PRE_STATUS, CComVariant(desc));
 					//-----------------------------------------------------------------------------------------
 					valueobj[ATTRID_META]=mref;
@@ -385,7 +386,7 @@
 			CHECK_INSTRPAR(path);
       
 			CComBSTR xpath(regprefix);
-			xpath.Append("/");
+			COMTHROW(xpath.Append(L"/"));
 			COMTHROW(xpath.AppendBSTR(path));
 			COMTHROW(fco->get_RegistryNode(xpath, pVal));
 		} COMCATCH(;)
@@ -745,7 +746,7 @@
 
 				ITERATE_THROUGH(children) {
 					CComBSTR subpath(mypath);
-					subpath.Append("/");
+					COMTHROW(subpath.Append(L"/"));
 					CComBSTR path = ITER[ATTRID_NAME];
 					COMTHROW(subpath.Append(path));
 					if(virtuals) {
@@ -769,7 +770,7 @@
 							COMTHROW(MGACOLL_ITER->get_Name(&path));
 							if(match.find(path) != match.end()) continue;
 							CComBSTR subpath(mypath);
-							subpath.Append("/");
+							COMTHROW(subpath.Append("/"));
 							COMTHROW(subpath.Append(path));
 							q->Add(fco->rpool.getpoolobj(subpath, fco, mgaproject));
 						} MGACOLL_ITERATE_END;
@@ -787,7 +788,7 @@
 			CHECK_INSTRPAR(name);
       
 			CComBSTR xpath(mypath);
-			xpath.Append("/");
+			COMTHROW(xpath.Append(L"/"));
 			COMTHROW(xpath.AppendBSTR(name));
 			COMTHROW(fco->get_RegistryNode(xpath, pVal));
 		} COMCATCH(;)
@@ -838,9 +839,9 @@
 			valueobj <<= findregvalueobj(fco->self, mypath, dummy, false);
 			if(valueobj) {
 				// lph: Pre-Notification PRE_STATUS (the registry node is being destroyed)
-				CComBSTR desc = "REGISTRY,";
-				desc.Append(mypath);
-				desc.Append(",Removed");
+				CComBSTR desc = L"REGISTRY,";
+				COMTHROW(desc.Append(mypath));
+				COMTHROW(desc.Append(L",Removed"));
 				fco->PreNotify(OBJEVENT_PRE_STATUS, CComVariant(desc));
 				//--------------------------------------------------------------------------
 				RegistryChildrenRemove(valueobj);
@@ -957,7 +958,7 @@
 			CHECK_INSTRPAR(path);
       
 			CComBSTR xpath(regprefix);
-			xpath.Append("/");
+			COMTHROW(xpath.Append(L"/"));
 			COMTHROW(xpath.AppendBSTR(path));
 			COMTHROW(fco->get_RegistryNode(xpath, pVal));
 		} COMCATCH(;)

Modified: trunk/GME/Mga/MgaCheck.cpp
==============================================================================
--- trunk/GME/Mga/MgaCheck.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Mga/MgaCheck.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -358,11 +358,11 @@
 						get_relmetapath(end, relpath2, curp);
 						COMTHROW(relpath2.Append(", FCO name: "));
 						CComBSTR fcoName;
-						endfco->get_Name(&fcoName);
+						COMTHROW(endfco->get_Name(&fcoName));
 						COMTHROW(relpath2.Append(fcoName));
 						COMTHROW(relpath2.Append(", FCO ID: "));
 						CComBSTR fcoID;
-						endfco->get_ID(&fcoID);
+						COMTHROW(endfco->get_ID(&fcoID));
 						COMTHROW(relpath2.Append(fcoID));
 						separator2 = "\n";
 					}

Modified: trunk/GME/Mga/MgaFCO.cpp
==============================================================================
--- trunk/GME/Mga/MgaFCO.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Mga/MgaFCO.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -252,7 +252,8 @@
 			par = self[ATTRID_PARENT];
 			if(par.GetMetaID() != DTID_ROOT) {
 				ObjForCore(par)->getinterface(&pv);
-				if(l != NULL) pv->get_ObjType(l);
+				if (l != NULL)
+					COMTHROW(pv->get_ObjType(l));
 				if(pVal != NULL) {
 					*pVal = pv.Detach();
 					COMTHROW((*pVal)->Open());
@@ -423,7 +424,8 @@
 					CComBSTR n = ITER[ATTRID_NAME];
 					if(!wcsncmp(nname, n, len)) {
 						unsigned int f = 0;
-						if(n.Length() == len) f = 1;
+						if (n.Length() == len)
+							f = 1;
 						else {
 							swscanf(n+len,L"-%d", &f);
 							f++;
@@ -436,7 +438,7 @@
 			if(freenum) {
 				OLECHAR p[10];
 				swprintf(p, 10, L"-%d",freenum);
-				nname.Append(p);
+				COMTHROW(nname.Append(p));
 			}
 		}
 		self[ATTRID_NAME] = nname;
@@ -491,20 +493,21 @@
 		while( !par.IsRootFolder())
 		{
 			CComBSTR tp("/@");
-			tp.Append( cur[ATTRID_NAME]);
+			COMTHROW(tp.Append( cur[ATTRID_NAME]));
 
-			tp.Append("|kind=");
+			COMTHROW(tp.Append("|kind="));
 			CComBSTR metakind;
 			COMTHROW( mgaproject->FindMetaRef( cur[ATTRID_META])->get_Name( &metakind));
-			tp.Append( metakind);
+			COMTHROW(tp.Append( metakind));
 
 			int n;
 			giveme( mgaproject, par, cur, metakind, &n);
 			char p[10]; sprintf( p, "%d", n);
 			CComBSTR relative_pos;
-			tp.Append("|relpos=");tp.Append( p);
+			COMTHROW(tp.Append("|relpos="));
+			COMTHROW(tp.Append( p));
 
-			tp.Append( path);
+			COMTHROW(tp.Append( path));
 			path = tp;
 			cur = par;
 			par = par[ATTRID_PARENT];
@@ -849,7 +852,7 @@
 	COMTHROW(cobj->get_PreviousAttrValue(ATTRID_REGNODEVALUE, &previous));
 	if (previous != current) {
 		CComBSTR label = "REGISTRY:";
-		label.Append(path);
+		COMTHROW(label.Append(path));
 		CComVariant ident = label;
 		mv.push_back(ident);
 		mv.push_back(previous);
@@ -857,13 +860,14 @@
 	ITERATE_THROUGH(cobj[ATTRID_REGNOWNER+ATTRID_COLLECTION]) {
 		CComBSTR cname = ITER[ATTRID_NAME];
 		CComBSTR cpath = path;
-		cpath.Append("/");
-		cpath.Append(cname);
+		COMTHROW(cpath.Append("/"));
+		COMTHROW(cpath.Append(cname));
 		getRegistryModifications(ITER, cpath, mv);
 	}
 }
 
 HRESULT get_Modifications(FCO *fco, unsigned long changemask, CComVariant *mods) {
+	COMTRY {
 	ModificationsVector modifications;
 	if (changemask & OBJEVENT_REGISTRY) {
 		ITERATE_THROUGH(fco->self[ATTRID_REGNOWNER+ATTRID_COLLECTION]) {
@@ -895,7 +899,7 @@
 				CComBSTR name;
 				COMTHROW(ma->get_Name(&name));
 				CComBSTR label = "ATTR:";
-				label.Append(name);
+				COMTHROW(label.Append(name));
 				CComVariant ident = label;
 				modifications.push_back(ident);
 				modifications.push_back(previous);
@@ -905,7 +909,7 @@
 	if (changemask & OBJEVENT_PROPERTIES) {
 		CComVariant name = fco->self[ATTRID_NAME];
 		CComVariant pname;
-		fco->self->get_PreviousAttrValue(ATTRID_NAME, &pname);
+		COMTHROW(fco->self->get_PreviousAttrValue(ATTRID_NAME, &pname));
 		if (pname != name) {
 			CComVariant ident = "PROPERTIES:Name";
 			modifications.push_back(ident);
@@ -929,13 +933,14 @@
 		rgsabound[0].cElements = modifications.size();
 		pVariantsArray = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
 		for (LONG i=0; i<LONG(modifications.size()); i++) {
-			SafeArrayPutElement(pVariantsArray, &i, &modifications[i]);
+			COMTHROW(SafeArrayPutElement(pVariantsArray, &i, &modifications[i]));
 		}
 		CComVariant varOut;
 		varOut.vt = VT_ARRAY | VT_VARIANT;
 		varOut.parray = pVariantsArray;
 		varOut.Detach(mods);
 	}
+	} COMCATCH(;)
 	return S_OK;
 }
 //-------------------------------------------------------------------------------------

Modified: trunk/GME/Mga/MgaFolder.cpp
==============================================================================
--- trunk/GME/Mga/MgaFolder.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Mga/MgaFolder.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -523,7 +523,8 @@
 // MGA=tMp2.MGA
 bool libraryNameEqual( CComBSTR n1, CComBSTR n2)
 {
-	n1.ToUpper(); n2.ToUpper();
+	COMTHROW(n1.ToUpper());
+	COMTHROW(n2.ToUpper());
 	std::string s1, s2;
 	CopyTo( n1, s1); CopyTo( n2, s2);
 
@@ -607,7 +608,9 @@
 			p++;
 
 			CComBSTR name_b, kind_b, relpos_b;
-			name_b.Append("");//prepare for empty names, name_b.p is not 0 anymore
+			name_b.Attach(SysAllocString(L""));//prepare for empty names, name_b.p is not 0 anymore
+			if (name_b.m_str == NULL)
+				COMTHROW(E_OUTOFMEMORY);
 			OLECHAR * p2 = p;
 
 			str_scan_name( &p2, lenOf + path - p2, name_b, kind_b, relpos_b); // 2nd parameter = the # of characters left
@@ -676,7 +679,9 @@
 		else // regular name
 		{
 			CComBSTR name_b;
-			name_b.Append("");//prepare for empty names, name_b.p is not 0 anymore
+			name_b.Attach(SysAllocString(L""));//prepare for empty names, name_b.p is not 0 anymore
+			if (name_b.m_str == NULL)
+				COMTHROW(E_OUTOFMEMORY);
 			OLECHAR * p2 = p;
 
 			str_scan_name( &p2, lenOf + path - p2, name_b, CComBSTR(), CComBSTR()); // disregard kind and relpos
@@ -748,7 +753,9 @@
 			p++;
 
 			CComBSTR name_b, kind_b, relpos_b;
-			name_b.Append("");//prepare for empty names, name_b.p is not 0 anymore
+			name_b.Attach(SysAllocString(L""));//prepare for empty names, name_b.p is not 0 anymore
+			if (name_b.m_str == NULL)
+				COMTHROW(E_OUTOFMEMORY);
 			OLECHAR * p2 = p;
 
 			str_scan_name( &p2, lenOf + path - p2, name_b, kind_b, relpos_b);

Modified: trunk/GME/Mga/MgaLibOps.cpp
==============================================================================
--- trunk/GME/Mga/MgaLibOps.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Mga/MgaLibOps.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -129,8 +129,9 @@
 			COMTHROW( ele->GetGuidDisp( &gd));
 			
 			// '\n' delimited list created (no '\n' at the end)
-			if( pResBstr && pResBstr.Length() > 0) pResBstr.Append( "\n");
-			pResBstr.AppendBSTR( gd);
+			if( pResBstr && pResBstr.Length() > 0)
+				COMTHROW(pResBstr.Append( "\n"));
+			COMTHROW(pResBstr.AppendBSTR( gd));
 		}
 	}
 }
@@ -419,10 +420,10 @@
 				COMTHROW(dumper->put_FormatVersion(0));
 				COMTHROW(dumper->DumpProject( p, PutInBstr( szTempXmeFileName)) );
 
-				p->Close();
+				COMTHROW(p->Close());
 
 				// Create a new 'paradigmname' project
-				connstr_upgraded.Append( szTempMgaFileName); // connection string prepared
+				COMTHROW(connstr_upgraded.Append( szTempMgaFileName)); // connection string prepared
 				hr = p->CreateEx( PutInBstr( connstr_upgraded), PutInBstr( paradigmname), paradigmGUID);
 				if( SUCCEEDED( hr)) {
 					CComPtr<IMgaParser> parser;
@@ -430,7 +431,7 @@
 					ASSERT( parser != NULL );
 
 					COMTHROW(parser->ParseProject( p, PutInBstr( szTempXmeFileName)) );
-					p->Close();
+					COMTHROW(p->Close());
 					upgraded = true;
 				}
 				else if(hr == E_MGA_PARADIGM_NOTREG || hr == E_MGA_PARADIGM_INVALID) {
@@ -446,13 +447,13 @@
 		{
 			if( p_tolerateOldMga)
 			{
-				MyCComBSTR msg( "Library copy is in old MGA format. Library Refresh feature ver.1 (old) can be used only!");
-				msg.Append( "To benefit from the new Library Refresh ver.2 feature please open/save the library with GME, then reattach it to this project.");
+				MyCComBSTR msg( L"Library copy is in old MGA format. Library Refresh feature ver.1 (old) can be used only!");
+				COMTHROW(msg.Append( L"To benefit from the new Library Refresh ver.2 feature please open/save the library with GME, then reattach it to this project."));
 				reporter.show( msg);
 			}
 			else
 			{
-				MyCComBSTR msg( "Library is in old MGA format. To update please open it as a project, save it and only then can be attached!");
+				MyCComBSTR msg( L"Library is in old MGA format. To update please open it as a project, save it and only then can be attached!");
 				reporter.show( msg);
 				
 				COMTHROW(E_MGA_NOT_SUPPORTED);
@@ -491,8 +492,8 @@
 				lib_results.clear();
 
 				CComBSTR msg( "Exception while analyzing library ");
-				msg.Append( connstr);
-				msg.Append( " !");
+				COMTHROW(msg.Append( connstr));
+				COMTHROW(msg.Append( " !"));
 				
 				reporter.show( msg);
 
@@ -509,8 +510,8 @@
 		catch(...)
 		{
 			CComBSTR msg( "Exception while loading external library ");
-			msg.Append( connstr);
-			msg.Append( " !");
+			COMTHROW(msg.Append( connstr));
+			COMTHROW(msg.Append( " ."));
 			reporter.show( msg);
 
 			throw hresult_exception( -1); // fail
@@ -547,9 +548,11 @@
 		matching_libs.clear();
 		if(p) {
 			long st;
-			p->get_ProjectStatus(&st);
-			if(st & 8) p->AbortTransaction();
-			if(st & 1) p->Close();
+			COMTHROW(p->get_ProjectStatus(&st));
+			if(st & 8)
+				p->AbortTransaction();
+			if(st & 1)
+				p->Close();
 		};
 		throw;
 	}
@@ -573,10 +576,10 @@
 		// examining the attachable library
 		CComBSTR msg( "--------------------- Creating ");
 		if( lw.isOptimized())
-			msg.Append( "optimized ");
-		msg.Append("library image from [");
-		msg.Append( lw.getExpandedConnectionStr());
-		msg.Append("]--");
+			COMTHROW(msg.Append( "optimized "));
+		COMTHROW(msg.Append("library image from ["));
+		COMTHROW(msg.Append( lw.getExpandedConnectionStr()));
+		COMTHROW(msg.Append("]--"));
 		reporter.show( msg, false);
 
 		CoreObj libimgroot;
@@ -787,10 +790,10 @@
 			// examining the refreshable library
 			CComBSTR msg( "--------------------- Creating ");
 			if( lw.isOptimized())
-				msg.Append( "optimized ");
-			msg.Append("library image from [");
-			msg.Append( lw.getExpandedConnectionStr());
-			msg.Append("]--");
+				COMTHROW(msg.Append( "optimized "));
+			COMTHROW(msg.Append("library image from ["));
+			COMTHROW(msg.Append( lw.getExpandedConnectionStr()));
+			COMTHROW(msg.Append("]--"));
 			reporter.show( msg, false);
 //
 //  If required another logic could be introduced later:
@@ -853,7 +856,8 @@
 			if( is_old_lib_copy) // do a plain old refresh
 			{
 				MyCComBSTR msg( "Old version of Library refresh started [");
-				msg.AppendBSTR( libname); msg.Append( "] --");
+				COMTHROW(msg.AppendBSTR( libname));
+				COMTHROW(msg.Append( "] --"));
 				reporter.show( msg, false);
 
 				redo_derivs(mgaproject, self, libimgroot, false);
@@ -863,7 +867,8 @@
 			else // do a uid based refresh
 			{
 				MyCComBSTR msg( "---------------------Library refresh v2 started [");
-				msg.AppendBSTR( libname); msg.Append( "] --");
+				COMTHROW(msg.AppendBSTR( libname));
+				COMTHROW(msg.Append( "] --"));
 				reporter.show( msg, false);
 				
 				RefreshManager rm( mgaproject, self, libimgroot, Ozer::isIncluded( self));
@@ -897,12 +902,12 @@
 					docheck(mgaproject);
 
 					MyCComBSTR msg;
-					msg.Append( "----------------------Library refresh done [");
-					msg.AppendBSTR( libname);
-					msg.Append("]--------");
+					COMTHROW(msg.Append( "----------------------Library refresh done ["));
+					COMTHROW(msg.AppendBSTR( libname));
+					COMTHROW(msg.Append("]--------"));
 					int num = rm.getNumOfErrors( msg);
 					*ptrNumOfErrors = num;
-					msg.Append( "--");
+					COMTHROW(msg.Append( "--"));
 					reporter.show( msg, false);
 
 				} catch(hresult_exception& ) {
@@ -1059,7 +1064,7 @@
 {
 	CComBSTR oid;
 	LibImgHelper::GetItsGuid( p_container, &oid);
-	oid.Append( L" lib recorded");
+	COMTHROW(oid.Append( L" lib recorded"));
 	if( m_mgaProject) Reporter::showIt( m_mgaProject, oid, false);
 
 	for( std::map< BinGuid, std::vector< CoreObj > >::iterator it = p_results.begin()
@@ -1071,7 +1076,7 @@
 			BinGuid bf = it->first;
 			MyCComBSTR m;
 			m.appendGuid( bf);
-			m.Append( L" duplicate lib");
+			COMTHROW(m.Append( L" duplicate lib"));
 			if( m_mgaProject) Reporter::showIt( m_mgaProject, m, false);
 		}
 	}
@@ -1180,65 +1185,65 @@
 {
 	if( !p_log || !p_log.Length())
 	{
-		p_log.Append( "Opportunities for optimization found.");
+		COMTHROW(p_log.Append( "Opportunities for optimization found."));
 	}
 	
-	p_log.Append( "<br> ...(External, Hosted) library pairs found: ");
+	COMTHROW(p_log.Append( "<br> ...(External, Hosted) library pairs found: "));
 
 	if( p_libsToBe.size() > 1)
 	{
-		p_log.Append( "<br>! ! ! Warning: attached library contains two or more (sub)libraries with similar guids! ! !");
+		COMTHROW(p_log.Append( "<br>Warning: attached library contains two or more (sub)libraries with similar guids!"));
 	}
 
 	for( Typedefs::LIBVEC_CITER it = p_libsToBe.begin(), endit = p_libsToBe.end(); it != endit; ++it)
 	{
-		p_log.Append( "<br>External library in attachment:");
+		COMTHROW(p_log.Append( "<br>External library in attachment:"));
 		//p_log.Append( "<br>External library being attached");
 		//p_log.Append( "<br>External library:");
 		FCO* it_lib( ObjForCore( *it));
 		CComBSTR nm, id, gd;
 		if( it_lib) 
 		{
-			it_lib->get_Name( &nm);//nm = (*it)[ATTRID_NAME];
-			it_lib->get_ID( &id);
-			it_lib->GetGuidDisp( &gd);
-			p_log.Append( " [");
-			p_log.Append( id);
-			p_log.Append( "] GUID=");
-			p_log.Append( gd);
-			p_log.Append( " ");
-			p_log.Append( nm);
+			COMTHROW(it_lib->get_Name( &nm));//nm = (*it)[ATTRID_NAME];
+			COMTHROW(it_lib->get_ID( &id));
+			COMTHROW(it_lib->GetGuidDisp( &gd));
+			COMTHROW(p_log.Append( L" ["));
+			COMTHROW(p_log.Append( id));
+			COMTHROW(p_log.Append( L"] GUID="));
+			COMTHROW(p_log.Append( gd));
+			COMTHROW(p_log.Append( L" "));
+			COMTHROW(p_log.Append( nm));
 		}
 		else
 		{
 			ASSERT( 0);
-			p_log.Append( "libNull");
+			COMTHROW(p_log.Append( L"libNull"));
 		}
 	}
 
 	for( Typedefs::LIBVEC_CITER jt = p_libsHosted.begin(), endjt = p_libsHosted.end(); jt != endjt; ++jt)
 	{
-		p_log.Append( "<br>Hosted library already present:");
+		COMTHROW(p_log.Append( "<br>Hosted library already present:"));
 		//p_log.Append( "<br>A hosted library:");
 
 		FCO* jt_lib( ObjForCore( *jt));
 		CComBSTR nm, id, gd;
 		if( jt_lib) 
 		{
-			jt_lib->get_Name( &nm);//nm = (*it)[ATTRID_NAME];
-			jt_lib->get_ID( &id);
-			jt_lib->GetGuidDisp( &gd);
-			p_log.Append( " [");
-			p_log.Append( id);
-			p_log.Append( "] GUID=");
-			p_log.Append( gd);
-			p_log.Append( " ");
-			p_log.Append( nm);
+			COMTHROW(jt_lib->get_Name( &nm));//nm = (*it)[ATTRID_NAME];
+			COMTHROW(jt_lib->get_ID( &id));
+			COMTHROW(jt_lib->GetGuidDisp( &gd));
+			COMTHROW(p_log.Append( " ["));
+			COMTHROW(p_log.Append( id));
+			COMTHROW(p_log.Append( "] GUID="));
+			COMTHROW(p_log.Append( gd));
+			COMTHROW(p_log.Append( " "));
+			COMTHROW(p_log.Append( nm));
 		}
 		else 
 		{
 			ASSERT( 0);
-			p_log.Append( "libNull");
+			COMTHROW(p_log.Append(L"libNull"));
 		}
 	}
 }
@@ -1264,16 +1269,17 @@
 				CComBSTR nm, id;
 				nm = (iiit->second)[ATTRID_NAME];
 				FCO* lib = ObjForCore( iiit->second);
-				if( lib) lib->get_ID( &id);
+				if( lib)
+					COMTHROW(lib->get_ID( &id));
 				
-				msg.AppendBSTR( nm);
-				msg.Append( " [ ");
-				msg.AppendBSTR( id);
-				msg.Append( " ] !");
+				COMTHROW(msg.AppendBSTR( nm));
+				COMTHROW(msg.Append( " [ "));
+				COMTHROW(msg.AppendBSTR( id));
+				COMTHROW(msg.Append( " ] !"));
 			} 
 			catch( ... ) 
 			{ 
-				msg.Append( "!");
+				COMTHROW(msg.Append( "!"));
 			}
 			p_reporter.show( msg);
 		}
@@ -1299,14 +1305,14 @@
 				FCO* lib = ObjForCore( *it);
 				if( lib) lib->get_ID( &id);
 				
-				msg.AppendBSTR( nm);
-				msg.Append( " [ ");
-				msg.AppendBSTR( id);
-				msg.Append( " ] !");
+				COMTHROW(msg.AppendBSTR( nm));
+				COMTHROW(msg.Append( " [ "));
+				COMTHROW(msg.AppendBSTR( id));
+				COMTHROW(msg.Append( " ] !"));
 			} 
 			catch( ... ) 
 			{ 
-				msg.Append( "!");
+				COMTHROW(msg.Append( "!"));
 			}
 
 			reporter.show( msg);
@@ -1453,8 +1459,9 @@
 	else              Ozer::StorageMgr::getIncludes( p_fldCore, valu);
 	
 	// value appended
-	if( valu && valu.Length() > 0) valu.Append( L"\n");
-	valu.AppendBSTR( p_idToAddToReg); // p_idToAddToReg might be a list of ids !!!
+	if( valu && valu.Length() > 0)
+		COMTHROW(valu.Append( L"\n"));
+	COMTHROW(valu.AppendBSTR( p_idToAddToReg)); // p_idToAddToReg might be a list of ids !!!
 
 	// save value
 	if( p_incByOrInc) Ozer::StorageMgr::setIncludedBy( p_fldCore, valu);
@@ -1482,9 +1489,9 @@
 		else
 		{
 			if( p_valueList && p_valueList.Length() > 0)  // if not empty
-				p_valueList.Append( L"\n");               // use separator 
+				COMTHROW(p_valueList.Append( L"\n"));               // use separator 
 
-			p_valueList.Append( it.getCurrentBstr());
+			COMTHROW(p_valueList.Append( it.getCurrentBstr()));
 		}
 	}
 
@@ -1507,8 +1514,8 @@
 		Ozer::StorageMgr::getIncludedBy( p_newLib, val);
 		if( val && val.Length() > 0)
 		{
-			list.Append( L"\n");
-			list.AppendBSTR( val);
+			COMTHROW(list.Append( L"\n"));
+			COMTHROW(list.AppendBSTR( val));
 		}
 		Ozer::StorageMgr::setIncludedBy( p_newLib, list);
 	}

Modified: trunk/GME/Mga/MgaLibOps.h
==============================================================================
--- trunk/GME/Mga/MgaLibOps.h	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Mga/MgaLibOps.h	Tue Nov 15 13:34:02 2011	(r1687)
@@ -309,9 +309,9 @@
 									ObjForCore( base_con2)->get_ID( &idofcon2);
 								}
 
-								idofcon2.Append( ";");
-								idofcon2.AppendBSTR( nmofcon2);
-								idofcon2.Append( ".");
+								COMTHROW(idofcon2.Append( ";"));
+								COMTHROW(idofcon2.AppendBSTR( nmofcon2));
+								COMTHROW(idofcon2.Append( "."));
 #endif
 								CoreObj role_cntpt;
 								if( base_con2)

Modified: trunk/GME/Mga/MgaLibRefr.cpp
==============================================================================
--- trunk/GME/Mga/MgaLibRefr.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Mga/MgaLibRefr.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -126,7 +126,7 @@
 	*p_isSecondaryDerd    = false;
 
 	CComPtr<IMgaFCO> base;
-	ref->get_DerivedFrom( &base);
+	ref->get_DerivedFrom( &base); // ignore failure
 
 	if( base)
 	{
@@ -152,9 +152,9 @@
 		COMTHROW( baseRef->get_Referred( &baseTarg));*/
 		
 		CComBSTR nm;
-		derdRef->get_Name( &nm);
+		COMTHROW(derdRef->get_Name( &nm));
 		short st;
-		derdRef->CompareToBase( &st);
+		COMTHROW(derdRef->CompareToBase( &st));
 		/*bool x = COM_EQUAL( baseTarg, derdTarg);
 		ASSERT( x == (st==0));
 		if(x != (st==0))
@@ -436,7 +436,7 @@
 		derconn_details.derd_parent = d_model;
 		derconn_details.b_conn      = conn;
 
-		conn->get_MetaRole( &derconn_details.b_conn_role);
+		COMTHROW(conn->get_MetaRole( &derconn_details.b_conn_role));
 
 		getConnectionDetails( conn, derconn_details.b_conn_struct);
 		
@@ -587,9 +587,14 @@
 				MyCComBSTR msg;
 				msg.appendLink( new_conn); 
 #ifdef _DEBUG
-				CComBSTR ncid; new_conn->get_ID( &ncid); msg.AppendBSTR( ncid);if( current_i.is_derived && current_i.is_sec_derived) msg.Append( L" napofsec "); else msg.Append( L" reg ");
+				CComBSTR ncid; COMTHROW(new_conn->get_ID( &ncid));
+				COMTHROW(msg.AppendBSTR( ncid));
+				if( current_i.is_derived && current_i.is_sec_derived) 
+					COMTHROW(msg.Append( L" napofsec "));
+				else 
+					COMTHROW(msg.Append( L" reg "));
 #endif
-				msg.Append( L" reconstructed in "); 
+				COMTHROW(msg.Append( L" reconstructed in "));
 				msg.appendLink( pM);
 				m_reporter.show( msg, false);
 
@@ -641,15 +646,19 @@
 			prepareConnErrMsg( pM, s, d, sref_chain, dref_chain, current_i, msg);
 			if( chain1_rb_ok && chain2_rb_ok) // buildRefChainColl succeeded, verifyChain failed
 			{
-				msg.Append( L"<br>");
-				if( !chain1_vf_ok) msg.Append( L"Reason: SrcChain verification failed. ");
-				if( !chain2_vf_ok) msg.Append( L"Reason: DstChain verification failed. ");
+				COMTHROW(msg.Append( L"<br>"));
+				if( !chain1_vf_ok)
+					COMTHROW(msg.Append( L"Reason: SrcChain verification failed. "));
+				if( !chain2_vf_ok)
+					COMTHROW(msg.Append( L"Reason: DstChain verification failed. "));
 			}
 			else // buildRefChainColl failed
 			{
-				msg.Append( L"<br>");
-				if( !chain1_rb_ok) msg.Append( L"Reason: SrcChain rebuilding failed. ");
-				if( !chain2_rb_ok) msg.Append( L"Reason: DstChain rebuilding failed. ");
+				COMTHROW(msg.Append( L"<br>"));
+				if( !chain1_rb_ok) 
+					COMTHROW(msg.Append( L"Reason: SrcChain rebuilding failed. "));
+				if( !chain2_rb_ok)
+					COMTHROW(msg.Append( L"Reason: DstChain rebuilding failed. "));
 			}
 			m_reporter.show( msg);
 		}
@@ -1034,7 +1043,8 @@
 
 	bool ret = true;
 	long c = 0;
-	if( sref_chain) sref_chain->get_Count( &c);
+	if( sref_chain)
+		COMTHROW(sref_chain->get_Count( &c));
 	if( c == 0)
 	{
 		// s must be pM's child, or its grandchild (but in this case must be a port)
@@ -1051,7 +1061,7 @@
 	else if( c >= 1)
 	{
 		CComPtr<IMgaFCO> next;
-		sref_chain->get_Item( 1, &next);
+		COMTHROW(sref_chain->get_Item( 1, &next));
 		// next must be pM's child
 		CComPtr<IMgaModel> par;
 		HRESULT hr = E_FAIL;
@@ -1062,7 +1072,7 @@
 			for( i = 2; ret && i <= c; ++i)
 			{
 				CComPtr<IMgaFCO> chain_elem;
-				sref_chain->get_Item( i, &chain_elem);
+				COMTHROW(sref_chain->get_Item( i, &chain_elem));
 
 				CComQIPtr<IMgaReference> next_as_ref( next);
 				if( next_as_ref)
@@ -1085,7 +1095,7 @@
 			if( i == c+1 && ret) // ret is still ok, went through the chain
 			{
 				CComPtr<IMgaFCO> last;
-				sref_chain->get_Item(c, &last);
+				COMTHROW(sref_chain->get_Item(c, &last));
 				CComQIPtr<IMgaReference> last_ref( last);
 				if( last_ref)
 				{
@@ -1123,43 +1133,53 @@
 	//
 	// prepare error message
 	//msg.appendLink( current_i.connid, current_i.connname);
-	msg.Append( current_i.connname);
-	msg.Append( L" [");
-	msg.Append( current_i.connid);
-	msg.Append( L"]");
-	msg.Append( L" connection could not be reconstructed in ");
-	if( pM)      msg.appendLink( pM); 
-	else         msg.Append( L"Null");
-
-	msg.Append( L"<br>\tSrc: ");
-	if( s)       msg.appendLink( s);
-	else         msg.Append( L"Null");
-
-	msg.Append( L" Dst: ");
-	if( d)       msg.appendLink( d);
-	else         msg.Append( L"Null");
+	COMTHROW(msg.Append( current_i.connname));
+	COMTHROW(msg.Append( L" ["));
+	COMTHROW(msg.Append( current_i.connid));
+	COMTHROW(msg.Append( L"]"));
+	COMTHROW(msg.Append( L" connection could not be reconstructed in "));
+	if( pM)
+		msg.appendLink( pM);
+	else
+		COMTHROW(msg.Append( L"Null"));
+
+	COMTHROW(msg.Append( L"<br>\tSrc: "));
+	if( s)
+		msg.appendLink( s);
+	else
+		COMTHROW(msg.Append( L"Null"));
 
-	msg.Append( L"<br>\tSrcRefs:");
+	COMTHROW(msg.Append( L" Dst: "));
+	if( d)
+		msg.appendLink( d);
+	else
+		COMTHROW(msg.Append( L"Null"));
+
+	COMTHROW(msg.Append( L"<br>\tSrcRefs:"));
 	long c_len = 0;
-	if( sref_chain) sref_chain->get_Count( &c_len);
+	if( sref_chain)
+		COMTHROW(sref_chain->get_Count( &c_len));
 	for( long i = 1; i <= c_len; ++i)
 	{
-		if( i != 1) msg.Append( L",");
-		msg.Append( L" ");
+		if( i != 1)
+			COMTHROW(msg.Append( L","));
+		COMTHROW(msg.Append( L" "));
 		CComPtr<IMgaFCO> r_i;
-		sref_chain->get_Item( i, &r_i);
+		COMTHROW(sref_chain->get_Item( i, &r_i));
 		msg.appendLink( r_i);
 	}
 
-	msg.Append( L" DstRefs:");
+	COMTHROW(msg.Append( L" DstRefs:"));
 	c_len = 0;
-	if( dref_chain) dref_chain->get_Count( &c_len);
+	if( dref_chain) 
+		COMTHROW(dref_chain->get_Count( &c_len));
 	for( long i = 1; i <= c_len; ++i)
 	{
-		if( i != 1) msg.Append( L",");
-		msg.Append( L" ");
+		if( i != 1)
+			COMTHROW(msg.Append( L","));
+		COMTHROW(msg.Append( L" "));
 		CComPtr<IMgaFCO> r_i;
-		dref_chain->get_Item( i, &r_i);
+		COMTHROW(dref_chain->get_Item( i, &r_i));
 		msg.appendLink( r_i);
 	}
 }
@@ -1221,10 +1241,15 @@
 				
 				MyCComBSTR msg;
 				msg.appendLink( new_conn); 
-				msg.Append( L" reconstructed in "); 
+				COMTHROW(msg.Append( L" reconstructed in "));
 				msg.appendLink( pM);
 #ifdef _DEBUG
-				CComBSTR ncid, pmid; new_conn->get_ID( &ncid); msg.AppendBSTR( ncid); msg.Append( " "); pM->get_ID( &pmid); msg.AppendBSTR( pmid);
+				CComBSTR ncid, pmid;
+				COMTHROW(new_conn->get_ID( &ncid));
+				COMTHROW(msg.AppendBSTR( ncid));
+				COMTHROW(msg.Append( " "));
+				COMTHROW(pM->get_ID( &pmid));
+				COMTHROW(msg.AppendBSTR( pmid));
 #endif
 				m_reporter.show( msg, false);
 
@@ -1272,9 +1297,11 @@
 			prepareConnErrMsg( pM, s, d, sref_chain, dref_chain, current_i, msg);
 			if( valid)
 			{
-				msg.Append( L"<br>");
-				if( !chain1_ok) msg.Append( L"Reason: SrcChain verification failed. ");
-				if( !chain2_ok) msg.Append( L"Reason: DstChain verification failed. ");
+				COMTHROW(msg.Append( L"<br>"));
+				if( !chain1_ok)
+					COMTHROW(msg.Append( L"Reason: SrcChain verification failed. "));
+				if( !chain2_ok)
+					COMTHROW(msg.Append( L"Reason: DstChain verification failed. "));
 			}
 				
 			m_reporter.show( msg);
@@ -1466,9 +1493,11 @@
 			// success
 			MyCComBSTR msg;
 			msg.appendLink( orig);
-			msg.Append( L" stand alone reference retargeted to ");
-			if( ref_tgt_newlib) msg.appendLink( ref_tgt_newlib);
-			else                msg.Append( L"Null");
+			COMTHROW(msg.Append( L" stand alone reference retargeted to "));
+			if( ref_tgt_newlib)
+				msg.appendLink( ref_tgt_newlib);
+			else
+				COMTHROW(msg.Append( L"Null"));
 			m_reporter.show( msg, false);
 
 		} catch( hresult_exception&) {
@@ -1476,9 +1505,11 @@
 			// failure
 			MyCComBSTR msg;
 			msg.appendLink( orig);
-			msg.Append( L" stand alone reference could not be retargeted to ");
-			if( ref_tgt_newlib) msg.appendLink( ref_tgt_newlib);
-			else                msg.Append( L"Null");
+			COMTHROW(msg.Append( L" stand alone reference could not be retargeted to "));
+			if( ref_tgt_newlib)
+				msg.appendLink( ref_tgt_newlib);
+			else
+				COMTHROW(msg.Append( L"Null"));
 			m_reporter.show( msg);
 		}
 	}
@@ -1507,10 +1538,10 @@
 				// connpoint is 0 already
 				//COMTHROW( cn->DestroyObject());
 				long pos = 0;
-				coll_of_conns->Find( cn, 1, &pos);
+				coll_of_conns->Find( cn, 1, &pos); // ignore failure
 				if( pos < 1)
 				{
-					coll_of_conns->Append( cn);
+					COMTHROW(coll_of_conns->Append( cn));
 					// save it
 					saveConnection( CComPtr<IMgaFCO>(cn));
 				}
@@ -1537,18 +1568,18 @@
 
 
 				MyCComBSTR msg;
-				msg.Append( L"Connection ");
+				COMTHROW(msg.Append( L"Connection "));
 				msg.appendLink( cn_i);
-				msg.Append( L" deleted while retargeting reference ");
+				COMTHROW(msg.Append( L" deleted while retargeting reference "));
 				msg.appendLink( orig);
 				m_reporter.show( msg, false);
 
 			} catch(hresult_exception&) {
 
 				MyCComBSTR msg;
-				msg.Append( L"Connection ");
+				COMTHROW(msg.Append( L"Connection "));
 				msg.appendLink( cn_i);
-				msg.Append( L" could not be deleted while retargeting reference ");
+				COMTHROW(msg.Append( L" could not be deleted while retargeting reference "));
 				msg.appendLink( orig);
 				m_reporter.show( msg);
 			}
@@ -1565,7 +1596,7 @@
 			// success
 			MyCComBSTR msg;
 			msg.appendLink( orig);
-			msg.Append( L" retargeted to ");
+			COMTHROW(msg.Append( L" retargeted to "));
 			msg.appendLink( ref_tgt_newlib);
 			m_reporter.show( msg, false);
 
@@ -1574,7 +1605,7 @@
 			// failure
 			MyCComBSTR msg;
 			msg.appendLink( orig);
-			msg.Append( L" could not be retargeted to ");
+			COMTHROW(msg.Append( L" could not be retargeted to "));
 			msg.appendLink( ref_tgt_newlib);
 			m_reporter.show( msg);
 		}
@@ -1615,9 +1646,11 @@
 			// target element of ref not found in library
 			lib_target = SearchTool::findLibObj( m_oldLib, guid_of_target);
 			MyCComBSTR msg( "Reference target "); 
-			if( lib_target) msg.appendLink( lib_target);
-			else            msg.appendGuid( guid_of_target);
-			msg.Append( L" not found in new library!");
+			if( lib_target)
+				msg.appendLink( lib_target);
+			else
+				msg.appendGuid( guid_of_target);
+			COMTHROW(msg.Append( L" not found in new library!"));
 			m_reporter.show( msg);
 
 			continue;
@@ -1625,7 +1658,7 @@
 
 		
 		MyCComBSTR mm;
-		mm.Append( L"Redirect refs to target: ");
+		COMTHROW(mm.Append( L"Redirect refs to target: "));
 		mm.appendLink( lib_target);
 		m_reporter.show( mm, false);
 		for( CORE_REFERENCES_VEC::iterator jt = refs.begin();
@@ -1659,7 +1692,7 @@
 				ASSERT(0);
 				MyCComBSTR msg( "Could not find reference "); 
 				msg.appendLink( elem_in_proj);
-				msg.Append( L" in project!");
+				COMTHROW(msg.Append( L" in project!"));
 				m_reporter.show( msg);
 			}
 		}
@@ -1686,7 +1719,7 @@
 			MyCComBSTR msg( "Reference target "); 
 			if( lib_target) msg.appendLink( lib_target);
 			else            msg.appendGuid( guid_of_target);
-			msg.Append( L" not found in new library!");
+			COMTHROW(msg.Append( L" not found in new library!"));
 			m_reporter.show( msg);
 
 			continue;
@@ -1719,7 +1752,7 @@
 				ASSERT(0);
 				MyCComBSTR msg( "Could not find "); 
 				msg.appendLink( elem_in_proj);
-				msg.Append( L" in project!");
+				COMTHROW(msg.Append( L" in project!"));
 				m_reporter.show( msg);
 			}
 		}
@@ -2004,9 +2037,9 @@
 			{
 //#ifdef _DEBUG
 				MyCComBSTR msg;
-				msg.Append( L"Orphan child ");
+				COMTHROW(msg.Append( L"Orphan child "));
 				msg.appendLink( ObjForCore(ITER));
-				msg.Append( L" deleted.");
+				COMTHROW(msg.Append( L" deleted."));
 				m_reporter.show( msg, false);
 //#endif
 				ObjForCore(ITER)->inDeleteObject();
@@ -2045,9 +2078,9 @@
 		else
 		{
 			MyCComBSTR msg;
-			msg.Append( L"Could not find derived peer of ");
+			COMTHROW(msg.Append( L"Could not find derived peer of "));
 			msg.appendLink( b_memb);
-			msg.Append( L" in order to add as a member in ");
+			COMTHROW(msg.Append( L" in order to add as a member in "));
 			msg.appendLink( adaptvSet);
 			m_reporter.show( msg);
 		}
@@ -2076,9 +2109,9 @@
 		else
 		{
 			MyCComBSTR msg;
-			msg.Append( L"Could not find derived peer of ");
+			COMTHROW(msg.Append( L"Could not find derived peer of "));
 			msg.appendLink( b_tgt);
-			msg.Append( L" in order to set as target of ");
+			COMTHROW(msg.Append( L" in order to set as target of "));
 			msg.appendLink( adaptvRef);
 			m_reporter.show( msg);
 		}
@@ -2284,7 +2317,7 @@
 
 					MyCComBSTR msg;
 					msg.appendLink( ObjForCore(frsh_base));
-					msg.Append( L" derived to ");
+					COMTHROW(msg.Append( L" derived to "));
 					msg.appendLink( ObjForCore(prev_detached));
 					m_reporter.show( msg, false);
 				}
@@ -2292,7 +2325,7 @@
 				{
 					ASSERT(0); // error
 					MyCComBSTR msg(" Could not find detached object "); msg.appendLink( jt->subt_ptr);
-					msg.Append( L" while trying to re-attach to base!");
+					COMTHROW(msg.Append( L" while trying to re-attach to base!"));
 					m_reporter.show( msg);
 				}
 			}
@@ -2319,10 +2352,12 @@
 //#ifdef _DEBUG
 					MyCComBSTR msg;
 					msg.appendLink( prev_detached_obj);
-					msg.Append( L" deleted as ");
-					if( jt->is_instance) msg.Append( L"an instance");
-					else                 msg.Append( L"a subtype");
-					msg.Append( L" of an obsolete library object.");
+					COMTHROW(msg.Append( L" deleted as "));
+					if( jt->is_instance)
+						COMTHROW(msg.Append( L"an instance"));
+					else
+						COMTHROW(msg.Append( L"a subtype"));
+					COMTHROW(msg.Append( L" of an obsolete library object."));
 					m_reporter.show( msg, false);
 //#endif
 					ObjForCore(CoreObj(prev_detached_obj))->inDeleteObject();
@@ -2923,9 +2958,9 @@
 				mapOfDeriveds[ elem_self.uid].push_back( sp);
 #ifdef _DEBUG
 				//MyCComBSTR msg ("mapOfDeriveds ");
-				//CComBSTR oid, sid; ObjForCore( one_fco)->get_ID( &oid); sub->get_ID( &sid);
-				//msg.AppendBSTR( oid);msg.Append( L" base of "); msg.AppendBSTR( sid);
-				//msg.appendLink( one_fco); msg.appendLink( sub);
+				//CComBSTR oid, sid; COMTHROW(ObjForCore( one_fco)->get_ID( &oid)); COMTHROW(sub->get_ID( &sid));
+				//COMTHROW(msg.AppendBSTR( oid));COMTHROW(msg.Append( L" base of ")); COMTHROW(msg.AppendBSTR( sid));
+				//COMTHROW(msg.appendLink( one_fco)); COMTHROW(msg.appendLink( sub));
 				//m_reporter.show( msg);
 #endif
 
@@ -3206,8 +3241,8 @@
 	int k = m_reporter.getErrors();
 	TCHAR buf[32];
 	_stprintf_s( buf, _T("%d"), k);
-	msg.Append( L"Warnings: ");
-	msg.Append( buf);
+	COMTHROW(msg.Append( L"Warnings: "));
+	COMTHROW(msg.Append( buf));
 
 	return k;
 }

Modified: trunk/GME/Mga/MgaLibRefr.h
==============================================================================
--- trunk/GME/Mga/MgaLibRefr.h	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Mga/MgaLibRefr.h	Tue Nov 15 13:34:02 2011	(r1687)
@@ -185,17 +185,19 @@
 	template<class T>
 	void appendLink( const T& ptr)
 	{
-		if( ptr) appendLink( ObjForCore( CoreObj(ptr)));
-		else     Append( L"NullObject");
+		if( ptr)
+			appendLink( ObjForCore( CoreObj(ptr)));
+		else
+			COMTHROW(Append( L"NullObject"));
 	}
 
-	void appendLink( const CComBSTR& id, const CComBSTR& nm = "NonameObject")
+	void appendLink( const CComBSTR& id, const CComBSTR& nm = L"NonameObject")
 	{
-		Append(L"<A HREF=\"mga:");
-		AppendBSTR( id);
-		Append(L"\">");
-		AppendBSTR( nm);
-		Append(L"</A>");
+		COMTHROW(Append(L"<A HREF=\"mga:"));
+		COMTHROW(AppendBSTR( id));
+		COMTHROW(Append(L"\">"));
+		COMTHROW(AppendBSTR( nm));
+		COMTHROW(Append(L"</A>"));
 	}
 
 	void appendLink( FCO* fco)
@@ -203,12 +205,12 @@
 		CComBSTR id, nm;
 		if( fco)
 		{
-			fco->get_ID( &id);
-			fco->get_Name( &nm);
+			COMTHROW(fco->get_ID( &id));
+			COMTHROW(fco->get_Name( &nm));
 			appendLink( id, nm);
 		}
 		else
-			Append(L"NullObject");
+			COMTHROW(Append(L"NullObject"));
 	}
 
 	void appendGuid( const GUID& t_guid)
@@ -219,7 +221,7 @@
 			t_guid.Data4[0], t_guid.Data4[1], t_guid.Data4[2], t_guid.Data4[3],
 			t_guid.Data4[4], t_guid.Data4[5], t_guid.Data4[6], t_guid.Data4[7]);
 
-		Append( buff);
+		COMTHROW(Append( buff));
 	}
 
 	void appendGuid( const BinGuid& p_guid)
@@ -233,7 +235,7 @@
 	void appendGuid( const UniqueId& p_uid)
 	{
 		appendGuid( p_uid.objectId);
-		Append( L" in library ");
+		COMTHROW(Append( L" in library "));
 		appendGuid( p_uid.libId);
 	}
 };
@@ -399,7 +401,7 @@
 		if( error) ++m_counter;
 		if( m_gme)
 		{
-			m_gme->ConsoleMessage( msg, error?MSG_ERROR:MSG_INFO);
+			COMTHROW(m_gme->ConsoleMessage( msg, error?MSG_ERROR:MSG_INFO));
 		}
 	}
 
@@ -414,7 +416,7 @@
 
 		if( t_gme)
 		{
-			t_gme->ConsoleMessage( msg, error?MSG_ERROR:MSG_INFO);
+			COMTHROW(t_gme->ConsoleMessage( msg, error?MSG_ERROR:MSG_INFO));
 		}
 	}
 };

Modified: trunk/GME/Mga/MgaProject.cpp
==============================================================================
--- trunk/GME/Mga/MgaProject.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Mga/MgaProject.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -513,8 +513,9 @@
 		    *parversion = CComBSTR(dataroot[ATTRID_PARVERSION]).Detach();
 		    CComVariant(dataroot[ATTRID_PARGUID]).Detach(paradigmGUID);
 			*mgaversion = dataroot[ATTRID_MGAVERSION];
-			dp->PopTerritory();
+			COMTHROW(dp->PopTerritory());
 		} catch(hresult_exception &) {
+			// FIXME
 			;
 		}
 		dp->AbortTransaction();
@@ -641,8 +642,8 @@
 		ITERATE_THROUGH(s) {
 			CComPtr<ICoreMetaObject> m;
 			metaid_type t;
-			ITER->get_MetaObject(&m);
-			m->get_MetaID(&t);
+			COMTHROW(ITER->get_MetaObject(&m));
+			COMTHROW(m->get_MetaID(&t));
 			if(t == DTID_FOLDER) {
 				ObjForCore(ITER)->getinterface(pVal);
 				break;
@@ -722,8 +723,10 @@
 			mm < DTID_MODEL || mm > DTID_FOLDER) COMTHROW(E_MGA_BAD_ID);
 		CoreObj obj;
 		COMTHROW(dataproject->get_Object(mm,ss,&obj.ComPtr()));
-		if(obj) ObjForCore(obj)->getinterface(pVal);
-		else COMTHROW(E_MGA_BAD_ID);
+		if (obj)
+			ObjForCore(obj)->getinterface(pVal);
+		else
+			COMTHROW(E_MGA_BAD_ID);
     } COMCATCH(;);
 }
 
@@ -1297,10 +1300,12 @@
 		}
 		ASSERT(mode == TRANSACTION_GENERAL || mode == TRANSACTION_READ_ONLY  || mode == TRANSACTION_NON_NESTED);
 		CComPtr<IMgaProject> p;
-		ter->get_Project(&p);
-		if( p != this) COMTHROW(E_MGA_FOREIGN_OBJECT);
+		COMTHROW(ter->get_Project(&p));
+		if (p != this)
+			COMTHROW(E_MGA_FOREIGN_OBJECT);
 		CMgaTerritory *t = static_cast<CMgaTerritory *>(ter);
-		if(!t->coreterr) COMTHROW(E_MGA_TARGET_DESTROYED);
+		if (!t->coreterr)
+			COMTHROW(E_MGA_TARGET_DESTROYED);
 		read_only = (mode == TRANSACTION_READ_ONLY);
 		non_nestable = (mode == TRANSACTION_NON_NESTED);
 		// this call fails if the project has been closed (maybe we're being called by an FCO destructor)
@@ -1352,7 +1357,7 @@
 		COMTHROW(CommitNotify());		
 		COMTHROW(dataproject->PopTerritory());
 		short nestedCount;
-		dataproject->get_NestedTransactionCount(&nestedCount);
+		COMTHROW(dataproject->get_NestedTransactionCount(&nestedCount));
 		if (nestedCount == 1 && !read_only)
 			COMTHROW(GlobalNotify(GLOBALEVENT_COMMIT_TRANSACTION));
 		COMTHROW(dataproject->CommitTransaction(read_only ? TRANSTYPE_READFIRST: TRANSTYPE_FIRST));
@@ -1647,7 +1652,7 @@
 		CComBSTR hack_str = "UpdateSourceControlInfo";
 		CComBSTR para_str( param);
 		if( para_str.Length() > 0)
-			hack_str.Append( para_str);
+			COMTHROW(hack_str.Append( para_str));
 		CoreObj  dataroot;
 		COMTHROW(dataproject->get_RootObject(&dataroot.ComPtr()));
 		dataroot[ATTRID_MDATE] = hack_str;
@@ -1688,7 +1693,7 @@
 		CComBSTR hack_str = "WhoControlsThisObj";
 		CComBSTR para_str( p_optionalID);
 		if( para_str.Length() > 0)
-			hack_str.Append( para_str);
+			COMTHROW(hack_str.Append( para_str));
 		CoreObj  dataroot;
 		COMTHROW(dataproject->get_RootObject(&dataroot.ComPtr()));
 		dataroot[ATTRID_MDATE] = hack_str;
@@ -1766,11 +1771,11 @@
 	CComBSTR nm = getNmspc();
 	if( nm.Length() > 0)// or if not found('::')
 	{
-		kindname_m.AppendBSTR( nm);
-		kindname_m.Append( "::");
+		COMTHROW(kindname_m.AppendBSTR( nm));
+		COMTHROW(kindname_m.Append( "::"));
 	}
 
-	kindname_m.AppendBSTR( pKindname);
+	COMTHROW(kindname_m.AppendBSTR( pKindname));
 
 	return kindname_m;
 }
@@ -1837,14 +1842,15 @@
 	COMTHROW(mp->get_Object(mi, &mo));
 	CComPtr<ICoreMetaAttributes> atts;
 	COMTHROW(mo->get_Attributes(&atts));
-	long count = 0;								
-	COMTHROW( atts->get_Count(&count) );		
-	CComPtr<ICoreMetaAttribute> *arrptr, *arrend, *array = new CComPtr<ICoreMetaAttribute>[count]; 
+	long count = 0;
+	COMTHROW( atts->get_Count(&count) );
+	std::unique_ptr<CComPtr<ICoreMetaAttribute>[]> array(new CComPtr<ICoreMetaAttribute>[count]);
+	CComPtr<ICoreMetaAttribute> *arrptr, *arrend = array.get();
 	if(count > 0) { 
-		COMTHROW( atts->GetAll((unsigned long)count, &(*array)) ); 
+		COMTHROW( atts->GetAll((unsigned long)count, &(*array.get())) ); 
 	} 
-	arrend = array+count; 
-	for(arrptr = array; arrptr != arrend; arrptr++)  {
+	arrend = array.get()+count; 
+	for(arrptr = array.get(); arrptr != arrend; arrptr++)  {
 		unsigned char t;
 		COMTHROW((*arrptr)->get_ValueType(&t)); 
 		switch(t) {
@@ -1878,7 +1884,6 @@
 				}
 		}
 	}
-	delete []array;
 }
 
 

Modified: trunk/GME/Mga/MgaTerritory.cpp
==============================================================================
--- trunk/GME/Mga/MgaTerritory.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Mga/MgaTerritory.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -120,7 +120,7 @@
 		if( m_bstrCurrNamespace.Length() > 0) // namespace set
 		{
 			CComBSTR res;
-			res.AppendBSTR( m_bstrCurrNamespace);
+			COMTHROW(res.AppendBSTR( m_bstrCurrNamespace));
 			*pNmsp = res.Detach();
 		}
 	} COMCATCH(;)

Modified: trunk/GME/MgaUtil/CompDlg.cpp
==============================================================================
--- trunk/GME/MgaUtil/CompDlg.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/MgaUtil/CompDlg.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -519,7 +519,7 @@
 	CCompInfoDlg dlg(registrar);
 	dlg.m_filename = path;
 
-	TCHAR paren, info[200];
+	TCHAR paren, info[200] = {0};
 	if(_stscanf_s(CString(buf), _T(" $!COMMENT( %[^)]%c"), info, &paren) != 2 || paren != ')') {
 nothing_understood:
 		AfxMessageBox("Cannot read component info in file " + path);

Modified: trunk/GME/MgaUtil/MakeClosure.cpp
==============================================================================
--- trunk/GME/MgaUtil/MakeClosure.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/MgaUtil/MakeClosure.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -508,11 +508,11 @@
 					CComBSTR bstr, id, nm;
 					COMTHROW( connection->get_ID( &id));
 					COMTHROW( connection->get_Name( &nm));
-					bstr.Append("Closure: <A HREF=\"mga:");
-					bstr.AppendBSTR( id);
-					bstr.Append("\">");
-					bstr.AppendBSTR( nm);
-					bstr.Append("</A> disregarded. Connection involving reference ports. Use the \"Connection thru refport\" option to include it.");
+					COMTHROW(bstr.Append("Closure: <A HREF=\"mga:"));
+					COMTHROW(bstr.AppendBSTR( id));
+					COMTHROW(bstr.Append("\">"));
+					COMTHROW(bstr.AppendBSTR( nm));
+					COMTHROW(bstr.Append("</A> disregarded. Connection involving reference ports. Use the \"Connection thru refport\" option to include it."));
 
 					COMTHROW(m_GME->ConsoleMessage(bstr, MSG_ERROR));
 				}
@@ -703,7 +703,7 @@
 		
 		if( str_buf.find( new_mrk) == std::string::npos) // if marker not present
 		{
-			buf0.Append( buf1); // insert new marker into list & update
+			COMTHROW(buf0.Append( buf1)); // insert new marker into list & update
 			COMTHROW( obj->put_RegistryValue( CComBSTR( m_markerNode), buf0));
 		}
 	}

Modified: trunk/GME/MgaUtil/MgaRegistrar.cpp
==============================================================================
--- trunk/GME/MgaUtil/MgaRegistrar.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/MgaUtil/MgaRegistrar.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -1577,12 +1577,12 @@
 			if(res == ERROR_SUCCESS) {
 				for(int index = 0;; ++index) {
 					TCHAR name[512];
-					DWORD namesize = sizeof(name);
-					BYTE value[512];
+					DWORD namesize = sizeof(name) / sizeof(name[0]);
+					TCHAR value[512];
 					DWORD valuesize = sizeof(value);
 					DWORD valtype;
 
-					LONG err = RegEnumValue(par, index, name, &namesize, NULL, &valtype, value, &valuesize);
+					LONG err = RegEnumValue(par, index, name, &namesize, NULL, &valtype, (BYTE*)value, &valuesize);
 					if( err == ERROR_NO_MORE_ITEMS )
 						break;
 					ERRTHROW( err );
@@ -1667,11 +1667,11 @@
 			for(int index = 0;; ++index) {
 				TCHAR name[512];
 				DWORD namesize = sizeof(name) / sizeof(name[0]);
-				BYTE value[512];
-				DWORD valuesize = sizeof(value) / sizeof(value[0]);
+				TCHAR value[512];
+				DWORD valuesize = sizeof(value);
 				DWORD valtype;
 
-				LONG err = RegEnumValue(par, index, name, &namesize, NULL, &valtype, value, &valuesize);
+				LONG err = RegEnumValue(par, index, name, &namesize, NULL, &valtype, (BYTE*)value, &valuesize);
 				if( err == ERROR_NO_MORE_ITEMS )
 					break;
 				ERRTHROW( err );
@@ -1696,12 +1696,12 @@
 				ERRTHROW( par.RecurseDeleteKey(PutInCString(guidbstr)) );
 				for(int index = 0;; ++index) {
 					TCHAR name[512];
-					DWORD namesize = sizeof(name);
-					BYTE value[512];
+					DWORD namesize = sizeof(name) / sizeof(name[0]);
+					TCHAR value[512];
 					DWORD valuesize = sizeof(value);
 					DWORD valtype;
 
-					LONG err = RegEnumValue(par, index, name, &namesize, NULL, &valtype, value, &valuesize);
+					LONG err = RegEnumValue(par, index, name, &namesize, NULL, &valtype, (BYTE*)value, &valuesize);
 					if( err == ERROR_NO_MORE_ITEMS )
 						break;
 					ERRTHROW( err );

Modified: trunk/GME/MgaUtil/MgaResolver.cpp
==============================================================================
--- trunk/GME/MgaUtil/MgaResolver.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/MgaUtil/MgaResolver.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -50,8 +50,8 @@
 CComBSTR CMgaResolver::prefixIt(CComBSTR pIn)
 {
 	CComBSTR rval;
-	rval.AppendBSTR( m_prefix); 
-	rval.AppendBSTR( pIn);
+	COMTHROW(rval.AppendBSTR( m_prefix));
+	COMTHROW(rval.AppendBSTR( pIn));
 
 	return rval;
 }
@@ -65,7 +65,7 @@
 
 	if( crole.Left( trunc.GetLength()) == trunc)
 	{
-		rval.Append( crole.Right( crole.GetLength() - trunc.GetLength()));
+		COMTHROW(rval.Append( crole.Right( crole.GetLength() - trunc.GetLength())));
 	}
 
 	return rval;

Modified: trunk/GME/ObjectInspector/InPlaceManager.cpp
==============================================================================
--- trunk/GME/ObjectInspector/InPlaceManager.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/ObjectInspector/InPlaceManager.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -441,6 +441,8 @@
 			launched = ::CreateProcess(szAppPath,szCommandLine.GetBuffer(nCommandLineLength),
 				NULL,NULL,FALSE,0,NULL,NULL,&startUpInfo,&processInfo);
 			szCommandLine.ReleaseBuffer();
+			CloseHandle(processInfo.hProcess);
+			CloseHandle(processInfo.hThread);
 		}
 
 		if( !launched)
@@ -482,6 +484,8 @@
 		launched = ::CreateProcess(szAppPath,szCommandLine.GetBuffer(nCommandLineLength),
 			NULL,NULL,FALSE,0,NULL,NULL,&startUpInfo,&processInfo);
 		szCommandLine.ReleaseBuffer();
+		CloseHandle(processInfo.hProcess);
+		CloseHandle(processInfo.hThread);
 	}
 
 	// DWORD h = ::WaitForSingleObject(processInfo.hProcess, INFINITE);

Modified: trunk/GME/ObjectInspector/ObjectInspectorCtl.cpp
==============================================================================
--- trunk/GME/ObjectInspector/ObjectInspectorCtl.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/ObjectInspector/ObjectInspectorCtl.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -1129,8 +1129,11 @@
 void CObjectInspectorCtrl::UndoRedo( bool undo /*= true*/)
 {
 	short usz( 0), rsz( 0);
-	if( m_project) m_project->UndoRedoSize( &usz, &rsz);
-	if( undo && usz > 0) COMTHROW( m_project->Undo());
-	else if( !undo && rsz > 0) COMTHROW( m_project->Redo());
+	if( m_project)
+		COMTHROW(m_project->UndoRedoSize( &usz, &rsz));
+	if( undo && usz > 0)
+		COMTHROW( m_project->Undo());
+	else if( !undo && rsz > 0)
+		COMTHROW( m_project->Redo());
 }
 

Modified: trunk/GME/ObjectInspector/Preference.cpp
==============================================================================
--- trunk/GME/ObjectInspector/Preference.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/ObjectInspector/Preference.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -504,7 +504,7 @@
 		bool bFirstRun=true;
 		bool bSameValuefOrAll=true;
 		bool bIsDefault=true;
-		objtype_enum oeFirstType;
+		objtype_enum oeFirstType = OBJTYPE_ATOM;
 		CString strFirstValue;
 
 		while(posFCOs)

Modified: trunk/GME/Parser/GUIDCreate.cpp
==============================================================================
--- trunk/GME/Parser/GUIDCreate.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Parser/GUIDCreate.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -5,7 +5,7 @@
 
 CComBSTR GuidCreate::newGuid()
 {
-	char res[39];
+	char res[39] = {0};
 	GUID t_guid = GUID_NULL;
 	::CoCreateGuid(&t_guid);
 		

Modified: trunk/GME/Parser/Helper.cpp
==============================================================================
--- trunk/GME/Parser/Helper.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Parser/Helper.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -118,14 +118,14 @@
 	COMTHROW( p_obj->get_Name( &nm));
 	if( nm == 0 || nm == _T("") || use_anyway_nm_2) // if called from the Start... (or just derived) then the name its not yet parsed
 		nm = nm2.c_str();
-	bstr.Append(L"<A HREF=\"mga:");
-	bstr.AppendBSTR( id);
-	bstr.Append(L"\">");
+	COMTHROW(bstr.Append(L"<A HREF=\"mga:"));
+	COMTHROW(bstr.AppendBSTR( id));
+	COMTHROW(bstr.Append(L"\">"));
 	if( nm.Length() != 0)
-		bstr.AppendBSTR( nm);
+		COMTHROW(bstr.AppendBSTR( nm));
 	else
-		bstr.Append(L"emptyname");
-	bstr.Append(L"</A>");
+		COMTHROW(bstr.Append(L"emptyname"));
+	COMTHROW(bstr.Append(L"</A>"));
 
 	return bstr;
 }

Modified: trunk/GME/Parser/MgaDumper.cpp
==============================================================================
--- trunk/GME/Parser/MgaDumper.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Parser/MgaDumper.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -118,15 +118,15 @@
 	elems.clear();
 
 	if( territory != NULL )
-		territory->Destroy();
+		COMTHROW(territory->Destroy());
 	territory = NULL;
 
 	if( project != NULL )
 	{
 		if( abort )
-			project->AbortTransaction();
+			COMTHROW(project->AbortTransaction());
 		else
-			project->CommitTransaction();
+			COMTHROW(project->CommitTransaction());
 	}
 	
 	m_selFcos.clear();

Modified: trunk/GME/Parser/MgaParser.cpp
==============================================================================
--- trunk/GME/Parser/MgaParser.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Parser/MgaParser.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -130,7 +130,8 @@
 		CloseAll();
 		// in case we rethrew the [probably MGA originated] exception 
 		// we have set into errorinfo the location info
-		if( m_GME) m_GME->ConsoleMessage( errorinfo, MSG_ERROR);
+		if( m_GME)
+			COMTHROW(m_GME->ConsoleMessage( errorinfo, MSG_ERROR));
 		clear_GME( m_GME);
 
 		ASSERT( FAILED(e.hr) );
@@ -280,7 +281,8 @@
 		CloseAll();
 		// in case we rethrew the [probably MGA originated] exception 
 		// we have set into errorinfo the location info
-		if( m_GME) m_GME->ConsoleMessage( errorinfo, MSG_ERROR);
+		if( m_GME)
+			COMTHROW(m_GME->ConsoleMessage( errorinfo, MSG_ERROR));
 		clear_GME( m_GME);
 
 		ASSERT( FAILED(e.hr) );
@@ -382,7 +384,7 @@
 
 	if( progress != NULL )
 	{
-		progress->StopProgressDialog();
+		COMTHROW(progress->StopProgressDialog());
 		progress = NULL;
 	}
 
@@ -390,13 +392,13 @@
 
 	if( project != NULL )
 	{
-		project->put_Preferences(project_prefs_orig);
-		project->AbortTransaction();
-		project->Notify(APPEVENT_XML_IMPORT_END);
+		COMTHROW(project->put_Preferences(project_prefs_orig));
+		COMTHROW(project->AbortTransaction());
+		COMTHROW(project->Notify(APPEVENT_XML_IMPORT_END));
 	}
 
 	if( territory != NULL )
-		territory->Destroy();
+		COMTHROW(territory->Destroy());
 
 	territory = NULL;
 	project = NULL;
@@ -461,7 +463,7 @@
 			skip_element_level = 1;
 			if (pass_count == 99)
 				if (m_GME)
-					m_GME->ConsoleMessage(_bstr_t(e.wwhat()), msgtype_enum::MSG_ERROR);
+					COMTHROW(m_GME->ConsoleMessage(_bstr_t(e.wwhat()), msgtype_enum::MSG_ERROR));
 		}
 	}
 }
@@ -527,8 +529,10 @@
 	id_lookup_iterator i = id_lookup.find(id);
 	if( i != id_lookup.end() )
 	{
-		// we intentionally do not check the HRSULT
-		project->GetObjectByID((*i).second, PutOut(ret));
+		HRESULT hr = project->GetObjectByID((*i).second, PutOut(ret));
+		if (hr != E_MGA_BAD_ID)
+			// FIXME: test and enable
+			; // COMTHROW(hr);
 	}
 }
 
@@ -541,8 +545,10 @@
 	id_lookup_iterator i = id_lookup.find(id);
 	if( i != id_lookup.end() )
 	{
-		// we intentionally do not check the HRSULT
-		project->GetFCOByID((*i).second, PutOut(ret));
+		HRESULT hr = project->GetFCOByID((*i).second, PutOut(ret));
+		if (hr != E_MGA_BAD_ID)
+			// FIXME: test and enable
+			; // COMTHROW(hr);
 	}
 }
 
@@ -572,7 +578,7 @@
 		{
 				// when fco was created already got a fresh GUID, but we need to maintain
 				// the old guid, thus we overwrite the old value with the parsed one
-			object->PutGuidDisp( CComBSTR( (*i).second.c_str()));
+			COMTHROW(object->PutGuidDisp( CComBSTR( (*i).second.c_str())));
 		}
 		else if( (*i).first == _T("perm") )
 		{
@@ -789,7 +795,7 @@
 			{
 				if( int_mode == VARIANT_TRUE) // if interactive
 				{
-					resolver->getUserOptions();
+					COMTHROW(resolver->getUserOptions());
 				}
 			}
 		}
@@ -839,7 +845,7 @@
 	{
 		if( int_mode == VARIANT_TRUE)
 		{
-			resolver->getUserOptions();
+			COMTHROW(resolver->getUserOptions());
 		}
 	}
 }

Modified: trunk/GME/Parser/MgaParserBC.cpp
==============================================================================
--- trunk/GME/Parser/MgaParserBC.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Parser/MgaParserBC.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -52,11 +52,11 @@
 			CComBSTR bstr, id, nm;
 			COMTHROW( m_target->get_ID( &id));
 			COMTHROW( m_target->get_Name( &nm));
-			bstr.Append(L"[Closure Parser] Inserting copy closured data into: <A HREF=\"mga:");
-			bstr.AppendBSTR( id);
-			bstr.Append(L"\">");
-			bstr.AppendBSTR( nm);
-			bstr.Append(L"</A>");
+			COMTHROW(bstr.Append(L"[Closure Parser] Inserting copy closured data into: <A HREF=\"mga:"));
+			COMTHROW(bstr.AppendBSTR( id));
+			COMTHROW(bstr.Append(L"\">"));
+			COMTHROW(bstr.AppendBSTR( nm));
+			COMTHROW(bstr.Append(L"</A>"));
 			COMTHROW( m_GME->ConsoleMessage(bstr, MSG_INFO));
 		}
 
@@ -146,7 +146,8 @@
 		CloseAll();
 		// in case we rethrew the [probably MGA originated] exception 
 		// we have set into errorinfo the location info
-		if( m_GME) m_GME->ConsoleMessage( errorinfo, MSG_ERROR);
+		if( m_GME)
+			COMTHROW(m_GME->ConsoleMessage( errorinfo, MSG_ERROR));
 		clear_GME( m_GME);
 
 		ASSERT( FAILED(e.hr) );
@@ -235,11 +236,12 @@
 		else if( !findExact( *acceptingkinds, kind_nm))
 		{
 			CComBSTR bstr(L"[Parser] Target kind \"");
-			bstr.Append( kind_nm.c_str());
-			bstr.Append(L"\" not found among accepting kinds: \"");
-			bstr.Append( acceptingkinds->c_str());
-			bstr.Append(L"\". If you'd like to avoid this check remove or modify to \"\" the \"acceptingkind\" attribute of \"clipboard\" element in an editor.");
-			if( m_GME) COMTHROW( m_GME->ConsoleMessage(bstr, MSG_ERROR));
+			COMTHROW(bstr.Append( kind_nm.c_str()));
+			COMTHROW(bstr.Append(L"\" not found among accepting kinds: \""));
+			COMTHROW(bstr.Append( acceptingkinds->c_str()));
+			COMTHROW(bstr.Append(L"\". If you'd like to avoid this check remove or modify to \"\" the \"acceptingkind\" attribute of \"clipboard\" element in an editor."));
+			if( m_GME)
+				COMTHROW( m_GME->ConsoleMessage(bstr, MSG_ERROR));
 			HR_THROW(E_INVALID_MGA);
 		}
 
@@ -275,12 +277,12 @@
 				CComBSTR bstr, id, nm;
 				COMTHROW( obj->get_ID( &id));
 				COMTHROW( obj->get_Name( &nm));
-				bstr.Append(L"[Closure Parser] Name ambiguity found. Selected: <A HREF=\"mga:");
-				bstr.AppendBSTR( id);
-				bstr.Append(L"\">");
-				bstr.AppendBSTR( nm);
-				bstr.Append(L"</A> as basetype. Search path used: ");
-				bstr.Append( makeViewable(*s).c_str());
+				COMTHROW(bstr.Append(L"[Closure Parser] Name ambiguity found. Selected: <A HREF=\"mga:"));
+				COMTHROW(bstr.AppendBSTR( id));
+				COMTHROW(bstr.Append(L"\">"));
+				COMTHROW(bstr.AppendBSTR( nm));
+				COMTHROW(bstr.Append(L"</A> as basetype. Search path used: "));
+				COMTHROW(bstr.Append( makeViewable(*s).c_str()));
 
 				COMTHROW( m_GME->ConsoleMessage(bstr, MSG_ERROR));
 			}
@@ -338,12 +340,12 @@
 				CComBSTR bstr, id, nm;
 				COMTHROW( obj->get_ID( &id));
 				COMTHROW( obj->get_Name( &nm));
-				bstr.Append(L"[Closure Parser] Name ambiguity found. Selected: <A HREF=\"mga:");
-				bstr.AppendBSTR( id);
-				bstr.Append(L"\">");
-				bstr.AppendBSTR( nm);
-				bstr.Append(L"</A> as connection target. Search path used: ");
-				bstr.Append( makeViewable(*libtg).c_str());
+				COMTHROW(bstr.Append(L"[Closure Parser] Name ambiguity found. Selected: <A HREF=\"mga:"));
+				COMTHROW(bstr.AppendBSTR( id));
+				COMTHROW(bstr.Append(L"\">"));
+				COMTHROW(bstr.AppendBSTR( nm));
+				COMTHROW(bstr.Append(L"</A> as connection target. Search path used: "));
+				COMTHROW(bstr.Append( makeViewable(*libtg).c_str()));
 
 				COMTHROW( m_GME->ConsoleMessage(bstr, MSG_ERROR));
 			}
@@ -431,12 +433,12 @@
 					CComBSTR bstr, id, nm;
 					COMTHROW( obj->get_ID( &id));
 					COMTHROW( obj->get_Name( &nm));
-					bstr.Append(L"[Closure Parser] Name ambiguity found. Selected: <A HREF=\"mga:");
-					bstr.AppendBSTR( id);
-					bstr.Append(L"\">");
-					bstr.AppendBSTR( nm);
-					bstr.Append(L"</A> as library reference. Search path used: ");
-					bstr.Append( makeViewable(*s).c_str());
+					COMTHROW(bstr.Append(L"[Closure Parser] Name ambiguity found. Selected: <A HREF=\"mga:"));
+					COMTHROW(bstr.AppendBSTR( id));
+					COMTHROW(bstr.Append(L"\">"));
+					COMTHROW(bstr.AppendBSTR( nm));
+					COMTHROW(bstr.Append(L"</A> as library reference. Search path used: "));
+					COMTHROW(bstr.Append( makeViewable(*s).c_str()));
 
 					COMTHROW( m_GME->ConsoleMessage(bstr, MSG_ERROR));
 				}

Modified: trunk/GME/Parser/MgaParserClosureHelper.cpp
==============================================================================
--- trunk/GME/Parser/MgaParserClosureHelper.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Parser/MgaParserClosureHelper.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -375,17 +375,17 @@
 			if( m_GME) 
 			{
 				CComBSTR bstr;
-				bstr.Append(_T("Name ambiguity, selected: "));
-				bstr.AppendBSTR( makeLink( p_obj));
+				COMTHROW(bstr.Append(_T("Name ambiguity, selected: ")));
+				COMTHROW(bstr.AppendBSTR( makeLink( p_obj)));
 				
 				if( !text.empty())
 				{
-					bstr.Append(" as ");
-					bstr.Append( text.c_str());
+					COMTHROW(bstr.Append(L" as "));
+					COMTHROW(bstr.Append( text.c_str()));
 				}
 
-				bstr.Append(". Search path used: ");
-				bstr.Append( makeViewable(p_absPath).c_str());
+				COMTHROW(bstr.Append(L". Search path used: "));
+				COMTHROW(bstr.Append( makeViewable(p_absPath).c_str()));
 				msgSC( bstr, MSG_WARNING);
 			}
 		}
@@ -456,16 +456,16 @@
 			if( m_GME) 
 			{
 				CComBSTR bstr;
-				bstr.Append("Name ambiguity, selected: ");
-				bstr.AppendBSTR( makeLink( obj));
+				COMTHROW(bstr.Append(L"Name ambiguity, selected: "));
+				COMTHROW(bstr.AppendBSTR( makeLink( obj)));
 				if( !text.empty())
 				{
-					bstr.Append(" as ");
-					bstr.Append( text.c_str());
+					COMTHROW(bstr.Append(L" as "));
+					COMTHROW(bstr.Append( text.c_str()));
 				}
 
-				bstr.Append(". Search path used: ");
-				bstr.Append( makeViewable(relpath).c_str());
+				COMTHROW(bstr.Append(L". Search path used: "));
+				COMTHROW(bstr.Append( makeViewable(relpath).c_str()));
 				msgSC( bstr, MSG_WARNING);
 			}
 		}
@@ -520,12 +520,12 @@
 		place = m_target;//<!> let's try this
 		
 		CComBSTR bstr("Correct place not found for object: ");
-		bstr.Append( makeNameViewable( GetByName( attributes, _T("closurename"))).c_str());
-		bstr.Append(". Search path used: ");
-		bstr.Append( makeViewable( GetByName(attributes, _T("closurepath"))).c_str());
-		bstr.Append(". Trying to insert into the target object: ");
-		bstr.AppendBSTR( makeLink( place));
-		bstr.Append(".");
+		COMTHROW(bstr.Append( makeNameViewable( GetByName( attributes, _T("closurename"))).c_str()));
+		COMTHROW(bstr.Append(". Search path used: "));
+		COMTHROW(bstr.Append( makeViewable( GetByName(attributes, _T("closurepath"))).c_str()));
+		COMTHROW(bstr.Append(". Trying to insert into the target object: "));
+		COMTHROW(bstr.AppendBSTR( makeLink( place)));
+		COMTHROW(bstr.Append("."));
 		msgSC(bstr, MSG_ERROR);
 
 		place.QueryInterface( place_folder);
@@ -561,83 +561,6 @@
 	p_GME = CComPtr<IGMEOLEApp>();
 }
 
-//void CMgaParser::popInfo()
-//{
-//	if( m_parsed1.empty() || m_parsed2.empty()) return; // empty stack of informations
-//
-//	CComObjPtr<IMgaObject> obj = m_parsed1[0]; m_parsed1.pop_back();
-//	CComObjPtr<IMgaObject> fco1 = m_parsed2[0]; m_parsed2.pop_back();
-//	CComObjPtr<IMgaObject> fco2 = m_parsed3[0]; m_parsed3.pop_back();
-//
-//	writeInfo( obj, fco1, fco2);
-//}
-//
-//void CMgaParser::pushInfo( const CComObjPtr<IMgaFolder>& place_fld, const CComObjPtr<IMgaModel>& place_mdl, const CComObjPtr<IMgaFCO>& fco1, const CComObjPtr<IMgaFCO>& fco2)
-//{
-//	CComObjPtr<IMgaObject> obj;
-//	if( place_fld)
-//		obj = place_fld;
-//	else if( place_mdl)
-//		obj = place_mdl;
-//	else ASSERT(0);
-//
-//	//m_parsed.push_back( pair< CComObjPtr<IMgaObject>, CComObjPtr<IMgaObject>( obj, fco1) );
-//	m_parsed1.push_back( obj);
-//	m_parsed2.push_back( CComObjPtr<IMgaObject>( fco1));
-//	m_parsed3.push_back( CComObjPtr<IMgaObject>( fco2));
-//}
-//
-//void CMgaParser::writeInfo( const CComObjPtr<IMgaObject>& obj, const CComObjPtr<IMgaObject>& fco1, const CComObjPtr<IMgaObject>& fco2, bool normal_msg)
-//{
-//	if( obj && fco1 )
-//	{
-//		CComBSTR bstr, id2, nm2, id1, nm1, id0, nm0;
-//		COMTHROW( obj->get_ID( &id0));
-//		COMTHROW( obj->get_Name( &nm0));
-//		COMTHROW( fco1->get_ID( &id1));
-//		COMTHROW( fco1->get_Name( &nm1));
-//		if( fco2) COMTHROW( fco2->get_ID( &id2));
-//		if( fco2) COMTHROW( fco2->get_Name( &nm2));
-//
-//		bstr.Append("[Smartcopy Parser] <A HREF=\"mga:");
-//		bstr.AppendBSTR( id1);
-//		bstr.Append("\">");
-//
-//		if( nm1.Length() != 0)	bstr.AppendBSTR( nm1);
-//		else					bstr.Append("emptyname");
-//
-//		bstr.Append( "</A>");
-//
-//		if( fco2) 
-//		{
-//			bstr.Append( " derived from <A HREF=\"mga:");
-//			bstr.AppendBSTR( id2);
-//			bstr.Append("\">");
-//
-//			if( nm2.Length() != 0)	bstr.AppendBSTR( nm2);
-//			else					bstr.Append("emptyname");
-//
-//			bstr.Append("</A>");
-//		}
-//
-//		if( !normal_msg)
-//			bstr.Append(" could not be");
-//		bstr.Append( " inserted into <A HREF=\"mga:");
-//		bstr.AppendBSTR( id0);
-//		bstr.Append( "\">");
-//
-//		if( nm0.Length() != 0)	bstr.AppendBSTR( nm0);
-//		else					bstr.Append("emptyname");
-//
-//		bstr.Append( "</A>.");
-//		if( m_GME) 
-//		{
-//			if( normal_msg) COMTHROW( m_GME->ConsoleMessage(bstr, MSG_INFO));
-//			else			COMTHROW( m_GME->ConsoleMessage(bstr, MSG_ERROR));
-//		}
-//	}
-//}
-
 
 bool CMgaParser::isNeedFor2ndStep()
 {
@@ -667,10 +590,10 @@
 				COMTHROW( ref->put_Referred( fco_target));
 
 				CComBSTR bstr( "Reference ");
-				bstr.AppendBSTR( makeLink( ref));
-				bstr.Append( " set to refer to ");
-				bstr.AppendBSTR( makeLink( fco_target));
-				bstr.Append(" in 2nd step successfully.");
+				COMTHROW(bstr.AppendBSTR( makeLink( ref)));
+				COMTHROW(bstr.Append( " set to refer to "));
+				COMTHROW(bstr.AppendBSTR( makeLink( fco_target)));
+				COMTHROW(bstr.Append(" in 2nd step successfully."));
 				msgSC(bstr, MSG_INFO);
 			}
 			else
@@ -682,10 +605,10 @@
 		if( error)
 		{
 			CComBSTR bstr( "Reference ");
-			bstr.AppendBSTR( makeLink( it->first ));
-			bstr.Append( ": target not found in 2nd step. ");
-			bstr.Append("Search path used: ");
-			bstr.Append( makeViewable( it->second).c_str());
+			COMTHROW(bstr.AppendBSTR( makeLink( it->first )));
+			COMTHROW(bstr.Append( ": target not found in 2nd step. "));
+			COMTHROW(bstr.Append("Search path used: "));
+			COMTHROW(bstr.Append( makeViewable( it->second).c_str()));
 			msgSC(bstr, MSG_ERROR);
 		}
 	}
@@ -723,10 +646,10 @@
 					COMTHROW( set->AddMember( fco_member));
 
 					CComBSTR bstr( "Member");
-					bstr.AppendBSTR( makeLink( fco_member));
-					bstr.Append( " added to set ");
-					bstr.AppendBSTR( makeLink( set));
-					bstr.Append(" in 2nd step successfully.");
+					COMTHROW(bstr.AppendBSTR( makeLink( fco_member)));
+					COMTHROW(bstr.Append( " added to set "));
+					COMTHROW(bstr.AppendBSTR( makeLink( set)));
+					COMTHROW(bstr.Append(" in 2nd step successfully."));
 					msgSC(bstr, MSG_INFO);
 				}
 				else
@@ -738,10 +661,10 @@
 			if( error)
 			{
 				CComBSTR bstr( "Set ");
-				bstr.AppendBSTR( makeLink( set));
-				bstr.Append(": member not found in 2nd step. ");
-				bstr.Append("Search path used: ");
-				bstr.Append( makeViewable( *member_it).c_str());
+				COMTHROW(bstr.AppendBSTR( makeLink( set)));
+				COMTHROW(bstr.Append(": member not found in 2nd step. "));
+				COMTHROW(bstr.Append("Search path used: "));
+				COMTHROW(bstr.Append( makeViewable( *member_it).c_str()));
 				msgSC(bstr, MSG_ERROR);
 			}
 		}
@@ -791,8 +714,8 @@
 	CopyTo( msg, t);
 	if( t.substr( 0, _tcslen( sc_text)) != sc_text)
 	{
-		m2.Append( sc_text);
-		m2.AppendBSTR( msg);
+		COMTHROW(m2.Append( sc_text));
+		COMTHROW(m2.AppendBSTR( msg));
 	}
 	else
 		m2 = msg;

Modified: trunk/GME/Parser/MgaParserSC.cpp
==============================================================================
--- trunk/GME/Parser/MgaParserSC.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Parser/MgaParserSC.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -149,7 +149,8 @@
 		CloseAll();
 		// in case we rethrew the [probably MGA originated] exception 
 		// we have set into errorinfo the location info
-		if( m_GME) m_GME->ConsoleMessage( errorinfo, MSG_ERROR);
+		if( m_GME)
+			COMTHROW(m_GME->ConsoleMessage( errorinfo, MSG_ERROR));
 		clear_GME( m_GME);
 
 		ASSERT( FAILED(e.hr) );
@@ -199,8 +200,8 @@
 			else
 			{
 				CComBSTR bstr(L"Archetype can not be found in library. Basetype lost. ");
-				bstr.Append(L"Search path used: ");
-				bstr.Append( makeViewable(*s).c_str());
+				COMTHROW(bstr.Append(L"Search path used: "));
+				COMTHROW(bstr.Append( makeViewable(*s).c_str()));
 				msgSC( bstr, MSG_ERROR);
 			}
 
@@ -248,8 +249,8 @@
 				else // error report
 				{
 					CComBSTR bstr(L"Archetype can not be found. Basetype lost. ");
-					bstr.Append(L"Search path used: ");
-					bstr.Append( makeViewable(rel_path_changed).c_str());
+					COMTHROW(bstr.Append(L"Search path used: "));
+					COMTHROW(bstr.Append( makeViewable(rel_path_changed).c_str()));
 					msgSC( bstr, MSG_ERROR);
 				}
 			}
@@ -298,8 +299,8 @@
 
 			// user info
 			CComBSTR msg = makeLink( conn, makeNameViewable( GetByName(attributes, _T("closurename"))), true);
-			msg.Append( L" connection derived from ");
-			msg.AppendBSTR( makeLink( deriv.from));
+			COMTHROW(msg.Append( L" connection derived from "));
+			COMTHROW(msg.AppendBSTR( makeLink( deriv.from)));
 			msgSC( msg, MSG_INFO);
 		}
 		else
@@ -344,8 +345,8 @@
 
 			// user info
 			CComBSTR msg = makeLink( conn, makeNameViewable( GetByName(attributes, _T("closurename"))), true);
-			msg.Append( L" connection derived from ");
-			msg.AppendBSTR( makeLink( deriv.from));
+			COMTHROW(msg.Append( L" connection derived from "));
+			COMTHROW(msg.AppendBSTR( makeLink( deriv.from)));
 			msgSC( msg, MSG_INFO);
 		}
 		else
@@ -368,27 +369,31 @@
 
 					// user info
 					CComBSTR msg = makeLink( conn, makeNameViewable( GetByName(attributes, _T("closurename"))));
-					msg.Append( L" connection created.");
+					COMTHROW(msg.Append( L" connection created."));
 					msgSC( msg, MSG_INFO);
 				}
 				else
 				{
 					// error, could not find a correct reference chain
 					CComBSTR bstr(L"Connection \"");
-					bstr.Append( makeNameViewable( GetByName(attributes, _T("closurename"))).c_str());
-					bstr.Append(L"\": could not be created.");
+					COMTHROW(bstr.Append( makeNameViewable( GetByName(attributes, _T("closurename"))).c_str()));
+					COMTHROW(bstr.Append(L"\": could not be created."));
 					msgSC( bstr, MSG_ERROR);
 
 					bstr.Empty();
-					bstr.Append(L"   Reference chain involved: ");
-					if( !o1) bstr.Append( makeViewable( GetByName( attributes, _T("smart0RefChain") )).c_str());
-					else if( !o2) bstr.Append( makeViewable( GetByName( attributes, _T("smart1RefChain") )).c_str());
+					COMTHROW(bstr.Append(L"   Reference chain involved: "));
+					if( !o1) 
+						COMTHROW(bstr.Append( makeViewable( GetByName( attributes, _T("smart0RefChain") )).c_str()));
+					else if( !o2) 
+						COMTHROW(bstr.Append( makeViewable( GetByName( attributes, _T("smart1RefChain") )).c_str()));
 					msgSC( bstr, MSG_ERROR);
 
 					bstr.Empty();
-					bstr.Append(L"   Target path used: ");
-					if( !o1) bstr.Append( makeViewable( GetByName( attributes, _T("smart0Target") )).c_str());
-					else if( !o2) bstr.Append( makeViewable( GetByName( attributes, _T("smart1Target") )).c_str());
+					COMTHROW(bstr.Append(L"   Target path used: "));
+					if( !o1)
+						COMTHROW(bstr.Append( makeViewable( GetByName( attributes, _T("smart0Target") )).c_str()));
+					else if( !o2) 
+						COMTHROW(bstr.Append( makeViewable( GetByName( attributes, _T("smart1Target") )).c_str()));
 					msgSC( bstr, MSG_ERROR);
 
 					// to safely pass through hard times (parsing internal connpoints, attributes, regnodes...
@@ -408,8 +413,8 @@
 
 				// user info
 				CComBSTR msg = L"Merging ";
-				msg.AppendBSTR(makeLink( conn));
-				msg.Append( L" connection.");
+				COMTHROW(msg.AppendBSTR(makeLink( conn)));
+				COMTHROW(msg.Append( L" connection."));
 				msgSC( msg, MSG_INFO);
 			}
 
@@ -715,8 +720,8 @@
 
 			// user info
 			CComBSTR msg = makeLink( fco, makeNameViewable( GetByName(attributes, _T("closurename"))), true);
-			msg.Append( _T(" reference derived from "));
-			msg.AppendBSTR( makeLink( deriv.from));
+			COMTHROW(msg.Append( _T(" reference derived from ")));
+			COMTHROW(msg.AppendBSTR( makeLink( deriv.from)));
 			msgSC( msg, MSG_INFO);
 
 		}
@@ -739,7 +744,7 @@
 
 				// user info
 				CComBSTR msg = makeLink( fco, makeNameViewable( GetByName(attributes, _T("closurename"))));
-				msg.Append( _T(" reference created."));
+				COMTHROW(msg.Append( _T(" reference created.")));
 				msgSC( msg, MSG_INFO);
 			}
 			else // will skip contained elements/attribute values/regnode entries/constraints/name element
@@ -749,9 +754,10 @@
 
 				// user info
 				CComBSTR msg = L"Merging ";
-				msg.AppendBSTR(makeLink( fco));
-				if( needs_target) msg.Append(L" null");
-				msg.Append( L" reference.");
+				COMTHROW(msg.AppendBSTR(makeLink( fco)));
+				if( needs_target)
+					COMTHROW(msg.Append(L" null"));
+				COMTHROW(msg.Append( L" reference."));
 				msgSC( msg, MSG_INFO);
 			}
 		}
@@ -788,8 +794,8 @@
 			
 			// user info
 			CComBSTR msg = makeLink( fco, makeNameViewable( GetByName(attributes, _T("closurename"))), true);
-			msg.Append( L" reference derived from ");
-			msg.AppendBSTR( makeLink( deriv.from));
+			COMTHROW(msg.Append( L" reference derived from "));
+			COMTHROW(msg.AppendBSTR( makeLink( deriv.from)));
 			msgSC( msg, MSG_INFO);
 		}
 		else
@@ -806,7 +812,7 @@
 
 				// user info
 				CComBSTR msg = makeLink( fco, makeNameViewable( GetByName(attributes, _T("closurename"))));
-				msg.Append( L" reference created.");
+				COMTHROW(msg.Append( L" reference created."));
 				msgSC( msg, MSG_INFO);
 			}
 			else // will skip contained elements/attribute values/regnode entries/constraints/name element
@@ -816,9 +822,10 @@
 
 				// user info
 				CComBSTR msg = "LMerging ";
-				msg.AppendBSTR(makeLink( fco));
-				if( needs_target) msg.Append(L" null");
-				msg.Append( L" reference.");
+				COMTHROW(msg.AppendBSTR(makeLink( fco)));
+				if( needs_target)
+					COMTHROW(msg.Append(L" null"));
+				COMTHROW(msg.Append( L" reference."));
 				msgSC( msg, MSG_INFO);
 			}
 		}
@@ -842,10 +849,10 @@
 			else // report error
 			{
 				CComBSTR bstr("Reference ");
-				bstr.Append( makeLink( fco, makeNameViewable( GetByName( attributes, _T("closurename"))), true));
-				bstr.Append(": target not found in library. ");
-				bstr.Append("Search path used: ");
-				bstr.Append( makeViewable( *s).c_str());
+				COMTHROW(bstr.Append( makeLink( fco, makeNameViewable( GetByName( attributes, _T("closurename"))), true)));
+				COMTHROW(bstr.Append(": target not found in library. "));
+				COMTHROW(bstr.Append("Search path used: "));
+				COMTHROW(bstr.Append( makeViewable( *s).c_str()));
 				msgSC(bstr, MSG_ERROR);
 			}
 		}
@@ -885,10 +892,10 @@
 				else // report error
 				{
 					CComBSTR bstr("Reference ");
-					bstr.Append( makeLink( fco, makeNameViewable( GetByName( attributes, _T("closurename"))), true));
-					bstr.Append(": target not found. ");
-					bstr.Append("Search path used: ");
-					bstr.Append( makeViewable( path).c_str());
+					COMTHROW(bstr.Append( makeLink( fco, makeNameViewable( GetByName( attributes, _T("closurename"))), true)));
+					COMTHROW(bstr.Append(": target not found. "));
+					COMTHROW(bstr.Append("Search path used: "));
+					COMTHROW(bstr.Append( makeViewable( path).c_str()));
 					msgSC(bstr, MSG_ERROR);
 
 					// store data to process in 2nd step
@@ -939,8 +946,8 @@
 
 			// user info
 			CComBSTR msg = makeLink( fco, makeNameViewable( GetByName(attributes, _T("closurename"))), true);
-			msg.Append( " set derived from ");
-			msg.AppendBSTR( makeLink( deriv.from));
+			COMTHROW(msg.Append( " set derived from "));
+			COMTHROW(msg.AppendBSTR( makeLink( deriv.from)));
 			msgSC( msg, MSG_INFO);
 		}
 		else
@@ -962,7 +969,7 @@
 
 				// user info
 				CComBSTR msg = makeLink( fco, makeNameViewable( GetByName(attributes, _T("closurename"))));
-				msg.Append( " set created.");
+				COMTHROW(msg.Append( " set created."));
 				msgSC( msg, MSG_INFO);
 			}
 			else // will skip contained connpoints/elements/attribute values/regnode entries/constraints/name element
@@ -972,9 +979,9 @@
 
 				// user info
 				CComBSTR msg = "Merging ";
-				msg.AppendBSTR(makeLink( fco));
+				COMTHROW(msg.AppendBSTR(makeLink( fco)));
 				//if( needs_members) msg.Append(" empty");
-				msg.Append( " set.");
+				COMTHROW(msg.Append( " set."));
 				msgSC( msg, MSG_INFO);
 			}
 		}
@@ -1013,8 +1020,8 @@
 
 			// user info
 			CComBSTR msg = makeLink( fco, makeNameViewable( GetByName(attributes, _T("closurename"))), true);
-			msg.Append( " set derived from ");
-			msg.AppendBSTR( makeLink( deriv.from));
+			COMTHROW(msg.Append( " set derived from "));
+			COMTHROW(msg.AppendBSTR( makeLink( deriv.from)));
 			msgSC( msg, MSG_INFO);
 		}
 		else
@@ -1031,7 +1038,7 @@
 
 				// user info
 				CComBSTR msg = makeLink( fco, makeNameViewable( GetByName(attributes, _T("closurename"))));
-				msg.Append( " set created.");
+				COMTHROW(msg.Append( " set created."));
 				msgSC( msg, MSG_INFO);
 			}
 			else // will skip contained connpoints/elements/attribute values/regnode entries/constraints/name element
@@ -1041,9 +1048,9 @@
 
 				// user info
 				CComBSTR msg = "Merging ";
-				msg.AppendBSTR(makeLink( fco));
+				COMTHROW(msg.AppendBSTR(makeLink( fco)));
 				//if( needs_members) msg.Append(" empty");
-				msg.Append( " set.");
+				COMTHROW(msg.Append( " set."));
 				msgSC( msg, MSG_INFO);
 			}
 		}
@@ -1105,10 +1112,10 @@
 			else
 			{
 				CComBSTR bstr( "Set ");
-				bstr.Append( makeLink( fco, makeNameViewable( GetByName(attributes, _T("closurename"))), true));
-				bstr.Append( ": member not found. ");
-				bstr.Append( "Search path used: ");
-				bstr.Append( makeViewable( path_s).c_str());
+				COMTHROW(bstr.Append( makeLink( fco, makeNameViewable( GetByName(attributes, _T("closurename"))), true)));
+				COMTHROW(bstr.Append( ": member not found. "));
+				COMTHROW(bstr.Append( "Search path used: "));
+				COMTHROW(bstr.Append( makeViewable( path_s).c_str()));
 				msgSC(bstr, MSG_ERROR);
 
 				// insert data to process in 2nd step
@@ -1159,8 +1166,8 @@
 
 			// user info
 			CComBSTR msg = makeLink( model, makeNameViewable( GetByName(attributes, _T("closurename"))), true);
-			msg.Append( " model derived from ");
-			msg.AppendBSTR( makeLink( deriv.from));
+			COMTHROW(msg.Append( " model derived from "));
+			COMTHROW(msg.AppendBSTR( makeLink( deriv.from)));
 			msgSC( msg, MSG_INFO);
 		}
 		else
@@ -1180,7 +1187,7 @@
 
 				// user info
 				CComBSTR msg = makeLink( model, makeNameViewable( GetByName(attributes, _T("closurename"))));
-				msg.Append( " model created.");
+				COMTHROW(msg.Append( " model created."));
 				msgSC( msg, MSG_INFO);
 			}
 			else // will use the object found
@@ -1189,8 +1196,8 @@
 
 				// user info
 				CComBSTR msg = "Merging ";
-				msg.AppendBSTR(makeLink( model));
-				msg.Append( " model.");
+				COMTHROW(msg.AppendBSTR(makeLink( model)));
+				COMTHROW(msg.Append( " model."));
 				msgSC( msg, MSG_INFO);
 			}
 		}
@@ -1227,8 +1234,8 @@
 
 			// user info
 			CComBSTR msg = makeLink( model, makeNameViewable( GetByName(attributes, _T("closurename"))), true);
-			msg.Append( " model derived from ");
-			msg.AppendBSTR( makeLink( deriv.from));
+			COMTHROW(msg.Append( " model derived from "));
+			COMTHROW(msg.AppendBSTR( makeLink( deriv.from)));
 			msgSC( msg, MSG_INFO);
 		}
 		else
@@ -1245,7 +1252,7 @@
 
 				// user info
 				CComBSTR msg = makeLink( model, makeNameViewable( GetByName(attributes, _T("closurename"))));
-				msg.Append( " model created.");
+				COMTHROW(msg.Append( " model created."));
 				msgSC( msg, MSG_INFO);
 			}
 			else // will use the object found
@@ -1254,8 +1261,8 @@
 
 				// user info
 				CComBSTR msg = "Merging ";
-				msg.AppendBSTR(makeLink( model));
-				msg.Append( " model.");
+				COMTHROW(msg.AppendBSTR(makeLink( model)));
+				COMTHROW(msg.Append( " model."));
 				msgSC( msg, MSG_INFO);
 			}
 		}
@@ -1293,8 +1300,8 @@
 
 			// user info
 			CComBSTR msg = makeLink( atom, makeNameViewable( GetByName(attributes, _T("closurename"))), true);
-			msg.Append( " atom derived from ");
-			msg.AppendBSTR( makeLink( deriv.from));
+			COMTHROW(msg.Append( " atom derived from "));
+			COMTHROW(msg.AppendBSTR( makeLink( deriv.from)));
 			msgSC( msg, MSG_INFO);
 		}
 		else
@@ -1316,7 +1323,7 @@
 
 				// user info
 				CComBSTR msg = makeLink( atom, makeNameViewable( GetByName(attributes, _T("closurename"))));
-				msg.Append( " atom created.");
+				COMTHROW(msg.Append( L" atom created."));
 				msgSC( msg, MSG_INFO);
 			}
 			else // will use the object found
@@ -1324,9 +1331,9 @@
 				skip_inner_elements = true;
 
 				// user info
-				CComBSTR msg = "Merging ";
-				msg.AppendBSTR(makeLink( atom));
-				msg.Append( " atom.");
+				CComBSTR msg = L"Merging ";
+				COMTHROW(msg.AppendBSTR(makeLink( atom)));
+				COMTHROW(msg.Append( L" atom."));
 				msgSC( msg, MSG_INFO);
 			}
 		}
@@ -1362,8 +1369,8 @@
 
 			// user info
 			CComBSTR msg = makeLink( atom, makeNameViewable( GetByName(attributes, _T("closurename"))), true);
-			msg.Append( " atom derived from ");
-			msg.AppendBSTR( makeLink( deriv.from));
+			COMTHROW(msg.Append( L" atom derived from "));
+			COMTHROW(msg.AppendBSTR( makeLink( deriv.from)));
 			msgSC( msg, MSG_INFO);
 		}
 		else
@@ -1379,7 +1386,7 @@
 
 				// user info
 				CComBSTR msg = makeLink( atom, makeNameViewable( GetByName(attributes, _T("closurename"))));
-				msg.Append( " atom created.");
+				COMTHROW(msg.Append( L" atom created."));
 				msgSC( msg, MSG_INFO);
 			}
 			else // will skip contained elements
@@ -1387,9 +1394,9 @@
 				skip_inner_elements = true;
 
 				// user info
-				CComBSTR msg = "Merging ";
-				msg.AppendBSTR(makeLink( atom));
-				msg.Append( " atom.");
+				CComBSTR msg = L"Merging ";
+				COMTHROW(msg.AppendBSTR(makeLink( atom)));
+				COMTHROW(msg.Append( L" atom."));
 				msgSC( msg, MSG_INFO);
 			}
 		}
@@ -1441,7 +1448,7 @@
 
 			// user info
 			CComBSTR msg = makeLink(CComObjPtr<IMgaObject>(folder), makeNameViewable( GetByName(attributes, _T("closurename"))));
-			msg.Append( " folder created.");
+			COMTHROW(msg.Append(L" folder created."));
 			msgSC( msg, MSG_INFO);
 		}
 		else // will use the object found
@@ -1449,9 +1456,9 @@
 			skip_inner_elements = true;
 
 			// user info
-			CComBSTR msg = "Merging ";
-			msg.AppendBSTR(makeLink( CComObjPtr<IMgaObject>(folder)));
-			msg.Append( " folder.");
+			CComBSTR msg = L"Merging ";
+			COMTHROW(msg.AppendBSTR(makeLink( CComObjPtr<IMgaObject>(folder))));
+			COMTHROW(msg.Append( L" folder."));
 			msgSC( msg, MSG_INFO);
 		}
 	}

Modified: trunk/GME/Search/SearchAlg.cpp
==============================================================================
--- trunk/GME/Search/SearchAlg.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Search/SearchAlg.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -63,7 +63,7 @@
                     CComQIPtr<IMgaFCO> an_fco( MGACOLL_ITER);
                     if( an_fco && non_container_coll) 
                     {
-                        non_container_coll->Append( an_fco);
+                        COMTHROW(non_container_coll->Append( an_fco));
                         ++nExtra;
                     }
             } // switch

Modified: trunk/GME/Search/SearchCtl.cpp
==============================================================================
--- trunk/GME/Search/SearchCtl.cpp	Tue Nov 15 13:33:04 2011	(r1686)
+++ trunk/GME/Search/SearchCtl.cpp	Tue Nov 15 13:34:02 2011	(r1687)
@@ -466,7 +466,8 @@
 	coll_in_active_terr.CoCreateInstance( L"Mga.MgaObjects");
 
 	long c = 0;
-	if( p_inColl) p_inColl->get_Count( &c);
+	if( p_inColl)
+		COMTHROW(p_inColl->get_Count( &c));
 
 	// nothing to copy? no territory? failed to create out coll? or no transaction active?
 	if( c > 0 && m_territory && coll_in_active_terr && m_transactionCnt > 0) 
@@ -474,10 +475,10 @@
 		for( long i = 1; i <= c; ++i)                 // for all items in coll
 		{
 			CComPtr<IMgaObject> obj, item;
-			p_inColl->get_Item( i, &item);
+			COMTHROW(p_inColl->get_Item( i, &item));
 
-			m_territory->OpenObj( item, &obj);        // puts in our territory
-			coll_in_active_terr->Append( obj);
+			COMTHROW(m_territory->OpenObj( item, &obj));        // puts in our territory
+			COMTHROW(coll_in_active_terr->Append( obj));
 		}
 	}
 


More information about the gme-commit mailing list