From: havoc Date: Sun, 24 May 2020 07:03:22 +0000 (+0000) Subject: Fix a size_t comparison warning by doing the math better. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bb058a186b0431d2c46ec787770645c6ad0bfefc;p=xonotic%2Fdarkplaces.git Fix a size_t comparison warning by doing the math better. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12560 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cmd.c b/cmd.c index fedfb13d..ce0c4013 100644 --- a/cmd.c +++ b/cmd.c @@ -196,7 +196,7 @@ void Cbuf_AddText (cmd_state_t *cmd, const char *text) l = (int)strlen(text); Cbuf_Lock(cmd); - if (cmd->text.cursize + l >= (size_t)cmd->text.maxsize) + if (cmd->text.maxsize - cmd->text.cursize <= l) Con_Print("Cbuf_AddText: overflow\n"); else SZ_Write(&cmd->text, (const unsigned char *)text, l);