src: minor cleanups

This commit is contained in:
Markus F.X.J. Oberhumer
2023-08-21 22:41:42 +02:00
parent dd928cf956
commit dd1838a7eb
10 changed files with 50 additions and 25 deletions
+6
View File
@@ -92,6 +92,7 @@ int upx_compress(const upx_bytep src, unsigned src_len, upx_bytep dst, unsigned
cresult->debug.c_len = 0;
#endif
const unsigned orig_dst_len = *dst_len;
if (__acc_cte(false)) {
}
#if (WITH_LZMA)
@@ -118,6 +119,7 @@ int upx_compress(const upx_bytep src, unsigned src_len, upx_bytep dst, unsigned
// debugging aid
cresult->debug.c_len = *dst_len;
#endif
assert_noexcept(*dst_len <= orig_dst_len);
return r;
}
@@ -135,6 +137,7 @@ int upx_decompress(const upx_bytep src, unsigned src_len, upx_bytep dst, unsigne
if (cresult && cresult->debug.method == 0)
cresult = nullptr;
const unsigned orig_dst_len = *dst_len;
if (__acc_cte(false)) {
}
#if (WITH_LZMA)
@@ -161,6 +164,7 @@ int upx_decompress(const upx_bytep src, unsigned src_len, upx_bytep dst, unsigne
throwInternalError("unknown decompression method");
}
assert_noexcept(*dst_len <= orig_dst_len);
return r;
}
@@ -180,6 +184,7 @@ int upx_test_overlap(const upx_bytep buf, const upx_bytep tbuf, unsigned src_off
unsigned overlap_overhead = src_off + src_len - *dst_len;
assert((int) overlap_overhead > 0);
const unsigned orig_dst_len = *dst_len;
if (__acc_cte(false)) {
}
#if (WITH_LZMA)
@@ -202,6 +207,7 @@ int upx_test_overlap(const upx_bytep buf, const upx_bytep tbuf, unsigned src_off
throwInternalError("unknown decompression method");
}
assert_noexcept(*dst_len <= orig_dst_len);
return r;
}