mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
Core: Fixed zlib overloading problem
git-svn-id: svn://ultimatepp.org/upp/trunk@10128 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
b96717f892
commit
058feb5bee
8 changed files with 105 additions and 102 deletions
|
|
@ -1329,8 +1329,9 @@ int64 CopyStream(Stream& dest, Stream& src, int64 count) {
|
|||
return done;
|
||||
}
|
||||
|
||||
int64 CopyStream(Stream& dest, Stream& src, int64 count, Function<bool(int64, int64)> progress) {
|
||||
int block = (int)min<int64>(count, 65536);
|
||||
int64 CopyStream(Stream& dest, Stream& src, int64 count, EventGate<int64, int64> progress)
|
||||
{
|
||||
int block = (int)min<int64>(count, 32768);
|
||||
Buffer<byte> temp(block);
|
||||
int loaded;
|
||||
int64 done = 0;
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ Zlib::~Zlib()
|
|||
Free();
|
||||
}
|
||||
|
||||
int64 zPress(Stream& out, Stream& in, int64 size, Function<bool(int64, int64)> progress, bool gzip, bool compress,
|
||||
int64 zPress(Stream& out, Stream& in, int64 size, EventGate<int64, int64> progress, bool gzip, bool compress,
|
||||
dword *crc = NULL, bool hdr = true)
|
||||
{
|
||||
Zlib zlib;
|
||||
|
|
@ -331,95 +331,95 @@ int64 zPress(Stream& out, Stream& in, int64 size, Function<bool(int64, int64)> p
|
|||
return r;
|
||||
}
|
||||
|
||||
int64 ZCompress(Stream& out, Stream& in, int64 size, Function<bool(int64, int64)> progress, bool hdr)
|
||||
int64 ZCompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64>progress, bool hdr)
|
||||
{
|
||||
return zPress(out, in, size, progress, false, true, NULL, hdr);
|
||||
}
|
||||
|
||||
int64 ZDecompress(Stream& out, Stream& in, int64 size, Function<bool(int64, int64)> progress, bool hdr)
|
||||
int64 ZDecompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64>progress, bool hdr)
|
||||
{
|
||||
return zPress(out, in, size, progress, false, false, NULL, hdr);
|
||||
}
|
||||
|
||||
int64 ZCompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress)
|
||||
int64 ZCompress(Stream& out, Stream& in, EventGate<int64, int64>progress)
|
||||
{
|
||||
return ZCompress(out, in, in.GetLeft(), progress);
|
||||
}
|
||||
|
||||
int64 ZDecompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress)
|
||||
int64 ZDecompress(Stream& out, Stream& in, EventGate<int64, int64>progress)
|
||||
{
|
||||
return zPress(out, in, in.GetLeft(), progress, false, false);
|
||||
}
|
||||
|
||||
String ZCompress(const void *data, int64 len, Function<bool(int64, int64)> progress)
|
||||
String ZCompress(const void *data, int64 len, EventGate<int64, int64>progress)
|
||||
{
|
||||
StringStream out;
|
||||
MemReadStream in(data, len);
|
||||
return ZCompress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
|
||||
}
|
||||
|
||||
String ZCompress(const String& s, Function<bool(int64, int64)> progress)
|
||||
String ZCompress(const String& s, EventGate<int64, int64>progress)
|
||||
{
|
||||
return ZCompress(~s, s.GetLength(), progress);
|
||||
}
|
||||
|
||||
String ZDecompress(const void *data, int64 len, Function<bool(int64, int64)> progress)
|
||||
String ZDecompress(const void *data, int64 len, EventGate<int64, int64>progress)
|
||||
{
|
||||
StringStream out;
|
||||
MemReadStream in(data, len);
|
||||
return ZDecompress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
|
||||
}
|
||||
|
||||
String ZDecompress(const String& s, Function<bool(int64, int64)> progress)
|
||||
String ZDecompress(const String& s, EventGate<int64, int64>progress)
|
||||
{
|
||||
return ZDecompress(~s, s.GetLength(), progress);
|
||||
}
|
||||
|
||||
int64 GZCompress(Stream& out, Stream& in, int64 size, Function<bool(int64, int64)> progress)
|
||||
int64 GZCompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64>progress)
|
||||
{
|
||||
return zPress(out, in, size, progress, true, true);
|
||||
}
|
||||
|
||||
int64 GZDecompress(Stream& out, Stream& in, int64 size, Function<bool(int64, int64)> progress)
|
||||
int64 GZDecompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64>progress)
|
||||
{
|
||||
return zPress(out, in, size, progress, true, false);
|
||||
}
|
||||
|
||||
int64 GZCompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress)
|
||||
int64 GZCompress(Stream& out, Stream& in, EventGate<int64, int64>progress)
|
||||
{
|
||||
return GZCompress(out, in, in.GetLeft(), progress);
|
||||
}
|
||||
|
||||
String GZCompress(const void *data, int len, Function<bool(int64, int64)> progress)
|
||||
String GZCompress(const void *data, int len, EventGate<int64, int64>progress)
|
||||
{
|
||||
StringStream out;
|
||||
MemReadStream in(data, len);
|
||||
return GZCompress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
|
||||
}
|
||||
|
||||
String GZCompress(const String& s, Function<bool(int64, int64)> progress)
|
||||
String GZCompress(const String& s, EventGate<int64, int64>progress)
|
||||
{
|
||||
return GZCompress(~s, s.GetCount(), progress);
|
||||
}
|
||||
|
||||
int64 GZDecompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress)
|
||||
int64 GZDecompress(Stream& out, Stream& in, EventGate<int64, int64>progress)
|
||||
{
|
||||
return GZDecompress(out, in, in.GetLeft(), progress);
|
||||
}
|
||||
|
||||
String GZDecompress(const void *data, int len, Function<bool(int64, int64)> progress)
|
||||
String GZDecompress(const void *data, int len, EventGate<int64, int64>progress)
|
||||
{
|
||||
StringStream out;
|
||||
MemReadStream in(data, len);
|
||||
return GZDecompress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
|
||||
}
|
||||
|
||||
String GZDecompress(const String& s, Function<bool(int64, int64)> progress)
|
||||
String GZDecompress(const String& s, EventGate<int64, int64>progress)
|
||||
{
|
||||
return GZDecompress(~s, s.GetCount(), progress);
|
||||
}
|
||||
|
||||
bool GZCompressFile(const char *dstfile, const char *srcfile, Function<bool(int64, int64)> progress)
|
||||
bool GZCompressFile(const char *dstfile, const char *srcfile, EventGate<int64, int64>progress)
|
||||
{
|
||||
FileIn in(srcfile);
|
||||
if(!in)
|
||||
|
|
@ -433,13 +433,13 @@ bool GZCompressFile(const char *dstfile, const char *srcfile, Function<bool(int6
|
|||
return !out.IsError();
|
||||
}
|
||||
|
||||
bool GZCompressFile(const char *srcfile, Function<bool(int64, int64)> progress)
|
||||
bool GZCompressFile(const char *srcfile, EventGate<int64, int64>progress)
|
||||
{
|
||||
String dstfile = String(srcfile) + ".gz";
|
||||
return GZCompressFile(dstfile, srcfile, progress);
|
||||
}
|
||||
|
||||
bool GZDecompressFile(const char *dstfile, const char *srcfile, Function<bool(int64, int64)> progress)
|
||||
bool GZDecompressFile(const char *dstfile, const char *srcfile, EventGate<int64, int64>progress)
|
||||
{
|
||||
FileIn in(srcfile);
|
||||
if(!in)
|
||||
|
|
@ -453,7 +453,7 @@ bool GZDecompressFile(const char *dstfile, const char *srcfile, Function<bool(in
|
|||
return !out.IsError();
|
||||
}
|
||||
|
||||
bool GZDecompressFile(const char *srcfile, Function<bool(int64, int64)> progress)
|
||||
bool GZDecompressFile(const char *srcfile, EventGate<int64, int64>progress)
|
||||
{
|
||||
String dstfile = srcfile;
|
||||
if(dstfile.EndsWith(".gz"))
|
||||
|
|
@ -466,9 +466,11 @@ bool GZDecompressFile(const char *srcfile, Function<bool(int64, int64)> progress
|
|||
return GZDecompressFile(dstfile, srcfile, progress);
|
||||
}
|
||||
|
||||
Function<bool(int64, int64)> AsGate64(Gate2<int, int> gate)
|
||||
EventGate<int64, int64> AsGate64(Gate2<int, int> gate)
|
||||
{
|
||||
return [=](int64 a, int64 b) { return gate((int)a, (int)b); };
|
||||
EventGate<int64, int64> h;
|
||||
h << [=](int64 a, int64 b) { return gate((int)a, (int)b); };
|
||||
return h;
|
||||
}
|
||||
|
||||
#include "lib/lz4.h"
|
||||
|
|
|
|||
|
|
@ -120,37 +120,37 @@ public:
|
|||
~ZDecompressStream() { Close(); }
|
||||
};
|
||||
|
||||
int64 CopyStream(Stream& dest, Stream& src, int64 count, Function<bool(int64, int64)> progress);
|
||||
int64 CopyStream(Stream& dest, Stream& src, int64 count, EventGate<int64, int64> progress);
|
||||
|
||||
int64 ZCompress(Stream& out, Stream& in, int64 size, Function<bool(int64, int64)> progress = CNULL, bool hdr = true);
|
||||
int64 ZCompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress = CNULL);
|
||||
String ZCompress(const void *data, int64 len, Function<bool(int64, int64)> progress = CNULL);
|
||||
String ZCompress(const String& s, Function<bool(int64, int64)> progress = CNULL);
|
||||
int64 ZCompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64> progress = false, bool hdr = true);
|
||||
int64 ZCompress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
|
||||
String ZCompress(const void *data, int64 len, EventGate<int64, int64> progress = false);
|
||||
String ZCompress(const String& s, EventGate<int64, int64> progress = false);
|
||||
|
||||
int64 ZDecompress(Stream& out, Stream& in, int64 size, Function<bool(int64, int64)> progress = CNULL, bool hdr = true);
|
||||
int64 ZDecompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress = CNULL);
|
||||
String ZDecompress(const void *data, int64 len, Function<bool(int64, int64)> progress = CNULL);
|
||||
String ZDecompress(const String& s, Function<bool(int64, int64)> progress = CNULL);
|
||||
int64 ZDecompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64> progress = false, bool hdr = true);
|
||||
int64 ZDecompress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
|
||||
String ZDecompress(const void *data, int64 len, EventGate<int64, int64> progress = false);
|
||||
String ZDecompress(const String& s, EventGate<int64, int64> progress = false);
|
||||
|
||||
int64 GZCompress(Stream& out, Stream& in, int64 size, Function<bool(int64, int64)> progress = CNULL);
|
||||
int64 GZCompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress = CNULL);
|
||||
String GZCompress(const void *data, int len, Function<bool(int64, int64)> progress = CNULL);
|
||||
String GZCompress(const String& s, Function<bool(int64, int64)> progress = CNULL);
|
||||
int64 GZCompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64> progress = false);
|
||||
int64 GZCompress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
|
||||
String GZCompress(const void *data, int len, EventGate<int64, int64> progress = false);
|
||||
String GZCompress(const String& s, EventGate<int64, int64> progress = false);
|
||||
|
||||
int64 GZDecompress(Stream& out, Stream& in, int64 size, Function<bool(int64, int64)> progress = CNULL);
|
||||
int64 GZDecompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress = CNULL);
|
||||
String GZDecompress(const void *data, int len, Function<bool(int64, int64)> progress = CNULL);
|
||||
String GZDecompress(const String& s, Function<bool(int64, int64)> progress = CNULL);
|
||||
int64 GZDecompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64> progress = false);
|
||||
int64 GZDecompress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
|
||||
String GZDecompress(const void *data, int len, EventGate<int64, int64> progress = false);
|
||||
String GZDecompress(const String& s, EventGate<int64, int64> progress = false);
|
||||
|
||||
bool GZCompressFile(const char *dstfile, const char *srcfile, Function<bool(int64, int64)> progress = CNULL);
|
||||
bool GZCompressFile(const char *srcfile, Function<bool(int64, int64)> progress = CNULL);
|
||||
bool GZCompressFile(const char *dstfile, const char *srcfile, EventGate<int64, int64> progress = false);
|
||||
bool GZCompressFile(const char *srcfile, EventGate<int64, int64> progress = false);
|
||||
|
||||
bool GZDecompressFile(const char *dstfile, const char *srcfile, Function<bool(int64, int64)> progress = CNULL);
|
||||
bool GZDecompressFile(const char *srcfile, Function<bool(int64, int64)> progress = CNULL);
|
||||
bool GZDecompressFile(const char *dstfile, const char *srcfile, EventGate<int64, int64> progress = false);
|
||||
bool GZDecompressFile(const char *srcfile, EventGate<int64, int64> progress = false);
|
||||
|
||||
/// Backward compatibility:
|
||||
|
||||
Function<bool(int64, int64)> AsGate64(Gate2<int, int> gate);
|
||||
EventGate<int64, int64> AsGate64(Gate2<int, int> gate);
|
||||
|
||||
inline int ZCompress(Stream& out, Stream& in, Gate2<int, int> progress) { return (int)ZCompress(out, in, AsGate64(progress)); }
|
||||
inline String ZCompress(const void *data, int len, Gate2<int, int> progress) { return ZCompress(data, len, AsGate64(progress)); }
|
||||
|
|
|
|||
|
|
@ -110,20 +110,20 @@ public:
|
|||
~LZ4DecompressStream();
|
||||
};
|
||||
|
||||
int64 LZ4Compress(Stream& out, Stream& in, Function<bool(int64, int64)> progress = CNULL);
|
||||
int64 LZ4Decompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress = CNULL);
|
||||
String LZ4Compress(const void *data, int64 len, Function<bool(int64, int64)> progress = CNULL);
|
||||
String LZ4Compress(const String& s, Function<bool(int64, int64)> progress = CNULL);
|
||||
String LZ4Decompress(const void *data, int64 len, Function<bool(int64, int64)> progress = CNULL);
|
||||
String LZ4Decompress(const String& s, Function<bool(int64, int64)> progress = CNULL);
|
||||
int64 LZ4Compress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
|
||||
int64 LZ4Decompress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
|
||||
String LZ4Compress(const void *data, int64 len, EventGate<int64, int64> progress = false);
|
||||
String LZ4Compress(const String& s, EventGate<int64, int64> progress = false);
|
||||
String LZ4Decompress(const void *data, int64 len, EventGate<int64, int64> progress = false);
|
||||
String LZ4Decompress(const String& s, EventGate<int64, int64> progress = false);
|
||||
|
||||
#ifdef _MULTITHREADED
|
||||
int64 CoLZ4Compress(Stream& out, Stream& in, Function<bool(int64, int64)> progress = CNULL);
|
||||
int64 CoLZ4Decompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress = CNULL);
|
||||
String CoLZ4Compress(const void *data, int64 len, Function<bool(int64, int64)> progress = CNULL);
|
||||
String CoLZ4Compress(const String& s, Function<bool(int64, int64)> progress = CNULL);
|
||||
String CoLZ4Decompress(const void *data, int64 len, Function<bool(int64, int64)> progress = CNULL);
|
||||
String CoLZ4Decompress(const String& s, Function<bool(int64, int64)> progress = CNULL);
|
||||
int64 CoLZ4Compress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
|
||||
int64 CoLZ4Decompress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
|
||||
String CoLZ4Compress(const void *data, int64 len, EventGate<int64, int64> progress = false);
|
||||
String CoLZ4Compress(const String& s, EventGate<int64, int64> progress = false);
|
||||
String CoLZ4Decompress(const void *data, int64 len, EventGate<int64, int64> progress = false);
|
||||
String CoLZ4Decompress(const String& s, EventGate<int64, int64> progress = false);
|
||||
#endif
|
||||
|
||||
bool IsLZ4(Stream& s);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Upp {
|
||||
|
||||
void sCompressStreamCopy_(Stream& out, Stream& in, Function<bool(int64, int64)> progress, Stream& orig_in, int64 insz)
|
||||
void sCompressStreamCopy_(Stream& out, Stream& in, EventGate<int64, int64> progress, Stream& orig_in, int64 insz)
|
||||
{
|
||||
const int CHUNK = 32678;
|
||||
Buffer<byte> b(CHUNK);
|
||||
|
|
@ -15,7 +15,7 @@ void sCompressStreamCopy_(Stream& out, Stream& in, Function<bool(int64, int64)>
|
|||
progress(orig_in.GetPos(), insz);
|
||||
}
|
||||
|
||||
static int64 sLZ4Compress(Stream& out, Stream& in, int64 size, Function<bool(int64, int64)> progress, bool co)
|
||||
static int64 sLZ4Compress(Stream& out, Stream& in, int64 size, EventGate<int64, int64> progress, bool co)
|
||||
{
|
||||
LZ4CompressStream outs(out);
|
||||
#ifdef _MULTITHREADED
|
||||
|
|
@ -29,7 +29,7 @@ static int64 sLZ4Compress(Stream& out, Stream& in, int64 size, Function<bool(int
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int64 sLZ4Decompress(Stream& out, Stream& in, int64 size, Function<bool(int64, int64)> progress, bool co)
|
||||
static int64 sLZ4Decompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64> progress, bool co)
|
||||
{
|
||||
LZ4DecompressStream ins(in);
|
||||
#ifdef _MULTITHREADED
|
||||
|
|
@ -43,72 +43,72 @@ static int64 sLZ4Decompress(Stream& out, Stream& in, int64 size, Function<bool(i
|
|||
return -1;
|
||||
}
|
||||
|
||||
int64 LZ4Compress(Stream& out, Stream& in, Function<bool(int64, int64)> progress)
|
||||
int64 LZ4Compress(Stream& out, Stream& in, EventGate<int64, int64> progress)
|
||||
{
|
||||
return sLZ4Compress(out, in, in.GetLeft(), progress, false);
|
||||
}
|
||||
|
||||
int64 LZ4Decompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress)
|
||||
int64 LZ4Decompress(Stream& out, Stream& in, EventGate<int64, int64> progress)
|
||||
{
|
||||
return sLZ4Decompress(out, in, in.GetLeft(), progress, false);
|
||||
}
|
||||
|
||||
String LZ4Compress(const void *data, int64 len, Function<bool(int64, int64)> progress)
|
||||
String LZ4Compress(const void *data, int64 len, EventGate<int64, int64> progress)
|
||||
{
|
||||
StringStream out;
|
||||
MemReadStream in(data, len);
|
||||
return LZ4Compress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
|
||||
}
|
||||
|
||||
String LZ4Compress(const String& s, Function<bool(int64, int64)> progress)
|
||||
String LZ4Compress(const String& s, EventGate<int64, int64> progress)
|
||||
{
|
||||
return LZ4Compress(~s, s.GetLength(), progress);
|
||||
}
|
||||
|
||||
String LZ4Decompress(const void *data, int64 len, Function<bool(int64, int64)> progress)
|
||||
String LZ4Decompress(const void *data, int64 len, EventGate<int64, int64> progress)
|
||||
{
|
||||
StringStream out;
|
||||
MemReadStream in(data, len);
|
||||
return LZ4Decompress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
|
||||
}
|
||||
|
||||
String LZ4Decompress(const String& s, Function<bool(int64, int64)> progress)
|
||||
String LZ4Decompress(const String& s, EventGate<int64, int64> progress)
|
||||
{
|
||||
return LZ4Decompress(~s, s.GetLength(), progress);
|
||||
}
|
||||
|
||||
#ifdef _MULTITHREADED
|
||||
|
||||
int64 CoLZ4Compress(Stream& out, Stream& in, Function<bool(int64, int64)> progress)
|
||||
int64 CoLZ4Compress(Stream& out, Stream& in, EventGate<int64, int64> progress)
|
||||
{
|
||||
return sLZ4Compress(out, in, in.GetLeft(), progress, true);
|
||||
}
|
||||
|
||||
int64 CoLZ4Decompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress)
|
||||
int64 CoLZ4Decompress(Stream& out, Stream& in, EventGate<int64, int64> progress)
|
||||
{
|
||||
return sLZ4Decompress(out, in, in.GetLeft(), progress, true);
|
||||
}
|
||||
|
||||
String CoLZ4Compress(const void *data, int64 len, Function<bool(int64, int64)> progress)
|
||||
String CoLZ4Compress(const void *data, int64 len, EventGate<int64, int64> progress)
|
||||
{
|
||||
StringStream out;
|
||||
MemReadStream in(data, len);
|
||||
return CoLZ4Compress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
|
||||
}
|
||||
|
||||
String CoLZ4Compress(const String& s, Function<bool(int64, int64)> progress)
|
||||
String CoLZ4Compress(const String& s, EventGate<int64, int64> progress)
|
||||
{
|
||||
return CoLZ4Compress(~s, s.GetLength(), progress);
|
||||
}
|
||||
|
||||
String CoLZ4Decompress(const void *data, int64 len, Function<bool(int64, int64)> progress)
|
||||
String CoLZ4Decompress(const void *data, int64 len, EventGate<int64, int64> progress)
|
||||
{
|
||||
StringStream out;
|
||||
MemReadStream in(data, len);
|
||||
return CoLZ4Decompress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
|
||||
}
|
||||
|
||||
String CoLZ4Decompress(const String& s, Function<bool(int64, int64)> progress)
|
||||
String CoLZ4Decompress(const String& s, EventGate<int64, int64> progress)
|
||||
{
|
||||
return CoLZ4Decompress(~s, s.GetLength(), progress);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace Upp {
|
||||
|
||||
void sCompressStreamCopy_(Stream& out, Stream& in, Function<bool(int64, int64)> progress, Stream& orig_in, int64 insz);
|
||||
void sCompressStreamCopy_(Stream& out, Stream& in, EventGate<int64, int64> progress, Stream& orig_in, int64 insz);
|
||||
|
||||
static int64 sZstdCompress(Stream& out, Stream& in, int64 size, Function<bool(int64, int64)> progress, bool co)
|
||||
static int64 sZstdCompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64> progress, bool co)
|
||||
{
|
||||
ZstdCompressStream outs(out);
|
||||
#ifdef _MULTITHREADED
|
||||
|
|
@ -18,7 +18,7 @@ static int64 sZstdCompress(Stream& out, Stream& in, int64 size, Function<bool(in
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int64 sZstdDecompress(Stream& out, Stream& in, int64 size, Function<bool(int64, int64)> progress, bool co)
|
||||
static int64 sZstdDecompress(Stream& out, Stream& in, int64 size, EventGate<int64, int64> progress, bool co)
|
||||
{
|
||||
ZstdDecompressStream ins(in);
|
||||
#ifdef _MULTITHREADED
|
||||
|
|
@ -32,72 +32,72 @@ static int64 sZstdDecompress(Stream& out, Stream& in, int64 size, Function<bool(
|
|||
return -1;
|
||||
}
|
||||
|
||||
int64 ZstdCompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress)
|
||||
int64 ZstdCompress(Stream& out, Stream& in, EventGate<int64, int64> progress)
|
||||
{
|
||||
return sZstdCompress(out, in, in.GetLeft(), progress, false);
|
||||
}
|
||||
|
||||
int64 ZstdDecompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress)
|
||||
int64 ZstdDecompress(Stream& out, Stream& in, EventGate<int64, int64> progress)
|
||||
{
|
||||
return sZstdDecompress(out, in, in.GetLeft(), progress, false);
|
||||
}
|
||||
|
||||
String ZstdCompress(const void *data, int64 len, Function<bool(int64, int64)> progress)
|
||||
String ZstdCompress(const void *data, int64 len, EventGate<int64, int64> progress)
|
||||
{
|
||||
StringStream out;
|
||||
MemReadStream in(data, len);
|
||||
return ZstdCompress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
|
||||
}
|
||||
|
||||
String ZstdCompress(const String& s, Function<bool(int64, int64)> progress)
|
||||
String ZstdCompress(const String& s, EventGate<int64, int64> progress)
|
||||
{
|
||||
return ZstdCompress(~s, s.GetLength(), progress);
|
||||
}
|
||||
|
||||
String ZstdDecompress(const void *data, int64 len, Function<bool(int64, int64)> progress)
|
||||
String ZstdDecompress(const void *data, int64 len, EventGate<int64, int64> progress)
|
||||
{
|
||||
StringStream out;
|
||||
MemReadStream in(data, len);
|
||||
return ZstdDecompress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
|
||||
}
|
||||
|
||||
String ZstdDecompress(const String& s, Function<bool(int64, int64)> progress)
|
||||
String ZstdDecompress(const String& s, EventGate<int64, int64> progress)
|
||||
{
|
||||
return ZstdDecompress(~s, s.GetLength(), progress);
|
||||
}
|
||||
|
||||
#ifdef _MULTITHREADED
|
||||
|
||||
int64 CoZstdCompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress)
|
||||
int64 CoZstdCompress(Stream& out, Stream& in, EventGate<int64, int64> progress)
|
||||
{
|
||||
return sZstdCompress(out, in, in.GetLeft(), progress, true);
|
||||
}
|
||||
|
||||
int64 CoZstdDecompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress)
|
||||
int64 CoZstdDecompress(Stream& out, Stream& in, EventGate<int64, int64> progress)
|
||||
{
|
||||
return sZstdDecompress(out, in, in.GetLeft(), progress, true);
|
||||
}
|
||||
|
||||
String CoZstdCompress(const void *data, int64 len, Function<bool(int64, int64)> progress)
|
||||
String CoZstdCompress(const void *data, int64 len, EventGate<int64, int64> progress)
|
||||
{
|
||||
StringStream out;
|
||||
MemReadStream in(data, len);
|
||||
return CoZstdCompress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
|
||||
}
|
||||
|
||||
String CoZstdCompress(const String& s, Function<bool(int64, int64)> progress)
|
||||
String CoZstdCompress(const String& s, EventGate<int64, int64> progress)
|
||||
{
|
||||
return CoZstdCompress(~s, s.GetLength(), progress);
|
||||
}
|
||||
|
||||
String CoZstdDecompress(const void *data, int64 len, Function<bool(int64, int64)> progress)
|
||||
String CoZstdDecompress(const void *data, int64 len, EventGate<int64, int64> progress)
|
||||
{
|
||||
StringStream out;
|
||||
MemReadStream in(data, len);
|
||||
return CoZstdDecompress(out, in, progress) < 0 ? String::GetVoid() : out.GetResult();
|
||||
}
|
||||
|
||||
String CoZstdDecompress(const String& s, Function<bool(int64, int64)> progress)
|
||||
String CoZstdDecompress(const String& s, EventGate<int64, int64> progress)
|
||||
{
|
||||
return CoZstdDecompress(~s, s.GetLength(), progress);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,20 +95,20 @@ public:
|
|||
~ZstdDecompressStream();
|
||||
};
|
||||
|
||||
int64 ZstdCompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress);
|
||||
int64 ZstdDecompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress);
|
||||
String ZstdCompress(const void *data, int64 len, Function<bool(int64, int64)> progress);
|
||||
String ZstdCompress(const String& s, Function<bool(int64, int64)> progress);
|
||||
String ZstdDecompress(const void *data, int64 len, Function<bool(int64, int64)> progress);
|
||||
String ZstdDecompress(const String& s, Function<bool(int64, int64)> progress);
|
||||
int64 ZstdCompress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
|
||||
int64 ZstdDecompress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
|
||||
String ZstdCompress(const void *data, int64 len, EventGate<int64, int64> progress = false);
|
||||
String ZstdCompress(const String& s, EventGate<int64, int64> progress = false);
|
||||
String ZstdDecompress(const void *data, int64 len, EventGate<int64, int64> progress = false);
|
||||
String ZstdDecompress(const String& s, EventGate<int64, int64> progress = false);
|
||||
|
||||
#ifdef _MULTITHREADED
|
||||
int64 CoZstdCompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress);
|
||||
int64 CoZstdDecompress(Stream& out, Stream& in, Function<bool(int64, int64)> progress);
|
||||
String CoZstdCompress(const void *data, int64 len, Function<bool(int64, int64)> progress);
|
||||
String CoZstdCompress(const String& s, Function<bool(int64, int64)> progress);
|
||||
String CoZstdDecompress(const void *data, int64 len, Function<bool(int64, int64)> progress);
|
||||
String CoZstdDecompress(const String& s, Function<bool(int64, int64)> progress);
|
||||
int64 CoZstdCompress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
|
||||
int64 CoZstdDecompress(Stream& out, Stream& in, EventGate<int64, int64> progress = false);
|
||||
String CoZstdCompress(const void *data, int64 len, EventGate<int64, int64> progress = false);
|
||||
String CoZstdCompress(const String& s, EventGate<int64, int64> progress = false);
|
||||
String CoZstdDecompress(const void *data, int64 len, EventGate<int64, int64> progress = false);
|
||||
String CoZstdDecompress(const String& s, EventGate<int64, int64> progress = false);
|
||||
#endif
|
||||
|
||||
bool IsZstd(Stream& s);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ description "\3770,128,128";
|
|||
|
||||
file
|
||||
import.ext,
|
||||
zstd.h,
|
||||
Compress.cpp,
|
||||
zstd.h,
|
||||
Decompress.cpp,
|
||||
Util.cpp,
|
||||
common\zstd.h;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue