From 86d29bd7751409da43586d9255016907978d8b15 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Mon, 1 Apr 2024 21:21:47 +0200 Subject: [PATCH] LibCore: Avoid narrowing conversion in DateTime::to_string --- Userland/Libraries/LibCore/DateTime.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibCore/DateTime.cpp b/Userland/Libraries/LibCore/DateTime.cpp index a4e7dca263f..1bf701fa2f0 100644 --- a/Userland/Libraries/LibCore/DateTime.cpp +++ b/Userland/Libraries/LibCore/DateTime.cpp @@ -127,7 +127,7 @@ ErrorOr DateTime::to_string(StringView format) const struct tm tm; localtime_r(&m_timestamp, &tm); StringBuilder builder; - int const format_len = format.length(); + size_t const format_len = format.length(); auto format_time_zone_offset = [&](bool with_separator) -> ErrorOr { struct tm gmt_tm; @@ -154,7 +154,7 @@ ErrorOr DateTime::to_string(StringView format) const return {}; }; - for (int i = 0; i < format_len; ++i) { + for (size_t i = 0; i < format_len; ++i) { if (format[i] != '%') { TRY(builder.try_append(format[i])); } else {