mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 11:14:58 -06:00
fixed multiple returning when doing mt compressing/decompressing
This commit is contained in:
@@ -313,6 +313,7 @@ static void *pt_compress(void *arg)
|
||||
size_t LZ4MT_compressCCtx(LZ4MT_CCtx * ctx, LZ4MT_RdWr_t * rdwr)
|
||||
{
|
||||
int t;
|
||||
void *retval_of_thread = 0;
|
||||
|
||||
if (!ctx)
|
||||
return ERROR(compressionParameter_unsupported);
|
||||
@@ -335,7 +336,7 @@ size_t LZ4MT_compressCCtx(LZ4MT_CCtx * ctx, LZ4MT_RdWr_t * rdwr)
|
||||
void *p;
|
||||
pthread_join(w->pthread, &p);
|
||||
if (p)
|
||||
return (size_t) p;
|
||||
retval_of_thread = p;
|
||||
}
|
||||
|
||||
/* clean up lists */
|
||||
@@ -349,7 +350,7 @@ size_t LZ4MT_compressCCtx(LZ4MT_CCtx * ctx, LZ4MT_RdWr_t * rdwr)
|
||||
free(wl);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (size_t)retval_of_thread;
|
||||
}
|
||||
|
||||
/* returns current uncompressed data size */
|
||||
|
||||
@@ -485,6 +485,7 @@ size_t LZ4MT_decompressDCtx(LZ4MT_DCtx * ctx, LZ4MT_RdWr_t * rdwr)
|
||||
int t, rv;
|
||||
cwork_t *w = &ctx->cwork[0];
|
||||
LZ4MT_Buffer *in = &w->in;
|
||||
void *retval_of_thread = 0;
|
||||
|
||||
if (!ctx)
|
||||
return ERROR(compressionParameter_unsupported);
|
||||
@@ -544,7 +545,7 @@ size_t LZ4MT_decompressDCtx(LZ4MT_DCtx * ctx, LZ4MT_RdWr_t * rdwr)
|
||||
void *p;
|
||||
pthread_join(w->pthread, &p);
|
||||
if (p)
|
||||
return (size_t) p;
|
||||
retval_of_thread = p;
|
||||
}
|
||||
|
||||
okay:
|
||||
@@ -559,7 +560,7 @@ size_t LZ4MT_decompressDCtx(LZ4MT_DCtx * ctx, LZ4MT_RdWr_t * rdwr)
|
||||
free(wl);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (size_t)retval_of_thread;
|
||||
}
|
||||
|
||||
/* returns current uncompressed data size */
|
||||
|
||||
@@ -313,6 +313,7 @@ static void *pt_compress(void *arg)
|
||||
size_t LZ5MT_compressCCtx(LZ5MT_CCtx * ctx, LZ5MT_RdWr_t * rdwr)
|
||||
{
|
||||
int t;
|
||||
void *retval_of_thread = 0;
|
||||
|
||||
if (!ctx)
|
||||
return ERROR(compressionParameter_unsupported);
|
||||
@@ -335,7 +336,7 @@ size_t LZ5MT_compressCCtx(LZ5MT_CCtx * ctx, LZ5MT_RdWr_t * rdwr)
|
||||
void *p;
|
||||
pthread_join(w->pthread, &p);
|
||||
if (p)
|
||||
return (size_t) p;
|
||||
retval_of_thread = p;
|
||||
}
|
||||
|
||||
/* clean up lists */
|
||||
@@ -349,7 +350,7 @@ size_t LZ5MT_compressCCtx(LZ5MT_CCtx * ctx, LZ5MT_RdWr_t * rdwr)
|
||||
free(wl);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (size_t)retval_of_thread;
|
||||
}
|
||||
|
||||
/* returns current uncompressed data size */
|
||||
|
||||
@@ -485,6 +485,7 @@ size_t LZ5MT_decompressDCtx(LZ5MT_DCtx * ctx, LZ5MT_RdWr_t * rdwr)
|
||||
int t, rv;
|
||||
cwork_t *w = &ctx->cwork[0];
|
||||
LZ5MT_Buffer *in = &w->in;
|
||||
void *retval_of_thread = 0;
|
||||
|
||||
if (!ctx)
|
||||
return ERROR(compressionParameter_unsupported);
|
||||
@@ -544,7 +545,7 @@ size_t LZ5MT_decompressDCtx(LZ5MT_DCtx * ctx, LZ5MT_RdWr_t * rdwr)
|
||||
void *p;
|
||||
pthread_join(w->pthread, &p);
|
||||
if (p)
|
||||
return (size_t) p;
|
||||
retval_of_thread = p;
|
||||
}
|
||||
|
||||
okay:
|
||||
@@ -559,7 +560,7 @@ size_t LZ5MT_decompressDCtx(LZ5MT_DCtx * ctx, LZ5MT_RdWr_t * rdwr)
|
||||
free(wl);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (size_t)retval_of_thread;
|
||||
}
|
||||
|
||||
/* returns current uncompressed data size */
|
||||
|
||||
@@ -328,7 +328,7 @@ static void *pt_compress(void *arg)
|
||||
size_t ZSTDMT_compressCCtx(ZSTDMT_CCtx * ctx, ZSTDMT_RdWr_t * rdwr)
|
||||
{
|
||||
int t;
|
||||
void *rv = 0;
|
||||
void *retval_of_thread = 0;
|
||||
|
||||
if (!ctx)
|
||||
return ZSTDMT_ERROR(init_missing);
|
||||
@@ -358,7 +358,7 @@ size_t ZSTDMT_compressCCtx(ZSTDMT_CCtx * ctx, ZSTDMT_RdWr_t * rdwr)
|
||||
void *p;
|
||||
pthread_join(w->pthread, &p);
|
||||
if (p)
|
||||
rv = p;
|
||||
retval_of_thread = p;
|
||||
}
|
||||
|
||||
/* clean up the free list */
|
||||
@@ -373,7 +373,7 @@ size_t ZSTDMT_compressCCtx(ZSTDMT_CCtx * ctx, ZSTDMT_RdWr_t * rdwr)
|
||||
}
|
||||
|
||||
/* on error, these two lists may have some entries */
|
||||
if (rv) {
|
||||
if (retval_of_thread) {
|
||||
struct writelist *wl;
|
||||
struct list_head *entry;
|
||||
|
||||
@@ -394,7 +394,7 @@ size_t ZSTDMT_compressCCtx(ZSTDMT_CCtx * ctx, ZSTDMT_RdWr_t * rdwr)
|
||||
}
|
||||
}
|
||||
|
||||
return (size_t) rv;
|
||||
return (size_t)retval_of_thread;
|
||||
}
|
||||
|
||||
/* returns current uncompressed data size */
|
||||
|
||||
@@ -697,6 +697,7 @@ size_t ZSTDMT_decompressDCtx(ZSTDMT_DCtx * ctx, ZSTDMT_RdWr_t * rdwr)
|
||||
ZSTDMT_Buffer *in = &In;
|
||||
cwork_t *w;
|
||||
int t, rv, type = TYPE_UNKNOWN;
|
||||
void *retval_of_thread = 0;
|
||||
|
||||
if (!ctx)
|
||||
return ZSTDMT_ERROR(compressionParameter_unsupported);
|
||||
@@ -819,7 +820,7 @@ size_t ZSTDMT_decompressDCtx(ZSTDMT_DCtx * ctx, ZSTDMT_RdWr_t * rdwr)
|
||||
void *p;
|
||||
pthread_join(w->pthread, &p);
|
||||
if (p)
|
||||
return (size_t) p;
|
||||
retval_of_thread = p;
|
||||
}
|
||||
|
||||
/* clean up pthread stuff */
|
||||
@@ -838,7 +839,7 @@ size_t ZSTDMT_decompressDCtx(ZSTDMT_DCtx * ctx, ZSTDMT_RdWr_t * rdwr)
|
||||
free(wl);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (size_t)retval_of_thread;
|
||||
}
|
||||
|
||||
/* returns current uncompressed data size */
|
||||
|
||||
Reference in New Issue
Block a user