[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/io
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2010-09-12 14:30:41
Message-ID: 20100912143041.D0A3EAC887 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1174469 by aacid:

add QLatin1Char to some parts of the function, it keeps consistency and makes it an \
awesome 0.15% faster :D Also add some const


 M  +9 -9      kurl.cpp  


--- trunk/KDE/kdelibs/kdecore/io/kurl.cpp #1174468:1174469
@@ -509,13 +509,13 @@
   // WORKAROUND THE RFC 1606 LOOPHOLE THAT ALLOWS
   // http:/index.html AS A VALID SYNTAX FOR RELATIVE
   // URLS. ( RFC 2396 section 5.2 item # 3 )
-  int len = _u.scheme().length();
+  const int len = _u.scheme().length();
   if ( !_u.host().isEmpty() && !rUrl.isEmpty() &&
        rUrl.indexOf( _u.scheme(), 0, Qt::CaseInsensitive ) == 0 &&
-       rUrl[len] == ':' && (rUrl[len+1] != QLatin1Char('/') ||
-       (rUrl[len+1] == '/' && rUrl[len+2] != QLatin1Char('/'))) )
+       rUrl[len] == QLatin1Char(':') && (rUrl[len+1] != QLatin1Char('/') ||
+       (rUrl[len+1] == QLatin1Char('/') && rUrl[len+2] != QLatin1Char('/'))) )
   {
-    rUrl.remove( 0, rUrl.indexOf( ':' ) + 1 );
+    rUrl.remove( 0, rUrl.indexOf( QLatin1Char(':') ) + 1 );
   }
 
 
@@ -523,7 +523,7 @@
   {
     *this = _u;
   }
-  else if ( rUrl[0] == '#' )
+  else if ( rUrl[0] == QLatin1Char('#') )
   {
     *this = _u;
     QByteArray strRef_encoded = rUrl.mid(1).toLatin1();
@@ -549,9 +549,9 @@
         }
         strPath.clear();
     }
-    else if ( rUrl[0] != '?' )
+    else if ( rUrl[0] != QLatin1Char('?') )
     {
-       int pos = strPath.lastIndexOf( QLatin1Char('/') );
+       const int pos = strPath.lastIndexOf( QLatin1Char('/') );
        if (pos >= 0)
           strPath.truncate(pos);
        strPath += QLatin1Char('/');
@@ -563,14 +563,14 @@
     }
     setPath( strPath );
     //kDebug(kurlDebugArea()) << "url()=" << url() << " rUrl=" << rUrl;
-    KUrl tmp( url() + rUrl);
+    const KUrl tmp( url() + rUrl);
     //kDebug(kurlDebugArea()) << "assigning tmp=" << tmp.url();
     *this = tmp;
     cleanPath(KeepDirSeparators);
   }
   else
   {
-    KUrl tmp( rUrl );
+    const KUrl tmp( rUrl );
     //kDebug(kurlDebugArea()) << "not relative; assigning tmp=" << tmp.url();
     *this = tmp;
     // Preserve userinfo if applicable.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic