From bd7e80e0653f8851e9ca710561e1bdd1c90064fc Mon Sep 17 00:00:00 2001 From: Sam Nystrom Date: Fri, 23 Jun 2023 01:21:22 -0400 Subject: close subtitle file after parsing --- main.ha | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'main.ha') diff --git a/main.ha b/main.ha index f2c571f..42e7039 100644 --- a/main.ha +++ b/main.ha @@ -24,7 +24,6 @@ use fs; use os; use strconv; use strings; -use strio; use time; use unix::poll; use unix::tty; @@ -66,12 +65,13 @@ export fn main() void = { }; let subtitles = parse_srt(file); + io::close(file)!; defer free(subtitles); defer for (let i = 0z; i < len(subtitles); i += 1) { free_text(subtitles[i].text); }; - fmt::fprint(os::stdout_file, "\x1b[?25l")!; + fmt::fprint(os::stdout_file, "\x1b[?25l")!; // Hide the cursor defer fmt::fprint(os::stdout_file, "\x1b[?25h")!; let termios = tty::termios_query(os::stdin_file)!; defer tty::termios_restore(&termios); @@ -240,7 +240,7 @@ fn parse_srt(file: io::handle) []subtitle = { case state::TEXT => if (len(line) > 0) { io::writeall(&content, strings::toutf8(line))!; - strio::appendrune(&content, '\n')!; + io::writeall(&content, strings::toutf8("\n"))!; continue; }; -- cgit v1.2.3