r282 - in trunk/code: botlib qcommon

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Nov 5 14:06:10 EST 2005


Author: ludwig
Date: 2005-11-05 14:06:10 -0500 (Sat, 05 Nov 2005)
New Revision: 282

Modified:
   trunk/code/botlib/be_aas_route.c
   trunk/code/botlib/be_ai_chat.c
   trunk/code/qcommon/q_shared.h
Log:
- put ALIGN macro into q_shared.h
- yet another alignment fix for botlib


Modified: trunk/code/botlib/be_aas_route.c
===================================================================
--- trunk/code/botlib/be_aas_route.c	2005-11-05 18:41:37 UTC (rev 281)
+++ trunk/code/botlib/be_aas_route.c	2005-11-05 19:06:10 UTC (rev 282)
@@ -521,7 +521,7 @@
 		//
 		size += settings->numreachableareas * sizeof(unsigned short *);
 		//
-		size += settings->numreachableareas * revreach->numlinks * sizeof(unsigned short);
+		size += settings->numreachableareas * ALIGN(revreach->numlinks) * sizeof(unsigned short);
 	} //end for
 	//allocate memory for the area travel times
 	ptr = (char *) GetClearedMemory(size);
@@ -541,7 +541,7 @@
 		for (l = 0; l < settings->numreachableareas; l++)
 		{
 			aasworld.areatraveltimes[i][l] = (unsigned short *) ptr;
-			ptr += revreach->numlinks * sizeof(unsigned short);
+			ptr += ALIGN(revreach->numlinks) * sizeof(unsigned short);
 			//reachability link
 			reach = &aasworld.reachability[settings->firstreachablearea + l];
 			//

Modified: trunk/code/botlib/be_ai_chat.c
===================================================================
--- trunk/code/botlib/be_ai_chat.c	2005-11-05 18:41:37 UTC (rev 281)
+++ trunk/code/botlib/be_ai_chat.c	2005-11-05 19:06:10 UTC (rev 282)
@@ -20,15 +20,6 @@
 ===========================================================================
 */
 
-#if 1
-#define ALIGN(x) \
-	do { \
-		x = (x+sizeof(void*)-1) & ~(sizeof(void*)-1L); \
-	} while(0)
-#else
-#define ALIGN(x) 
-#endif
-
 /*****************************************************************************
  * name:		be_ai_chat.c
  *
@@ -699,7 +690,7 @@
 							return NULL;
 						} //end if
 						len = strlen(token.string) + 1;
-						ALIGN(len);
+						len = ALIGN(len);
 						size += sizeof(bot_synonym_t) + len;
 						if (pass)
 						{
@@ -998,7 +989,7 @@
 				return NULL;
 			} //end if
 			len = strlen(token.string) + 1;
-			ALIGN(len);
+			len = ALIGN(len);
 			size += sizeof(bot_randomlist_t) + len;
 			if (pass)
 			{
@@ -1029,7 +1020,7 @@
 					return NULL;
 				} //end if
 				len = strlen(chatmessagestring) + 1;
-				ALIGN(len);
+				len = ALIGN(len);
 				size += sizeof(bot_randomstring_t) + len;
 				if (pass)
 				{
@@ -2132,7 +2123,7 @@
 								return NULL;
 							} //end if
 							len = strlen(chatmessagestring) + 1;
-							ALIGN(len);
+							len = ALIGN(len);
 							if (pass)
 							{
 								chatmessage = (bot_chatmessage_t *) ptr;

Modified: trunk/code/qcommon/q_shared.h
===================================================================
--- trunk/code/qcommon/q_shared.h	2005-11-05 18:41:37 UTC (rev 281)
+++ trunk/code/qcommon/q_shared.h	2005-11-05 19:06:10 UTC (rev 282)
@@ -111,6 +111,7 @@
 typedef int		fileHandle_t;
 typedef int		clipHandle_t;
 
+#define ALIGN(x) ((x+sizeof(long)-1) & ~(sizeof(long)-1))
 
 #ifndef NULL
 #define NULL ((void *)0)




More information about the quake3-commits mailing list