mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-10 14:07:11 -06:00
major Lizard fixes
- changed to real Lizard code v1.0 (I used LZ5 v2.0) - add Lizard file handling, so '.liz' files can be used in windows - changed CompressDialog (Lizard has 4 entries in the methods now) - added Lizard icon
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#include "lizframe.h"
|
||||
#include "lizard_frame.h"
|
||||
#include "lizard-mt.h"
|
||||
|
||||
/* will be used for lib errors */
|
||||
@@ -32,8 +32,8 @@ unsigned LIZARDMT_isError(size_t code)
|
||||
*/
|
||||
const char *LIZARDMT_getErrorString(size_t code)
|
||||
{
|
||||
if (LIZF_isError(lizardmt_errcode))
|
||||
return LIZF_getErrorName(lizardmt_errcode);
|
||||
if (LizardF_isError(lizardmt_errcode))
|
||||
return LizardF_getErrorName(lizardmt_errcode);
|
||||
|
||||
static const char *noErrorCode = "Unspecified lizardmt error code";
|
||||
switch ((LIZARDMT_ErrorCode) (0 - code)) {
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define LIZF_DISABLE_OBSOLETE_ENUMS
|
||||
#include "lizframe.h"
|
||||
#define LizardF_DISABLE_OBSOLETE_ENUMS
|
||||
#include "lizard_frame.h"
|
||||
|
||||
#include "memmt.h"
|
||||
#include "threading.h"
|
||||
@@ -38,7 +38,7 @@
|
||||
/* worker for compression */
|
||||
typedef struct {
|
||||
LIZARDMT_CCtx *ctx;
|
||||
LIZF_preferences_t zpref;
|
||||
LizardF_preferences_t zpref;
|
||||
pthread_t pthread;
|
||||
} cwork_t;
|
||||
|
||||
@@ -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(LIZF_preferences_t));
|
||||
memset(&w->zpref, 0, sizeof(LizardF_preferences_t));
|
||||
w->zpref.compressionLevel = level;
|
||||
w->zpref.frameInfo.blockMode = LIZF_blockLinked;
|
||||
w->zpref.frameInfo.blockMode = LizardF_blockLinked;
|
||||
w->zpref.frameInfo.contentSize = 1;
|
||||
w->zpref.frameInfo.contentChecksumFlag =
|
||||
LIZF_contentChecksumEnabled;
|
||||
LizardF_contentChecksumEnabled;
|
||||
|
||||
}
|
||||
|
||||
@@ -229,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 =
|
||||
LIZF_compressFrameBound(ctx->inputsize,
|
||||
LizardF_compressFrameBound(ctx->inputsize,
|
||||
&w->zpref) + 12;
|
||||
list_move(entry, &ctx->writelist_busy);
|
||||
} else {
|
||||
@@ -241,7 +241,7 @@ static void *pt_compress(void *arg)
|
||||
return (void *)ERROR(memory_allocation);
|
||||
}
|
||||
wl->out.size =
|
||||
LIZF_compressFrameBound(ctx->inputsize,
|
||||
LizardF_compressFrameBound(ctx->inputsize,
|
||||
&w->zpref) + 12;;
|
||||
wl->out.buf = malloc(wl->out.size);
|
||||
if (!wl->out.buf) {
|
||||
@@ -278,10 +278,10 @@ static void *pt_compress(void *arg)
|
||||
|
||||
/* compress whole frame */
|
||||
result =
|
||||
LIZF_compressFrame((unsigned char *)wl->out.buf + 12,
|
||||
LizardF_compressFrame((unsigned char *)wl->out.buf + 12,
|
||||
wl->out.size - 12, in.buf, in.size,
|
||||
&w->zpref);
|
||||
if (LIZF_isError(result)) {
|
||||
if (LizardF_isError(result)) {
|
||||
pthread_mutex_lock(&ctx->write_mutex);
|
||||
list_move(&wl->node, &ctx->writelist_free);
|
||||
pthread_mutex_unlock(&ctx->write_mutex);
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define LIZF_DISABLE_OBSOLETE_ENUMS
|
||||
#include "lizframe.h"
|
||||
#define LizardF_DISABLE_OBSOLETE_ENUMS
|
||||
#include "lizard_frame.h"
|
||||
|
||||
#include "memmt.h"
|
||||
#include "threading.h"
|
||||
@@ -40,7 +40,7 @@ typedef struct {
|
||||
LIZARDMT_DCtx *ctx;
|
||||
pthread_t pthread;
|
||||
LIZARDMT_Buffer in;
|
||||
LIZF_decompressionContext_t dctx;
|
||||
LizardF_decompressionContext_t dctx;
|
||||
} cwork_t;
|
||||
|
||||
struct writelist;
|
||||
@@ -130,7 +130,7 @@ LIZARDMT_DCtx *LIZARDMT_createDCtx(int threads, int inputsize)
|
||||
w->ctx = ctx;
|
||||
|
||||
/* setup thread work */
|
||||
LIZF_createDecompressionContext(&w->dctx, LIZF_VERSION);
|
||||
LizardF_createDecompressionContext(&w->dctx, LIZARDF_VERSION);
|
||||
}
|
||||
|
||||
return ctx;
|
||||
@@ -348,10 +348,10 @@ static void *pt_decompress(void *arg)
|
||||
}
|
||||
|
||||
result =
|
||||
LIZF_decompress(w->dctx, out->buf, &out->size,
|
||||
LizardF_decompress(w->dctx, out->buf, &out->size,
|
||||
in->buf, &in->size, 0);
|
||||
|
||||
if (LIZF_isError(result)) {
|
||||
if (LizardF_isError(result)) {
|
||||
lizardmt_errcode = result;
|
||||
result = ERROR(compression_library);
|
||||
goto error_lock;
|
||||
@@ -392,7 +392,7 @@ static void *pt_decompress(void *arg)
|
||||
static size_t st_decompress(void *arg)
|
||||
{
|
||||
LIZARDMT_DCtx *ctx = (LIZARDMT_DCtx *) arg;
|
||||
LIZF_errorCode_t nextToLoad = 0;
|
||||
LizardF_errorCode_t nextToLoad = 0;
|
||||
cwork_t *w = &ctx->cwork[0];
|
||||
LIZARDMT_Buffer Out;
|
||||
LIZARDMT_Buffer *out = &Out;
|
||||
@@ -420,8 +420,8 @@ static size_t st_decompress(void *arg)
|
||||
memcpy(in->buf, magic, in->size);
|
||||
|
||||
nextToLoad =
|
||||
LIZF_decompress(w->dctx, out->buf, &pos, in->buf, &in->size, 0);
|
||||
if (LIZF_isError(nextToLoad)) {
|
||||
LizardF_decompress(w->dctx, out->buf, &pos, in->buf, &in->size, 0);
|
||||
if (LizardF_isError(nextToLoad)) {
|
||||
free(in->buf);
|
||||
free(out->buf);
|
||||
return ERROR(compression_library);
|
||||
@@ -451,10 +451,10 @@ static size_t st_decompress(void *arg)
|
||||
|
||||
/* decompress */
|
||||
nextToLoad =
|
||||
LIZF_decompress(w->dctx, out->buf, &out->size,
|
||||
LizardF_decompress(w->dctx, out->buf, &out->size,
|
||||
(unsigned char *)in->buf + pos,
|
||||
&remaining, NULL);
|
||||
if (LIZF_isError(nextToLoad)) {
|
||||
if (LizardF_isError(nextToLoad)) {
|
||||
free(in->buf);
|
||||
free(out->buf);
|
||||
return ERROR(compression_library);
|
||||
@@ -603,7 +603,7 @@ void LIZARDMT_freeDCtx(LIZARDMT_DCtx * ctx)
|
||||
|
||||
for (t = 0; t < ctx->threads; t++) {
|
||||
cwork_t *w = &ctx->cwork[t];
|
||||
LIZF_freeDecompressionContext(w->dctx);
|
||||
LizardF_freeDecompressionContext(w->dctx);
|
||||
}
|
||||
|
||||
pthread_mutex_destroy(&ctx->read_mutex);
|
||||
|
||||
Reference in New Issue
Block a user