Skip to content

Commit

Permalink
Fixing JuliaLang#13559 with more limited impact. Performance should b…
Browse files Browse the repository at this point in the history
…e identical to baseline.

Fixed infinite loop in previous fix for JuliaLang#13559.

Do not throw EOFError if buffer already contains n bytes. JuliaLang#13559
  • Loading branch information
hessammehr committed Oct 20, 2015
1 parent 24c1b2f commit 68442e2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,13 @@ static void NORETURN throw_eof_error(void)
DLLEXPORT uint64_t jl_ios_get_nbyte_int(ios_t *s, const size_t n)
{
assert(n <= 8);
size_t ret = ios_readprep(s, n);
if (ret < n)
throw_eof_error();
size_t space, ret;
do {
space = s->size - s->bpos;
ret = ios_readprep(s, n);
if (space == ret && ret < n)
throw_eof_error();
} while(ret < n);
uint64_t x = 0;
uint8_t *buf = (uint8_t*)&s->buf[s->bpos];
if (n == 8) {
Expand Down

0 comments on commit 68442e2

Please sign in to comment.