Fix read bug

Reproduction code:
import time
s = "--------- switch to main\n--------- switch to system\n"
print(s[:0xc], end='', flush=True)
time.sleep(1)
print(s[0xc:], end='', flush=True)
This commit is contained in:
blankie 2023-01-20 21:31:07 +07:00
parent b6ad9c5d90
commit d5cf2584db
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 2 additions and 2 deletions

View File

@ -35,8 +35,8 @@ static inline void look_for_newlines(char buf[NEWLINE_BUF_SIZE], size_t* used, s
size_t newline_length = (reinterpret_cast<size_t>(newline_ptr) - reinterpret_cast<size_t>(&buf[real_offset])) / sizeof(char); size_t newline_length = (reinterpret_cast<size_t>(newline_ptr) - reinterpret_cast<size_t>(&buf[real_offset])) / sizeof(char);
(logcat_thread->*handle_line)(&buf[real_offset], newline_length, is_stdout); (logcat_thread->*handle_line)(&buf[real_offset], newline_length, is_stdout);
search_offset += newline_length + 1; real_offset += newline_length + 1;
real_offset = search_offset; search_offset = real_offset;
} }
if (real_offset) { if (real_offset) {