mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:57:45 +00:00
LibLine: Avoid pointless size_t <-> ssize_t cast
Just a small cleanup.
This commit is contained in:
parent
f6afb70b07
commit
b732edf61c
1 changed files with 6 additions and 6 deletions
|
@ -827,9 +827,9 @@ void Editor::handle_read_event()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_incomplete_data.append(keybuf, nread);
|
m_incomplete_data.append(keybuf, nread);
|
||||||
nread = m_incomplete_data.size();
|
auto available_bytes = m_incomplete_data.size();
|
||||||
|
|
||||||
if (nread == 0) {
|
if (available_bytes == 0) {
|
||||||
m_input_error = Error::Empty;
|
m_input_error = Error::Empty;
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
|
@ -839,12 +839,12 @@ void Editor::handle_read_event()
|
||||||
|
|
||||||
// Discard starting bytes until they make sense as utf-8.
|
// Discard starting bytes until they make sense as utf-8.
|
||||||
size_t valid_bytes = 0;
|
size_t valid_bytes = 0;
|
||||||
while (nread) {
|
while (available_bytes > 0) {
|
||||||
Utf8View { StringView { m_incomplete_data.data(), (size_t)nread } }.validate(valid_bytes);
|
Utf8View { StringView { m_incomplete_data.data(), available_bytes } }.validate(valid_bytes);
|
||||||
if (valid_bytes)
|
if (valid_bytes != 0)
|
||||||
break;
|
break;
|
||||||
m_incomplete_data.take_first();
|
m_incomplete_data.take_first();
|
||||||
--nread;
|
--available_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utf8View input_view { StringView { m_incomplete_data.data(), valid_bytes } };
|
Utf8View input_view { StringView { m_incomplete_data.data(), valid_bytes } };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue