1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00

Avoid GCC error "array subscript is above array bounds" which probably considers that the unsigned char could underflow and access an element out of the months range.

This commit is contained in:
Sandu Liviu Catalin 2016-03-27 22:15:51 +03:00
parent 6647386d30
commit 29da6850e4

View File

@ -196,7 +196,7 @@ Uint8 Date::DaysInMonth(Uint16 year, Uint8 month)
STHROWF("Month value is out of range: %u > 12", month); STHROWF("Month value is out of range: %u > 12", month);
} }
// Obtain the days in this month // Obtain the days in this month
Uint8 days = MonthLengths[month - 1]; Uint8 days = *(MonthLengths + month);
// Should we account for January? // Should we account for January?
if (month == 2 && IsLeapYear(year)) if (month == 2 && IsLeapYear(year))
{ {