Index: kdecore/kernel/kstandarddirs.cpp
===================================================================
--- kdecore/kernel/kstandarddirs.cpp	(wersja 829656)
+++ kdecore/kernel/kstandarddirs.cpp	(kopia robocza)
@@ -393,12 +393,14 @@
                                     const QString& absdir,
                                     bool priority)
 {
+    if (absdir.isEmpty() || !type)
+      return false;
     // find or insert entry in the map
-    QStringList &paths = d->absolutes[type];
     QString copy = absdir;
     if (copy.at(copy.length() - 1) != '/')
         copy += '/';
 
+    QStringList &paths = d->absolutes[type];
     if (!paths.contains(copy)) {
         if (priority)
             paths.prepend(copy);
@@ -554,13 +556,13 @@
     // access() and stat() give a stupid error message to the user
     // if the path is not accessible at all (e.g. no disk in A:/ and
     // we do stat("A:/.directory")
-    if(fullPath.at(fullPath.length() - 1) == '/')
+    if(fullPath.endsWith('/')
         return QDir(fullPath).exists();
     return QFileInfo(fullPath).exists();
 #else
     KDE_struct_stat buff;
     if (access(QFile::encodeName(fullPath), R_OK) == 0 && KDE_stat( QFile::encodeName(fullPath), &buff ) == 0) {
-        if (fullPath.at(fullPath.length() - 1) != '/') {
+        if (!fullPath.endsWith('/')) {
             if (S_ISREG( buff.st_mode ))
                 return true;
         } else
@@ -577,7 +579,7 @@
                             QStringList& relList,
                             bool recursive, bool unique)
 {
-    QString pattern = regexp.pattern();
+    const QString pattern = regexp.pattern();
     if (recursive || pattern.contains('?') || pattern.contains('*'))
     {
         if (path.isEmpty()) //for sanity
@@ -678,15 +680,12 @@
     QString path;
     QString rest;
 
-    if (relpath.length())
-    {
-        int slash = relpath.indexOf('/');
-        if (slash < 0)
-            rest = relpath.left(relpath.length() - 1);
-        else {
-            path = relpath.left(slash);
-            rest = relpath.mid(slash + 1);
-        }
+    int slash = relpath.indexOf('/');
+    if (slash < 0)
+        rest = relpath.left(relpath.length() - 1);
+    else {
+        path = relpath.left(slash);
+        rest = relpath.mid(slash + 1);
     }
 
     if (prefix.isEmpty()) //for sanity
@@ -753,11 +752,10 @@
                                  SearchOptions options,
                                  QStringList &relList) const
 {
-    QStringList list;
     QString filterPath;
     QString filterFile;
 
-    if ( filter.length() )
+    if ( !filter.isEmpty() )
     {
         int slash = filter.lastIndexOf('/');
         if (slash < 0) {
@@ -793,6 +791,7 @@
 
     QRegExp regExp(filterFile, Qt::CaseSensitive, QRegExp::Wildcard);
 
+    QStringList list;
     foreach ( const QString& candidate, candidates )
     {
         lookupPrefix(candidate, filterPath, "", regExp, list,
@@ -1071,7 +1070,7 @@
     QStringList tokens;
     QString p = pstr;
 
-    if( p.isNull() )
+    if( p.isEmpty() )
     {
         p = QString::fromLocal8Bit( qgetenv( "PATH" ) );
     }
@@ -1261,7 +1260,7 @@
             token += str[ index ];
         }
     }
-    if ( token.length() > 0 )
+    if ( !token.isEmpty() )
     {
         tokens.append( equalizePath(token) );
     }
@@ -1574,7 +1573,7 @@
     for (QStringList::ConstIterator it = kdedirList.begin();
          it != kdedirList.end(); ++it) {
         QString dir = *it;
-        if (dir.length() < 1 || dir[dir.length()-1] != '/')
+        if (!dir.endsWith('/'))
             dir += '/';
         kdedirDataDirs.append(dir+"share/");
     }
@@ -1781,7 +1780,7 @@
                     // generate directory list, there may be more than 1.
                     QStringList dirs = (*it2).split(',');
                     QStringList::Iterator sIt(dirs.begin());
-                    QString resType = key.mid(4, key.length());
+                    QString resType = key.mid(4);
                     for (; sIt != dirs.end(); ++sIt)
                     {
                         addResourceDir(resType.toLatin1(), *sIt, priority);
