diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/androidfw/BackupData.cpp | 10 | ||||
-rw-r--r-- | libs/androidfw/BackupHelpers.cpp | 19 | ||||
-rw-r--r-- | libs/androidfw/ResourceTypes.cpp | 4 | ||||
-rw-r--r-- | libs/storage/Android.mk | 2 | ||||
-rw-r--r-- | libs/storage/IMountService.cpp | 17 | ||||
-rw-r--r-- | libs/storage/IMountServiceListener.cpp | 4 | ||||
-rw-r--r-- | libs/storage/IMountShutdownObserver.cpp | 4 | ||||
-rw-r--r-- | libs/storage/IObbActionListener.cpp | 9 |
8 files changed, 31 insertions, 38 deletions
diff --git a/libs/androidfw/BackupData.cpp b/libs/androidfw/BackupData.cpp index 2b45a70..ba4a4ff 100644 --- a/libs/androidfw/BackupData.cpp +++ b/libs/androidfw/BackupData.cpp @@ -45,12 +45,6 @@ static const bool kIsDebug = false; const static int ROUND_UP[4] = { 0, 3, 2, 1 }; static inline size_t -round_up(size_t n) -{ - return n + ROUND_UP[n % 4]; -} - -static inline size_t padding_extra(size_t n) { return ROUND_UP[n % 4]; @@ -343,7 +337,7 @@ BackupDataReader::ReadEntityData(void* data, size_t size) } int remaining = m_dataEndPos - m_pos; if (kIsDebug) { - ALOGD("ReadEntityData size=%d m_pos=0x%x m_dataEndPos=0x%x remaining=%d\n", + ALOGD("ReadEntityData size=%zu m_pos=0x%zx m_dataEndPos=0x%zx remaining=%d\n", size, m_pos, m_dataEndPos, remaining); } if (remaining <= 0) { @@ -353,7 +347,7 @@ BackupDataReader::ReadEntityData(void* data, size_t size) size = remaining; } if (kIsDebug) { - ALOGD(" reading %d bytes", size); + ALOGD(" reading %zu bytes", size); } int amt = read(m_fd, data, size); if (amt < 0) { diff --git a/libs/androidfw/BackupHelpers.cpp b/libs/androidfw/BackupHelpers.cpp index 36a4cfe..3f82830 100644 --- a/libs/androidfw/BackupHelpers.cpp +++ b/libs/androidfw/BackupHelpers.cpp @@ -555,7 +555,7 @@ int write_tarfile(const String8& packageName, const String8& domain, snprintf(buf + 124, 12, "%011llo", (isdir) ? 0LL : s.st_size); // [ 136 : 12 ] last mod time as a UTC time_t - snprintf(buf + 136, 12, "%0lo", s.st_mtime); + snprintf(buf + 136, 12, "%0lo", (unsigned long)s.st_mtime); // [ 156 : 1 ] link/file type uint8_t type; @@ -1307,23 +1307,12 @@ get_mod_time(const char* filename, struct timeval times[2]) fprintf(stderr, "stat '%s' failed: %s\n", filename, strerror(errno)); return errno; } - times[0].tv_sec = st.st_atime; - times[1].tv_sec = st.st_mtime; - // If st_atime is a macro then struct stat64 uses struct timespec - // to store the access and modif time values and typically - // st_*time_nsec is not defined. In glibc, this is controlled by - // __USE_MISC. -#ifdef __USE_MISC -#if !defined(st_atime) || defined(st_atime_nsec) -#error "Check if this __USE_MISC conditional is still needed." -#endif + times[0].tv_sec = st.st_atim.tv_sec; times[0].tv_usec = st.st_atim.tv_nsec / 1000; + + times[1].tv_sec = st.st_mtim.tv_sec; times[1].tv_usec = st.st_mtim.tv_nsec / 1000; -#else - times[0].tv_usec = st.st_atime_nsec / 1000; - times[1].tv_usec = st.st_mtime_nsec / 1000; -#endif return 0; } diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index e2263d2..679a75f 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -733,8 +733,8 @@ const char16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const } #else // We do not want to be in this case when actually running Android. - ALOGW("CREATING STRING CACHE OF %d bytes", - mHeader->stringCount*sizeof(char16_t**)); + ALOGW("CREATING STRING CACHE OF %zu bytes", + static_cast<size_t>(mHeader->stringCount*sizeof(char16_t**))); #endif mCache = (char16_t**)calloc(mHeader->stringCount, sizeof(char16_t**)); if (mCache == NULL) { diff --git a/libs/storage/Android.mk b/libs/storage/Android.mk index 7a9dd6c..fae2bf7 100644 --- a/libs/storage/Android.mk +++ b/libs/storage/Android.mk @@ -9,4 +9,6 @@ LOCAL_SRC_FILES:= \ LOCAL_MODULE:= libstorage +LOCAL_CFLAGS += -Wall -Werror + include $(BUILD_STATIC_LIBRARY) diff --git a/libs/storage/IMountService.cpp b/libs/storage/IMountService.cpp index 621de18..7ac7737 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") // ---------------------------------------------------------------------- -}; +} diff --git a/libs/storage/IMountServiceListener.cpp b/libs/storage/IMountServiceListener.cpp index c98a424..11b53fd 100644 --- a/libs/storage/IMountServiceListener.cpp +++ b/libs/storage/IMountServiceListener.cpp @@ -34,7 +34,7 @@ status_t BnMountServiceListener::onTransact( onUsbMassStorageConnectionChanged(connected); reply->writeNoException(); return NO_ERROR; - } break; + } case TRANSACTION_onStorageStateChanged: { CHECK_INTERFACE(IMountServiceListener, data, reply); String16 path = data.readString16(); @@ -50,4 +50,4 @@ status_t BnMountServiceListener::onTransact( } // ---------------------------------------------------------------------- -}; +} diff --git a/libs/storage/IMountShutdownObserver.cpp b/libs/storage/IMountShutdownObserver.cpp index 1a6fdee..a74a768 100644 --- a/libs/storage/IMountShutdownObserver.cpp +++ b/libs/storage/IMountShutdownObserver.cpp @@ -33,11 +33,11 @@ status_t BnMountShutdownObserver::onTransact( onShutDownComplete(statusCode); reply->writeNoException(); return NO_ERROR; - } break; + } default: return BBinder::onTransact(code, data, reply, flags); } } // ---------------------------------------------------------------------- -}; +} diff --git a/libs/storage/IObbActionListener.cpp b/libs/storage/IObbActionListener.cpp index eaa211e..9656e65 100644 --- a/libs/storage/IObbActionListener.cpp +++ b/libs/storage/IObbActionListener.cpp @@ -30,10 +30,11 @@ public: : BpInterface<IObbActionListener>(impl) { } - virtual void onObbResult(const String16& filename, const int32_t nonce, const int32_t state) { } + virtual void onObbResult(const String16& /* filename */, const int32_t /* nonce */, + const int32_t /* state */) { } }; -IMPLEMENT_META_INTERFACE(ObbActionListener, "IObbActionListener"); +IMPLEMENT_META_INTERFACE(ObbActionListener, "IObbActionListener") // ---------------------------------------------------------------------- @@ -49,7 +50,7 @@ status_t BnObbActionListener::onTransact( onObbResult(filename, nonce, state); reply->writeNoException(); return NO_ERROR; - } break; + } default: return BBinder::onTransact(code, data, reply, flags); } @@ -57,4 +58,4 @@ status_t BnObbActionListener::onTransact( // ---------------------------------------------------------------------- -}; +} |