vcpkg/ports/date/fix-uninitialized-values.patch
JonLiu1993 1143d75d55
[date] Fix uninitialized values ()
* [date] Fix uninitialized values

* update version

* add notes for patch

* update version
2022-04-05 11:18:28 -07:00

41 lines
2.4 KiB
Diff

diff --git a/include/date/date.h b/include/date/date.h
index 9c6f335..3967d6b 100644
--- a/include/date/date.h
+++ b/include/date/date.h
@@ -6767,7 +6767,7 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt,
CONSTDATA auto w = Duration::period::den == 1 ? 2 : 3 + dfs::width;
int tH;
int tM;
- long double S;
+ long double S{};
read(is, ru{tH, 1, 2}, CharT{':'}, ru{tM, 1, 2},
CharT{':'}, rld{S, 1, w});
checked_set(H, tH, not_a_hour, is);
@@ -7202,7 +7202,7 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt,
// "%I:%M:%S %p"
using dfs = detail::decimal_format_seconds<Duration>;
CONSTDATA auto w = Duration::period::den == 1 ? 2 : 3 + dfs::width;
- long double S;
+ long double S{};
int tI = not_a_hour_12_value;
int tM = not_a_minute;
read(is, ru{tI, 1, 2}, CharT{':'}, ru{tM, 1, 2},
@@ -7258,7 +7258,7 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt,
{
using dfs = detail::decimal_format_seconds<Duration>;
CONSTDATA auto w = Duration::period::den == 1 ? 2 : 3 + dfs::width;
- long double S;
+ long double S{};
read(is, rld{S, 1, width == -1 ? w : static_cast<unsigned>(width)});
checked_set(s, round_i<Duration>(duration<long double>{S}),
not_a_second, is);
@@ -7292,7 +7292,7 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt,
CONSTDATA auto w = Duration::period::den == 1 ? 2 : 3 + dfs::width;
int tH = not_a_hour;
int tM = not_a_minute;
- long double S;
+ long double S{};
read(is, ru{tH, 1, 2}, CharT{':'}, ru{tM, 1, 2},
CharT{':'}, rld{S, 1, w});
checked_set(H, tH, not_a_hour, is);