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

List:       kde-commits
Subject:    kdenox/konq-embed/dropin/kio
From:       Luciano Montanaro <mikelima () cirulla ! net>
Date:       2005-04-08 8:31:58
Message-ID: 20050408083158.CBE01644 () office ! kde ! org
[Download RAW message or body]

CVS commit by montanaro: 

Use better alternatives for string matching.


  M +5 -4      kio_file.cpp   1.15


--- kdenox/konq-embed/dropin/kio/kio_file.cpp  #1.14:1.15
@@ -4,4 +4,5 @@
     Copyright (C) 2002-2003 Paul Chitescu <paulc-devel@null.ro>
     Copyright (C) 2003 Luciano Montanaro <mikelima@cirulla.net>
+    Copyright (C) 2005 Fastweb SpA
 
     This library is free software; you can redistribute it and/or
@@ -61,10 +62,10 @@ void File::get( const KURL &url )
         KConfigGroupSaver saver( config, QString::fromLatin1( "Local Protocols" ) );
         QString temp=config->readEntry( mProtocol, QString::null );
-        if ( temp.left( 1 ) == "*" )
+        if ( temp.startsWith("*") )
         {
             temp.remove( 0, 1 );
             mayExec = true;
         }
-        else if ( temp.left( 1 ) == "!" )
+        else if ( temp.startsWith("!") )
         {
             temp.remove( 0, 1 );
@@ -73,5 +74,5 @@ void File::get( const KURL &url )
             path="";
         }
-        if ( temp.left( 1 ) == "~" )
+        if ( temp.startsWith("~") )
         {
             temp.remove( 0, 1 );
@@ -80,5 +81,5 @@ void File::get( const KURL &url )
         path=temp+path;
     }
-    if ( path.find( "/../" ) != -1 || path.right( 3 ) == "/.." )
+    if ( path.contains("/../") || path.endsWith("/..") )
     {
         error( KIO::ERR_MALFORMED_URL, path );


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

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