summaryrefslogtreecommitdiffstats
path: root/source/core/slang-riff.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/core/slang-riff.cpp')
-rw-r--r--source/core/slang-riff.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/source/core/slang-riff.cpp b/source/core/slang-riff.cpp
index 9fc23fbc8..2162c40be 100644
--- a/source/core/slang-riff.cpp
+++ b/source/core/slang-riff.cpp
@@ -313,6 +313,11 @@ struct DumpVisitor : public RiffContainer::Visitor
return SLANG_OK;
}
+/* static */SlangResult RiffUtil::write(RiffContainer* container, Stream* stream)
+{
+ return write(container->getRoot(), true, stream);
+}
+
/* static */SlangResult RiffUtil::read(Stream* stream, RiffContainer& outContainer)
{
typedef RiffContainer::ScopeChunk ScopeChunk;
@@ -561,6 +566,20 @@ void RiffContainer::ListChunk::findContained(FourCC type, List<DataChunk*>& out)
}
}
+RiffContainer::ListChunk* RiffContainer::ListChunk::findContainedList(FourCC type)
+{
+ Chunk* chunk = m_containedChunks;
+ while (chunk)
+ {
+ if (chunk->m_fourCC == type && chunk->m_kind == Chunk::Kind::List)
+ {
+ return static_cast<ListChunk*>(chunk);
+ }
+ chunk = chunk->m_next;
+ }
+ return nullptr;
+}
+
RiffContainer::Data* RiffContainer::ListChunk::findContainedData(FourCC type) const
{
Chunk* found = findContained(type);
@@ -841,11 +860,11 @@ void RiffContainer::setPayload(Data* data, const void* payload, size_t size)
// Add current chunks data
m_dataChunk->m_payloadSize += size;
-
+
data->m_ownership = Ownership::Arena;
data->m_size = size;
- data->m_payload = m_arena.allocate(size);
+ data->m_payload = m_arena.allocateAligned(size, PAYLOAD_MIN_ALIGNMENT);
if (payload)
{
@@ -922,7 +941,7 @@ RiffContainer::Data* RiffContainer::makeSingleData(DataChunk* dataChunk)
// Okay lets combine all into one block
const size_t payloadSize = dataChunk->calcPayloadSize();
- void* dst = m_arena.allocate(payloadSize);
+ void* dst = m_arena.allocateAligned(payloadSize, PAYLOAD_MIN_ALIGNMENT);
dataChunk->getPayload(dst);
// Remove other datas