From kde-commits Tue Sep 25 20:52:47 2007 From: David Faure Date: Tue, 25 Sep 2007 20:52:47 +0000 To: kde-commits Subject: branches/KDE/3.5/kdelibs/kio/kio Message-Id: <1190753567.400947.27765.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=119075358515655 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;