diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2017-07-26 23:37:44 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-07-27 07:56:48 +0200 |
commit | c27504a322ad3dcc1ff483b416df265148486710 (patch) | |
tree | cfb6ef5fbcc19b6109c45d71a87df4849cc706a9 /src/serialization.h | |
parent | 61e487719017511fdc37a944ea7321da46d28ee4 (diff) | |
download | hax-minetest-server-c27504a322ad3dcc1ff483b416df265148486710.tar.gz hax-minetest-server-c27504a322ad3dcc1ff483b416df265148486710.zip |
compressZlib: don't use a SharedBuffer but a raw u8 * pointer
Remove usage of the SharedBuffer in zlib compression which has two problems:
* We copied the whole memory block to compress it (not good with mapblocks)
* We copied sometimes strings to SharedBuffer to SharedBuffer (2nd time)
Use this method in MapNode::serializeBulk + optimize serialization but merging 3 identical loops in a single loop
Diffstat (limited to '')
-rw-r--r-- | src/serialization.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/serialization.h b/src/serialization.h index c91c3241f..4e01db40a 100644 --- a/src/serialization.h +++ b/src/serialization.h @@ -86,12 +86,12 @@ inline bool ser_ver_supported(s32 v) { Misc. serialization functions */ -void compressZlib(SharedBuffer<u8> data, std::ostream &os, int level = -1); +void compressZlib(const u8 *data, size_t data_size, std::ostream &os, int level = -1); void compressZlib(const std::string &data, std::ostream &os, int level = -1); void decompressZlib(std::istream &is, std::ostream &os); // These choose between zlib and a self-made one according to version -void compress(SharedBuffer<u8> data, std::ostream &os, u8 version); +void compress(const SharedBuffer<u8> &data, std::ostream &os, u8 version); //void compress(const std::string &data, std::ostream &os, u8 version); void decompress(std::istream &is, std::ostream &os, u8 version); |