diff options
-rw-r--r-- | SConstruct | 6 | ||||
-rw-r--r-- | gpsdecode.c | 4 |
2 files changed, 7 insertions, 3 deletions
@@ -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 3ade9b8c..51a9c2eb 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,9 @@ static void encode(FILE *fpin, FILE *fpout) "stdin", sizeof(session.gpsdata.dev.path)); policy.json = true; + /* Parsing is always made in unscaled mode, + * this policy applies to the dumping */ + policy.scaled = scaled; while (fgets(inbuf, (int)sizeof(inbuf), fpin) != NULL) { int status; |