]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
eradicated SZ_Print, thanks to Fuh for pointing out the sheer evil of this function...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 4 Dec 2003 11:13:57 +0000 (11:13 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 4 Dec 2003 11:13:57 +0000 (11:13 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3688 d7cf8633-e32d-0410-b094-e92efae38249

cmd.c
common.c

diff --git a/cmd.c b/cmd.c
index d2b0b115531d382e90ee2782b0d9143c7ff53baf..24c4c6351f2928f7fa5dfec70c1b7c5eccf69aa9 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -848,6 +848,7 @@ Sends the entire command line over to the server
 */
 void Cmd_ForwardToServer (void)
 {
+       char *s;
        if (cls.state != ca_connected)
        {
                Con_Printf ("Can't \"%s\", not connected\n", Cmd_Argv(0));
@@ -857,16 +858,15 @@ void Cmd_ForwardToServer (void)
        if (cls.demoplayback)
                return;         // not really connected
 
-       MSG_WriteByte (&cls.message, clc_stringcmd);
+       // LordHavoc: thanks to Fuh for bringing the pure evil of SZ_Print to my
+       // attention, it has been eradicated from here, its only (former) use in
+       // all of darkplaces.
        if (strcasecmp(Cmd_Argv(0), "cmd") != 0)
-       {
-               SZ_Print (&cls.message, Cmd_Argv(0));
-               SZ_Print (&cls.message, " ");
-       }
-       if (Cmd_Argc() > 1)
-               SZ_Print (&cls.message, Cmd_Args());
+               s = va("%s %s", Cmd_Argv(0), Cmd_Argc() > 1 ? Cmd_Args() : "\n");
        else
-               SZ_Print (&cls.message, "\n");
+               s = va("%s", Cmd_Argc() > 1 ? Cmd_Args() : "\n");
+       MSG_WriteByte(&cls.message, clc_stringcmd);
+       SZ_Write(&cls.message, s, strlen(s) + 1);
 }
 
 
index 518ad5b9594d198fcc95bf6556347b506210d7fb..557f83e7ffb00e5c962ee46fba5a56aa1e2465db 100644 (file)
--- a/common.c
+++ b/common.c
@@ -425,17 +425,9 @@ void SZ_Write (sizebuf_t *buf, const void *data, int length)
        memcpy (SZ_GetSpace(buf,length),data,length);
 }
 
-void SZ_Print (sizebuf_t *buf, const char *data)
-{
-       int len;
-       len = strlen(data)+1;
-
-// byte * cast to keep VC++ happy
-       if (buf->data[buf->cursize-1])
-               memcpy ((qbyte *)SZ_GetSpace(buf, len),data,len); // no trailing 0
-       else
-               memcpy ((qbyte *)SZ_GetSpace(buf, len-1)-1,data,len); // write over trailing 0
-}
+// LordHavoc: thanks to Fuh for bringing the pure evil of SZ_Print to my
+// attention, it has been eradicated from here, its only (former) use in
+// all of darkplaces.
 
 static char *hexchar = "0123456789ABCDEF";
 void Com_HexDumpToConsole(const qbyte *data, int size)