Fixed std::string usage so that std::string::size_type is used where
appropriate.
This commit is contained in:
@@ -72,8 +72,8 @@ void ApplicationUsage::getFormatedString(std::string& str, const UsageMap& um,un
|
||||
line.replace(optionPos,optionWidth,citr->first);
|
||||
|
||||
const std::string& explanation = citr->second;
|
||||
unsigned int pos = 0;
|
||||
unsigned int offset = 0;
|
||||
std::string::size_type pos = 0;
|
||||
std::string::size_type offset = 0;
|
||||
bool firstInLine = true;
|
||||
while (pos<explanation.length())
|
||||
{
|
||||
@@ -88,8 +88,8 @@ void ApplicationUsage::getFormatedString(std::string& str, const UsageMap& um,un
|
||||
|
||||
firstInLine = false;
|
||||
|
||||
unsigned int width = minimum((unsigned int)explanation.length()-pos,explanationWidth-offset);
|
||||
unsigned int slashn_pos = explanation.find('\n',pos);
|
||||
std::string::size_type width = minimum((std::string::size_type)(explanation.length()-pos),(std::string::size_type)(explanationWidth-offset));
|
||||
std::string::size_type slashn_pos = explanation.find('\n',pos);
|
||||
unsigned int extraSkip = 0;
|
||||
bool concatinated = false;
|
||||
if (slashn_pos!=std::string::npos)
|
||||
|
||||
@@ -296,39 +296,14 @@ void ArgumentParser::reportRemainingOptionsAsUnrecognized(ErrorSeverity severity
|
||||
{
|
||||
if (option[prevpos]=='-')
|
||||
{
|
||||
// verbose approach implemented for debugging string(const string&,unsigned int,unsigned int) operation on x86-64
|
||||
notify(INFO)<<"option=\""<<option<<"\" \tprevpos="<<prevpos<<" \tn="<<pos-prevpos<<"\tnpos="<<std::string::npos;
|
||||
|
||||
std::string str(option,prevpos,pos-prevpos);
|
||||
|
||||
notify(INFO)<<" \tstr=\""<<str<<"\"";
|
||||
|
||||
options.insert(str);
|
||||
|
||||
notify(INFO)<<" \tinserted into options set"<<std::endl;
|
||||
|
||||
|
||||
// original op which causes a crash under x86-64
|
||||
//options.insert(std::string(option,prevpos,pos-prevpos));
|
||||
options.insert(std::string(option,prevpos,pos-prevpos));
|
||||
}
|
||||
prevpos=pos+1;
|
||||
}
|
||||
if (option[prevpos]=='-')
|
||||
{
|
||||
|
||||
// verbose approach implemented for debugging string(const string&,unsigned int,unsigned int) operation on x86-64
|
||||
notify(INFO)<<"option=\""<<option<<"\" \tprevpos="<<prevpos<<" \tn=npos="<<std::string::npos;
|
||||
|
||||
std::string str(option,prevpos,pos-prevpos);
|
||||
|
||||
notify(INFO)<<" \tstr=\""<<str<<"\"";
|
||||
|
||||
options.insert(str);
|
||||
|
||||
notify(INFO)<<" \tinserted into options set"<<std::endl;
|
||||
|
||||
// original op
|
||||
//options.insert(std::string(option,prevpos,std::string::npos));
|
||||
options.insert(std::string(option,prevpos,std::string::npos));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -241,11 +241,11 @@ void Object::readTexFilename(ifstream& fin, TextureFilename& texture)
|
||||
break;
|
||||
|
||||
// Strip " if present
|
||||
string line = buf;
|
||||
size_t pos = line.find('"');
|
||||
std::string line = buf;
|
||||
std::string::size_type pos = line.find('"');
|
||||
if (pos != string::npos) {
|
||||
size_t end = line.rfind('"');
|
||||
int len = (end != string::npos ? (end-pos-1) : (line.size()-pos));
|
||||
std::string::size_type end = line.rfind('"');
|
||||
int len = (end != std::string::npos ? (end-pos-1) : (line.size()-pos));
|
||||
texture = line.substr(pos+1, len);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user