mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
fix a sign-compare warning and use -Wall
Test: mma Bug: 34901468 Change-Id: If68c1540a88ea28987fb7359a0ee01cf45263579
This commit is contained in:
@@ -17,6 +17,11 @@ cc_library_shared {
|
||||
relative_install_path: "hw",
|
||||
srcs: ["Power.cpp"],
|
||||
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"liblog",
|
||||
"libhardware",
|
||||
@@ -35,6 +40,11 @@ cc_binary {
|
||||
init_rc: ["android.hardware.power@1.0-service.rc"],
|
||||
srcs: ["service.cpp"],
|
||||
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"liblog",
|
||||
"libdl",
|
||||
|
||||
@@ -81,7 +81,7 @@ Return<void> Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_c
|
||||
number_platform_modes = mModule->get_number_of_platform_modes(mModule);
|
||||
if (number_platform_modes)
|
||||
{
|
||||
if (SIZE_MAX / sizeof(size_t) <= number_platform_modes) // overflow
|
||||
if ((ssize_t) (SIZE_MAX / sizeof(size_t)) <= number_platform_modes) // overflow
|
||||
goto done;
|
||||
voters = new (std::nothrow) size_t [number_platform_modes];
|
||||
if (voters == nullptr)
|
||||
@@ -91,7 +91,7 @@ Return<void> Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_c
|
||||
if (ret != 0)
|
||||
goto done;
|
||||
|
||||
if (SIZE_MAX / sizeof(power_state_platform_sleep_state_t)
|
||||
if ((ssize_t) (SIZE_MAX / sizeof(power_state_platform_sleep_state_t))
|
||||
<= number_platform_modes) // overflow
|
||||
goto done;
|
||||
legacy_states = new (std::nothrow)
|
||||
|
||||
Reference in New Issue
Block a user