@@ -59,7 +59,7 @@ struct tm : std::tm {
5959 * @return int32_t The parsed integer.
6060 * @throws std::invalid_argument if the value is not convertible.
6161 */
62- template <typename T = int32_t >
62+ template <typename T>
6363MGUTILITY_CNSTXPR auto parse_integer (T &result, mgutility::string_view str,
6464 uint32_t len, uint32_t &next,
6565 uint32_t begin_offset = 0 ) -> std::errc {
@@ -79,8 +79,8 @@ MGUTILITY_CNSTXPR auto parse_integer(T &result, mgutility::string_view str,
7979 * @param max The maximum acceptable value.
8080 * @throws std::out_of_range if the value is out of range.
8181 */
82- template <typename T = int32_t >
83- MGUTILITY_CNSTXPR auto check_range (const T& value, const int32_t & min, const int32_t & max) -> std::errc {
82+ template <typename T>
83+ MGUTILITY_CNSTXPR auto check_range (const T& value, const T & min, const T & max) -> std::errc {
8484 if (value < min || value > max) {
8585 return std::errc::result_out_of_range;
8686 }
@@ -93,7 +93,7 @@ MGUTILITY_CNSTXPR auto check_range(const T& value, const int32_t& min, const int
9393 * @param year The year to check.
9494 * @return bool True if the year is a leap year, false otherwise.
9595 */
96- auto MGUTILITY_CNSTXPR is_leap_year (uint32_t year) -> bool {
96+ auto MGUTILITY_CNSTXPR is_leap_year (int32_t year) -> bool {
9797 return (year % 4 ) == 0 && ((year % 100 ) != 0 || (year % 400 ) == 0 );
9898}
9999
@@ -129,7 +129,7 @@ MGUTILITY_CNSTXPR auto mktime(std::time_t &result, std::tm &time_struct) -> std:
129129 // Add the days for the current year
130130 for (auto i{0 }; i < time_struct.tm_mon ; ++i) {
131131 // NOLINTNEXTLINE
132- result += num_of_days[is_leap_year (time_struct.tm_year )][i ];
132+ result += num_of_days[is_leap_year (time_struct.tm_year )][static_cast <std:: size_t >(i) ];
133133 }
134134
135135 result += time_struct.tm_mday - 1 ; // nth day since 1970
@@ -260,7 +260,7 @@ MGUTILITY_CNSTXPR auto parse_fraction(detail::tm &result, string_view date_str,
260260 if (error != std::errc{}) {
261261 return error;
262262 }
263- error = check_range (result.tm_ms , 0 , 999 );
263+ error = check_range (result.tm_ms , 0U , 999U );
264264 return error;
265265}
266266
0 commit comments