Skip to content

Commit 5f3eb66

Browse files
committed
mapped_io: fix mapped_eof on windows
The mmaped IO implementation on windows does not always increment `pos` on each `getByte`. It relies on an incrementing pointer `iter`, and update `pos` only when a new chunk gets maped. However, mmaped_eof was only considering `pos` and not `iter`, and therefore was sometimes incorrectly returning false until a later call to `getByte` would update `pos`.
1 parent 216d8c3 commit 5f3eb66

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mappedio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static int TIDY_CALL mapped_getByte( void *sourceData )
156156
static Bool TIDY_CALL mapped_eof( void *sourceData )
157157
{
158158
MappedFileSource *data = sourceData;
159-
return ( data->pos >= data->size );
159+
return ( data->pos + (data->iter - data->view) >= data->size );
160160
}
161161

162162
static void TIDY_CALL mapped_ungetByte( void *sourceData, byte ARG_UNUSED(bt) )

0 commit comments

Comments
 (0)