From db45861ff4b636b9dd833d622dd64e2ad24b0645 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 10 Jun 2014 14:50:02 -0700 Subject: [PATCH] sensorservice: 64-bit compile issues Change-Id: Ied7b779f39e71d041791729f7355b052b63903c5 --- services/sensorservice/SensorDevice.cpp | 25 +++++++++++++----------- services/sensorservice/SensorService.cpp | 12 ++++++------ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp index 3b64f0a8b..35b781925 100644 --- a/services/sensorservice/SensorDevice.cpp +++ b/services/sensorservice/SensorDevice.cpp @@ -14,8 +14,9 @@ * limitations under the License. */ -#include +#include #include +#include #include #include @@ -134,11 +135,11 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled) Info& info( mActivationCount.editValueFor(handle) ); ALOGD_IF(DEBUG_CONNECTIONS, - "SensorDevice::activate: ident=%p, handle=0x%08x, enabled=%d, count=%d", + "SensorDevice::activate: ident=%p, handle=0x%08x, enabled=%d, count=%zu", ident, handle, enabled, info.batchParams.size()); if (enabled) { - ALOGD_IF(DEBUG_CONNECTIONS, "enable index=%d", info.batchParams.indexOfKey(ident)); + ALOGD_IF(DEBUG_CONNECTIONS, "enable index=%zd", info.batchParams.indexOfKey(ident)); if (info.batchParams.indexOfKey(ident) >= 0) { if (info.batchParams.size() == 1) { @@ -150,7 +151,7 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled) ALOGE("\t >>>ERROR: activate called without batch"); } } else { - ALOGD_IF(DEBUG_CONNECTIONS, "disable index=%d", info.batchParams.indexOfKey(ident)); + ALOGD_IF(DEBUG_CONNECTIONS, "disable index=%zd", info.batchParams.indexOfKey(ident)); if (info.removeBatchParamsForIdent(ident) >= 0) { if (info.batchParams.size() == 0) { @@ -163,7 +164,7 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled) // batch_rate and timeout. One of the apps has unregistered for sensor // events, and the best effort batch parameters might have changed. ALOGD_IF(DEBUG_CONNECTIONS, - "\t>>> actuating h/w batch %d %d %lld %lld ", handle, + "\t>>> actuating h/w batch %d %d %" PRId64 " %" PRId64, handle, info.bestBatchParams.flags, info.bestBatchParams.batchDelay, info.bestBatchParams.batchTimeout); mSensorDevice->batch(mSensorDevice, handle,info.bestBatchParams.flags, @@ -191,7 +192,7 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled) // On older devices which do not support batch, call setDelay(). if (getHalDeviceVersion() < SENSORS_DEVICE_API_VERSION_1_1 && info.batchParams.size() > 0) { - ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w setDelay %d %lld ", handle, + ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w setDelay %d %" PRId64, handle, info.bestBatchParams.batchDelay); mSensorDevice->setDelay( reinterpret_cast(mSensorDevice), @@ -231,7 +232,7 @@ status_t SensorDevice::batch(void* ident, int handle, int flags, int64_t samplin } ALOGD_IF(DEBUG_CONNECTIONS, - "SensorDevice::batch: ident=%p, handle=0x%08x, flags=%d, period_ns=%lld timeout=%lld", + "SensorDevice::batch: ident=%p, handle=0x%08x, flags=%d, period_ns=%" PRId64 " timeout=%" PRId64, ident, handle, flags, samplingPeriodNs, maxBatchReportLatencyNs); Mutex::Autolock _l(mLock); @@ -250,7 +251,8 @@ status_t SensorDevice::batch(void* ident, int handle, int flags, int64_t samplin info.selectBatchParams(); ALOGD_IF(DEBUG_CONNECTIONS, - "\t>>> curr_period=%lld min_period=%lld curr_timeout=%lld min_timeout=%lld", + "\t>>> curr_period=%" PRId64 " min_period=%" PRId64 + " curr_timeout=%" PRId64 " min_timeout=%" PRId64, prevBestBatchParams.batchDelay, info.bestBatchParams.batchDelay, prevBestBatchParams.batchTimeout, info.bestBatchParams.batchTimeout); @@ -258,7 +260,7 @@ status_t SensorDevice::batch(void* ident, int handle, int flags, int64_t samplin // If the min period or min timeout has changed since the last batch call, call batch. if (prevBestBatchParams != info.bestBatchParams) { if (halVersion >= SENSORS_DEVICE_API_VERSION_1_1) { - ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w BATCH %d %d %lld %lld ", handle, + ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w BATCH %d %d %" PRId64 " %" PRId64, handle, info.bestBatchParams.flags, info.bestBatchParams.batchDelay, info.bestBatchParams.batchTimeout); err = mSensorDevice->batch(mSensorDevice, handle, info.bestBatchParams.flags, @@ -270,7 +272,8 @@ status_t SensorDevice::batch(void* ident, int handle, int flags, int64_t samplin // call setDelay in SensorDevice::activate() method. } if (err != NO_ERROR) { - ALOGE("sensor batch failed %p %d %d %lld %lld err=%s", mSensorDevice, handle, + ALOGE("sensor batch failed %p %d %d %" PRId64 " %" PRId64 " err=%s", + mSensorDevice, handle, info.bestBatchParams.flags, info.bestBatchParams.batchDelay, info.bestBatchParams.batchTimeout, strerror(-err)); info.removeBatchParamsForIdent(ident); @@ -324,7 +327,7 @@ status_t SensorDevice::Info::setBatchParamsForIdent(void* ident, int flags, int64_t maxBatchReportLatencyNs) { ssize_t index = batchParams.indexOfKey(ident); if (index < 0) { - ALOGE("Info::setBatchParamsForIdent(ident=%p, period_ns=%lld timeout=%lld) failed (%s)", + ALOGE("Info::setBatchParamsForIdent(ident=%p, period_ns=%" PRId64 " timeout=%" PRId64 ") failed (%s)", ident, samplingPeriodNs, maxBatchReportLatencyNs, strerror(-index)); return BAD_INDEX; } diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp index 6df6315d1..d671951ad 100644 --- a/services/sensorservice/SensorService.cpp +++ b/services/sensorservice/SensorService.cpp @@ -370,7 +370,7 @@ bool SensorService::threadLoop() for (size_t j=0 ; j= minBufferSize) { ALOGE("buffer too small to hold all events: " - "count=%u, k=%u, size=%u", + "count=%zd, k=%zu, size=%zu", count, k, minBufferSize); break; } @@ -509,11 +509,11 @@ void SensorService::cleanupConnection(SensorEventConnection* c) Mutex::Autolock _l(mLock); const wp connection(c); size_t size = mActiveSensors.size(); - ALOGD_IF(DEBUG_CONNECTIONS, "%d active sensors", size); + ALOGD_IF(DEBUG_CONNECTIONS, "%zu active sensors", size); for (size_t i=0 ; ihasSensor(handle)) { - ALOGD_IF(DEBUG_CONNECTIONS, "%i: disabling handle=0x%08x", i, handle); + ALOGD_IF(DEBUG_CONNECTIONS, "%zu: disabling handle=0x%08x", i, handle); SensorInterface* sensor = mSensorMap.valueFor( handle ); ALOGE_IF(!sensor, "mSensorMap[handle=0x%08x] is null!", handle); if (sensor) { @@ -521,9 +521,9 @@ void SensorService::cleanupConnection(SensorEventConnection* c) } } SensorRecord* rec = mActiveSensors.valueAt(i); - ALOGE_IF(!rec, "mActiveSensors[%d] is null (handle=0x%08x)!", i, handle); + ALOGE_IF(!rec, "mActiveSensors[%zu] is null (handle=0x%08x)!", i, handle); ALOGD_IF(DEBUG_CONNECTIONS, - "removing connection %p for sensor[%d].handle=0x%08x", + "removing connection %p for sensor[%zu].handle=0x%08x", c, i, handle); if (rec && rec->removeConnection(connection)) { @@ -591,7 +591,7 @@ status_t SensorService::enable(const sp& connection, samplingPeriodNs = minDelayNs; } - ALOGD_IF(DEBUG_CONNECTIONS, "Calling batch handle==%d flags=%d rate=%lld timeout== %lld", + ALOGD_IF(DEBUG_CONNECTIONS, "Calling batch handle==%d flags=%d rate=%" PRId64 " timeout== %" PRId64, handle, reservedFlags, samplingPeriodNs, maxBatchReportLatencyNs); status_t err = sensor->batch(connection.get(), handle, reservedFlags, samplingPeriodNs,