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

List:       kde-commits
Subject:    branches/KDE/3.5/kdelibs/kio/kio
From:       David Faure <faure () kde ! org>
Date:       2007-09-25 20:52:47
Message-ID: 1190753567.400947.27765.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 717004 by dfaure:

Konqueror performance patch 1 (especially on a smbmount'ed directory): avoid a stat() \
call in KFileItem::isReadable() when possible


 M  +16 -8     kfileitem.cpp  


--- branches/KDE/3.5/kdelibs/kio/kio/kfileitem.cpp #717003:717004
@@ -628,12 +628,18 @@
   // for the groups... then we need to handle the deletion properly...
   */
 
-  // No read permission at all
-  if ( !(S_IRUSR & m_permissions) && !(S_IRGRP & m_permissions) && !(S_IROTH & \
                m_permissions) )
-      return false;
+  if ( m_permissions != KFileItem::Unknown ) {
+    // No read permission at all
+    if ( !(S_IRUSR & m_permissions) && !(S_IRGRP & m_permissions) && !(S_IROTH & \
m_permissions) ) +        return false;
 
+    // Read permissions for all: save a stat call
+    if ( (S_IRUSR|S_IRGRP|S_IROTH) & m_permissions )
+        return true;
+  }
+
   // Or if we can't read it [using ::access()] - not network transparent
-  else if ( m_bIsLocalURL && ::access( QFile::encodeName(m_url.path()), R_OK ) == -1 \
) +  if ( m_bIsLocalURL && ::access( QFile::encodeName(m_url.path()), R_OK ) == -1 )
       return false;
 
   return true;
@@ -649,12 +655,14 @@
   // for the groups... then we need to handle the deletion properly...
   */
 
-  // No write permission at all
-  if ( !(S_IWUSR & m_permissions) && !(S_IWGRP & m_permissions) && !(S_IWOTH & \
                m_permissions) )
-      return false;
+  if ( m_permissions != KFileItem::Unknown ) {
+    // No write permission at all
+    if ( !(S_IWUSR & m_permissions) && !(S_IWGRP & m_permissions) && !(S_IWOTH & \
m_permissions) ) +        return false;
+  }
 
   // Or if we can't read it [using ::access()] - not network transparent
-  else if ( m_bIsLocalURL && ::access( QFile::encodeName(m_url.path()), W_OK ) == -1 \
) + if ( m_bIsLocalURL && ::access( QFile::encodeName(m_url.path()), W_OK ) == -1 )
       return false;
 
   return true;


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

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