[commit] r1677 - in trunk/GME: ConstraintManager Core Meta Mga XmlBackEnd

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Thu Nov 10 22:08:59 CST 2011


Author: ksmyth
Date: Thu Nov 10 22:08:59 2011
New Revision: 1677

Log:
Fix int pos = std::string::find() et al problems

Modified:
   trunk/GME/ConstraintManager/GMEConstraintEx.cpp
   trunk/GME/ConstraintManager/OCLCommon.cpp
   trunk/GME/ConstraintManager/OCLCommonEx.cpp
   trunk/GME/ConstraintManager/OCLException.cpp
   trunk/GME/ConstraintManager/OCLTypeExGMECM.cpp
   trunk/GME/ConstraintManager/ocl.g
   trunk/GME/Core/CoreProject.cpp
   trunk/GME/Meta/MgaMetaRegNode.cpp
   trunk/GME/Mga/MgaFCO.cpp
   trunk/GME/Mga/MgaLibOps.cpp
   trunk/GME/Mga/MgaLibOps.h
   trunk/GME/XmlBackEnd/OperOptions.cpp

Modified: trunk/GME/ConstraintManager/GMEConstraintEx.cpp
==============================================================================
--- trunk/GME/ConstraintManager/GMEConstraintEx.cpp	Thu Nov 10 22:08:35 2011	(r1676)
+++ trunk/GME/ConstraintManager/GMEConstraintEx.cpp	Thu Nov 10 22:08:59 2011	(r1677)
@@ -71,7 +71,7 @@
 		}
 
 		std::string strDName = GetDefinedName();
-		int iPos = strDName.rfind( "::" );
+		size_t iPos = strDName.rfind( "::" );
 
 		if ( iPos == std::string::npos ) {
 			strContext = "?";

Modified: trunk/GME/ConstraintManager/OCLCommon.cpp
==============================================================================
--- trunk/GME/ConstraintManager/OCLCommon.cpp	Thu Nov 10 22:08:35 2011	(r1676)
+++ trunk/GME/ConstraintManager/OCLCommon.cpp	Thu Nov 10 22:08:59 2011	(r1677)
@@ -52,7 +52,7 @@
 
 	int convertR( std::string& s, TypeSeq& si, int i )
 	{
-		int p = s.find( '(' );
+		size_t p = s.find( '(' );
 		if ( p == std::string::npos ) {
 			si.push_back( s );
 			return 0;

Modified: trunk/GME/ConstraintManager/OCLCommonEx.cpp
==============================================================================
--- trunk/GME/ConstraintManager/OCLCommonEx.cpp	Thu Nov 10 22:08:35 2011	(r1676)
+++ trunk/GME/ConstraintManager/OCLCommonEx.cpp	Thu Nov 10 22:08:59 2011	(r1677)
@@ -175,7 +175,7 @@
 	std::string ParseLibraryName( const std::string& strFullName )
 	{
 		std::string strName;
-		int iPos = strFullName.rfind( "\\" );
+		size_t iPos = strFullName.rfind( "\\" );
 		if ( iPos != std::string::npos )
 			strName = strFullName.substr( iPos + 1 );
 		iPos = strName.rfind( "." );
@@ -276,7 +276,7 @@
 	{
 		eType = OBJTYPE_NULL;
 		strKind = "";
-		int iPos = strFullName.find( "::" );
+		size_t iPos = strFullName.find( "::" );
 		if ( iPos == std::string::npos ) {
 			strKind = strFullName;
 			return true;
@@ -617,7 +617,7 @@
 	{
 		StringVector vecKinds;
 		for ( unsigned int i = 0 ; i < vecDescriptions.size() ; i++ ) {
-			int iPos = vecDescriptions[ i ].find( ' ' );
+			size_t iPos = vecDescriptions[ i ].find( ' ' );
 			if ( iPos == std::string::npos ) {
 				if ( std::find( vecKinds.begin(), vecKinds.end(), vecDescriptions[ i ] ) == vecKinds.end() )
 					vecKinds.push_back( vecDescriptions[ i ] );

Modified: trunk/GME/ConstraintManager/OCLException.cpp
==============================================================================
--- trunk/GME/ConstraintManager/OCLException.cpp	Thu Nov 10 22:08:35 2011	(r1676)
+++ trunk/GME/ConstraintManager/OCLException.cpp	Thu Nov 10 22:08:59 2011	(r1677)
@@ -86,7 +86,7 @@
 			}
 		}
 		unsigned int iCnt = 0;
-		int iPos = strMessage.find( '?' );
+		size_t iPos = strMessage.find( '?' );
 		while ( iPos != std::string::npos && iCnt < m_vecParameters.size() ) {
 			strMessage = strMessage.substr( 0, iPos ) + m_vecParameters[ iCnt++ ] + strMessage.substr( iPos + 1, strMessage.length() - iPos - 1 );
 			iPos = strMessage.find( '?' );

Modified: trunk/GME/ConstraintManager/OCLTypeExGMECM.cpp
==============================================================================
--- trunk/GME/ConstraintManager/OCLTypeExGMECM.cpp	Thu Nov 10 22:08:35 2011	(r1676)
+++ trunk/GME/ConstraintManager/OCLTypeExGMECM.cpp	Thu Nov 10 22:08:59 2011	(r1677)
@@ -2391,13 +2391,13 @@
 
 	void TypeFactory::GetDynamicTypes( const std::string& strName, std::vector<unique_ptr<OclMeta::Type>>& vecTypes, std::string& strNameResult )
 	{
-		int jPos = strName.find( "gme::" );
-		int kPos = strName.find( "ocl::" );
+		size_t jPos = strName.find( "gme::" );
+		size_t kPos = strName.find( "ocl::" );
 		if( jPos == std::string::npos             // neither 'gme::' 
 		 && kPos == std::string::npos)            // nor     'ocl::' is found
 		{
 			// lookup in meta:
-			int iPos = strName.find( "meta::");
+			size_t iPos = strName.find( "meta::");
 			std::string strN = strName;
 			std::string strNS;
 			if( iPos != std::string::npos)        // if 'meta::' found

Modified: trunk/GME/ConstraintManager/ocl.g
==============================================================================
--- trunk/GME/ConstraintManager/ocl.g	Thu Nov 10 22:08:35 2011	(r1676)
+++ trunk/GME/ConstraintManager/ocl.g	Thu Nov 10 22:08:59 2011	(r1677)
@@ -762,7 +762,7 @@
 	<< INSLINE0( LID_CONTEXT_TYPE ); >>
 	<< INSLINE0( LID_FEATURE_NAME ); >>
 	<<
-		int iPos = strName.rfind( ':' );
+		size_t iPos = strName.rfind( ':' );
 		if ( iPos != string::npos )
 			{ strType = strName.substr( 0, iPos - 1 ); strName = strName.substr( iPos + 1, strName.length() - iPos - 1 ); }
 		else

Modified: trunk/GME/Core/CoreProject.cpp
==============================================================================
--- trunk/GME/Core/CoreProject.cpp	Thu Nov 10 22:08:35 2011	(r1676)
+++ trunk/GME/Core/CoreProject.cpp	Thu Nov 10 22:08:59 2011	(r1677)
@@ -154,7 +154,7 @@
 	std::string con;
 	CopyTo(connection, con);
 
-	int pos = con.find('=');
+	size_t pos = con.find('=');
 	if( pos != std::string::npos )
 		con.resize(pos);
 

Modified: trunk/GME/Meta/MgaMetaRegNode.cpp
==============================================================================
--- trunk/GME/Meta/MgaMetaRegNode.cpp	Thu Nov 10 22:08:35 2011	(r1676)
+++ trunk/GME/Meta/MgaMetaRegNode.cpp	Thu Nov 10 22:08:59 2011	(r1677)
@@ -23,7 +23,7 @@
 
 		for(;;)
 		{
-			int pos = path.find('/');//pos will be either in range 0..len-1 or will be equal with string::npos 
+			size_t pos = path.find('/');//pos will be either in range 0..len-1 or will be equal with string::npos 
 			std::string name(path, 0, pos);
 
 			CComBstrObj bname;

Modified: trunk/GME/Mga/MgaFCO.cpp
==============================================================================
--- trunk/GME/Mga/MgaFCO.cpp	Thu Nov 10 22:08:35 2011	(r1676)
+++ trunk/GME/Mga/MgaFCO.cpp	Thu Nov 10 22:08:59 2011	(r1677)
@@ -963,6 +963,7 @@
 						getinterface(&tt);
 
 #if(REQUIRE_NOTIFICATION_SUCCESS)
+						// FIXME: if this throws, user has no idea the addon failed
 						COMTHROW(t->handler->ObjectEvent(tt, mmask, mods));
 #else
 						if((s = t->handler->ObjectEvent(tt, mmask, mods)) != S_OK) {

Modified: trunk/GME/Mga/MgaLibOps.cpp
==============================================================================
--- trunk/GME/Mga/MgaLibOps.cpp	Thu Nov 10 22:08:35 2011	(r1676)
+++ trunk/GME/Mga/MgaLibOps.cpp	Thu Nov 10 22:08:59 2011	(r1677)
@@ -1039,10 +1039,10 @@
 	CopyTo( m_libName, v);
 
 	// replacing the found environment variable, %Name% syntax used
-	unsigned int pos = v.find( '%');
+	size_t pos = v.find( '%');
 	if( pos != std::string::npos) // found
 	{
-		unsigned int npos = v.find( '%', pos + 1); //next occurence of '%'
+		size_t npos = v.find( '%', pos + 1); //next occurence of '%'
 		if( npos != -1 && npos > pos + 1)
 		{
 			// get the value of the environment variable between the two %'s

Modified: trunk/GME/Mga/MgaLibOps.h
==============================================================================
--- trunk/GME/Mga/MgaLibOps.h	Thu Nov 10 22:08:35 2011	(r1676)
+++ trunk/GME/Mga/MgaLibOps.h	Thu Nov 10 22:08:59 2011	(r1677)
@@ -484,8 +484,8 @@
 		std::string getCurrentStr();
 
 	protected:
-		unsigned int          m_pos;
-		unsigned int          m_nextPos;
+		size_t          m_pos;
+		size_t          m_nextPos;
 		std::string           m_tokenizable;
 	};
 

Modified: trunk/GME/XmlBackEnd/OperOptions.cpp
==============================================================================
--- trunk/GME/XmlBackEnd/OperOptions.cpp	Thu Nov 10 22:08:35 2011	(r1676)
+++ trunk/GME/XmlBackEnd/OperOptions.cpp	Thu Nov 10 22:08:59 2011	(r1677)
@@ -94,7 +94,7 @@
 std::string OperatingOptions::parseStr( const std::string& p_line, const std::string& p_optStr)
 {
 	std::string ret;
-	int pos = p_line.find_first_not_of( "\t =", p_optStr.length()); // skip whitespaces, equal sign
+	size_t pos = p_line.find_first_not_of( "\t =", p_optStr.length()); // skip whitespaces, equal sign
 	if( pos != std::string::npos) // found
 	{
 		int cpos = p_line.find_first_of( "\t #", pos); // find comments at the end of line, skip whitespaces too


More information about the gme-commit mailing list