Testing different method of dealing with the troublesome non-type-locked single characters; if the new kdelibs build fails a subsequent thorough runtime test then this commit will need to be reverted!

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1164087 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent 98771216a3
commit 40949332b7

@ -144,7 +144,7 @@ bool KStandardDirs::isRestrictedResource(const char *type, const TQString& relPa
void KStandardDirs::applyDataRestrictions(const TQString &relPath) const void KStandardDirs::applyDataRestrictions(const TQString &relPath) const
{ {
TQString key; TQString key;
int i = relPath.find('/'); int i = relPath.find(QChar('/'));
if (i != -1) if (i != -1)
key = "data_"+relPath.left(i); key = "data_"+relPath.left(i);
else else
@ -189,8 +189,8 @@ void KStandardDirs::addPrefix( const TQString& _dir, bool priority )
return; return;
TQString dir = _dir; TQString dir = _dir;
if (dir.at(dir.length() - 1) != '/') if (dir.at(dir.length() - 1) != QChar('/'))
dir += '/'; dir += QChar('/');
if (!prefixes.contains(dir)) { if (!prefixes.contains(dir)) {
priorityAdd(prefixes, dir, priority); priorityAdd(prefixes, dir, priority);
@ -209,8 +209,8 @@ void KStandardDirs::addXdgConfigPrefix( const TQString& _dir, bool priority )
return; return;
TQString dir = _dir; TQString dir = _dir;
if (dir.at(dir.length() - 1) != '/') if (dir.at(dir.length() - 1) != QChar('/'))
dir += '/'; dir += QChar('/');
if (!d->xdgconf_prefixes.contains(dir)) { if (!d->xdgconf_prefixes.contains(dir)) {
priorityAdd(d->xdgconf_prefixes, dir, priority); priorityAdd(d->xdgconf_prefixes, dir, priority);
@ -229,8 +229,8 @@ void KStandardDirs::addXdgDataPrefix( const TQString& _dir, bool priority )
return; return;
TQString dir = _dir; TQString dir = _dir;
if (dir.at(dir.length() - 1) != '/') if (dir.at(dir.length() - 1) != QChar('/'))
dir += '/'; dir += QChar('/');
if (!d->xdgdata_prefixes.contains(dir)) { if (!d->xdgdata_prefixes.contains(dir)) {
priorityAdd(d->xdgdata_prefixes, dir, priority); priorityAdd(d->xdgdata_prefixes, dir, priority);
@ -271,8 +271,8 @@ bool KStandardDirs::addResourceType( const char *type,
relatives.insert(type, rels); relatives.insert(type, rels);
} }
TQString copy = relativename; TQString copy = relativename;
if (copy.at(copy.length() - 1) != '/') if (copy.at(copy.length() - 1) != QChar('/'))
copy += '/'; copy += QChar('/');
if (!rels->contains(copy)) { if (!rels->contains(copy)) {
if (priority) if (priority)
rels->prepend(copy); rels->prepend(copy);
@ -301,8 +301,8 @@ bool KStandardDirs::addResourceDir( const char *type,
absolutes.insert(type, paths); absolutes.insert(type, paths);
} }
TQString copy = absdir; TQString copy = absdir;
if (copy.at(copy.length() - 1) != '/') if (copy.at(copy.length() - 1) != QChar('/'))
copy += '/'; copy += QChar('/');
if (!paths->contains(copy)) { if (!paths->contains(copy)) {
if (priority) if (priority)
@ -389,7 +389,7 @@ TQStringList KStandardDirs::findDirs( const char *type,
if (reldir.endsWith("/")) if (reldir.endsWith("/"))
list.append(reldir); list.append(reldir);
else else
list.append(reldir+'/'); list.append(reldir+QChar('/'));
} }
return list; return list;
} }
@ -404,7 +404,7 @@ TQStringList KStandardDirs::findDirs( const char *type,
it != candidates.end(); ++it) { it != candidates.end(); ++it) {
testdir.setPath(*it + reldir); testdir.setPath(*it + reldir);
if (testdir.exists()) if (testdir.exists())
list.append(testdir.absPath() + '/'); list.append(testdir.absPath() + QChar('/'));
} }
return list; return list;
@ -452,7 +452,7 @@ bool KStandardDirs::exists(const TQString &fullPath)
{ {
KDE_struct_stat buff; KDE_struct_stat buff;
if (access(TQFile::encodeName(fullPath), R_OK) == 0 && KDE_stat( TQFile::encodeName(fullPath), &buff ) == 0) if (access(TQFile::encodeName(fullPath), R_OK) == 0 && KDE_stat( TQFile::encodeName(fullPath), &buff ) == 0)
if (fullPath.at(fullPath.length() - 1) != '/') { if (fullPath.at(fullPath.length() - 1) != QChar('/')) {
if (S_ISREG( buff.st_mode )) if (S_ISREG( buff.st_mode ))
return true; return true;
} else } else
@ -478,9 +478,9 @@ static void lookupDirectory(const TQString& path, const TQString &relPart,
return; return;
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
assert(path.at(path.length() - 1) == '/' || path.at(path.length() - 1) == '\\'); assert(path.at(path.length() - 1) == QChar('/') || path.at(path.length() - 1) == QChar('\\'));
#else #else
assert(path.at(path.length() - 1) == '/'); assert(path.at(path.length() - 1) == QChar('/'));
#endif #endif
struct dirent *ep; struct dirent *ep;
@ -492,7 +492,7 @@ static void lookupDirectory(const TQString& path, const TQString &relPart,
while( ( ep = readdir( dp ) ) != 0L ) while( ( ep = readdir( dp ) ) != 0L )
{ {
TQString fn( TQFile::decodeName(ep->d_name)); TQString fn( TQFile::decodeName(ep->d_name));
if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1).latin1() == '~') if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1).latin1() == (QChar)QChar('~'))
continue; continue;
if (!recursive && !regexp.exactMatch(fn)) if (!recursive && !regexp.exactMatch(fn))
@ -505,7 +505,7 @@ static void lookupDirectory(const TQString& path, const TQString &relPart,
} }
if ( recursive ) { if ( recursive ) {
if ( S_ISDIR( buff.st_mode )) { if ( S_ISDIR( buff.st_mode )) {
lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, unique); lookupDirectory(pathfn + QChar('/'), relPart + fn + QChar('/'), regexp, list, relList, recursive, unique);
} }
if (!regexp.exactMatch(fn)) if (!regexp.exactMatch(fn))
continue; // No match continue; // No match
@ -557,7 +557,7 @@ static void lookupPrefix(const TQString& prefix, const TQString& relpath,
if (relpath.length()) if (relpath.length())
{ {
int slash = relpath.find('/'); int slash = relpath.find(QChar('/'));
if (slash < 0) if (slash < 0)
rest = relpath.left(relpath.length() - 1); rest = relpath.left(relpath.length() - 1);
else { else {
@ -569,9 +569,9 @@ static void lookupPrefix(const TQString& prefix, const TQString& relpath,
if (prefix.isEmpty()) //for sanity if (prefix.isEmpty()) //for sanity
return; return;
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
assert(prefix.at(prefix.length() - 1) == '/' || prefix.at(prefix.length() - 1) == '\\'); assert(prefix.at(prefix.length() - 1) == QChar('/') || prefix.at(prefix.length() - 1) == QChar('\\'));
#else #else
assert(prefix.at(prefix.length() - 1) == '/'); assert(prefix.at(prefix.length() - 1) == QChar('/'));
#endif #endif
KDE_struct_stat buff; KDE_struct_stat buff;
@ -591,7 +591,7 @@ static void lookupPrefix(const TQString& prefix, const TQString& relpath,
while( ( ep = readdir( dp ) ) != 0L ) while( ( ep = readdir( dp ) ) != 0L )
{ {
TQString fn( TQFile::decodeName(ep->d_name)); TQString fn( TQFile::decodeName(ep->d_name));
if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1) == '~') if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1) == QChar('~'))
continue; continue;
if ( !pathExp.exactMatch(fn) ) if ( !pathExp.exactMatch(fn) )
@ -603,15 +603,15 @@ static void lookupPrefix(const TQString& prefix, const TQString& relpath,
continue; // Couldn't stat (e.g. no permissions) continue; // Couldn't stat (e.g. no permissions)
} }
if ( S_ISDIR( buff.st_mode )) if ( S_ISDIR( buff.st_mode ))
lookupPrefix(fn + '/', rest, rfn + '/', regexp, list, relList, recursive, unique); lookupPrefix(fn + QChar('/'), rest, rfn + QChar('/'), regexp, list, relList, recursive, unique);
} }
closedir( dp ); closedir( dp );
} else { } else {
// Don't stat, if the dir doesn't exist we will find out // Don't stat, if the dir doesn't exist we will find out
// when we try to open it. // when we try to open it.
lookupPrefix(prefix + path + '/', rest, lookupPrefix(prefix + path + QChar('/'), rest,
relPart + path + '/', regexp, list, relPart + path + QChar('/'), regexp, list,
relList, recursive, unique); relList, recursive, unique);
} }
} }
@ -692,7 +692,7 @@ KStandardDirs::realPath(const TQString &dirname)
if (realpath( TQFile::encodeName(dirname).data(), realpath_buffer) != 0) { if (realpath( TQFile::encodeName(dirname).data(), realpath_buffer) != 0) {
// success, use result from realpath // success, use result from realpath
int len = strlen(realpath_buffer); int len = strlen(realpath_buffer);
realpath_buffer[len] = '/'; realpath_buffer[len] = QChar('/');
realpath_buffer[len+1] = 0; realpath_buffer[len+1] = 0;
return TQFile::decodeName(realpath_buffer); return TQFile::decodeName(realpath_buffer);
} }
@ -771,13 +771,13 @@ void KStandardDirs::createSpecialResource(const char *type)
if (result > 0) if (result > 0)
{ {
link[result] = 0; link[result] = 0;
if (link[0] == '/') if (link[0] == (QChar)QChar('/'))
dir = TQFile::decodeName(link); dir = TQFile::decodeName(link);
else else
dir = TQDir::cleanDirPath(dir+TQFile::decodeName(link)); dir = TQDir::cleanDirPath(dir+TQFile::decodeName(link));
} }
#endif #endif
addResourceDir(type, dir+'/'); addResourceDir(type, dir+QChar('/'));
} }
TQStringList KStandardDirs::resourceDirs(const char *type) const TQStringList KStandardDirs::resourceDirs(const char *type) const
@ -892,9 +892,9 @@ TQStringList KStandardDirs::systemPaths( const TQString& pstr )
{ {
p = tokens[ i ]; p = tokens[ i ];
if ( p[ 0 ] == '~' ) if ( p[ 0 ] == QChar('~') )
{ {
int len = p.find( '/' ); int len = p.find( QChar('/') );
if ( len == -1 ) if ( len == -1 )
len = p.length(); len = p.length();
if ( len == 1 ) if ( len == 1 )
@ -1167,8 +1167,8 @@ bool KStandardDirs::makeDir(const TQString& dir, int mode)
uint len = target.length(); uint len = target.length();
// append trailing slash if missing // append trailing slash if missing
if (dir.at(len - 1) != '/') if (dir.at(len - 1) != QChar('/'))
target += '/'; target += QChar('/');
TQString base(""); TQString base("");
uint i = 1; uint i = 1;
@ -1176,7 +1176,7 @@ bool KStandardDirs::makeDir(const TQString& dir, int mode)
while( i < len ) while( i < len )
{ {
KDE_struct_stat st; KDE_struct_stat st;
int pos = target.find('/', i); int pos = target.find(QChar('/'), i);
base += target.mid(i - 1, pos - i + 1); base += target.mid(i - 1, pos - i + 1);
TQCString baseEncoded = TQFile::encodeName(base); TQCString baseEncoded = TQFile::encodeName(base);
// bail out if we encountered a problem // bail out if we encountered a problem
@ -1220,7 +1220,7 @@ static TQString executablePrefix()
if (length == -1) if (length == -1)
return TQString::null; return TQString::null;
path_buffer[length] = '\0'; path_buffer[length] = QChar('\0');
TQString path = TQFile::decodeName(path_buffer); TQString path = TQFile::decodeName(path_buffer);
@ -1230,7 +1230,7 @@ static TQString executablePrefix()
int pos = path.findRev('/'); // Skip filename int pos = path.findRev('/'); // Skip filename
if(pos <= 0) if(pos <= 0)
return TQString::null; return TQString::null;
pos = path.findRev('/', pos - 1); // Skip last directory pos = path.findRev(QChar('/'), pos - 1); // Skip last directory
if(pos <= 0) if(pos <= 0)
return TQString::null; return TQString::null;
@ -1314,15 +1314,15 @@ void KStandardDirs::addKDEDefaults()
TQString localKdeDir = readEnvPath(getuid() ? "KDEHOME" : "KDEROOTHOME"); TQString localKdeDir = readEnvPath(getuid() ? "KDEHOME" : "KDEROOTHOME");
if (!localKdeDir.isEmpty()) if (!localKdeDir.isEmpty())
{ {
if (localKdeDir[localKdeDir.length()-1] != '/') if (localKdeDir[localKdeDir.length()-1] != QChar('/'))
localKdeDir += '/'; localKdeDir += QChar('/');
} }
else else
{ {
localKdeDir = TQDir::homeDirPath() + "/.kde3/"; localKdeDir = TQDir::homeDirPath() + "/.kde3/";
} }
if (localKdeDir != "-/") if (localKdeDir != QString("-/"))
{ {
localKdeDir = KShell::tildeExpand(localKdeDir); localKdeDir = KShell::tildeExpand(localKdeDir);
addPrefix(localKdeDir); addPrefix(localKdeDir);
@ -1358,8 +1358,8 @@ void KStandardDirs::addKDEDefaults()
TQString localXdgDir = readEnvPath("XDG_CONFIG_HOME"); TQString localXdgDir = readEnvPath("XDG_CONFIG_HOME");
if (!localXdgDir.isEmpty()) if (!localXdgDir.isEmpty())
{ {
if (localXdgDir[localXdgDir.length()-1] != '/') if (localXdgDir[localXdgDir.length()-1] != QChar('/'))
localXdgDir += '/'; localXdgDir += QChar('/');
} }
else else
{ {
@ -1390,8 +1390,8 @@ void KStandardDirs::addKDEDefaults()
it != kdedirList.end(); ++it) it != kdedirList.end(); ++it)
{ {
TQString dir = *it; TQString dir = *it;
if (dir[dir.length()-1] != '/') if (dir[dir.length()-1] != QChar('/'))
dir += '/'; dir += QChar('/');
xdgdirList.append(dir+"share/"); xdgdirList.append(dir+"share/");
} }
@ -1402,8 +1402,8 @@ void KStandardDirs::addKDEDefaults()
localXdgDir = readEnvPath("XDG_DATA_HOME"); localXdgDir = readEnvPath("XDG_DATA_HOME");
if (!localXdgDir.isEmpty()) if (!localXdgDir.isEmpty())
{ {
if (localXdgDir[localXdgDir.length()-1] != '/') if (localXdgDir[localXdgDir.length()-1] != QChar('/'))
localXdgDir += '/'; localXdgDir += QChar('/');
} }
else else
{ {
@ -1538,9 +1538,9 @@ bool KStandardDirs::addCustomized(KConfig *config)
KUser thisUser; KUser thisUser;
char hostname[ 256 ]; char hostname[ 256 ];
hostname[ 0 ] = '\0'; hostname[ 0 ] = QChar('\0');
if (!gethostname( hostname, 255 )) if (!gethostname( hostname, 255 ))
hostname[sizeof(hostname)-1] = '\0'; hostname[sizeof(hostname)-1] = QChar('\0');
if ((user == thisUser.loginName()) && if ((user == thisUser.loginName()) &&
(host.isEmpty() || (host == hostname))) (host.isEmpty() || (host == hostname)))

Loading…
Cancel
Save