From 7ebef8fd406ee4a2381fd6ab428b4392322f4390 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Fri, 14 Dec 2018 15:22:40 -0800 Subject: applypatch: Fix comparison of integers of different signs. bootable/recovery/applypatch/imgpatch.cpp:57:3: error: comparison of integers of different signs: 'unsigned int' and 'int' [-Werror,-Wsign-compare] CHECK_GT(expected_target_length, 0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bootable/recovery/applypatch/freecache.cpp:145:50: error: comparison of integers of different signs: 'long' and '__fsblkcnt64_t' (aka 'unsigned long') [-Werror,-Wsign-compare] if (sf.f_bsize == 0 || free_space / sf.f_bsize != sf.f_bavail) { ~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~ bootable/recovery/applypatch/freecache.cpp:190:16: error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] if (free_now >= bytes_needed) { ~~~~~~~~ ^ ~~~~~~~~~~~~ bootable/recovery/applypatch/freecache.cpp:233:18: error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] if (free_now >= bytes_needed) { ~~~~~~~~ ^ ~~~~~~~~~~~~ Test: `mmma -j bootable/recovery/applypatch` with -Wsign-compare Test: Run recovery_unit_test on marlin. Change-Id: I4aa1fd0f9b7205b9e4e50874fc4bccb62951e7fe --- applypatch/imgpatch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'applypatch/imgpatch.cpp') diff --git a/applypatch/imgpatch.cpp b/applypatch/imgpatch.cpp index e6be39a2f..f4c33e5a3 100644 --- a/applypatch/imgpatch.cpp +++ b/applypatch/imgpatch.cpp @@ -54,7 +54,7 @@ static bool ApplyBSDiffPatchAndStreamOutput(const uint8_t* src_data, size_t src_ const Value& patch, size_t patch_offset, const char* deflate_header, SinkFn sink) { size_t expected_target_length = static_cast(Read8(deflate_header + 32)); - CHECK_GT(expected_target_length, 0); + CHECK_GT(expected_target_length, static_cast(0)); int level = Read4(deflate_header + 40); int method = Read4(deflate_header + 44); int window_bits = Read4(deflate_header + 48); -- cgit v1.2.3