[libc-commits] [libc] 60af835 - [libc] Fix implicit cast warning in strftime (#127282)
via libc-commits
libc-commits at lists.llvm.org
Fri Feb 14 16:06:06 PST 2025
Author: Michael Jones
Date: 2025-02-14T16:06:02-08:00
New Revision: 60af83506a3aa379c59e0f9793ce7815d726aee1
URL: https://github.com/llvm/llvm-project/commit/60af83506a3aa379c59e0f9793ce7815d726aee1
DIFF: https://github.com/llvm/llvm-project/commit/60af83506a3aa379c59e0f9793ce7815d726aee1.diff
LOG: [libc] Fix implicit cast warning in strftime (#127282)
Forgot to change a size_t to an int, which caused warnings on gcc but
not clang for some reason. Regardless, this patch fixes the issue.
Added:
Modified:
libc/src/time/strftime_core/composite_converter.h
Removed:
################################################################################
diff --git a/libc/src/time/strftime_core/composite_converter.h b/libc/src/time/strftime_core/composite_converter.h
index 5c473f172c073..3530075cfe9a9 100644
--- a/libc/src/time/strftime_core/composite_converter.h
+++ b/libc/src/time/strftime_core/composite_converter.h
@@ -171,11 +171,11 @@ LIBC_INLINE int convert_full_date_time(printf_core::Writer *writer,
// we only pad the first conversion, and we assume all the other values are in
// their valid ranges.
// sizeof("Sun Jan 12 03:45:06 2025")
- const size_t full_conv_len = 3 + 1 + 3 + 1 + 2 + 1 + 8 + 1 + 4;
+ constexpr int FULL_CONV_LEN = 3 + 1 + 3 + 1 + 2 + 1 + 8 + 1 + 4;
// use the full conv len because this isn't being passed to a proper converter
// that will handle the width of the leading conversion. Instead it has to be
// handled below.
- const int requested_padding = to_conv.min_width - full_conv_len;
+ const int requested_padding = to_conv.min_width - FULL_CONV_LEN;
cpp::string_view wday_str = unwrap_opt(time_reader.get_weekday_short_name());
cpp::string_view month_str = unwrap_opt(time_reader.get_month_short_name());
More information about the libc-commits
mailing list