Fix error -Werror=sign-compare 70/310170/2
authorYoungjae Cho <y0.cho@samsung.com>
Tue, 23 Apr 2024 09:59:49 +0000 (18:59 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Tue, 23 Apr 2024 10:59:15 +0000 (19:59 +0900)
commit86a329a668b7cc08176bf1f8c3d72652b6fe6caa
tree72442f3e8eed115b249e910ef67fd3df469eee14
parent35fc181163b2ad0449da975648db530b27082a0b
Fix error -Werror=sign-compare

It blames comparing signed type with unsigned type.

Fix it in two step:
 1. If signed variable is definitely a nonnegative value at the
    code context, cast it into unsigned type directly.
 2. If it is unclear whether a signed variable is nonnegative, then
    add assertion for testing the variable is nonnegative. After
    that assertion, cast it into unsigned type. It helps catching
    violation that casting negative value into unsigned variable.

Change-Id: Ib4f2a2cb2ad1901518d0726de6035ac4a033bc67
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/img-verifier/img-verifier.c
src/upgrade-apply-deltafs/engine/SS_FSUpdate.c
src/upgrade-apply-deltafs/engine/SS_PatchDelta.c
src/upgrade-apply-deltafs/ua.c
src/upgrade-apply/main.c
src/upgrade-apply/patch/patch.c
src/upgrade-apply/sha1/sha1.c