(Windows) Fixed some compiler errors and a compiler warning.

This commit is contained in:
Leon Styhre 2021-09-19 14:57:54 +02:00
parent 63767347f2
commit dd8f5afdf4
2 changed files with 18 additions and 2 deletions

View file

@ -664,10 +664,10 @@ void Window::setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpSt
"lt", "lt",
"start", "start",
"back"}; "back"};
size_t i = 0; int i = 0;
int aVal = 0; int aVal = 0;
int bVal = 0; int bVal = 0;
while (i < map.size()) { while (i < static_cast<int>(map.size())) {
if (a.first == map[i]) if (a.first == map[i])
aVal = i; aVal = i;
if (b.first == map[i]) if (b.first == map[i])

View file

@ -18,7 +18,11 @@ namespace Utils
DateTime::DateTime() DateTime::DateTime()
{ {
mTime = 0; mTime = 0;
#if defined(_WIN64)
mTimeStruct = {0, 0, 0, 1, 0, 0, 0, 0, -1};
#else
mTimeStruct = {0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0}; mTimeStruct = {0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0};
#endif
mIsoString = "00000000T000000"; mIsoString = "00000000T000000";
} }
@ -83,7 +87,11 @@ namespace Utils
{ {
const char* s = string.c_str(); const char* s = string.c_str();
const char* f = format.c_str(); const char* f = format.c_str();
#if defined(_WIN64)
tm timeStruct = {0, 0, 0, 1, 0, 0, 0, 0, -1};
#else
tm timeStruct = {0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0}; tm timeStruct = {0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0};
#endif
size_t parsedChars = 0; size_t parsedChars = 0;
if (string == "19700101T010000") if (string == "19700101T010000")
@ -231,7 +239,11 @@ namespace Utils
int daysInMonth(const int year, const int month) int daysInMonth(const int year, const int month)
{ {
#if defined(_WIN64)
tm timeStruct = {0, 0, 0, 0, month, year - 1900, 0, 0, -1};
#else
tm timeStruct = {0, 0, 0, 0, month, year - 1900, 0, 0, -1, 0, 0}; tm timeStruct = {0, 0, 0, 0, month, year - 1900, 0, 0, -1, 0, 0};
#endif
mktime(&timeStruct); mktime(&timeStruct);
return timeStruct.tm_mday; return timeStruct.tm_mday;
@ -239,7 +251,11 @@ namespace Utils
int daysInYear(const int year) int daysInYear(const int year)
{ {
#if defined(_WIN64)
tm timeStruct = {0, 0, 0, 0, 0, year - 1900 + 1, 0, 0, -1};
#else
tm timeStruct = {0, 0, 0, 0, 0, year - 1900 + 1, 0, 0, -1, 0, 0}; tm timeStruct = {0, 0, 0, 0, 0, year - 1900 + 1, 0, 0, -1, 0, 0};
#endif
mktime(&timeStruct); mktime(&timeStruct);
return timeStruct.tm_yday + 1; return timeStruct.tm_yday + 1;