Fix for compilers with broken string::find_last_not_of.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_1_6@1385 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2001-01-24 17:34:00 +00:00
parent b70db4ad74
commit 1c207d01ec
3 changed files with 18 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2001-01-23 Dekel Tsur <dekelts@tau.ac.il>
* src/support/lstrings.C (strip): Add a fix for compilers with broken
string::find_last_not_of.
* src/support/filetools.C (AddPath): Simplify by using strip and
frontStrip.
2001-01-24 Dekel Tsur <dekelts@tau.ac.il>
* src/MenuBackend.C (expand): Fix the sorting of the formats.

View File

@ -942,12 +942,9 @@ string const AddPath(string const & path, string const & path_2)
buf += '/';
}
if (!path2.empty()) {
string::size_type const p2start = path2.find_first_not_of('/');
string::size_type const p2end = path2.find_last_not_of('/');
string const tmp = path2.substr(p2start, p2end - p2start + 1);
buf += tmp + '/';
}
if (!path2.empty())
buf += frontStrip(strip(path2, '/'), '/') + '/';
return buf;
}

View File

@ -512,6 +512,13 @@ string const strip(string const & a, char c)
if (i == a.length() - 1) return tmp; // no c's at end of a
if (i != string::npos)
tmp.erase(i + 1, string::npos);
#if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
/// Needed for broken string::find_last_not_of
else if (tmp[0] != c) {
if (a.length() == 1) return tmp;
tmp.erase(1, string::npos);
}
#endif
else
tmp.erase(); // only c in the whole string
return tmp;