land: gps: fix build for OSS builds

Squash of the following commits:

gps: Correct forward declaration in proprietary definitions

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

karate: 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 karthick111
parent ecf15a1c13
commit 85a6b00c53
2 changed files with 10 additions and 5 deletions

View file

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

View file

@ -195,9 +195,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;
}
}