From 3feb4a7b54cd9a4f5bab2aa8c247a56473267585 Mon Sep 17 00:00:00 2001 From: SangYoun Kwak Date: Tue, 11 Jun 2024 19:44:44 +0900 Subject: [PATCH] ss_bsdiff: Add casting for explicit conversion Since there were implicit conversion from off_t to uint64_t, which caused by the compariton between off_t type variables and uint64_t type varaibles. It causes warning about the comparison between unmatched types thus the off_t value will be casted implicitly to uint64_t if this warning is ignored. To suppress this warning and preserve the behavior of the original code, explicit type casting to uint64_t is added. Change-Id: Ieb6c0e073986e2cf0ef686307b2cfe894d84f27d Signed-off-by: SangYoun Kwak --- bsdiff/ss_bsdiff.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bsdiff/ss_bsdiff.c b/bsdiff/ss_bsdiff.c index eaa4b5b..3384f9c 100644 --- a/bsdiff/ss_bsdiff.c +++ b/bsdiff/ss_bsdiff.c @@ -465,9 +465,10 @@ int Function(int offset_oldscore, uint64_t *block_count) */ const size_t fuzz = 8; if (prev_len - fuzz <= len && len <= prev_len && - prev_oldscore - fuzz <= oldscore && - oldscore <= prev_oldscore && - prev_pos <= pos && pos <= prev_pos + fuzz && + prev_oldscore - fuzz <= (uint64_t)oldscore && + (uint64_t)oldscore <= prev_oldscore && + prev_pos <= (uint64_t)pos && + (uint64_t)pos <= prev_pos + fuzz && oldscore <= len && len <= oldscore + fuzz) { num_less_than_eight++; } else { -- 2.7.4