mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
plugin\zstd_legacy: Legacy zstd support
git-svn-id: svn://ultimatepp.org/upp/trunk@12902 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
8d0c7d935d
commit
1e1cebc201
16 changed files with 41 additions and 104 deletions
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Upp {
|
||||
|
||||
namespace Legacy {
|
||||
|
||||
// we simply store data as series of complete Zstd frames, as library gives us no easy way
|
||||
// to do it in MT
|
||||
|
||||
|
|
@ -133,3 +135,5 @@ ZstdCompressStream::~ZstdCompressStream()
|
|||
}
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
namespace Upp {
|
||||
|
||||
namespace Legacy {
|
||||
|
||||
void ZstdDecompressStream::Init()
|
||||
{
|
||||
|
|
@ -271,3 +272,5 @@ bool IsZstd(Stream& s)
|
|||
}
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
|||
18
uppsrc/plugin/zstd_legacy/Lib.cpp
Normal file
18
uppsrc/plugin/zstd_legacy/Lib.cpp
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
namespace Upp {
|
||||
|
||||
namespace Legacy {
|
||||
|
||||
#include "lib/entropy_common.c"
|
||||
#include "lib/fse_compress.c"
|
||||
#include "lib/fse_decompress.c"
|
||||
#include "lib/huf_compress.c"
|
||||
#include "lib/huf_decompress.c"
|
||||
#include "lib/zbuff_compress.c"
|
||||
#include "lib/zbuff_decompress.c"
|
||||
#include "lib/zstd_common.c"
|
||||
#include "lib/zstd_compress.c"
|
||||
#include "lib/zstd_decompress.c"
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
#include "zstd.h"
|
||||
|
||||
namespace Upp {
|
||||
|
||||
void sCompressStreamCopy_(Stream& out, Stream& in, Gate<int64, int64> progress, Stream& orig_in, int64 insz);
|
||||
|
||||
void sCompressStreamCopy_(Stream& out, Stream& in, Gate<int64, int64> progress, Stream& orig_in, int64 insz);
|
||||
|
||||
namespace Legacy {
|
||||
|
||||
static int64 sZstdCompress(Stream& out, Stream& in, int64 size, Gate<int64, int64> progress, bool co)
|
||||
{
|
||||
ZstdCompressStream outs(out);
|
||||
|
|
@ -104,4 +106,6 @@ String CoZstdDecompress(const String& s, Gate<int64, int64> progress)
|
|||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
|
@ -35,11 +35,6 @@
|
|||
#ifndef BITSTREAM_H_MODULE
|
||||
#define BITSTREAM_H_MODULE
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* This API consists of small unitary functions, which must be inlined for best performance.
|
||||
* Since link-time-optimization is not available for all compilers,
|
||||
|
|
@ -407,8 +402,4 @@ MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* DStream)
|
|||
return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
|
||||
}
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BITSTREAM_H_MODULE */
|
||||
|
|
|
|||
|
|
@ -35,11 +35,6 @@
|
|||
#ifndef ERROR_H_MODULE
|
||||
#define ERROR_H_MODULE
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* ****************************************
|
||||
* Dependencies
|
||||
******************************************/
|
||||
|
|
@ -118,8 +113,4 @@ ERR_STATIC const char* ERR_getErrorName(size_t code)
|
|||
return ERR_getErrorString(ERR_getErrorCode(code));
|
||||
}
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ERROR_H_MODULE */
|
||||
|
|
|
|||
|
|
@ -33,11 +33,6 @@
|
|||
#ifndef ERROR_PUBLIC_H_MODULE
|
||||
#define ERROR_PUBLIC_H_MODULE
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* ****************************************
|
||||
* error codes list
|
||||
******************************************/
|
||||
|
|
@ -69,9 +64,4 @@ typedef enum {
|
|||
ZSTD_ErrorCode ZSTD_getErrorCode(size_t functionResult);
|
||||
const char* ZSTD_getErrorString(ZSTD_ErrorCode code);
|
||||
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ERROR_PUBLIC_H_MODULE */
|
||||
|
|
|
|||
|
|
@ -34,11 +34,6 @@
|
|||
#ifndef FSE_H
|
||||
#define FSE_H
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*-*****************************************
|
||||
* Dependencies
|
||||
******************************************/
|
||||
|
|
@ -620,9 +615,4 @@ MEM_STATIC unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr)
|
|||
|
||||
#endif /* FSE_STATIC_LINKING_ONLY */
|
||||
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FSE_H */
|
||||
|
|
|
|||
|
|
@ -190,8 +190,6 @@ size_t FSE_NCountWriteBound(unsigned maxSymbolValue, unsigned tableLog)
|
|||
return maxSymbolValue ? maxHeaderSize : FSE_NCOUNTBOUND; /* maxSymbolValue==0 ? use default */
|
||||
}
|
||||
|
||||
static short FSE_abs(short a) { return a<0 ? -a : a; }
|
||||
|
||||
static size_t FSE_writeNCount_generic (void* header, size_t headerBufferSize,
|
||||
const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog,
|
||||
unsigned writeIsSafe)
|
||||
|
|
|
|||
|
|
@ -34,11 +34,6 @@
|
|||
#ifndef HUF_H_298734234
|
||||
#define HUF_H_298734234
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* *** Dependencies *** */
|
||||
#include <stddef.h> /* size_t */
|
||||
|
||||
|
|
@ -220,9 +215,4 @@ size_t HUF_decompress1X4_usingDTable(void* dst, size_t maxDstSize, const void* c
|
|||
|
||||
#endif /* HUF_STATIC_LINKING_ONLY */
|
||||
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HUF_H_298734234 */
|
||||
|
|
|
|||
|
|
@ -35,10 +35,6 @@
|
|||
#ifndef MEM_H_MODULE
|
||||
#define MEM_H_MODULE
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-****************************************
|
||||
* Dependencies
|
||||
******************************************/
|
||||
|
|
@ -369,9 +365,5 @@ MEM_STATIC U32 MEM_readMINMATCH(const void* memPtr, U32 length)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MEM_H_MODULE */
|
||||
|
||||
|
|
|
|||
|
|
@ -31,10 +31,6 @@
|
|||
#ifndef ZSTD_BUFFERED_H_23987
|
||||
#define ZSTD_BUFFERED_H_23987
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* *************************************
|
||||
* Dependencies
|
||||
***************************************/
|
||||
|
|
@ -189,9 +185,4 @@ ZSTDLIB_API size_t ZBUFF_compressInit_advanced(ZBUFF_CCtx* zbc,
|
|||
|
||||
#endif /* ZBUFF_STATIC_LINKING_ONLY */
|
||||
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZSTD_BUFFERED_H_23987 */
|
||||
|
|
|
|||
|
|
@ -137,15 +137,6 @@ size_t ZBUFF_decompressInit(ZBUFF_DCtx* zbd)
|
|||
}
|
||||
|
||||
|
||||
/* internal util function */
|
||||
MEM_STATIC size_t ZBUFF_limitCopy(void* dst, size_t dstCapacity, const void* src, size_t srcSize)
|
||||
{
|
||||
size_t const length = MIN(dstCapacity, srcSize);
|
||||
memcpy(dst, src, length);
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
/* *** Decompression *** */
|
||||
|
||||
size_t ZBUFF_decompressContinue(ZBUFF_DCtx* zbd,
|
||||
|
|
|
|||
|
|
@ -32,10 +32,6 @@
|
|||
#ifndef ZSTD_H_235446
|
||||
#define ZSTD_H_235446
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-*************************************
|
||||
* Dependencies
|
||||
***************************************/
|
||||
|
|
@ -468,8 +464,4 @@ ZSTDLIB_API size_t ZSTD_insertBlock(ZSTD_DCtx* dctx, const void* blockStart, siz
|
|||
|
||||
#endif /* ZSTD_STATIC_LINKING_ONLY */
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZSTD_H_235446 */
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
#ifndef _plugin_zstd_zstd_h_
|
||||
#define _plugin_zstd_zstd_h_
|
||||
#ifndef _plugin_zstd_zstd_legacy_h_
|
||||
#define _plugin_zstd_zstd_legacy_h_
|
||||
|
||||
#include <Core/Core.h>
|
||||
|
||||
namespace Upp {
|
||||
|
||||
namespace Legacy {
|
||||
|
||||
#define ZSTD_STATIC_LINKING_ONLY
|
||||
#include "lib/zstd.h"
|
||||
|
||||
namespace Upp {
|
||||
|
||||
class ZstdCompressStream : public Stream {
|
||||
public:
|
||||
virtual void Close();
|
||||
|
|
@ -103,17 +105,17 @@ String ZstdCompress(const String& s, Gate<int64, int64> progress = Null);
|
|||
String ZstdDecompress(const void *data, int64 len, Gate<int64, int64> progress = Null);
|
||||
String ZstdDecompress(const String& s, Gate<int64, int64> progress = Null);
|
||||
|
||||
#ifdef _MULTITHREADED
|
||||
int64 CoZstdCompress(Stream& out, Stream& in, Gate<int64, int64> progress = Null);
|
||||
int64 CoZstdDecompress(Stream& out, Stream& in, Gate<int64, int64> progress = Null);
|
||||
String CoZstdCompress(const void *data, int64 len, Gate<int64, int64> progress = Null);
|
||||
String CoZstdCompress(const String& s, Gate<int64, int64> progress = Null);
|
||||
String CoZstdDecompress(const void *data, int64 len, Gate<int64, int64> progress = Null);
|
||||
String CoZstdDecompress(const String& s, Gate<int64, int64> progress = Null);
|
||||
#endif
|
||||
|
||||
bool IsZstd(Stream& s);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,18 +5,8 @@ file
|
|||
Compress.cpp,
|
||||
Decompress.cpp,
|
||||
Util.cpp,
|
||||
Lib.cpp,
|
||||
lib\zstd.h,
|
||||
src.tpp,
|
||||
Copying,
|
||||
lib readonly separator,
|
||||
lib\entropy_common.c,
|
||||
lib\fse_compress.c,
|
||||
lib\fse_decompress.c,
|
||||
lib\huf_compress.c,
|
||||
lib\huf_decompress.c,
|
||||
lib\zbuff_compress.c,
|
||||
lib\zbuff_decompress.c,
|
||||
lib\zstd_common.c,
|
||||
lib\zstd_compress.c,
|
||||
lib\zstd_decompress.c;
|
||||
Copying;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue