Skip to content

Commit

Permalink
fix alignment issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dt-12345 committed Jul 7, 2024
1 parent 9c45c96 commit 9b09f82
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/byml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,9 @@ struct WriteContext {
writer.RunAt(node.offset_in_container, [&](size_t) { writer.Write<u32>(it->second); });
} else {
const auto type = node.data->GetType();
if (IsContainerType(type)) {
writer.AlignUp(4); // unsure if necessary but a lot of other tools will break from unaligned reads so compatiblity I guess
}
const size_t offset = type != Byml::Type::File ? writer.Tell()
: util::AlignUp(node.data->GetFile().align, writer.Tell() + 8) - 8;
writer.RunAt(node.offset_in_container, [&](size_t) { writer.Write<u32>(offset); });
Expand Down

0 comments on commit 9b09f82

Please sign in to comment.