Page MenuHomePhabricator (Chris)

No OneTemporary

Authored By
Unknown
Size
816 B
Referenced Files
None
Subscribers
None
diff --git a/calendar.cpp b/calendar.cpp
index 2622379..6c553b0 100644
--- a/calendar.cpp
+++ b/calendar.cpp
@@ -1,23 +1,25 @@
#include "calendar.h"
+#define ARRAY_LEN(x) (sizeof(x) / sizeof(x[0]))
+
std::string getHoliday(int month, int day)
{
- for (int i=0;i<59;i++)
+ for (size_t i=0;i<ARRAY_LEN(PAGAN_HOLIDAYS);i++)
{
try
{
if (month==std::stoi(PAGAN_HOLIDAYS[i][0]))
{
if (day==std::stoi(PAGAN_HOLIDAYS[i][1]))
{
return PAGAN_HOLIDAYS[i][2];
}
}
} catch (...)
{
std::cerr << "Failed to convert " << PAGAN_HOLIDAYS[i][0] << " and " << PAGAN_HOLIDAYS[i][1] << " into ints\n";
continue;
}
}
return "";
}

File Metadata

Mime Type
text/x-diff
Expires
Tue, Jun 16, 12:29 AM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
70572
Default Alt Text
(816 B)

Event Timeline