Repository : ssh://git@diktynna/alfred
On branches: main,main
commit 7958994060a2b084a657dda860f6cf4790c7ef3b Author: Sven Eckelmann sven@narfation.org Date: Sat Jan 21 18:31:40 2023 +0100
alfred: gpsd: Fix build against gpsd 3.25
gpsd moved in commit 35fe48835da0 ("include/gps.h: Move fixsource_t into gps.h, add into gps_data_t.") the function gpsd_source_spec + its data structures from the private gpsdclient.h to the public API header gps.h. But the actual API major or minor version was not increased in this process.
It is therefore not easily possible to figure out whether the libgps API will provide this functionality or not. To avoid a conflict during the build, just rename fixsource_t and gpsd_source_spec.
Reported-by: Bj��rn Forsman bjorn.forsman@gmail.com Signed-off-by: Sven Eckelmann sven@narfation.org
7958994060a2b084a657dda860f6cf4790c7ef3b gpsd/alfred-gpsd.c | 11 +++++++---- gpsd/alfred-gpsd.h | 8 +++++--- 2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/gpsd/alfred-gpsd.c b/gpsd/alfred-gpsd.c index 20b3d98..d0bd47c 100644 --- a/gpsd/alfred-gpsd.c +++ b/gpsd/alfred-gpsd.c @@ -217,8 +217,11 @@ static int gpsd_read_answer(struct globals *globals) return 0; }
-/* Standard parsing of a GPS data source spec. Taken from gpsdclient.c */ -static void gpsd_source_spec(const char *arg, struct fixsource_t *source) +/* Standard parsing of a GPS data source spec. Taken from gpsdclient.c + * remove when gpsd 3.25 is minimum supported version + */ +static void alfred_gpsd_source_spec(const char *arg, + struct alfred_gpsd_fixsource_t *source) { /* the casts attempt to head off a -Wwrite-strings warning */ source->server = (char *)"localhost"; @@ -425,7 +428,7 @@ static struct globals *gpsd_init(int argc, char *argv[]) gpsd_parse_location(globals, optarg); break; case 'g': - gpsd_source_spec(optarg, &globals->gpsdsource); + alfred_gpsd_source_spec(optarg, &globals->gpsdsource); have_source = true; break; case 'u': @@ -443,7 +446,7 @@ static struct globals *gpsd_init(int argc, char *argv[]) }
if (globals->source == SOURCE_GPSD && !have_source) - gpsd_source_spec(NULL, &globals->gpsdsource); + alfred_gpsd_source_spec(NULL, &globals->gpsdsource);
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) perror("could not register SIGPIPE handler"); diff --git a/gpsd/alfred-gpsd.h b/gpsd/alfred-gpsd.h index 38588ad..174ca14 100644 --- a/gpsd/alfred-gpsd.h +++ b/gpsd/alfred-gpsd.h @@ -60,8 +60,10 @@ struct gpsd_v1 { #define GPSD_DATA_SIZE(gpsd_data) \ (sizeof(*gpsd_data) + (ntohl(gpsd_data->tpv_len)))
-/* struct taken from gpsdclient.h */ -struct fixsource_t +/* struct taken from gpsdclient.h + * remove when gpsd 3.25 is minimum supported version + */ +struct alfred_gpsd_fixsource_t { char *spec; /* pointer to actual storage */ char *server; @@ -84,7 +86,7 @@ struct globals { int unix_sock; const char *unix_path;
- struct fixsource_t gpsdsource; + struct alfred_gpsd_fixsource_t gpsdsource; struct gps_data_t gpsdata; char * tpv; };