From 85e093bc03d747f69b3ada658c9e82f442cda334 Mon Sep 17 00:00:00 2001 From: Ashutosh Joshi Date: Fri, 1 Apr 2016 12:45:47 -0700 Subject: [PATCH] Ensuring builds compile for both 32 bit and 64 bit targets. Fixing print formats for pointers. Fixing a dangerous memory free. Change-Id: I7c53bdaeceed80845ef002ed6a8a783ecb0378dc --- core/jni/android_hardware_location_ContextHubService.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/jni/android_hardware_location_ContextHubService.cpp b/core/jni/android_hardware_location_ContextHubService.cpp index 8b476cf742a7f..d05f82e2d2f3f 100644 --- a/core/jni/android_hardware_location_ContextHubService.cpp +++ b/core/jni/android_hardware_location_ContextHubService.cpp @@ -216,7 +216,7 @@ int add_app_instance(const hub_app_info *appInfo, uint32_t hubHandle, JNIEnv *en int appInstanceHandle = generate_id(); if (appInstanceHandle < 0 || !appName || !entry || !name) { - ALOGE("Cannot find resources to add app instance %d, %d, %d", + ALOGE("Cannot find resources to add app instance %d, %p, %p", appInstanceHandle, appName, entry); free(appName); @@ -360,8 +360,7 @@ int handle_query_apps_response(char *msg, int msgLen, uint32_t hubHandle) { memcpy(info, msg, msgLen); for (i = 0; i < numApps; i++) { - add_app_instance(info, hubHandle, env); - info++; + add_app_instance(&info[i], hubHandle, env); } free(info); @@ -438,7 +437,7 @@ int context_hub_callback(uint32_t hubId, msgHeader[HEADER_FIELD_MSG_TYPE] = msg->message_type; if (!sanity_check_cookie(cookie, hubId)) { - ALOGW("Incorrect cookie %" PRId32 " for cookie %lu! Bailing", + ALOGW("Incorrect cookie %" PRId32 " for cookie %p! Bailing", hubId, cookie); return -1;