fix incorrect loading of files over 8192 bytes

This commit is contained in:
Andrew Kelley 2016-01-28 22:38:18 -07:00
parent 53c14da220
commit 650fdded29
2 changed files with 3 additions and 1 deletions

View File

@ -43,7 +43,7 @@ static int read_all_fd_stream(int fd, Buf *out_buf) {
buf_resize(out_buf, buf_size);
ssize_t actual_buf_len = 0;
for (;;) {
ssize_t amt_read = read(fd, buf_ptr(out_buf), buf_len(out_buf));
ssize_t amt_read = read(fd, buf_ptr(out_buf) + actual_buf_len, buf_size);
if (amt_read < 0) {
return ErrorFileSystem;
}

View File

@ -878,6 +878,7 @@ void tokenize(Buf *buf, Tokenization *out) {
if (digit_value >= 0) {
if (digit_value >= t.cur_tok->radix) {
tokenize_error(&t, "invalid character: '%c'", c);
break;
}
// normal digit
} else {
@ -904,6 +905,7 @@ void tokenize(Buf *buf, Tokenization *out) {
if (digit_value >= 0) {
if (digit_value >= t.cur_tok->radix) {
tokenize_error(&t, "invalid character: '%c'", c);
break;
}
// normal digit
} else {