summaryrefslogtreecommitdiff
path: root/cmds/idmap2/libidmap2/BinaryStreamVisitor.cpp
diff options
context:
space:
mode:
authorRyan Mitchell <rtmitchell@google.com>2020-12-03 15:41:42 -0800
committerRyan Mitchell <rtmitchell@google.com>2021-01-06 16:19:50 -0800
commit0699f1de6a684644b2debf82d55dfbcbc9387679 (patch)
tree916a23f66e2121c3de601af478187e52687de57f /cmds/idmap2/libidmap2/BinaryStreamVisitor.cpp
parent7e8ae00d9c855d15d6bdddcadd0a5563bb4e0b64 (diff)
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
Diffstat (limited to 'cmds/idmap2/libidmap2/BinaryStreamVisitor.cpp')
-rw-r--r--cmds/idmap2/libidmap2/BinaryStreamVisitor.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/cmds/idmap2/libidmap2/BinaryStreamVisitor.cpp b/cmds/idmap2/libidmap2/BinaryStreamVisitor.cpp
index 726f6c5c2c99..5db09baca5d5 100644
--- a/cmds/idmap2/libidmap2/BinaryStreamVisitor.cpp
+++ b/cmds/idmap2/libidmap2/BinaryStreamVisitor.cpp
@@ -38,13 +38,6 @@ void BinaryStreamVisitor::Write32(uint32_t value) {
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 @@ void BinaryStreamVisitor::visit(const IdmapHeader& header) {
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());
}