mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Keep decompressing files after an error if KEEP_BROKEN has been enabled.
This commit is contained in:
parent
a9ba55fe61
commit
d5fb23ed9c
31
stream.c
31
stream.c
|
|
@ -450,6 +450,9 @@ static int zpaq_decompress_buf(rzip_control *control __UNUSED__, struct uncomp_t
|
||||||
|
|
||||||
if (unlikely(dlen != ucthread->u_len)) {
|
if (unlikely(dlen != ucthread->u_len)) {
|
||||||
print_err("Inconsistent length after decompression. Got %ld bytes, expected %lld\n", dlen, ucthread->u_len);
|
print_err("Inconsistent length after decompression. Got %ld bytes, expected %lld\n", dlen, ucthread->u_len);
|
||||||
|
if (KEEP_BROKEN)
|
||||||
|
print_err("Keeping broken file as requested\n");
|
||||||
|
else
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -477,14 +480,21 @@ static int bzip2_decompress_buf(rzip_control *control __UNUSED__, struct uncomp_
|
||||||
bzerr = BZ2_bzBuffToBuffDecompress((char*)ucthread->s_buf, &dlen, (char*)c_buf, ucthread->c_len, 0, 0);
|
bzerr = BZ2_bzBuffToBuffDecompress((char*)ucthread->s_buf, &dlen, (char*)c_buf, ucthread->c_len, 0, 0);
|
||||||
if (unlikely(bzerr != BZ_OK)) {
|
if (unlikely(bzerr != BZ_OK)) {
|
||||||
print_err("Failed to decompress buffer - bzerr=%d\n", bzerr);
|
print_err("Failed to decompress buffer - bzerr=%d\n", bzerr);
|
||||||
|
if (KEEP_BROKEN)
|
||||||
|
print_err("Keeping broken file as requested\n");
|
||||||
|
else {
|
||||||
free(ucthread->s_buf);
|
free(ucthread->s_buf);
|
||||||
ucthread->s_buf = c_buf;
|
ucthread->s_buf = c_buf;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (unlikely(dlen != ucthread->u_len)) {
|
if (unlikely(dlen != ucthread->u_len)) {
|
||||||
print_err("Inconsistent length after decompression. Got %d bytes, expected %lld\n", dlen, ucthread->u_len);
|
print_err("Inconsistent length after decompression. Got %d bytes, expected %lld\n", dlen, ucthread->u_len);
|
||||||
|
if (KEEP_BROKEN)
|
||||||
|
print_err("Keeping broken file as requested\n");
|
||||||
|
else
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -512,14 +522,21 @@ static int gzip_decompress_buf(rzip_control *control __UNUSED__, struct uncomp_t
|
||||||
gzerr = uncompress(ucthread->s_buf, &dlen, c_buf, ucthread->c_len);
|
gzerr = uncompress(ucthread->s_buf, &dlen, c_buf, ucthread->c_len);
|
||||||
if (unlikely(gzerr != Z_OK)) {
|
if (unlikely(gzerr != Z_OK)) {
|
||||||
print_err("Failed to decompress buffer - gzerr=%d\n", gzerr);
|
print_err("Failed to decompress buffer - gzerr=%d\n", gzerr);
|
||||||
|
if (KEEP_BROKEN)
|
||||||
|
print_err("Keeping broken file as requested\n");
|
||||||
|
else {
|
||||||
free(ucthread->s_buf);
|
free(ucthread->s_buf);
|
||||||
ucthread->s_buf = c_buf;
|
ucthread->s_buf = c_buf;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (unlikely((i64)dlen != ucthread->u_len)) {
|
if (unlikely((i64)dlen != ucthread->u_len)) {
|
||||||
print_err("Inconsistent length after decompression. Got %ld bytes, expected %lld\n", dlen, ucthread->u_len);
|
print_err("Inconsistent length after decompression. Got %ld bytes, expected %lld\n", dlen, ucthread->u_len);
|
||||||
|
if (KEEP_BROKEN)
|
||||||
|
print_err("Keeping broken file as requested\n");
|
||||||
|
else
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -550,14 +567,21 @@ static int lzma_decompress_buf(rzip_control *control, struct uncomp_thread *ucth
|
||||||
lzmaerr = LzmaUncompress(ucthread->s_buf, &dlen, c_buf, &c_len, control->lzma_properties, 5);
|
lzmaerr = LzmaUncompress(ucthread->s_buf, &dlen, c_buf, &c_len, control->lzma_properties, 5);
|
||||||
if (unlikely(lzmaerr)) {
|
if (unlikely(lzmaerr)) {
|
||||||
print_err("Failed to decompress buffer - lzmaerr=%d\n", lzmaerr);
|
print_err("Failed to decompress buffer - lzmaerr=%d\n", lzmaerr);
|
||||||
|
if (KEEP_BROKEN)
|
||||||
|
print_err("Keeping broken file as requested\n");
|
||||||
|
else {
|
||||||
free(ucthread->s_buf);
|
free(ucthread->s_buf);
|
||||||
ucthread->s_buf = c_buf;
|
ucthread->s_buf = c_buf;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (unlikely((i64)dlen != ucthread->u_len)) {
|
if (unlikely((i64)dlen != ucthread->u_len)) {
|
||||||
print_err("Inconsistent length after decompression. Got %lld bytes, expected %lld\n", (i64)dlen, ucthread->u_len);
|
print_err("Inconsistent length after decompression. Got %lld bytes, expected %lld\n", (i64)dlen, ucthread->u_len);
|
||||||
|
if (KEEP_BROKEN)
|
||||||
|
print_err("Keeping broken file as requested\n");
|
||||||
|
else
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -584,15 +608,22 @@ static int lzo_decompress_buf(rzip_control *control __UNUSED__, struct uncomp_th
|
||||||
|
|
||||||
lzerr = lzo1x_decompress((uchar*)c_buf, ucthread->c_len, (uchar*)ucthread->s_buf, &dlen, NULL);
|
lzerr = lzo1x_decompress((uchar*)c_buf, ucthread->c_len, (uchar*)ucthread->s_buf, &dlen, NULL);
|
||||||
if (unlikely(lzerr != LZO_E_OK)) {
|
if (unlikely(lzerr != LZO_E_OK)) {
|
||||||
|
if (KEEP_BROKEN)
|
||||||
|
print_err("Keeping broken file as requested\n");
|
||||||
|
else {
|
||||||
print_err("Failed to decompress buffer - lzerr=%d\n", lzerr);
|
print_err("Failed to decompress buffer - lzerr=%d\n", lzerr);
|
||||||
free(ucthread->s_buf);
|
free(ucthread->s_buf);
|
||||||
ucthread->s_buf = c_buf;
|
ucthread->s_buf = c_buf;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (unlikely((i64)dlen != ucthread->u_len)) {
|
if (unlikely((i64)dlen != ucthread->u_len)) {
|
||||||
print_err("Inconsistent length after decompression. Got %lu bytes, expected %lld\n", (unsigned long)dlen, ucthread->u_len);
|
print_err("Inconsistent length after decompression. Got %lu bytes, expected %lld\n", (unsigned long)dlen, ucthread->u_len);
|
||||||
|
if (KEEP_BROKEN)
|
||||||
|
print_err("Keeping broken file as requested\n");
|
||||||
|
else
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue