summaryrefslogtreecommitdiff
path: root/libs/androidfw/include
diff options
context:
space:
mode:
author Lee Shombert <shombert@google.com> 2023-05-19 15:52:00 -0700
committer Lee Shombert <shombert@google.com> 2023-05-23 17:41:35 -0700
commit5d4afa0986cbc440f458b4b8db05fd176ef3e6d2 (patch)
treec94d9a8a78867f3cafd860a30f4493b93bca3636 /libs/androidfw/include
parentf69ccd683bb06bcaac98847398a35f64b4939fa8 (diff)
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
Diffstat (limited to 'libs/androidfw/include')
-rw-r--r--libs/androidfw/include/androidfw/CursorWindow.h3
1 files changed, 3 insertions, 0 deletions
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);