Serialize actual size of packed file data instead of the size of the original file to enable compression

Description

When serializing pack files for being packed in the resulting installer, we're writing the size of the original file to the pack stream for being able to get the size of bytes to read back later from the pack stream during installing. This has two inconveniences:

  • There is just written the size of the original file. This size might change when compressing it before serializing, so we can't really compress a packed file using an additional compressor stream.

  • Generally, the size is written to the pack stream itself before the file is serialized to the same stream, so if the serialized size changes after filtering or compression the unpacker doesn't notice this change and we can't change this size later after serializing, thus, the unpacker would receive the wrong number of bytes to deserialize.

Change the above drawbacks in this way:

  • Remove writing the size before serializing and replace this by writing the serialized pack data size after serializing, getting the number of written bytes from the final serializer stream.

Environment

None

Assignee

René Krell

Reporter

René Krell

Impact

Functional - non-breaking and safe in existing environments

Components

Sprint

None

Fix versions

Affects versions

Priority

Medium
Configure