Core: Replace serialization arguments by context structures

Also fixed some endianness errors


Former-commit-id: 450849e681a9b002c3d501a856a8481470d08dea
This commit is contained in:
Lynix
2015-11-19 13:25:07 +01:00
parent bc4eb96af2
commit 1c8a09f90c
9 changed files with 164 additions and 46 deletions

View File

@@ -4209,23 +4209,23 @@ namespace Nz
return emptyString;
}
bool Serialize(OutputStream* output, const String& string, Endianness dataEndianness)
bool Serialize(SerializationContext& context, const String& string)
{
if (!Serialize<UInt32>(output, string.GetSize(), dataEndianness))
if (!Serialize<UInt32>(context, string.GetSize()))
return false;
output->Write(string.GetConstBuffer(), string.GetSize());
context.stream->Write(string.GetConstBuffer(), string.GetSize());
return true;
}
bool Unserialize(InputStream* input, String* string, Endianness dataEndianness)
bool Unserialize(UnserializationContext& context, String* string)
{
UInt32 size;
if (!Unserialize(input, &size, dataEndianness))
if (!Unserialize(context, &size))
return false;
string->Resize(size);
input->Read(string->GetBuffer(), size);
context.stream->Read(string->GetBuffer(), size);
return true;
}