r232 - trunk/code/botlib

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Nov 2 15:36:30 EST 2005


Author: ludwig
Date: 2005-11-02 15:36:30 -0500 (Wed, 02 Nov 2005)
New Revision: 232

Modified:
   trunk/code/botlib/be_ai_chat.c
Log:
round string length for pointer alignment


Modified: trunk/code/botlib/be_ai_chat.c
===================================================================
--- trunk/code/botlib/be_ai_chat.c	2005-11-02 20:34:25 UTC (rev 231)
+++ trunk/code/botlib/be_ai_chat.c	2005-11-02 20:36:30 UTC (rev 232)
@@ -675,6 +675,7 @@
 					lastsynonym = NULL;
 					while(1)
 					{
+						size_t len;
 						if (!PC_ExpectTokenString(source, "(") ||
 							!PC_ExpectTokenType(source, TT_STRING, 0, &token))
 						{
@@ -688,13 +689,14 @@
 							FreeSource(source);
 							return NULL;
 						} //end if
-						size += sizeof(bot_synonym_t) + strlen(token.string) + 1;
+						len = (strlen(token.string) + 1 +sizeof(void*)-1) & ~(sizeof(void*)-1);
+						size += sizeof(bot_synonym_t) + len;
 						if (pass)
 						{
 							synonym = (bot_synonym_t *) ptr;
 							ptr += sizeof(bot_synonym_t);
 							synonym->string = ptr;
-							ptr += strlen(token.string) + 1;
+							ptr += len;
 							strcpy(synonym->string, token.string);
 							//
 							if (lastsynonym) lastsynonym->next = synonym;




More information about the quake3-commits mailing list