← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-08 into lp:ubuntu-filemanager-app

 

Carlos Jose Mazieri has proposed merging lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-08 into lp:ubuntu-filemanager-app.

Commit message:
Removed static_cast from SmbLocationItemFile::size()
Fixed SmbUtil::getStatInfo() to set "Not exist" for items such as smb://host_does_not_exist

Requested reviews:
  Ubuntu File Manager Developers (ubuntu-filemanager-dev)

For more details, see:
https://code.launchpad.net/~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-08/+merge/276460

Removed static_cast from SmbLocationItemFile::size() when using SmbUtil::getStat() and SmbUtil::getFstat() as stated in https://code.launchpad.net/~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-05/+merge/275164

Fixed SmbUtil::getStatInfo() to set "Not exist" for items such as smb://host_does_not_exist
-- 
Your team Ubuntu File Manager Developers is requested to review the proposed merge of lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-08 into lp:ubuntu-filemanager-app.
=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemfile.cpp'
--- src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemfile.cpp	2015-10-28 01:07:56 +0000
+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemfile.cpp	2015-11-02 20:37:11 +0000
@@ -229,21 +229,13 @@
 {
     qint64 size = 0;
     struct stat  st;
-    SmbUtil::StatReturn  ret  = SmbUtil::StatInvalid;
-    if (isOpen())
-    {       
-        ret = static_cast<SmbUtil::StatReturn> (smbObj()->getFstat(m_context,m_fd,&st));
-    }
-    else
+    bool ok = isOpen() ? smbObj()->getFstat(m_context,m_fd,&st) == 0 : false;
+    if (!isOpen())
     {
-        if (m_context != 0) {
-            ret = static_cast<SmbUtil::StatReturn> (smbObj()->getStat(m_context,cleanUrl(),&st));
-        }
-        else {
-            ret = smbObj()->getStatInfo(cleanUrl(),&st);
-        }
+        ok = m_context != 0 ? smbObj()->getStat(m_context,cleanUrl(),&st) == 0 :
+                              smbObj()->getStatInfo(cleanUrl(),&st) == SmbUtil::StatDone;
     }
-    if(ret == SmbUtil::StatDone)
+    if(ok)
     {
         size = static_cast<qint64> (st.st_size);
     }

=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp'
--- src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp	2015-10-28 01:23:07 +0000
+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp	2015-11-02 20:37:11 +0000
@@ -361,7 +361,7 @@
             (void)getStat(context,smb_path,st);
         }
     }
-    else if (errno != EACCES && errno != ECONNREFUSED) // perhaps is a file
+    else if (errno != EACCES && errno != ECONNREFUSED && slashes >= URL_SLASHES_NUMBER_FOR_SHARES) // perhaps is a file
     {
         errno = 0;
         ret = static_cast<SmbUtil::StatReturn> (getStat(context, smb_path,st));


Follow ups