msm8974-common: gps: Fix build for OSS builds

gps: Correct forward declaration in proprietary definitions

Fix gps runtime error

The qcom prebuilt binary relies on FlpExtLocation_s,
so we cannot change it to FlpExtLocation.
This patch fixes it.

gps: fix remove trailing space

In setXtraUserAgent,
size_t is unsigned and never being negative.
Will cause segmentation fault, if string is all space.

Change-Id: I1cf1f956943b0739640afe909954ade6921e28a1
This commit is contained in:
Scott Mertz 2015-11-06 17:44:53 -08:00 committed by Kevin F. Haggerty
parent 4dd7fbc1e4
commit f066fa2e3a
2 changed files with 9 additions and 5 deletions

View File

@ -30,7 +30,9 @@
#define ULP_PROXY_BASE_H
#include <gps_extended.h>
#include "fused_location_extended.h"
struct FlpExtLocation_s;
struct FlpExtBatchOptions;
namespace loc_core {
@ -73,7 +75,7 @@ public:
bool active) {
return false;
}
inline virtual bool reportPositions(const FlpExtLocation* locations,
inline virtual bool reportPositions(const struct FlpExtLocation_s* locations,
int32_t number_of_locations) {
return false;
}

View File

@ -194,9 +194,11 @@ void LocEngAdapter::setXtraUserAgent() {
fclose(file);
// remove trailing spaces
size_t len = strlen(buf);
while (--len >= 0 && isspace(buf[len])) {
buf[len] = '\0';
char *s;
s = buf + strlen(buf);
while (--s >= buf) {
if (!isspace(*s)) break;
*s = 0;
}
}