Fix compiler warnings

This commit is contained in:
James R 2022-08-01 07:46:35 -07:00 committed by toaster
parent 281004bb85
commit 2ec2873b3e
2 changed files with 56 additions and 56 deletions

View file

@ -5339,7 +5339,7 @@ static void Got_Automatecmd(UINT8 **cp, INT32 playernum)
if (server || consoleplayer == playernum)
{
if (command == NULL || strlen(command) == 0)
if (command[0] == '\0')
{
CONS_Printf(
"Removed the %s automate command.\n",

View file

@ -1555,6 +1555,61 @@ static boolean SOCK_Ban(INT32 node)
#endif
}
static boolean SOCK_SetBanUsername(const char *username)
{
#ifdef NONET
(void)username;
return false;
#else
if (username == NULL || strlen(username) == 0)
{
username = "Direct IP ban";
}
if (banned[numbans - 1].username)
{
Z_Free(banned[numbans - 1].username);
banned[numbans - 1].username = NULL;
}
banned[numbans - 1].username = Z_StrDup(username);
return true;
#endif
}
static boolean SOCK_SetBanReason(const char *reason)
{
#ifdef NONET
(void)reason;
return false;
#else
if (reason == NULL || strlen(reason) == 0)
{
reason = "No reason given";
}
if (banned[numbans - 1].reason)
{
Z_Free(banned[numbans - 1].reason);
banned[numbans - 1].reason = NULL;
}
banned[numbans - 1].reason = Z_StrDup(reason);
return true;
#endif
}
static boolean SOCK_SetUnbanTime(time_t timestamp)
{
#ifdef NONET
(void)reason;
return false;
#else
banned[numbans - 1].timestamp = timestamp;
return true;
#endif
}
static boolean SOCK_SetBanAddress(const char *address, const char *mask)
{
#ifdef NONET
@ -1619,61 +1674,6 @@ static boolean SOCK_SetBanAddress(const char *address, const char *mask)
#endif
}
static boolean SOCK_SetBanUsername(const char *username)
{
#ifdef NONET
(void)username;
return false;
#else
if (username == NULL || strlen(username) == 0)
{
username = "Direct IP ban";
}
if (banned[numbans - 1].username)
{
Z_Free(banned[numbans - 1].username);
banned[numbans - 1].username = NULL;
}
banned[numbans - 1].username = Z_StrDup(username);
return true;
#endif
}
static boolean SOCK_SetBanReason(const char *reason)
{
#ifdef NONET
(void)reason;
return false;
#else
if (reason == NULL || strlen(reason) == 0)
{
reason = "No reason given";
}
if (banned[numbans - 1].reason)
{
Z_Free(banned[numbans - 1].reason);
banned[numbans - 1].reason = NULL;
}
banned[numbans - 1].reason = Z_StrDup(reason);
return true;
#endif
}
static boolean SOCK_SetUnbanTime(time_t timestamp)
{
#ifdef NONET
(void)reason;
return false;
#else
banned[numbans - 1].timestamp = timestamp;
return true;
#endif
}
static void SOCK_ClearBans(void)
{
numbans = 0;