ss_bsdiff: Add casting for explicit conversion 48/312548/2 accepted/tizen/unified/20240612.160709 accepted/tizen/unified/dev/20240620.000312 accepted/tizen/unified/toolchain/20240624.121655 accepted/tizen/unified/x/20240614.011706 accepted/tizen/unified/x/asan/20240625.091336
authorSangYoun Kwak <sy.kwak@samsung.com>
Tue, 11 Jun 2024 10:44:44 +0000 (19:44 +0900)
committerSangYoun Kwak <sy.kwak@samsung.com>
Tue, 11 Jun 2024 11:16:02 +0000 (20:16 +0900)
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 <sy.kwak@samsung.com>
bsdiff/ss_bsdiff.c

index eaa4b5b1ff6496b75b51f69951a934c613d825f5..3384f9c9046c0c6479eac7d07eb58f2f426bb6d2 100644 (file)
@@ -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 {