refactor(event/stream.c): fix confusing indent (#37398)

(cherry picked from commit 896968cad1)
This commit is contained in:
zeertzjq
2026-01-15 09:00:55 +08:00
committed by github-actions[bot]
parent 617a2f4061
commit b4cd55df15

View File

@@ -46,7 +46,7 @@ void stream_init(Loop *loop, Stream *stream, int fd, uv_stream_t *uvstream)
FUNC_ATTR_NONNULL_ARG(2)
{
// The underlying stream is either a file or an existing uv stream.
assert(uvstream == NULL ? fd >= 0 : fd < 0);
assert(uvstream == NULL ? fd >= 0 && loop != NULL : fd < 0 && loop == NULL);
stream->uvstream = uvstream;
if (fd >= 0) {
@@ -59,26 +59,22 @@ void stream_init(Loop *loop, Stream *stream, int fd, uv_stream_t *uvstream)
// processed between reads.
uv_idle_init(&loop->uv, &stream->uv.idle);
stream->uv.idle.data = stream;
#ifdef MSWIN
} else if (type == UV_TTY) {
uv_tty_init(&loop->uv, &stream->uv.tty, fd, 0);
uv_tty_set_mode(&stream->uv.tty, UV_TTY_MODE_RAW);
DWORD dwMode;
if (GetConsoleMode(stream->uv.tty.handle, &dwMode)) {
dwMode |= ENABLE_VIRTUAL_TERMINAL_INPUT;
SetConsoleMode(stream->uv.tty.handle, dwMode);
}
stream->uvstream = (uv_stream_t *)&stream->uv.tty;
#endif
} else {
assert(type == UV_NAMED_PIPE || type == UV_TTY);
#ifdef MSWIN
if (type == UV_TTY) {
uv_tty_init(&loop->uv, &stream->uv.tty, fd, 0);
uv_tty_set_mode(&stream->uv.tty, UV_TTY_MODE_RAW);
DWORD dwMode;
if (GetConsoleMode(stream->uv.tty.handle, &dwMode)) {
dwMode |= ENABLE_VIRTUAL_TERMINAL_INPUT;
SetConsoleMode(stream->uv.tty.handle, dwMode);
}
stream->uvstream = (uv_stream_t *)&stream->uv.tty;
} else {
#endif
uv_pipe_init(&loop->uv, &stream->uv.pipe, 0);
uv_pipe_open(&stream->uv.pipe, fd);
stream->uvstream = (uv_stream_t *)&stream->uv.pipe;
#ifdef MSWIN
}
#endif
}
}