projects
/
oweals
/
minetest.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow taking screenshots of formspecs and move message to chat
[oweals/minetest.git]
/
src
/
serialization.cpp
diff --git
a/src/serialization.cpp
b/src/serialization.cpp
index 1fd75c97aae219608c67e9990ff595693cd1a07a..c0fbe10e23335fb9cc8f2031dd8637e0cec548a3 100644
(file)
--- a/
src/serialization.cpp
+++ b/
src/serialization.cpp
@@
-20,7
+20,7
@@
with this program; if not, write to the Free Software Foundation, Inc.,
#include "serialization.h"
#include "util/serialize.h"
#include "serialization.h"
#include "util/serialize.h"
-#ifdef _
MSC_VER
+#ifdef _
WIN32
#define ZLIB_WINAPI
#endif
#include "zlib.h"
#define ZLIB_WINAPI
#endif
#include "zlib.h"
@@
-53,7
+53,7
@@
void zerr(int ret)
}
}
}
}
-void compressZlib(SharedBuffer<u8> data, std::ostream &os)
+void compressZlib(SharedBuffer<u8> data, std::ostream &os
, int level
)
{
z_stream z;
const s32 bufsize = 16384;
{
z_stream z;
const s32 bufsize = 16384;
@@
-65,7
+65,7
@@
void compressZlib(SharedBuffer<u8> data, std::ostream &os)
z.zfree = Z_NULL;
z.opaque = Z_NULL;
z.zfree = Z_NULL;
z.opaque = Z_NULL;
- ret = deflateInit(&z,
-1
);
+ ret = deflateInit(&z,
level
);
if(ret != Z_OK)
throw SerializationError("compressZlib: deflateInit failed");
if(ret != Z_OK)
throw SerializationError("compressZlib: deflateInit failed");
@@
-94,13
+94,12
@@
void compressZlib(SharedBuffer<u8> data, std::ostream &os)
}
deflateEnd(&z);
}
deflateEnd(&z);
-
}
}
-void compressZlib(const std::string &data, std::ostream &os)
+void compressZlib(const std::string &data, std::ostream &os
, int level
)
{
SharedBuffer<u8> databuf((u8*)data.c_str(), data.size());
{
SharedBuffer<u8> databuf((u8*)data.c_str(), data.size());
- compressZlib(databuf, os);
+ compressZlib(databuf, os
, level
);
}
void decompressZlib(std::istream &is, std::ostream &os)
}
void decompressZlib(std::istream &is, std::ostream &os)