From bf5a68552f489463afa636b1f2f521965a98ce19 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Wed, 12 Jul 2017 16:22:46 -0700 Subject: Fix printf warnings This fixes five warnings like: hardware/akm/AK8975_FS/libsensors/AkmSensor.cpp:143:44: warning: format specifies type 'long long' but the argument has type 'int64_t' (aka 'long') Also reformat a tiny bit of immediately surrounding code. Bug: None Test: mma. Warnings are gone. Change-Id: I1b48d1e93add7c98e731dcc303650fe0a2ef85e5 --- AK8975_FS/akmdfs/AKFS_Measure.c | 6 +++++- AK8975_FS/libsensors/AkmSensor.cpp | 9 +++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/AK8975_FS/akmdfs/AKFS_Measure.c b/AK8975_FS/akmdfs/AKFS_Measure.c index 849c921..efb73f4 100644 --- a/AK8975_FS/akmdfs/AKFS_Measure.c +++ b/AK8975_FS/akmdfs/AKFS_Measure.c @@ -16,6 +16,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + #ifdef WIN32 #include "AK8975_LinuxDriver.h" #else @@ -207,7 +210,8 @@ int16 AKFS_GetInterval( AKMERROR; return AKM_FAIL; } - AKMDATA(AKMDATA_GETINTERVAL,"delay[A,M,O]=%lld,%lld,%lld\n", + AKMDATA(AKMDATA_GETINTERVAL, + "delay[A,M,O]=%" PRIi64 ",%" PRIi64 ",%" PRIi64 "\n", delay[0], delay[1], delay[2]); /* update */ diff --git a/AK8975_FS/libsensors/AkmSensor.cpp b/AK8975_FS/libsensors/AkmSensor.cpp index bcbd445..3351fbf 100644 --- a/AK8975_FS/libsensors/AkmSensor.cpp +++ b/AK8975_FS/libsensors/AkmSensor.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include #include #include @@ -139,9 +140,9 @@ int AkmSensor::setDelay(int32_t handle, int64_t ns) char buffer[32]; int bytes; - if (ns < -1 || 2147483647 < ns) { - ALOGE("AkmSensor: invalid delay (%lld)", ns); - return -EINVAL; + if (ns < -1 || 2147483647 < ns) { + ALOGE("AkmSensor: invalid delay (%" PRIi64 ")", ns); + return -EINVAL; } switch (id) { @@ -160,7 +161,7 @@ int AkmSensor::setDelay(int32_t handle, int64_t ns) } if (ns != mDelay[id]) { - bytes = sprintf(buffer, "%lld", ns); + bytes = sprintf(buffer, "%" PRIi64, ns); err = write_sys_attribute(input_sysfs_path, buffer, bytes); if (err == 0) { mDelay[id] = ns; -- cgit v1.2.3