From 5d4afa0986cbc440f458b4b8db05fd176ef3e6d2 Mon Sep 17 00:00:00 2001 From: Lee Shombert Date: Fri, 19 May 2023 15:52:00 -0700 Subject: Remove unnecessary padding code Bug: 213170822 Remove the code that CursorWindow::writeToParcel() uses to ensure slot data is 4-byte aligned. Because mAllocOffset and mSlotsOffset are already 4-byte aligned, the alignment step here is unnecessary. CursorWindow::spaceInUse() returns the total space used. The tests verify that the total space used is always a multiple of 4 bytes. Test: atest * libandroidfw_tests Change-Id: I720699093d5c5a584283e5b76851938f449ffa21 --- libs/androidfw/include/androidfw/CursorWindow.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libs/androidfw/include') diff --git a/libs/androidfw/include/androidfw/CursorWindow.h b/libs/androidfw/include/androidfw/CursorWindow.h index 6e55a9a0eb8b..9ec026a19c4c 100644 --- a/libs/androidfw/include/androidfw/CursorWindow.h +++ b/libs/androidfw/include/androidfw/CursorWindow.h @@ -90,6 +90,9 @@ public: inline uint32_t getNumRows() { return mNumRows; } inline uint32_t getNumColumns() { return mNumColumns; } + inline size_t sizeOfSlots() const { return mSize - mSlotsOffset; } + inline size_t sizeInUse() const { return mAllocOffset + sizeOfSlots(); } + status_t clear(); status_t setNumColumns(uint32_t numColumns); -- cgit v1.2.3-59-g8ed1b