mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-09 22:07:05 -06:00
Major changes, including Brotli and Lizard
- update of zstd-mt library - add brotli v0.6.0 - add lizard v2.0 - xxhash is from zstd for lz4, lz5 and lizard now - update also the documentation, where needed
This commit is contained in:
@@ -14,8 +14,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define LZ5F_DISABLE_OBSOLETE_ENUMS
|
||||
#include "lz5frame.h"
|
||||
#define LIZF_DISABLE_OBSOLETE_ENUMS
|
||||
#include "lizframe.h"
|
||||
|
||||
#include "memmt.h"
|
||||
#include "threading.h"
|
||||
@@ -38,7 +38,7 @@
|
||||
/* worker for compression */
|
||||
typedef struct {
|
||||
LIZARDMT_CCtx *ctx;
|
||||
LZ5F_preferences_t zpref;
|
||||
LIZF_preferences_t zpref;
|
||||
pthread_t pthread;
|
||||
} cwork_t;
|
||||
|
||||
@@ -104,7 +104,7 @@ LIZARDMT_CCtx *LIZARDMT_createCCtx(int threads, int level, int inputsize)
|
||||
return 0;
|
||||
|
||||
/* check level */
|
||||
if (level < 1 || level > LIZARDMT_LEVEL_MAX)
|
||||
if (level < LIZARDMT_LEVEL_MIN || level > LIZARDMT_LEVEL_MAX)
|
||||
return 0;
|
||||
|
||||
/* calculate chunksize for one thread */
|
||||
@@ -138,12 +138,12 @@ LIZARDMT_CCtx *LIZARDMT_createCCtx(int threads, int level, int inputsize)
|
||||
w->ctx = ctx;
|
||||
|
||||
/* setup preferences for that thread */
|
||||
memset(&w->zpref, 0, sizeof(LZ5F_preferences_t));
|
||||
memset(&w->zpref, 0, sizeof(LIZF_preferences_t));
|
||||
w->zpref.compressionLevel = level;
|
||||
w->zpref.frameInfo.blockMode = LZ5F_blockLinked;
|
||||
w->zpref.frameInfo.blockMode = LIZF_blockLinked;
|
||||
w->zpref.frameInfo.contentSize = 1;
|
||||
w->zpref.frameInfo.contentChecksumFlag =
|
||||
LZ5F_contentChecksumEnabled;
|
||||
LIZF_contentChecksumEnabled;
|
||||
|
||||
}
|
||||
|
||||
@@ -169,7 +169,6 @@ static size_t mt_error(int rv)
|
||||
return ERROR(memory_allocation);
|
||||
}
|
||||
|
||||
/* XXX, some catch all other errors */
|
||||
return ERROR(read_fail);
|
||||
}
|
||||
|
||||
@@ -230,7 +229,7 @@ static void *pt_compress(void *arg)
|
||||
entry = list_first(&ctx->writelist_free);
|
||||
wl = list_entry(entry, struct writelist, node);
|
||||
wl->out.size =
|
||||
LZ5F_compressFrameBound(ctx->inputsize,
|
||||
LIZF_compressFrameBound(ctx->inputsize,
|
||||
&w->zpref) + 12;
|
||||
list_move(entry, &ctx->writelist_busy);
|
||||
} else {
|
||||
@@ -242,7 +241,7 @@ static void *pt_compress(void *arg)
|
||||
return (void *)ERROR(memory_allocation);
|
||||
}
|
||||
wl->out.size =
|
||||
LZ5F_compressFrameBound(ctx->inputsize,
|
||||
LIZF_compressFrameBound(ctx->inputsize,
|
||||
&w->zpref) + 12;;
|
||||
wl->out.buf = malloc(wl->out.size);
|
||||
if (!wl->out.buf) {
|
||||
@@ -263,7 +262,7 @@ static void *pt_compress(void *arg)
|
||||
}
|
||||
|
||||
/* eof */
|
||||
if (in.size == 0) {
|
||||
if (in.size == 0 && ctx->frames > 0) {
|
||||
free(in.buf);
|
||||
pthread_mutex_unlock(&ctx->read_mutex);
|
||||
|
||||
@@ -279,10 +278,10 @@ static void *pt_compress(void *arg)
|
||||
|
||||
/* compress whole frame */
|
||||
result =
|
||||
LZ5F_compressFrame((unsigned char *)wl->out.buf + 12,
|
||||
LIZF_compressFrame((unsigned char *)wl->out.buf + 12,
|
||||
wl->out.size - 12, in.buf, in.size,
|
||||
&w->zpref);
|
||||
if (LZ5F_isError(result)) {
|
||||
if (LIZF_isError(result)) {
|
||||
pthread_mutex_lock(&ctx->write_mutex);
|
||||
list_move(&wl->node, &ctx->writelist_free);
|
||||
pthread_mutex_unlock(&ctx->write_mutex);
|
||||
|
||||
Reference in New Issue
Block a user