summaryrefslogtreecommitdiffstats
path: root/media/mtp/MtpDataPacket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/mtp/MtpDataPacket.cpp')
-rw-r--r--media/mtp/MtpDataPacket.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/media/mtp/MtpDataPacket.cpp b/media/mtp/MtpDataPacket.cpp
index a7e975c..6f9ea24 100644
--- a/media/mtp/MtpDataPacket.cpp
+++ b/media/mtp/MtpDataPacket.cpp
@@ -299,17 +299,28 @@ void MtpDataPacket::putAUInt64(const uint64_t* values, int count) {
putUInt64(*values++);
}
-void MtpDataPacket::putString(const MtpStringBuffer& string)
-{
+void MtpDataPacket::putString(const MtpStringBuffer& string) {
string.writeToPacket(this);
}
-void MtpDataPacket::putString(const char* s)
-{
+void MtpDataPacket::putString(const char* s) {
MtpStringBuffer string(s);
string.writeToPacket(this);
}
+void MtpDataPacket::putString(const uint16_t* string) {
+ int count = 0;
+ for (int i = 0; i < 256; i++) {
+ if (string[i])
+ count++;
+ else
+ break;
+ }
+ putUInt8(count);
+ for (int i = 0; i < count; i++)
+ putUInt16(string[i]);
+}
+
#ifdef MTP_DEVICE
int MtpDataPacket::read(int fd) {
// first read the header