diff options
| author | ruki <[email protected]> | 2026-01-28 23:40:27 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-01-28 23:40:27 +0800 |
| commit | d0e47424619d453a1c74a7b248c26bab82bdd876 (patch) | |
| tree | a984fa0fd3102ca197c2fd74d6fb389cb28d750e /core/src | |
| parent | 83fd24bc6a601620f827338904eae23effb95099 (diff) | |
fix read
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/xmake/io/file_read.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/src/xmake/io/file_read.c b/core/src/xmake/io/file_read.c index e38f7bd0d..1d0ae7368 100644 --- a/core/src/xmake/io/file_read.c +++ b/core/src/xmake/io/file_read.c @@ -49,10 +49,14 @@ static tb_bool_t xm_io_file_stream_skip_sequential(tb_stream_ref_t stream, tb_hi while (left) { tb_size_t need = left > (tb_hize_t)sizeof(discard) ? (tb_size_t)sizeof(discard) : (tb_size_t)left; tb_long_t read = tb_stream_read(stream, discard, need); - if (read != (tb_long_t)need) { + if (read > 0) { + left -= read; + } else if (!read) { + read = tb_stream_wait(stream, TB_STREAM_WAIT_READ, -1); + tb_check_return_val(read > 0, tb_false); + } else { return tb_false; } - left -= need; } return tb_true; } |
