summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2018-12-12 12:39:17 +0200
committerAdrian Thurston <thurston@colm.net>2018-12-12 12:39:17 +0200
commitfb02d3cb283c022eb98aac426f04077ee1c17fef (patch)
tree534001b3587364e44ac28736a8797a598c4b3ebc /src
parent14feafceb89dd36663e65f8907e3c3d87b5dae84 (diff)
downloadcolm-fb02d3cb283c022eb98aac426f04077ee1c17fef.tar.gz
transfer locations once we find some data
If we don't wait for data we may get the location at the end of an empty stream.
Diffstat (limited to 'src')
-rw-r--r--src/stream.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/stream.c b/src/stream.c
index 37433ee4..1b68bae3 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -465,12 +465,13 @@ static int data_consume_data( struct colm_program *prg, struct stream_impl_data
if ( buf == 0 )
break;
- if ( !loc_set( loc ) )
- data_transfer_loc( prg, loc, sid );
-
/* Anything available in the current buffer. */
int avail = buf->length - buf->offset;
if ( avail > 0 ) {
+
+ if ( !loc_set( loc ) )
+ data_transfer_loc( prg, loc, sid );
+
/* The source data from the current buffer. */
int slen = avail <= remaining ? avail : remaining;
consumed += slen;