diff --git a/toml/datetime.hpp b/toml/datetime.hpp index f0ae405..4ea75e7 100644 --- a/toml/datetime.hpp +++ b/toml/datetime.hpp @@ -46,7 +46,7 @@ inline std::tm localtime_s(const std::time_t* src) #endif } // detail -enum class month_t : std::int8_t +enum class month_t : std::uint8_t { Jan = 0, Feb = 1, @@ -98,9 +98,9 @@ struct local_date t.tm_sec = 0; t.tm_min = 0; t.tm_hour = 0; - t.tm_mday = this->day; - t.tm_mon = this->month; - t.tm_year = this->year - 1900; + t.tm_mday = static_cast(this->day); + t.tm_mon = static_cast(this->month); + t.tm_year = static_cast(this->year) - 1900; t.tm_wday = 0; // the value will be ignored t.tm_yday = 0; // the value will be ignored t.tm_isdst = -1; diff --git a/toml/parser.hpp b/toml/parser.hpp index 1b76503..8e8a7ef 100644 --- a/toml/parser.hpp +++ b/toml/parser.hpp @@ -660,9 +660,9 @@ parse_local_time(location& loc) {{std::addressof(inner_loc), "here"}})); } local_time time( - static_cast(from_string(h.unwrap().str(), 0)), - static_cast(from_string(m.unwrap().str(), 0)), - static_cast(from_string(s.unwrap().str(), 0)), 0, 0); + from_string(h.unwrap().str(), 0), + from_string(m.unwrap().str(), 0), + from_string(s.unwrap().str(), 0), 0, 0); const auto before_secfrac = inner_loc.iter(); if(const auto secfrac = lex_time_secfrac::invoke(inner_loc)) @@ -678,13 +678,13 @@ parse_local_time(location& loc) } if(sf.size() >= 6) { - time.millisecond = from_string(sf.substr(0, 3), 0); - time.microsecond = from_string(sf.substr(3, 3), 0); + time.millisecond = from_string(sf.substr(0, 3), 0u); + time.microsecond = from_string(sf.substr(3, 3), 0u); } else if(sf.size() >= 3) { - time.millisecond = from_string(sf, 0); - time.microsecond = 0; + time.millisecond = from_string(sf, 0u); + time.microsecond = 0u; } } else