Remove idmap path 256 length limit
Overlay and target package paths can be longer than 256 characters.
Currently, the idmap will fail to be generated if either path
is longer than 256 characters.
This change removes the 256 character limit and makes parsing variable
length strings easier in libandroidfw.
Bug: 174676094
Test: idmap2_tests && libandroidfw_tests
Change-Id: Ic240cdb8700566b2ac2ade08da58bea852e4ae0c
diff --git a/cmds/idmap2/libidmap2/BinaryStreamVisitor.cpp b/cmds/idmap2/libidmap2/BinaryStreamVisitor.cpp
index 726f6c5..5db09ba 100644
--- a/cmds/idmap2/libidmap2/BinaryStreamVisitor.cpp
+++ b/cmds/idmap2/libidmap2/BinaryStreamVisitor.cpp
@@ -38,13 +38,6 @@
stream_.write(reinterpret_cast<char*>(&x), sizeof(uint32_t));
}
-void BinaryStreamVisitor::WriteString256(const StringPiece& value) {
- char buf[kIdmapStringLength];
- memset(buf, 0, sizeof(buf));
- memcpy(buf, value.data(), std::min(value.size(), sizeof(buf)));
- stream_.write(buf, sizeof(buf));
-}
-
void BinaryStreamVisitor::WriteString(const StringPiece& value) {
// pad with null to nearest word boundary;
size_t padding_size = CalculatePadding(value.size());
@@ -64,8 +57,8 @@
Write32(header.GetOverlayCrc());
Write32(header.GetFulfilledPolicies());
Write32(static_cast<uint8_t>(header.GetEnforceOverlayable()));
- WriteString256(header.GetTargetPath());
- WriteString256(header.GetOverlayPath());
+ WriteString(header.GetTargetPath());
+ WriteString(header.GetOverlayPath());
WriteString(header.GetDebugInfo());
}