Various code/warning cleanup

Fixed an issue with ItemID skill where using the skill on a crafted item would not output a result if creator of item was unknown
Command logs now also include any parameters used with a command
Fixed an issue where messages used with CustomTarget JS function would not get truncated properly if longer than the allowed maximum length
Fixed some instances of potential buffer overrun and/or out-of-bounds memory access
Fixed some potential null pointer dereferences
Fixed a couple instances of missing breaks in switch cases
Added [[maybe_unused]] attributes in places where return values are intentionally unused
Added [[fallthrough]] attributes in places where switch case fallthroughs are intentional
Misc minor code cleanup
This commit is contained in:
Xoduz 2021-07-04 02:26:43 +08:00
parent d0b4493513
commit 6ca9ddc6f2
35 changed files with 237 additions and 156 deletions

View file

@ -196,7 +196,7 @@ void cHTMLTemplate::Process( void )
}
// Time
char time_str[80];
char time_str[256];
RealTime( time_str );
Pos = ParsedContent.find( "%time" );
while( Pos != std::string::npos )
@ -255,12 +255,14 @@ void cHTMLTemplate::Process( void )
{
auto myPort = std::to_string(mServ->getPort());
if (cwmWorldState->GetKeepRun()){
// Both paths do the same. Something seems missing
//if (cwmWorldState->GetKeepRun()){
ParsedContent.replace(Pos, portToken.size(), myPort);
}
else {
ParsedContent.replace(Pos, portToken.size(), myPort);
}
//}
//else {
//ParsedContent.replace(Pos, portToken.size(), myPort);
//}
Pos = ParsedContent.find( portToken );
}
}