diff options
author | Andreas Gampe <agampe@google.com> | 2014-11-08 01:14:58 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-11-08 01:14:59 +0000 |
commit | 9ade8c1ad59a40f1a2fdbe88074d05aa97a95aff (patch) | |
tree | 623e47dbf6834ebe1f4c494c4d2a455cfb414ede /libs/storage/IMountService.cpp | |
parent | f89a2fdacb2ba907f180188dc79f9de81e3eb254 (diff) | |
parent | 2b3a8cd808a4013f43c881eca64a870ff0ea735b (diff) |
Merge "Frameworks/base: Wall Werror in libs/storage"
Diffstat (limited to 'libs/storage/IMountService.cpp')
-rw-r--r-- | libs/storage/IMountService.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libs/storage/IMountService.cpp b/libs/storage/IMountService.cpp index 621de18b1685..7ac77378f0c5 100644 --- a/libs/storage/IMountService.cpp +++ b/libs/storage/IMountService.cpp @@ -207,12 +207,19 @@ public: ALOGD("getStorageUsers caught exception %d\n", err); return err; } - const int32_t numUsers = reply.readInt32(); + int32_t numUsersI = reply.readInt32(); + uint32_t numUsers; + if (numUsersI < 0) { + ALOGW("Number of users is negative: %d\n", numUsersI); + numUsers = 0; + } else { + numUsers = static_cast<uint32_t>(numUsersI); + } *users = (int32_t*)malloc(sizeof(int32_t)*numUsers); - for (int i = 0; i < numUsers; i++) { + for (size_t i = 0; i < numUsers; i++) { **users++ = reply.readInt32(); } - return numUsers; + return static_cast<int32_t>(numUsers); } int32_t getVolumeState(const String16& mountPoint) @@ -546,8 +553,8 @@ public: } }; -IMPLEMENT_META_INTERFACE(MountService, "IMountService"); +IMPLEMENT_META_INTERFACE(MountService, "IMountService") // ---------------------------------------------------------------------- -}; +} |