Fix return code handling in LZP pre-compression, crashed adaptive modes.
This commit is contained in:
parent
e6f042aaf8
commit
fb0aef0bd6
1 changed files with 3 additions and 5 deletions
8
main.c
8
main.c
|
@ -205,15 +205,13 @@ preproc_compress(compress_func_ptr cmp_func, void *src, size_t srclen, void *dst
|
||||||
*((int64_t *)(dest + 1)) = htonll(srclen);
|
*((int64_t *)(dest + 1)) = htonll(srclen);
|
||||||
_dstlen = srclen;
|
_dstlen = srclen;
|
||||||
result = cmp_func(src, srclen, dest+9, &_dstlen, level, chdr, data);
|
result = cmp_func(src, srclen, dest+9, &_dstlen, level, chdr, data);
|
||||||
if (result == 0 && _dstlen < srclen) {
|
if (result > -1 && _dstlen < srclen) {
|
||||||
*dest |= PREPROC_COMPRESSED;
|
*dest |= PREPROC_COMPRESSED;
|
||||||
*dstlen = _dstlen + 9;
|
*dstlen = _dstlen + 9;
|
||||||
} else {
|
} else {
|
||||||
memcpy(dest+1, src, srclen);
|
result = -1;
|
||||||
_dstlen = srclen;
|
|
||||||
*dstlen = _dstlen + 1;
|
|
||||||
}
|
}
|
||||||
return (0);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in a new issue