mtp

Merge lp:~cyphermox/mtp/file-sizes into lp:mtp

Proposed by Mathieu Trudel-Lapierre
Status: Needs review
Proposed branch: lp:~cyphermox/mtp/file-sizes
Merge into: lp:mtp
Diff against target: 80 lines (+18/-6)
3 files modified
debian/changelog (+10/-0)
server/UbuntuMtpDatabase.h (+7/-5)
src/MtpServer.cpp (+1/-1)
To merge this branch: bzr merge lp:~cyphermox/mtp/file-sizes
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+263248@code.launchpad.net

Commit message

Better handle large files.

To post a comment you must log in.
lp:~cyphermox/mtp/file-sizes updated
70. By Mathieu Trudel-Lapierre

Update changelog for bug 1455464

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:69
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mathieu-tl/mtp/file-sizes/+merge/263248/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/mtp-ci/35/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mtp-vivid-amd64-ci/7
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mtp-vivid-armhf-ci/7
        deb: http://jenkins.qa.ubuntu.com/job/mtp-vivid-armhf-ci/7/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mtp-vivid-i386-ci/7

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mtp-ci/35/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:70
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mathieu-tl/mtp/file-sizes/+merge/263248/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/mtp-ci/36/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mtp-vivid-amd64-ci/8
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mtp-vivid-armhf-ci/8
        deb: http://jenkins.qa.ubuntu.com/job/mtp-vivid-armhf-ci/8/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mtp-vivid-i386-ci/8

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mtp-ci/36/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Unmerged revisions

70. By Mathieu Trudel-Lapierre

Update changelog for bug 1455464

69. By Mathieu Trudel-Lapierre

boost::filesystem file_size() returns a uintmax_t; and the MTP_PROPERTY_OBJECT_SIZE property should be a UINT64 anyway.

68. By Mathieu Trudel-Lapierre

Properly return MTP_RESPONSE_OBJECT_TOO_LARGE in MtpServer before reaching the database only if the reported file size is greater than the reported max file size, and isn't larger than a UINT32.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2015-03-11 19:36:38 +0000
+++ debian/changelog 2015-06-29 15:15:32 +0000
@@ -1,3 +1,13 @@
1mtp (0.0.4+15.04.20150219-0ubuntu3) UNRELEASED; urgency=medium
2
3 * Better handle the quirks of the MTP spec: base MTP supports up to 32 bit
4 file sizes in the CompressedSize parameter, if it's bigger, that field
5 needs to be set to 0xffffffff and the complete value (in a 64 bit field)
6 will fit in the ObjectSize property. Also make sure we use uintmax to keep
7 the file size everywhere. (LP: #1455464)
8
9 -- Mathieu Trudel-Lapierre <mathieu-tl@ubuntu.com> Mon, 29 Jun 2015 11:12:08 -0400
10
1mtp (0.0.4+15.04.20150219-0ubuntu2) vivid; urgency=medium11mtp (0.0.4+15.04.20150219-0ubuntu2) vivid; urgency=medium
212
3 * Properly fixing the startup script, as the previous change broke13 * Properly fixing the startup script, as the previous change broke
414
=== modified file 'server/UbuntuMtpDatabase.h'
--- server/UbuntuMtpDatabase.h 2015-01-26 19:35:23 +0000
+++ server/UbuntuMtpDatabase.h 2015-06-29 15:15:32 +0000
@@ -63,7 +63,7 @@
63 MtpStorageID storage_id;63 MtpStorageID storage_id;
64 MtpObjectFormat object_format;64 MtpObjectFormat object_format;
65 MtpObjectHandle parent;65 MtpObjectHandle parent;
66 size_t object_size;66 uintmax_t object_size;
67 std::string display_name;67 std::string display_name;
68 std::string path;68 std::string path;
69 int watch_fd;69 int watch_fd;
@@ -608,7 +608,7 @@
608 case MTP_PROPERTY_STORAGE_ID: packet.putUInt32(db.at(handle).storage_id); break; 608 case MTP_PROPERTY_STORAGE_ID: packet.putUInt32(db.at(handle).storage_id); break;
609 case MTP_PROPERTY_PARENT_OBJECT: packet.putUInt32(db.at(handle).parent); break; 609 case MTP_PROPERTY_PARENT_OBJECT: packet.putUInt32(db.at(handle).parent); break;
610 case MTP_PROPERTY_OBJECT_FORMAT: packet.putUInt16(db.at(handle).object_format); break;610 case MTP_PROPERTY_OBJECT_FORMAT: packet.putUInt16(db.at(handle).object_format); break;
611 case MTP_PROPERTY_OBJECT_SIZE: packet.putUInt32(db.at(handle).object_size); break;611 case MTP_PROPERTY_OBJECT_SIZE: packet.putUInt64(db.at(handle).object_size); break;
612 case MTP_PROPERTY_DISPLAY_NAME: packet.putString(db.at(handle).display_name.c_str()); break;612 case MTP_PROPERTY_DISPLAY_NAME: packet.putString(db.at(handle).display_name.c_str()); break;
613 case MTP_PROPERTY_OBJECT_FILE_NAME: packet.putString(db.at(handle).display_name.c_str()); break;613 case MTP_PROPERTY_OBJECT_FILE_NAME: packet.putString(db.at(handle).display_name.c_str()); break;
614 case MTP_PROPERTY_PERSISTENT_UID: packet.putUInt128(handle); break;614 case MTP_PROPERTY_PERSISTENT_UID: packet.putUInt128(handle); break;
@@ -841,7 +841,7 @@
841 if (property == ALL_PROPERTIES || property == MTP_PROPERTY_OBJECT_SIZE) {841 if (property == ALL_PROPERTIES || property == MTP_PROPERTY_OBJECT_SIZE) {
842 packet.putUInt32(i);842 packet.putUInt32(i);
843 packet.putUInt16(MTP_PROPERTY_OBJECT_SIZE);843 packet.putUInt16(MTP_PROPERTY_OBJECT_SIZE);
844 packet.putUInt16(MTP_TYPE_UINT32);844 packet.putUInt16(MTP_TYPE_UINT64);
845 packet.putUInt32(entry.object_size);845 packet.putUInt32(entry.object_size);
846 }846 }
847847
@@ -948,7 +948,9 @@
948 info.mStorageID = db.at(handle).storage_id;948 info.mStorageID = db.at(handle).storage_id;
949 info.mFormat = db.at(handle).object_format;949 info.mFormat = db.at(handle).object_format;
950 info.mProtectionStatus = 0x0;950 info.mProtectionStatus = 0x0;
951 info.mCompressedSize = db.at(handle).object_size;951 info.mCompressedSize
952 = db.at(handle).object_size > 0xFFFFFFFF
953 ? 0xFFFFFFFF : db.at(handle).object_size;
952 info.mImagePixWidth = 0;954 info.mImagePixWidth = 0;
953 info.mImagePixHeight = 0;955 info.mImagePixHeight = 0;
954 info.mImagePixDepth = 0;956 info.mImagePixDepth = 0;
@@ -1116,7 +1118,7 @@
1116 case MTP_PROPERTY_STORAGE_ID: result = new MtpProperty(property, MTP_TYPE_UINT32, false); break;1118 case MTP_PROPERTY_STORAGE_ID: result = new MtpProperty(property, MTP_TYPE_UINT32, false); break;
1117 case MTP_PROPERTY_PARENT_OBJECT: result = new MtpProperty(property, MTP_TYPE_UINT32, true); break;1119 case MTP_PROPERTY_PARENT_OBJECT: result = new MtpProperty(property, MTP_TYPE_UINT32, true); break;
1118 case MTP_PROPERTY_OBJECT_FORMAT: result = new MtpProperty(property, MTP_TYPE_UINT16, false); break;1120 case MTP_PROPERTY_OBJECT_FORMAT: result = new MtpProperty(property, MTP_TYPE_UINT16, false); break;
1119 case MTP_PROPERTY_OBJECT_SIZE: result = new MtpProperty(property, MTP_TYPE_UINT32, false); break;1121 case MTP_PROPERTY_OBJECT_SIZE: result = new MtpProperty(property, MTP_TYPE_UINT64, false); break;
1120 case MTP_PROPERTY_WIDTH: result = new MtpProperty(property, MTP_TYPE_UINT32, false); break;1122 case MTP_PROPERTY_WIDTH: result = new MtpProperty(property, MTP_TYPE_UINT32, false); break;
1121 case MTP_PROPERTY_HEIGHT: result = new MtpProperty(property, MTP_TYPE_UINT32, false); break;1123 case MTP_PROPERTY_HEIGHT: result = new MtpProperty(property, MTP_TYPE_UINT32, false); break;
1122 case MTP_PROPERTY_IMAGE_BIT_DEPTH: result = new MtpProperty(property, MTP_TYPE_UINT32, false); break;1124 case MTP_PROPERTY_IMAGE_BIT_DEPTH: result = new MtpProperty(property, MTP_TYPE_UINT32, false); break;
11231125
=== modified file 'src/MtpServer.cpp'
--- src/MtpServer.cpp 2014-10-31 15:56:55 +0000
+++ src/MtpServer.cpp 2015-06-29 15:15:32 +0000
@@ -912,7 +912,7 @@
912 if (maxFileSize != 0) {912 if (maxFileSize != 0) {
913 // if mSendObjectFileSize is 0xFFFFFFFF, then all we know is the file size913 // if mSendObjectFileSize is 0xFFFFFFFF, then all we know is the file size
914 // is >= 0xFFFFFFFF914 // is >= 0xFFFFFFFF
915 if (mSendObjectFileSize > maxFileSize || mSendObjectFileSize == 0xFFFFFFFF)915 if (mSendObjectFileSize > maxFileSize && mSendObjectFileSize != 0xFFFFFFFF)
916 return MTP_RESPONSE_OBJECT_TOO_LARGE;916 return MTP_RESPONSE_OBJECT_TOO_LARGE;
917 }917 }
918918

Subscribers

People subscribed via source and target branches