mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
fix a bug in lyxstring
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@271 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f6a727ca7b
commit
aba5e8132e
@ -1,3 +1,8 @@
|
||||
1999-11-02 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/support/lyxstring.C (find): remove bogus assert and return
|
||||
npos for the same condition.
|
||||
|
||||
1999-11-01 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* added patch for OS/2 from SMiyata.
|
||||
|
@ -73,7 +73,7 @@ string SpaceLess(string const & file)
|
||||
string path = OnlyPath(file);
|
||||
|
||||
for (string::size_type i = 0; i < name.length(); ++i) {
|
||||
name[i] &= 0x7f;
|
||||
name[i] &= 0x7f; // set 8th bit to 0
|
||||
if (!isalnum(name[i]) && name[i] != '.')
|
||||
name[i] = '_';
|
||||
}
|
||||
@ -137,7 +137,6 @@ int IsFileWriteable (string const & path)
|
||||
FilePtr fp(path, FilePtr::update);
|
||||
if (!fp()) {
|
||||
if ((errno == EACCES) || (errno == EROFS)) {
|
||||
//fp = FilePtr(path, FilePtr::read);
|
||||
fp.reopen(path, FilePtr::read);
|
||||
if (fp()) {
|
||||
return 0;
|
||||
@ -191,7 +190,7 @@ string FileOpenSearch (string const & path, string const & name,
|
||||
{
|
||||
string real_file, path_element;
|
||||
bool notfound = true;
|
||||
string tmppath=split(path, path_element, ';');
|
||||
string tmppath = split(path, path_element, ';');
|
||||
|
||||
while (notfound && !path_element.empty()) {
|
||||
path_element = CleanupPath(path_element);
|
||||
@ -338,9 +337,8 @@ bool PutEnvPath(string const & envstr)
|
||||
static
|
||||
int DeleteAllFilesInDir (string const & path)
|
||||
{
|
||||
DIR * dir;
|
||||
struct dirent * de;
|
||||
dir = opendir(path.c_str());
|
||||
DIR * dir = opendir(path.c_str());
|
||||
if (!dir) {
|
||||
WriteFSAlert (_("Error! Cannot open directory:"), path);
|
||||
return -1;
|
||||
@ -856,10 +854,8 @@ string AddPath(string const & path, string const & path_2)
|
||||
|
||||
if (!path2.empty()){
|
||||
int p2start = path2.find_first_not_of('/');
|
||||
//while (path2[p2start] == '/') ++p2start;
|
||||
|
||||
int p2end = path2.find_last_not_of('/');
|
||||
//while (path2[p2end] == '/') --p2end;
|
||||
|
||||
string tmp = path2.substr(p2start, p2end - p2start + 1);
|
||||
buf += tmp + '/';
|
||||
@ -950,6 +946,7 @@ string MakeDisplayPath (string const & path, unsigned int threshold)
|
||||
return prefix + relhome;
|
||||
}
|
||||
|
||||
|
||||
bool LyXReadLink(string const & File, string & Link)
|
||||
{
|
||||
char LinkBuffer[512];
|
||||
|
@ -921,9 +921,8 @@ lyxstring::size_type lyxstring::find(value_type const * ptr, size_type i,
|
||||
lyxstring::size_type lyxstring::find(value_type const * s, size_type i) const
|
||||
{
|
||||
Assert(s);
|
||||
if (!rep->sz) return npos;
|
||||
if (!rep->sz || i >= rep->sz) return npos;
|
||||
|
||||
Assert(i < rep->sz);
|
||||
TestlyxstringInvariant(this);
|
||||
|
||||
if (!s || !*s) return npos;
|
||||
|
Loading…
Reference in New Issue
Block a user