summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShankar Rao <shankar.nrao@ti.com>2013-11-06 11:40:20 -0600
committerShankar Rao <shankar.nrao@ti.com>2013-11-06 11:40:20 -0600
commit04f77acac1d988936ee0a136d969ee45cf5e689c (patch)
tree49b49c199e7c626d5c40f21189de1447eefeae0a
parente4acde5784051be1e02ab23e2fe0fc17bfa24259 (diff)
downloadcommon-open-04f77acac1d988936ee0a136d969ee45cf5e689c.tar.gz
mtpfuse: Remove call to read object size when calling readObject.
readObject API is able to handle cases where the size passed is greater than the object size. Hence, the need to determine object size is redundant. Also, some whitespaces removed and DBG changed to printf for error scenarios. Change-Id: Iedde6b4ba7620cab31a35494899e48a700d2bfc8 Signed-off-by: Shankar Rao <shankar.nrao@ti.com>
-rw-r--r--mtpfuse/mtpfuse.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/mtpfuse/mtpfuse.cpp b/mtpfuse/mtpfuse.cpp
index 60db6c4..debbe48 100644
--- a/mtpfuse/mtpfuse.cpp
+++ b/mtpfuse/mtpfuse.cpp
@@ -399,10 +399,6 @@ static int mtpfuse_read (const char * path, char * buf,
struct fuse_file_info *fi) {
int ret;
MtpObjectHandle h = (MtpObjectHandle)fi->fh;
- MtpObjectInfo *info = mtp_device->getObjectInfo(h);
- if (info->mCompressedSize < size) {
- size = info->mCompressedSize;
- }
bool status = mtp_device->readObject(h, read_callback, size, offset, buf);
if (status == false) {
ret = 0;
@@ -412,7 +408,8 @@ static int mtpfuse_read (const char * path, char * buf,
return ret;
}
-static void start_media_scanner(){ const char* cmd =
+static void start_media_scanner() {
+ const char* cmd =
"am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///mnt/shell/emulated/0";
system(cmd);
}
@@ -453,10 +450,10 @@ int main(int argc, char* argv[]) {
}
if (storageAreaList->size() == 0) {
- DBG("No storages found\n");
+ printf("No storages found\n");
return 0;
}
- DBG("Found %d storage(s)\n", storageAreaList->size());
+ printf("Found %d storage(s)\n", storageAreaList->size());
for (size_t i = 0;i < storageAreaList->size();i++) {
MtpStorageInfo* storageInfo = mtp_device->getStorageInfo(storageAreaList->itemAt(i));
printf("Desc: %s\n", storageInfo->mStorageDescription);