[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gpsd-dev] [PATCH 1/5] gpsdecode: honor scale flag
From: |
chris |
Subject: |
[gpsd-dev] [PATCH 1/5] gpsdecode: honor scale flag |
Date: |
Tue, 5 Jun 2012 17:26:20 +0100 |
From: Christian Gagneraud <address@hidden>
Currently gpsdecode doesn't care about the -u (unscaled) flag. Fix that.
The scaled flag is forced to unscaled when encoding, as the encoding code
assumes unscaled data.
This patch will allow aivdm-regress to run tests in scaled mode.
scons check passed.
Signed-off-by: Christian Gagneraud <address@hidden>
---
SConstruct | 6 +++---
gpsdecode.c | 3 +++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/SConstruct b/SConstruct
index 5f92ffa..c509e13 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1387,13 +1387,13 @@ rtcm_regress = Utility('rtcm-regress', [gpsdecode], [
'for f in $SRCDIR/test/*.rtcm2; do '
'echo "Testing $${f}..."; '
'TMPFILE=`mktemp -t gpsd-test-XXXXXXXXXXXXXX.chk`; '
- '$SRCDIR/gpsdecode -j <$${f} >$${TMPFILE}; '
+ '$SRCDIR/gpsdecode -u -j <$${f} >$${TMPFILE}; '
'diff -ub $${f}.chk $${TMPFILE}; '
'rm -f $${TMPFILE}; '
'done;',
'@echo "Testing idempotency of JSON dump/decode for RTCM2"',
'TMPFILE=`mktemp -t gpsd-test-XXXXXXXXXXXXXX.chk`; '
- '$SRCDIR/gpsdecode -e -j <test/synthetic-rtcm2.json >$${TMPFILE}; '
+ '$SRCDIR/gpsdecode -u -e -j <test/synthetic-rtcm2.json >$${TMPFILE}; '
'grep -v "^#" test/synthetic-rtcm2.json | diff -ub - $${TMPFILE}; '
'rm -f $${TMPFILE}; ',
])
@@ -1417,7 +1417,7 @@ aivdm_regress = Utility('aivdm-regress', [gpsdecode], [
'done;',
'@echo "Testing idempotency of JSON dump/decode for AIS"',
'TMPFILE=`mktemp -t gpsd-test-XXXXXXXXXXXXXX.chk`; '
- '$SRCDIR/gpsdecode -e -j <$SRCDIR/test/synthetic-ais.json >$${TMPFILE}; '
+ '$SRCDIR/gpsdecode -u -e -j <$SRCDIR/test/synthetic-ais.json >$${TMPFILE};
'
'grep -v "^#" $SRCDIR/test/synthetic-ais.json | diff -ub -
$${TMPFILE}; '
'rm -f $${TMPFILE}; ',
])
diff --git a/gpsdecode.c b/gpsdecode.c
index 3ade9b8..83cd904 100644
--- a/gpsdecode.c
+++ b/gpsdecode.c
@@ -511,6 +511,7 @@ static void decode(FILE *fpin, FILE*fpout)
//(void)strlcpy(session.gpsdata.dev.path, "stdin",
sizeof(session.gpsdata.dev.path));
memset(&policy, '\0', sizeof(policy));
policy.json = json;
+ policy.scaled = scaled;
gps_context_init(&context);
gpsd_time_init(&context, time(NULL));
@@ -576,6 +577,8 @@ static void encode(FILE *fpin, FILE *fpout)
"stdin",
sizeof(session.gpsdata.dev.path));
policy.json = true;
+ /* Encoding is always made in unscaled mode */
+ policy.scaled = false;
while (fgets(inbuf, (int)sizeof(inbuf), fpin) != NULL) {
int status;
--
1.7.7
- [gpsd-dev] [PATCH 0/5] [AIS] Modifications with potential side effects, chris, 2012/06/05
- [gpsd-dev] [PATCH 5/5] Add script to test for JSON validity, chris, 2012/06/05
- [gpsd-dev] [PATCH 1/5] gpsdecode: honor scale flag,
chris <=
- [gpsd-dev] [PATCH 2/5] gpsd_hexdump: Always dump in hex mode, chris, 2012/06/05
- [gpsd-dev] [PATCH 3/5] json.h: Change JSON_VAL_MAX from 120 to 512, chris, 2012/06/05
- [gpsd-dev] [PATCH 4/5] Add BS talker ID (used by AIS base stations), chris, 2012/06/05
- Re: [gpsd-dev] [PATCH 0/5] [AIS] Modifications with potential side effects, Eric S. Raymond, 2012/06/05