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

Proposed by Carlos Jose Mazieri on 2015-11-02
Status: Merged
Approved by: Arto Jalkanen on 2015-11-03
Approved revision: 493
Merged at revision: 493
Proposed branch: lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-08
Merge into: lp:ubuntu-filemanager-app
Diff against target: 43 lines (+6/-14)
2 files modified
src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemfile.cpp (+5/-13)
src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp (+1/-1)
To merge this branch: bzr merge lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-08
Reviewer Review Type Date Requested Status
Arto Jalkanen 2015-11-02 Approve on 2015-11-03
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-11-02
Jenkins Bot continuous-integration Approve on 2015-11-02
Review via email: mp+276460@code.launchpad.net

Commit message

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

Description of the change

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

To post a comment you must log in.
review: Approve (continuous-integration)
review: Approve (continuous-integration)
Arto Jalkanen (ajalkane) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemfile.cpp'
2--- src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemfile.cpp 2015-10-28 01:07:56 +0000
3+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemfile.cpp 2015-11-02 20:41:45 +0000
4@@ -229,21 +229,13 @@
5 {
6 qint64 size = 0;
7 struct stat st;
8- SmbUtil::StatReturn ret = SmbUtil::StatInvalid;
9- if (isOpen())
10- {
11- ret = static_cast<SmbUtil::StatReturn> (smbObj()->getFstat(m_context,m_fd,&st));
12- }
13- else
14+ bool ok = isOpen() ? smbObj()->getFstat(m_context,m_fd,&st) == 0 : false;
15+ if (!isOpen())
16 {
17- if (m_context != 0) {
18- ret = static_cast<SmbUtil::StatReturn> (smbObj()->getStat(m_context,cleanUrl(),&st));
19- }
20- else {
21- ret = smbObj()->getStatInfo(cleanUrl(),&st);
22- }
23+ ok = m_context != 0 ? smbObj()->getStat(m_context,cleanUrl(),&st) == 0 :
24+ smbObj()->getStatInfo(cleanUrl(),&st) == SmbUtil::StatDone;
25 }
26- if(ret == SmbUtil::StatDone)
27+ if(ok)
28 {
29 size = static_cast<qint64> (st.st_size);
30 }
31
32=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp'
33--- src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp 2015-10-28 01:23:07 +0000
34+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp 2015-11-02 20:41:45 +0000
35@@ -361,7 +361,7 @@
36 (void)getStat(context,smb_path,st);
37 }
38 }
39- else if (errno != EACCES && errno != ECONNREFUSED) // perhaps is a file
40+ else if (errno != EACCES && errno != ECONNREFUSED && slashes >= URL_SLASHES_NUMBER_FOR_SHARES) // perhaps is a file
41 {
42 errno = 0;
43 ret = static_cast<SmbUtil::StatReturn> (getStat(context, smb_path,st));

Subscribers

People subscribed via source and target branches