[commit] r1686 - in trunk/Paradigms/MetaGME: BONExtender BONExtender/Rep MetaInterpreter MetaInterpreter/Rep
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Tue Nov 15 13:33:04 CST 2011
Author: ksmyth
Date: Tue Nov 15 13:33:04 2011
New Revision: 1686
Log:
Fix int = string.find bugs
Modified:
trunk/Paradigms/MetaGME/BONExtender/Rep/Any.cpp
trunk/Paradigms/MetaGME/BONExtender/Rep/AttributeRep.cpp
trunk/Paradigms/MetaGME/BONExtender/Rep/MakeVisitor.cpp
trunk/Paradigms/MetaGME/BONExtender/logger.cpp
trunk/Paradigms/MetaGME/MetaInterpreter/BON2Component.cpp
trunk/Paradigms/MetaGME/MetaInterpreter/Rep/AttributeRep.cpp
trunk/Paradigms/MetaGME/MetaInterpreter/Rep/ConnJoint.cpp
trunk/Paradigms/MetaGME/MetaInterpreter/Rep/FolderRep.cpp
trunk/Paradigms/MetaGME/MetaInterpreter/Rep/ModelRep.cpp
trunk/Paradigms/MetaGME/MetaInterpreter/Rep/RoleRep.cpp
trunk/Paradigms/MetaGME/MetaInterpreter/token.cpp
Modified: trunk/Paradigms/MetaGME/BONExtender/Rep/Any.cpp
==============================================================================
--- trunk/Paradigms/MetaGME/BONExtender/Rep/Any.cpp Tue Nov 15 13:32:40 2011 (r1685)
+++ trunk/Paradigms/MetaGME/BONExtender/Rep/Any.cpp Tue Nov 15 13:33:04 2011 (r1686)
@@ -360,7 +360,7 @@
void Any::prepareMacros()
{
std::string h, s, n = getValidNmspc();
- int c = (n.length() < 15) ? 15-n.length():(
+ std::string::size_type c = (n.length() < 15) ? 15-n.length():(
(n.length() < 30) ? 30-n.length():(
(n.length() < 45) ? 45-n.length():(
0
@@ -429,7 +429,7 @@
std::string ind0 = std::string( 2 - 1, '\t'), ind = std::string( 2, '\t'), more_ind = std::string( 2 + 1, '\t');
std::string res, ctor_signature, ctor_inilist, ctor_body, class_body, name;
- unsigned int beg = 0, nwl = exc_str.find('\n');
+ std::string::size_type beg = 0, nwl = exc_str.find('\n');
name = exc_str.substr(0, nwl);
while( nwl != std::string::npos)
@@ -440,7 +440,7 @@
if( nwl > beg && beg < exc_str.length() - 1)
{
std::string par_line = exc_str.substr( beg, nwl - beg);
- int type_end = par_line.find('\t');
+ std::string::size_type type_end = par_line.find('\t');
std::string par_type, par_name;
par_type = par_line.substr(0, type_end);
par_name = par_line.substr( type_end + 1);
Modified: trunk/Paradigms/MetaGME/BONExtender/Rep/AttributeRep.cpp
==============================================================================
--- trunk/Paradigms/MetaGME/BONExtender/Rep/AttributeRep.cpp Tue Nov 15 13:32:40 2011 (r1685)
+++ trunk/Paradigms/MetaGME/BONExtender/Rep/AttributeRep.cpp Tue Nov 15 13:33:04 2011 (r1686)
@@ -96,21 +96,21 @@
std::string items = Dumper::xmlFilter( m_ptr->getAttribute("MenuItems")->getStringValue());
items += '\n'; // like an EOF sign
- int len = items.length();
+ std::string::size_type len = items.length();
std::string whitespace = "\r\n\t ";
- int start_i = 0;
+ std::string::size_type start_i = 0;
while (start_i < len && whitespace.find(items[start_i]) != std::string::npos )
++start_i;//skip heading multiple newlines
- int i = start_i, comma_i = 0;
+ std::string::size_type i = start_i, comma_i = 0;
while( i < len )
{
if ( items[i] == '\n' && i - start_i > 0) // pass till end of line
{
if ( comma_i != 0) // there is value also
{
- int st,end;
+ std::string::size_type st,end;
// from start_i, to comma_i
st = start_i;
while( st < comma_i && whitespace.find( items[st]) != std::string::npos) ++st; //leading whsp
@@ -143,7 +143,7 @@
}
else // no comma means no value
{
- int st,end;
+ std::string::size_type st,end;
// from start_i to i
st = start_i;
while( st < i && whitespace.find( items[st]) != std::string::npos) ++st; //leading whsp
Modified: trunk/Paradigms/MetaGME/BONExtender/Rep/MakeVisitor.cpp
==============================================================================
--- trunk/Paradigms/MetaGME/BONExtender/Rep/MakeVisitor.cpp Tue Nov 15 13:32:40 2011 (r1685)
+++ trunk/Paradigms/MetaGME/BONExtender/Rep/MakeVisitor.cpp Tue Nov 15 13:33:04 2011 (r1686)
@@ -57,7 +57,7 @@
std::string MakeVisitor::dumpVisitorHeader()
{
std::string short_form_header_file;
- int pos = global_vars.header_file_name.rfind( '\\');
+ std::string::size_type pos = global_vars.header_file_name.rfind( '\\');
if ( pos != std::string::npos)
{
if ( pos + 1 < global_vars.header_file_name.length())
Modified: trunk/Paradigms/MetaGME/BONExtender/logger.cpp
==============================================================================
--- trunk/Paradigms/MetaGME/BONExtender/logger.cpp Tue Nov 15 13:32:40 2011 (r1685)
+++ trunk/Paradigms/MetaGME/BONExtender/logger.cpp Tue Nov 15 13:33:04 2011 (r1686)
@@ -76,7 +76,7 @@
std::string shortFileName( const std::string& long_name)
{
- int pos = long_name.rfind( '\\');
+ std::string::size_type pos = long_name.rfind( '\\');
if ( pos != std::string::npos)
{
std::string short_name;
@@ -93,7 +93,7 @@
std::string cutExtension( const std::string& filename)
{
- int p = filename.rfind( ".");
+ std::string::size_type p = filename.rfind( ".");
if ( p != std::string::npos)
return filename.substr( 0, p);
Modified: trunk/Paradigms/MetaGME/MetaInterpreter/BON2Component.cpp
==============================================================================
--- trunk/Paradigms/MetaGME/MetaInterpreter/BON2Component.cpp Tue Nov 15 13:32:40 2011 (r1685)
+++ trunk/Paradigms/MetaGME/MetaInterpreter/BON2Component.cpp Tue Nov 15 13:33:04 2011 (r1686)
@@ -169,7 +169,7 @@
CComBSTR connString;
BONCOMTHROW(mgaProject->get_ProjectConnStr(&connString));
std::string path = Util::Copy( connString);
- int e = path.rfind('\\');
+ std::string::size_type e = path.rfind('\\');
if( e != std::string::npos && path.substr(0, 4) == "MGA=") m_dir = path.substr(4, e-3); // cut leading "MGA=" , preserve tailing '\\'
m_entities.clear();
Modified: trunk/Paradigms/MetaGME/MetaInterpreter/Rep/AttributeRep.cpp
==============================================================================
--- trunk/Paradigms/MetaGME/MetaInterpreter/Rep/AttributeRep.cpp Tue Nov 15 13:32:40 2011 (r1685)
+++ trunk/Paradigms/MetaGME/MetaInterpreter/Rep/AttributeRep.cpp Tue Nov 15 13:33:04 2011 (r1686)
@@ -134,21 +134,21 @@
std::string items = Dumper::xmlFilter( m_ptr->getAttribute("MenuItems")->getStringValue());
items += '\n'; // like an EOF sign
- int len = items.length();
+ std::string::size_type len = items.length();
std::string whitespace = "\r\n\t ";
- int start_i = 0;
+ std::string::size_type start_i = 0;
while (start_i < len && whitespace.find(items[start_i]) != std::string::npos )
++start_i;//skip heading multiple newlines
- int i = start_i, comma_i = 0;
+ std::string::size_type i = start_i, comma_i = 0;
while( i < len )
{
if ( items[i] == '\n' && i - start_i > 0) // pass till end of line
{
if ( comma_i != 0) // there is value also
{
- int st,end;
+ std::string::size_type st,end;
// from start_i, to comma_i
st = start_i;
while( st < comma_i && whitespace.find( items[st]) != std::string::npos) ++st; //leading whsp
@@ -181,7 +181,7 @@
}
else // no comma means no value
{
- int st,end;
+ std::string::size_type st,end;
// from start_i to i
st = start_i;
while( st < i && whitespace.find( items[st]) != std::string::npos) ++st; //leading whsp
Modified: trunk/Paradigms/MetaGME/MetaInterpreter/Rep/ConnJoint.cpp
==============================================================================
--- trunk/Paradigms/MetaGME/MetaInterpreter/Rep/ConnJoint.cpp Tue Nov 15 13:32:40 2011 (r1685)
+++ trunk/Paradigms/MetaGME/MetaInterpreter/Rep/ConnJoint.cpp Tue Nov 15 13:33:04 2011 (r1686)
@@ -390,7 +390,7 @@
std::string src_cons_name, dst_cons_name;
src_cons_name = "Valid" + conn_name + m_srcLabel + "Cardinality" + cons_id1_str;
dst_cons_name = "Valid" + conn_name + m_dstLabel + "Cardinality" + cons_id2_str;
- int pos = 0;
+ std::string::size_type pos = 0;
pos = src_cons_name.find( "::");
if( pos != std::string::npos)
src_cons_name.replace( pos, 2, 2, '_');
Modified: trunk/Paradigms/MetaGME/MetaInterpreter/Rep/FolderRep.cpp
==============================================================================
--- trunk/Paradigms/MetaGME/MetaInterpreter/Rep/FolderRep.cpp Tue Nov 15 13:32:40 2011 (r1685)
+++ trunk/Paradigms/MetaGME/MetaInterpreter/Rep/FolderRep.cpp Tue Nov 15 13:33:04 2011 (r1686)
@@ -260,7 +260,7 @@
std::string str_cons_name;
str_cons_name = "Valid" + getName() + "PartCardinality" + std::string(str_id);
- int pos = str_cons_name.find( "::");
+ std::string::size_type pos = str_cons_name.find( "::");
if( pos != std::string::npos)
str_cons_name.replace( pos, 2, 2, '_');
Modified: trunk/Paradigms/MetaGME/MetaInterpreter/Rep/ModelRep.cpp
==============================================================================
--- trunk/Paradigms/MetaGME/MetaInterpreter/Rep/ModelRep.cpp Tue Nov 15 13:32:40 2011 (r1685)
+++ trunk/Paradigms/MetaGME/MetaInterpreter/Rep/ModelRep.cpp Tue Nov 15 13:33:04 2011 (r1686)
@@ -794,7 +794,7 @@
std::string str_cons_name;
str_cons_name = "Valid" + getName() + "PartCardinality" + std::string(str_id);
- int pos = str_cons_name.find( "::");
+ std::string::size_type pos = str_cons_name.find( "::");
if( pos != std::string::npos)
str_cons_name.replace( pos, 2, 2, '_');
Modified: trunk/Paradigms/MetaGME/MetaInterpreter/Rep/RoleRep.cpp
==============================================================================
--- trunk/Paradigms/MetaGME/MetaInterpreter/Rep/RoleRep.cpp Tue Nov 15 13:32:40 2011 (r1685)
+++ trunk/Paradigms/MetaGME/MetaInterpreter/Rep/RoleRep.cpp Tue Nov 15 13:33:04 2011 (r1686)
@@ -14,13 +14,13 @@
// finds and returns the value after the "token" token
std::string get_name( const std::string& line, const std::string & token = "name")
{
- int start_of_token = line.find(token);
+ std::string::size_type start_of_token = line.find(token);
if (start_of_token == std::string::npos) return "";
- int first_quote = line.substr( start_of_token).find( "\"");
+ std::string::size_type first_quote = line.substr( start_of_token).find( "\"");
if (first_quote == std::string::npos) return "";
// find the second '"'
- int len_of_name = line.substr(start_of_token + first_quote + 1).find("\"");
+ std::string::size_type len_of_name = line.substr(start_of_token + first_quote + 1).find("\"");
if ( len_of_name == std::string::npos) return "";
std::string pp = line.substr( start_of_token + first_quote + 1, len_of_name);
Modified: trunk/Paradigms/MetaGME/MetaInterpreter/token.cpp
==============================================================================
--- trunk/Paradigms/MetaGME/MetaInterpreter/token.cpp Tue Nov 15 13:32:40 2011 (r1685)
+++ trunk/Paradigms/MetaGME/MetaInterpreter/token.cpp Tue Nov 15 13:33:04 2011 (r1686)
@@ -4,8 +4,8 @@
void Tokenizer::split( const std::string& source, const std::string& delimiter, std::vector< std::string> & result)
{
if ( delimiter.length() <= 0) return;
- unsigned int curr_token_start = 0;
- unsigned int curr_token_end = source.find( delimiter, curr_token_start);
+ std::string::size_type curr_token_start = 0;
+ std::string::size_type curr_token_end = source.find( delimiter, curr_token_start);
while ( curr_token_end != std::string::npos) // more delimiters found
{
More information about the gme-commit
mailing list