Merge "Adding KW warning fixes"

This commit is contained in:
Linux Build Service Account 2017-07-03 21:13:43 -07:00 committed by Gerrit - the friendly Code Review server
commit f44aa79ca9
2 changed files with 34 additions and 2 deletions

View file

@ -1096,7 +1096,7 @@ GnssAdapter::requestCapabilitiesCommand(LocationAPI* client)
return;
}
LocationCapabilitiesMask mask = {};
LocationCapabilitiesMask mask = 0;
// time based tracking always supported
mask |= LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT;
if (mApi.isMessageSupported(LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_LOCATION_BATCHING)){
@ -2741,7 +2741,7 @@ void GnssAdapter::convertSatelliteInfo(std::vector<GnssDebugSatelliteInfo>& out,
}
// extract each sv info from systemstatus report
for(uint32_t i=0; i<svid_num; i++) {
for(uint32_t i=0; i<svid_num && (svid_idx+i)<SV_ALL_NUM; i++) {
GnssDebugSatelliteInfo s = {};
s.size = sizeof(s);

View file

@ -583,6 +583,11 @@ void LocationAPIClientBase::locAPIRemoveGeofences(size_t count, uint32_t* ids)
pthread_mutex_lock(&mMutex);
if (mLocationAPI) {
uint32_t* sessions = (uint32_t*)malloc(sizeof(uint32_t) * count);
if (sessions == NULL) {
LOC_LOGE("%s:%d] Failed to allocate %d bytes !",
__FUNCTION__, __LINE__, sizeof(uint32_t) * count);
return;
}
if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) {
size_t j = 0;
@ -612,6 +617,11 @@ void LocationAPIClientBase::locAPIModifyGeofences(
pthread_mutex_lock(&mMutex);
if (mLocationAPI) {
uint32_t* sessions = (uint32_t*)malloc(sizeof(uint32_t) * count);
if (sessions == NULL) {
LOC_LOGE("%s:%d] Failed to allocate %d bytes !",
__FUNCTION__, __LINE__, sizeof(uint32_t) * count);
return;
}
if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) {
size_t j = 0;
@ -641,6 +651,11 @@ void LocationAPIClientBase::locAPIPauseGeofences(size_t count, uint32_t* ids)
pthread_mutex_lock(&mMutex);
if (mLocationAPI) {
uint32_t* sessions = (uint32_t*)malloc(sizeof(uint32_t) * count);
if (sessions == NULL) {
LOC_LOGE("%s:%d] Failed to allocate %d bytes !",
__FUNCTION__, __LINE__, sizeof(uint32_t) * count);
return;
}
if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) {
size_t j = 0;
@ -670,6 +685,11 @@ void LocationAPIClientBase::locAPIResumeGeofences(
pthread_mutex_lock(&mMutex);
if (mLocationAPI) {
uint32_t* sessions = (uint32_t*)malloc(sizeof(uint32_t) * count);
if (sessions == NULL) {
LOC_LOGE("%s:%d] Failed to allocate %d bytes !",
__FUNCTION__, __LINE__, sizeof(uint32_t) * count);
return;
}
if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) {
size_t j = 0;
@ -703,6 +723,11 @@ void LocationAPIClientBase::locAPIRemoveAllGeofences()
std::vector<uint32_t> sessionsVec = mGeofenceBiDict.getAllSessions();
size_t count = sessionsVec.size();
uint32_t* sessions = (uint32_t*)malloc(sizeof(uint32_t) * count);
if (sessions == NULL) {
LOC_LOGE("%s:%d] Failed to allocate %d bytes !",
__FUNCTION__, __LINE__, sizeof(uint32_t) * count);
return;
}
if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) {
size_t j = 0;
@ -747,6 +772,13 @@ void LocationAPIClientBase::beforeGeofenceBreachCb(
size_t n = geofenceBreachNotification.count;
geofenceBreachCallback genfenceCallback = nullptr;
if (ids == NULL) {
LOC_LOGE("%s:%d] Failed to alloc %d bytes",
__FUNCTION__, __LINE__,
sizeof(uint32_t) * geofenceBreachNotification.count);
return;
}
pthread_mutex_lock(&mMutex);
if (mGeofenceBreachCallback != nullptr) {
size_t count = 0;