mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-19 07:49:05 +00:00
LibCore: Avoid narrowing conversion in DateTime::to_string
This commit is contained in:
parent
28307d0db6
commit
86d29bd775
Notes:
sideshowbarker
2024-07-17 10:39:39 +09:00
Author: https://github.com/shannonbooth
Commit: 86d29bd775
Pull-request: https://github.com/SerenityOS/serenity/pull/23799
1 changed files with 2 additions and 2 deletions
|
@ -127,7 +127,7 @@ ErrorOr<String> 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<void> {
|
||||
struct tm gmt_tm;
|
||||
|
@ -154,7 +154,7 @@ ErrorOr<String> 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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue