[quake3-commits] r1889 - in trunk/code: game qcommon

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Feb 10 13:56:18 EST 2011


Author: thilo
Date: 2011-02-10 13:56:18 -0500 (Thu, 10 Feb 2011)
New Revision: 1889

Modified:
   trunk/code/game/g_cmds.c
   trunk/code/game/g_team.c
   trunk/code/qcommon/vm_x86.c
   trunk/code/qcommon/vm_x86_64.c
Log:
- Make some string functions in g_cmds.c cleaner, by DevHC
- embed VM_FREEBUFFERS() macro in do-while-loop


Modified: trunk/code/game/g_cmds.c
===================================================================
--- trunk/code/game/g_cmds.c	2011-02-10 18:45:28 UTC (rev 1888)
+++ trunk/code/game/g_cmds.c	2011-02-10 18:56:18 UTC (rev 1889)
@@ -76,7 +76,7 @@
 			perfect,
 			cl->ps.persistant[PERS_CAPTURES]);
 		j = strlen(entry);
-		if (stringlength + j > 1024)
+		if (stringlength + j >= sizeof(string))
 			break;
 		strcpy (string + stringlength, entry);
 		stringlength += j;

Modified: trunk/code/game/g_team.c
===================================================================
--- trunk/code/game/g_team.c	2011-02-10 18:45:28 UTC (rev 1888)
+++ trunk/code/game/g_team.c	2011-02-10 18:56:18 UTC (rev 1889)
@@ -1112,7 +1112,7 @@
 				i, player->client->pers.teamState.location, h, a, 
 				player->client->ps.weapon, player->s.powerups);
 			j = strlen(entry);
-			if (stringlength + j > sizeof(string))
+			if (stringlength + j >= sizeof(string))
 				break;
 			strcpy (string + stringlength, entry);
 			stringlength += j;

Modified: trunk/code/qcommon/vm_x86.c
===================================================================
--- trunk/code/qcommon/vm_x86.c	2011-02-10 18:45:28 UTC (rev 1888)
+++ trunk/code/qcommon/vm_x86.c	2011-02-10 18:56:18 UTC (rev 1889)
@@ -53,7 +53,7 @@
 
 */
 
-#define VMFREE_BUFFERS() {Z_Free(buf); Z_Free(jused);}
+#define VMFREE_BUFFERS() do {Z_Free(buf); Z_Free(jused);} while(0)
 static	byte	*buf = NULL;
 static	byte	*jused = NULL;
 static	int		compiledOfs = 0;

Modified: trunk/code/qcommon/vm_x86_64.c
===================================================================
--- trunk/code/qcommon/vm_x86_64.c	2011-02-10 18:45:28 UTC (rev 1888)
+++ trunk/code/qcommon/vm_x86_64.c	2011-02-10 18:56:18 UTC (rev 1889)
@@ -54,7 +54,7 @@
 #define Dfprintf(args...)
 #endif
 
-#define VM_FREEBUFFERS(vm) {assembler_init(0); VM_Destroy_Compiled(vm);}
+#define VM_FREEBUFFERS(vm) do {assembler_init(0); VM_Destroy_Compiled(vm);} while(0)
 
 void assembler_set_output(char* buf);
 size_t assembler_get_code_size(void);



More information about the quake3-commits mailing list