lib/utils: small cleanups

Fix some static analysis warnings
This commit is contained in:
Dirk-Jan C. Binnema
2026-04-10 00:12:50 +03:00
committed by Seth Ladygo
parent d8afabcc0f
commit 6715ff418a
5 changed files with 33 additions and 28 deletions

View File

@ -89,9 +89,10 @@ Mu::canonicalize_filename(const std::string& path, const std::string& relative_t
path.c_str(),
relative_to.empty() ? nullptr : relative_to.c_str())).value()};
// remove trailing '/'... is this needed?
if (str[str.length()-1] == G_DIR_SEPARATOR)
str.erase(str.length() - 1);
if (!str.empty()) { // remove trailing '/'... is this needed?
if (str[str.length()-1] == G_DIR_SEPARATOR)
str.erase(str.length() - 1);
}
return str;
}
@ -175,7 +176,6 @@ Mu::read_from_stdin()
{
g_autoptr(GOutputStream) outmem = g_memory_output_stream_new_resizable();
g_autoptr(GInputStream) input = g_unix_input_stream_new(STDIN_FILENO, TRUE);
//g_autoptr(GCancellable) cancel{maybe_cancellable_timeout(timeout)};
GError *err{};
auto bytes = g_output_stream_splice(outmem, input,