diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-03-27 02:26:22 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-03-27 02:26:22 +0000 |
commit | 7bdc8eacf14ff0bca9f99ae14302fd94aa7c4ce1 (patch) | |
tree | f4f285c0b1b3f0e52d5f576c3c8512b633596df3 /gpsdecode.c | |
parent | d56c57d9a35f178e4121a45ddfaf16cd162671ab (diff) | |
download | gpsd-7bdc8eacf14ff0bca9f99ae14302fd94aa7c4ce1.tar.gz |
Significant simplification of the packet-getter interface.
packet_get() now always returns nonzero when it could either read
fresh data or assemble a packet from data already read and buffered --
no more returning 0 when it has assembled a packet from buffered data
but can't read any new data. I suspect this may have been causing
subtle bugs.
Diffstat (limited to 'gpsdecode.c')
-rw-r--r-- | gpsdecode.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/gpsdecode.c b/gpsdecode.c index 4b35c743..9b80ce73 100644 --- a/gpsdecode.c +++ b/gpsdecode.c @@ -51,10 +51,8 @@ static void decode(FILE *fpin, FILE *fpout) packet_reset(&lexer); - for (;;) { - if (packet_get(fileno(fpin), &lexer) <= 0 && packet_buffered_input(&lexer) <= 0) - break; - else if (lexer.type == COMMENT_PACKET) + while (packet_get(fileno(fpin), &lexer) > 0) { + if (lexer.type == COMMENT_PACKET) continue; else if (lexer.type == RTCM2_PACKET) { rtcm2_unpack(&rtcm2, (char *)lexer.isgps.buf); |