unsigned -> size_t for string::find returns
This commit is contained in:
@@ -438,9 +438,9 @@ void Font::GetFontPaths(const CString &sFontOrTextureFilePath,
|
||||
|
||||
CString Font::GetPageNameFromFileName(const CString &fn)
|
||||
{
|
||||
unsigned begin = fn.find_first_of('[');
|
||||
size_t begin = fn.find_first_of('[');
|
||||
if(begin == fn.npos) return "main";
|
||||
unsigned end = fn.find_first_of(']', begin);
|
||||
size_t end = fn.find_first_of(']', begin);
|
||||
if(end == fn.npos) return "main";
|
||||
begin++; end--;
|
||||
if(end == begin) return "main";
|
||||
|
||||
@@ -316,7 +316,7 @@ void ReplaceText( CString &Text, const map<CString,CString> &m )
|
||||
|
||||
for(map<CString,CString>::const_iterator it = m.begin(); it != m.end(); ++it)
|
||||
{
|
||||
unsigned start = 0;
|
||||
size_t start = 0;
|
||||
while(1)
|
||||
{
|
||||
unsigned pos = txt.find(it->first, start);
|
||||
|
||||
@@ -91,7 +91,7 @@ static CString GetDirOfExecutable( CString argv0 )
|
||||
#endif
|
||||
|
||||
// strip off executable name
|
||||
unsigned n = sPath.find_last_of("/");
|
||||
size_t n = sPath.find_last_of("/");
|
||||
if( n != sPath.npos )
|
||||
sPath.erase(n);
|
||||
else
|
||||
|
||||
@@ -255,10 +255,10 @@ CString join( const CString &Delimitor, CStringArray::const_iterator begin, CStr
|
||||
template <class S>
|
||||
void do_split( const S &Source, const S &Delimitor, vector<S> &AddIt, const bool bIgnoreEmpty )
|
||||
{
|
||||
unsigned startpos = 0;
|
||||
size_t startpos = 0;
|
||||
|
||||
do {
|
||||
unsigned pos;
|
||||
size_t pos;
|
||||
if( Delimitor.size() == 1 )
|
||||
pos = Source.find( Delimitor[0], startpos );
|
||||
else
|
||||
@@ -323,7 +323,7 @@ void do_split( const S &Source, const S &Delimitor, int &begin, int &size, int l
|
||||
|
||||
/* Where's the string function to find within a substring? C++ strings apparently
|
||||
* are missing that ... */
|
||||
unsigned pos;
|
||||
size_t pos;
|
||||
if( Delimitor.size() == 1 )
|
||||
pos = Source.find( Delimitor[0], begin );
|
||||
else
|
||||
@@ -400,11 +400,11 @@ CString SetExtension( const CString &path, const CString &ext )
|
||||
|
||||
CString GetExtension( const CString &sPath )
|
||||
{
|
||||
unsigned pos = sPath.rfind( '.' );
|
||||
size_t pos = sPath.rfind( '.' );
|
||||
if( pos == sPath.npos )
|
||||
return "";
|
||||
|
||||
unsigned slash = sPath.find( '/', pos );
|
||||
size_t slash = sPath.find( '/', pos );
|
||||
if( slash != sPath.npos )
|
||||
return ""; /* rare: path/dir.ext/fn */
|
||||
|
||||
@@ -1007,7 +1007,7 @@ void Replace_Unicode_Markers( CString &Text )
|
||||
{
|
||||
/* Look for &#digits; */
|
||||
bool hex = false;
|
||||
unsigned pos = Text.find("&#", start);
|
||||
size_t pos = Text.find("&#", start);
|
||||
if(pos == Text.npos) {
|
||||
hex = true;
|
||||
pos = Text.find("&x", start);
|
||||
@@ -1058,11 +1058,11 @@ CString WcharDisplayText(wchar_t c)
|
||||
*/
|
||||
CString Basename( const CString &dir )
|
||||
{
|
||||
unsigned end = dir.find_last_not_of( "/\\" );
|
||||
size_t end = dir.find_last_not_of( "/\\" );
|
||||
if( end == dir.npos )
|
||||
return "";
|
||||
|
||||
unsigned start = dir.find_last_of( "/\\", end );
|
||||
size_t start = dir.find_last_of( "/\\", end );
|
||||
if( start == dir.npos )
|
||||
start = 0;
|
||||
else
|
||||
|
||||
@@ -31,7 +31,7 @@ void FileSet::GetFilesMatching(const CString &beginning, const CString &containi
|
||||
* search instead of string match). */
|
||||
if(containing.size())
|
||||
{
|
||||
unsigned pos = i->name.find(containing, beginning.size());
|
||||
size_t pos = i->name.find(containing, beginning.size());
|
||||
if(pos == i->name.npos) continue; /* doesn't contain it */
|
||||
if(pos + containing.size() > unsigned(end_pos)) continue; /* found it but it overlaps with the end */
|
||||
}
|
||||
@@ -87,7 +87,7 @@ static void SplitPath( CString Path, CString &Dir, CString &Name )
|
||||
if( Path.Right(1) == "/" )
|
||||
Path.erase( Path.size()-1 );
|
||||
|
||||
unsigned sep = Path.find_last_of( '/' );
|
||||
size_t sep = Path.find_last_of( '/' );
|
||||
if( sep == CString::npos )
|
||||
{
|
||||
Dir = "";
|
||||
@@ -196,13 +196,13 @@ void FilenameDB::GetFilesEqualTo(const CString &dir, const CString &fn, vector<C
|
||||
void FilenameDB::GetFilesSimpleMatch(const CString &dir, const CString &fn, vector<CString> &out, bool bOnlyDirs)
|
||||
{
|
||||
/* Does this contain a wildcard? */
|
||||
unsigned first_pos = fn.find_first_of('*');
|
||||
size_t first_pos = fn.find_first_of('*');
|
||||
if(first_pos == fn.npos)
|
||||
{
|
||||
/* No; just do a regular search. */
|
||||
GetFilesEqualTo(dir, fn, out, bOnlyDirs);
|
||||
} else {
|
||||
unsigned second_pos = fn.find_first_of('*', first_pos+1);
|
||||
size_t second_pos = fn.find_first_of('*', first_pos+1);
|
||||
if(second_pos == fn.npos)
|
||||
{
|
||||
/* Only one *: "A*B". */
|
||||
@@ -392,7 +392,7 @@ void FilenameDB::GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDi
|
||||
ASSERT(!sPath.empty());
|
||||
|
||||
/* Strip off the last path element and use it as a mask. */
|
||||
unsigned pos = sPath.find_last_of( '/' );
|
||||
size_t pos = sPath.find_last_of( '/' );
|
||||
CString fn;
|
||||
if( pos == sPath.npos )
|
||||
{
|
||||
|
||||
@@ -352,7 +352,7 @@ static void GetImageDirListing( CString sPath, CStringArray &AddTo, bool bReturn
|
||||
|
||||
static CString RemoveInitialWhitespace( CString s )
|
||||
{
|
||||
unsigned i = s.find_first_not_of(" \t\r\n");
|
||||
size_t i = s.find_first_not_of(" \t\r\n");
|
||||
if( i != s.npos )
|
||||
s.erase( 0, i );
|
||||
return s;
|
||||
|
||||
@@ -847,7 +847,7 @@ bool GetCommandlineArgument( const CString &option, CString *argument, int iInde
|
||||
{
|
||||
const CString CurArgument = g_argv[arg];
|
||||
|
||||
const unsigned i = CurArgument.find( "=" );
|
||||
const size_t i = CurArgument.find( "=" );
|
||||
CString CurOption = CurArgument.substr(0,i);
|
||||
if( CurOption.CompareNoCase(optstr) )
|
||||
continue; /* no match */
|
||||
|
||||
Reference in New Issue
Block a user