Merge "fix a sign-compare warning and use -Wall"
diff --git a/power/1.0/default/Android.bp b/power/1.0/default/Android.bp
index 91b9225..71daaeb 100644
--- a/power/1.0/default/Android.bp
+++ b/power/1.0/default/Android.bp
@@ -18,6 +18,11 @@
relative_install_path: "hw",
srcs: ["Power.cpp"],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+
shared_libs: [
"liblog",
"libhardware",
@@ -37,6 +42,11 @@
init_rc: ["android.hardware.power@1.0-service.rc"],
srcs: ["service.cpp"],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+
shared_libs: [
"liblog",
"libdl",
diff --git a/power/1.0/default/Power.cpp b/power/1.0/default/Power.cpp
index 2ddac0a..6ea9167 100644
--- a/power/1.0/default/Power.cpp
+++ b/power/1.0/default/Power.cpp
@@ -81,7 +81,7 @@
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 @@
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)