mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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
This commit is contained in:
parent
61e4877190
commit
c27504a322
3 changed files with 34 additions and 40 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue