From a67ad665b1677b6ba162c39b4ea788ad5ae12bb7 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Thu, 15 Dec 2022 17:27:38 -0500 Subject: [PATCH] LibLine: Convert strings to time_t using signed conversion methods The time_t type itself is signed, and the result of this conversion is always stored as time_t, so let's not use to_uint<>. --- Userland/Libraries/LibLine/Editor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp index 064a4e031b..06d5b52bec 100644 --- a/Userland/Libraries/LibLine/Editor.cpp +++ b/Userland/Libraries/LibLine/Editor.cpp @@ -259,7 +259,7 @@ bool Editor::load_history(DeprecatedString const& path) auto hist = StringView { data.data(), data.size() }; for (auto& str : hist.split_view("\n\n"sv)) { auto it = str.find("::"sv).value_or(0); - auto time = str.substring_view(0, it).to_uint().value_or(0); + auto time = str.substring_view(0, it).to_int().value_or(0); auto string = str.substring_view(it == 0 ? it : it + 2); m_history.append({ string, time }); } @@ -320,7 +320,7 @@ bool Editor::save_history(DeprecatedString const& path) file->line_begin(), file->line_end(), m_history.begin(), m_history.end(), final_history, [](StringView str) { auto it = str.find("::"sv).value_or(0); - auto time = str.substring_view(0, it).to_uint().value_or(0); + auto time = str.substring_view(0, it).to_int().value_or(0); auto string = str.substring_view(it == 0 ? it : it + 2); return HistoryEntry { string, time }; },