Browse Source

c++17 addressof fix

pull/5/head
craige1 7 years ago
parent
commit
be5a803d09
  1. 8
      RenX.Commands/RenX_Commands.cpp
  2. 20
      RenX.Core/RenX_Server.cpp
  3. 6
      RenX.ExtraLogging/RenX_ExtraLogging.cpp
  4. 6
      RenX.Ladder.Daily/RenX_Ladder_Daily.cpp
  5. 7
      RenX.Ladder.Monthly/RenX_Ladder_Monthly.cpp
  6. 6
      RenX.Ladder.Weekly/RenX_Ladder_Weekly.cpp
  7. 6
      RenX.Ladder.Yearly/RenX_Ladder_Yearly.cpp

8
RenX.Commands/RenX_Commands.cpp

@ -1878,13 +1878,15 @@ void BanSearchIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString
Jupiter::String out(256); Jupiter::String out(256);
Jupiter::String types(64); Jupiter::String types(64);
char timeStr[256]; char timeStr[256];
__time64_t tm_Time;
for (size_t i = 0; i != entries.size(); i++) for (size_t i = 0; i != entries.size(); i++)
{ {
entry = entries.get(i); entry = entries.get(i);
if (isMatch(type)) if (isMatch(type))
{ {
Jupiter::StringS &ip_str = Jupiter::Socket::ntop4(entry->ip); Jupiter::StringS &ip_str = Jupiter::Socket::ntop4(entry->ip);
strftime(timeStr, sizeof(timeStr), "%b %d %Y, %H:%M:%S", localtime(std::addressof<const time_t>(std::chrono::system_clock::to_time_t(entry->timestamp)))); tm_Time = std::chrono::system_clock::to_time_t(entry->timestamp);
strftime(timeStr, sizeof(timeStr), "%b %d %Y, %H:%M:%S", localtime(std::addressof<const time_t>(tm_Time)));
if ((entry->flags & 0x7FFF) == 0) if ((entry->flags & 0x7FFF) == 0)
types = " NULL;"_jrs; types = " NULL;"_jrs;
@ -2342,13 +2344,15 @@ void ExemptionSearchIRCCommand::trigger(IRC_Bot *source, const Jupiter::Readable
Jupiter::String out(256); Jupiter::String out(256);
Jupiter::String types(64); Jupiter::String types(64);
char timeStr[256]; char timeStr[256];
__time64_t tm_Time;
for (size_t i = 0; i != entries.size(); i++) for (size_t i = 0; i != entries.size(); i++)
{ {
entry = entries.get(i); entry = entries.get(i);
if (isMatch(type)) if (isMatch(type))
{ {
Jupiter::StringS &ip_str = Jupiter::Socket::ntop4(entry->ip); Jupiter::StringS &ip_str = Jupiter::Socket::ntop4(entry->ip);
strftime(timeStr, sizeof(timeStr), "%b %d %Y, %H:%M:%S", localtime(std::addressof<const time_t>(std::chrono::system_clock::to_time_t(entry->timestamp)))); tm_Time = std::chrono::system_clock::to_time_t(entry->timestamp);
strftime(timeStr, sizeof(timeStr), "%b %d %Y, %H:%M:%S", localtime(std::addressof<const time_t>(tm_Time)));
if ((entry->flags & 0xFF) == 0) if ((entry->flags & 0xFF) == 0)
types = " NULL;"_jrs; types = " NULL;"_jrs;

20
RenX.Core/RenX_Server.cpp

@ -557,9 +557,12 @@ void RenX::Server::banCheck(RenX::PlayerInfo &player)
} }
char timeStr[256]; char timeStr[256];
__time64_t tm_Time;
if (last_to_expire[0] != nullptr) // Game ban if (last_to_expire[0] != nullptr) // Game ban
{ {
strftime(timeStr, sizeof(timeStr), "%b %d %Y at %H:%M:%S", localtime(std::addressof<const time_t>(std::chrono::system_clock::to_time_t(last_to_expire[0]->timestamp + last_to_expire[0]->length))));
tm_Time = std::chrono::system_clock::to_time_t(last_to_expire[0]->timestamp + last_to_expire[0]->length);
strftime(timeStr, sizeof(timeStr), "%b %d %Y at %H:%M:%S", localtime(std::addressof<const time_t>(tm_Time)));
if (last_to_expire[0]->length == std::chrono::seconds::zero()) if (last_to_expire[0]->length == std::chrono::seconds::zero())
this->forceKickPlayer(player, Jupiter::StringS::Format("You were permanently banned from %.*s on %s for: %.*s", RenX::Server::ban_from_str.size(), RenX::Server::ban_from_str.ptr(), timeStr, last_to_expire[0]->reason.size(), last_to_expire[0]->reason.ptr())); this->forceKickPlayer(player, Jupiter::StringS::Format("You were permanently banned from %.*s on %s for: %.*s", RenX::Server::ban_from_str.size(), RenX::Server::ban_from_str.ptr(), timeStr, last_to_expire[0]->reason.size(), last_to_expire[0]->reason.ptr()));
else else
@ -571,7 +574,8 @@ void RenX::Server::banCheck(RenX::PlayerInfo &player)
{ {
if (last_to_expire[1] != nullptr) // Chat ban if (last_to_expire[1] != nullptr) // Chat ban
{ {
strftime(timeStr, sizeof(timeStr), "%b %d %Y at %H:%M:%S", localtime(std::addressof<const time_t>(std::chrono::system_clock::to_time_t(last_to_expire[1]->timestamp + last_to_expire[1]->length)))); tm_Time = std::chrono::system_clock::to_time_t(last_to_expire[1]->timestamp + last_to_expire[1]->length);
strftime(timeStr, sizeof(timeStr), "%b %d %Y at %H:%M:%S", localtime(std::addressof<const time_t>(tm_Time)));
this->mute(player); this->mute(player);
if (last_to_expire[1]->length == std::chrono::seconds::zero()) if (last_to_expire[1]->length == std::chrono::seconds::zero())
this->sendMessage(player, Jupiter::StringS::Format("You were permanently muted on this server on %s for: %.*s", timeStr, last_to_expire[1]->reason.size(), last_to_expire[1]->reason.ptr())); this->sendMessage(player, Jupiter::StringS::Format("You were permanently muted on this server on %s for: %.*s", timeStr, last_to_expire[1]->reason.size(), last_to_expire[1]->reason.ptr()));
@ -582,7 +586,8 @@ void RenX::Server::banCheck(RenX::PlayerInfo &player)
} }
else if (last_to_expire[2] != nullptr) // Bot ban else if (last_to_expire[2] != nullptr) // Bot ban
{ {
strftime(timeStr, sizeof(timeStr), "%b %d %Y at %H:%M:%S", localtime(std::addressof<const time_t>(std::chrono::system_clock::to_time_t(last_to_expire[2]->timestamp + last_to_expire[2]->length)))); tm_Time = std::chrono::system_clock::to_time_t(last_to_expire[2]->timestamp + last_to_expire[2]->length);
strftime(timeStr, sizeof(timeStr), "%b %d %Y at %H:%M:%S", localtime(std::addressof<const time_t>(tm_Time)));
if (last_to_expire[2]->length == std::chrono::seconds::zero()) if (last_to_expire[2]->length == std::chrono::seconds::zero())
this->sendMessage(player, Jupiter::StringS::Format("You were permanently bot-muted on this server on %s for: %.*s", timeStr, last_to_expire[2]->reason.size(), last_to_expire[2]->reason.ptr())); this->sendMessage(player, Jupiter::StringS::Format("You were permanently bot-muted on this server on %s for: %.*s", timeStr, last_to_expire[2]->reason.size(), last_to_expire[2]->reason.ptr()));
else else
@ -590,7 +595,8 @@ void RenX::Server::banCheck(RenX::PlayerInfo &player)
} }
if (last_to_expire[3] != nullptr) // Vote ban if (last_to_expire[3] != nullptr) // Vote ban
{ {
strftime(timeStr, sizeof(timeStr), "%b %d %Y at %H:%M:%S", localtime(std::addressof<const time_t>(std::chrono::system_clock::to_time_t(last_to_expire[3]->timestamp + last_to_expire[3]->length)))); tm_Time = std::chrono::system_clock::to_time_t(last_to_expire[3]->timestamp + last_to_expire[3]->length);
strftime(timeStr, sizeof(timeStr), "%b %d %Y at %H:%M:%S", localtime(std::addressof<const time_t>(tm_Time)));
if (last_to_expire[3]->length == std::chrono::seconds::zero()) if (last_to_expire[3]->length == std::chrono::seconds::zero())
this->sendMessage(player, Jupiter::StringS::Format("You were permanently vote-muted on this server on %s for: %.*s", timeStr, last_to_expire[3]->reason.size(), last_to_expire[3]->reason.ptr())); this->sendMessage(player, Jupiter::StringS::Format("You were permanently vote-muted on this server on %s for: %.*s", timeStr, last_to_expire[3]->reason.size(), last_to_expire[3]->reason.ptr()));
else else
@ -599,7 +605,8 @@ void RenX::Server::banCheck(RenX::PlayerInfo &player)
if (last_to_expire[4] != nullptr) // Mine ban if (last_to_expire[4] != nullptr) // Mine ban
{ {
this->mineBan(player); this->mineBan(player);
strftime(timeStr, sizeof(timeStr), "%b %d %Y at %H:%M:%S", localtime(std::addressof<const time_t>(std::chrono::system_clock::to_time_t(last_to_expire[4]->timestamp + last_to_expire[4]->length)))); tm_Time = std::chrono::system_clock::to_time_t(last_to_expire[4]->timestamp + last_to_expire[4]->length);
strftime(timeStr, sizeof(timeStr), "%b %d %Y at %H:%M:%S", localtime(std::addressof<const time_t>(tm_Time)));
if (last_to_expire[4]->length == std::chrono::seconds::zero()) if (last_to_expire[4]->length == std::chrono::seconds::zero())
this->sendMessage(player, Jupiter::StringS::Format("You were permanently mine-banned on this server on %s for: %.*s", timeStr, last_to_expire[4]->reason.size(), last_to_expire[4]->reason.ptr())); this->sendMessage(player, Jupiter::StringS::Format("You were permanently mine-banned on this server on %s for: %.*s", timeStr, last_to_expire[4]->reason.size(), last_to_expire[4]->reason.ptr()));
else else
@ -607,7 +614,8 @@ void RenX::Server::banCheck(RenX::PlayerInfo &player)
} }
if (last_to_expire[5] != nullptr) // Ladder ban if (last_to_expire[5] != nullptr) // Ladder ban
{ {
strftime(timeStr, sizeof(timeStr), "%b %d %Y at %H:%M:%S", localtime(std::addressof<const time_t>(std::chrono::system_clock::to_time_t(last_to_expire[5]->timestamp + last_to_expire[5]->length)))); tm_Time = std::chrono::system_clock::to_time_t(last_to_expire[5]->timestamp + last_to_expire[5]->length);
strftime(timeStr, sizeof(timeStr), "%b %d %Y at %H:%M:%S", localtime(std::addressof<const time_t>(tm_Time)));
if (last_to_expire[5]->length == std::chrono::seconds::zero()) if (last_to_expire[5]->length == std::chrono::seconds::zero())
this->sendMessage(player, Jupiter::StringS::Format("You were permanently ladder-banned on this server on %s for: %.*s", timeStr, last_to_expire[5]->reason.size(), last_to_expire[5]->reason.ptr())); this->sendMessage(player, Jupiter::StringS::Format("You were permanently ladder-banned on this server on %s for: %.*s", timeStr, last_to_expire[5]->reason.size(), last_to_expire[5]->reason.ptr()));
else else

6
RenX.ExtraLogging/RenX_ExtraLogging.cpp

@ -25,7 +25,8 @@ using namespace Jupiter::literals;
RenX_ExtraLoggingPlugin::RenX_ExtraLoggingPlugin() RenX_ExtraLoggingPlugin::RenX_ExtraLoggingPlugin()
{ {
RenX_ExtraLoggingPlugin::day = localtime(std::addressof<const time_t>(time(nullptr)))->tm_yday; __time64_t tm_Time = time(nullptr);
RenX_ExtraLoggingPlugin::day = localtime(std::addressof<const time_t>(tm_Time))->tm_yday;
} }
RenX_ExtraLoggingPlugin::~RenX_ExtraLoggingPlugin() RenX_ExtraLoggingPlugin::~RenX_ExtraLoggingPlugin()
@ -76,7 +77,8 @@ int RenX_ExtraLoggingPlugin::think()
{ {
if (RenX_ExtraLoggingPlugin::file != nullptr && RenX_ExtraLoggingPlugin::newDayFmt.isNotEmpty()) if (RenX_ExtraLoggingPlugin::file != nullptr && RenX_ExtraLoggingPlugin::newDayFmt.isNotEmpty())
{ {
int currentDay = localtime(std::addressof<const time_t>(time(nullptr)))->tm_yday; __time64_t tm_Time = time(nullptr);
int currentDay = localtime(std::addressof<const time_t>(tm_Time))->tm_yday;
if (currentDay != RenX_ExtraLoggingPlugin::day) if (currentDay != RenX_ExtraLoggingPlugin::day)
{ {
RenX_ExtraLoggingPlugin::day = currentDay; RenX_ExtraLoggingPlugin::day = currentDay;

6
RenX.Ladder.Daily/RenX_Ladder_Daily.cpp

@ -29,7 +29,8 @@ bool RenX_Ladder_Daily_TimePlugin::initialize()
this->database.setName(this->config.get("DatabaseName"_jrs, "Daily"_jrs)); this->database.setName(this->config.get("DatabaseName"_jrs, "Daily"_jrs));
this->database.setOutputTimes(this->config.get<bool>("OutputTimes"_jrs, false)); this->database.setOutputTimes(this->config.get<bool>("OutputTimes"_jrs, false));
this->last_sorted_day = gmtime(std::addressof<const time_t>(time(0)))->tm_wday; __time64_t tm_Time = time(0);
this->last_sorted_day = gmtime(std::addressof<const time_t>(tm_Time))->tm_wday;
this->database.OnPreUpdateLadder = OnPreUpdateLadder; this->database.OnPreUpdateLadder = OnPreUpdateLadder;
// Force database to default, if desired // Force database to default, if desired
@ -44,7 +45,8 @@ RenX_Ladder_Daily_TimePlugin pluginInstance;
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &) void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &)
{ {
tm *tm_ptr = gmtime(std::addressof<const time_t>(time(0))); __time64_t tm_Time = time(0);
tm *tm_ptr = gmtime(std::addressof<const time_t>(tm_Time));
if (pluginInstance.last_sorted_day != tm_ptr->tm_wday) if (pluginInstance.last_sorted_day != tm_ptr->tm_wday)
database.erase(); database.erase();
pluginInstance.last_sorted_day = tm_ptr->tm_wday; pluginInstance.last_sorted_day = tm_ptr->tm_wday;

7
RenX.Ladder.Monthly/RenX_Ladder_Monthly.cpp

@ -29,7 +29,9 @@ bool RenX_Ladder_Monthly_TimePlugin::initialize()
this->database.setName(this->config.get("DatabaseName"_jrs, "Monthly"_jrs)); this->database.setName(this->config.get("DatabaseName"_jrs, "Monthly"_jrs));
this->database.setOutputTimes(this->config.get<bool>("OutputTimes"_jrs, false)); this->database.setOutputTimes(this->config.get<bool>("OutputTimes"_jrs, false));
this->last_sorted_month = gmtime(std::addressof<const time_t>(time(0)))->tm_mon; __time64_t tm_Time;
tm_Time = time(0);
this->last_sorted_month = gmtime(std::addressof<const time_t>(tm_Time))->tm_mon;
this->database.OnPreUpdateLadder = OnPreUpdateLadder; this->database.OnPreUpdateLadder = OnPreUpdateLadder;
// Force database to default, if desired // Force database to default, if desired
@ -44,7 +46,8 @@ RenX_Ladder_Monthly_TimePlugin pluginInstance;
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &) void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &)
{ {
tm *tm_ptr = gmtime(std::addressof<const time_t>(time(0))); __time64_t tm_Time = time(0);
tm *tm_ptr = gmtime(std::addressof<const time_t>(tm_Time));
if (pluginInstance.last_sorted_month != tm_ptr->tm_mon) if (pluginInstance.last_sorted_month != tm_ptr->tm_mon)
database.erase(); database.erase();
pluginInstance.last_sorted_month = tm_ptr->tm_mon; pluginInstance.last_sorted_month = tm_ptr->tm_mon;

6
RenX.Ladder.Weekly/RenX_Ladder_Weekly.cpp

@ -29,7 +29,8 @@ bool RenX_Ladder_Weekly_TimePlugin::initialize()
this->database.setName(this->config.get("DatabaseName"_jrs, "Weekly"_jrs)); this->database.setName(this->config.get("DatabaseName"_jrs, "Weekly"_jrs));
this->database.setOutputTimes(this->config.get<bool>("OutputTimes"_jrs, false)); this->database.setOutputTimes(this->config.get<bool>("OutputTimes"_jrs, false));
this->last_sorted_day = gmtime(std::addressof<const time_t>(time(0)))->tm_wday; __time64_t tm_Time = time(0);
this->last_sorted_day = gmtime(std::addressof<const time_t>(tm_Time))->tm_wday;
this->reset_day = this->config.get<int>("ResetDay"_jrs); this->reset_day = this->config.get<int>("ResetDay"_jrs);
this->database.OnPreUpdateLadder = OnPreUpdateLadder; this->database.OnPreUpdateLadder = OnPreUpdateLadder;
@ -45,7 +46,8 @@ RenX_Ladder_Weekly_TimePlugin pluginInstance;
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &) void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &)
{ {
tm *tm_ptr = gmtime(std::addressof<const time_t>(time(0))); __time64_t tm_Time = time(0);
tm *tm_ptr = gmtime(std::addressof<const time_t>(tm_Time));
if (pluginInstance.last_sorted_day != tm_ptr->tm_wday && tm_ptr->tm_wday == pluginInstance.reset_day) if (pluginInstance.last_sorted_day != tm_ptr->tm_wday && tm_ptr->tm_wday == pluginInstance.reset_day)
database.erase(); database.erase();
pluginInstance.last_sorted_day = tm_ptr->tm_wday; pluginInstance.last_sorted_day = tm_ptr->tm_wday;

6
RenX.Ladder.Yearly/RenX_Ladder_Yearly.cpp

@ -29,7 +29,8 @@ bool RenX_Ladder_Yearly_TimePlugin::initialize()
this->database.setName(this->config.get("DatabaseName"_jrs, "Yearly"_jrs)); this->database.setName(this->config.get("DatabaseName"_jrs, "Yearly"_jrs));
this->database.setOutputTimes(this->config.get<bool>("OutputTimes"_jrs, false)); this->database.setOutputTimes(this->config.get<bool>("OutputTimes"_jrs, false));
this->last_sorted_year = gmtime(std::addressof<const time_t>(time(0)))->tm_year; __time64_t tm_Time = time(0);
this->last_sorted_year = gmtime(std::addressof<const time_t>(tm_Time))->tm_year;
this->database.OnPreUpdateLadder = OnPreUpdateLadder; this->database.OnPreUpdateLadder = OnPreUpdateLadder;
// Force database to default, if desired // Force database to default, if desired
@ -44,7 +45,8 @@ RenX_Ladder_Yearly_TimePlugin pluginInstance;
void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &) void OnPreUpdateLadder(RenX::LadderDatabase &database, RenX::Server &, const RenX::TeamType &)
{ {
tm *tm_ptr = gmtime(std::addressof<const time_t>(time(0))); __time64_t tm_Time = time(0);
tm *tm_ptr = gmtime(std::addressof<const time_t>(tm_Time));
if (pluginInstance.last_sorted_year != tm_ptr->tm_year) if (pluginInstance.last_sorted_year != tm_ptr->tm_year)
database.erase(); database.erase();
pluginInstance.last_sorted_year = tm_ptr->tm_year; pluginInstance.last_sorted_year = tm_ptr->tm_year;

Loading…
Cancel
Save