From c4c5858eb3ae32e3b21d53003bfd437c93cbf6a1 Mon Sep 17 00:00:00 2001 From: ludwig Date: Thu, 3 Nov 2005 22:26:59 +0000 Subject: disable the alignment "fix" until its clear why it causes crashes git-svn-id: svn://svn.icculus.org/quake3/trunk@251 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/botlib/be_ai_chat.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'code') diff --git a/code/botlib/be_ai_chat.c b/code/botlib/be_ai_chat.c index c21292f..ab4bf5f 100644 --- a/code/botlib/be_ai_chat.c +++ b/code/botlib/be_ai_chat.c @@ -20,6 +20,18 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ +#if 0 +#define ALIGN(x) \ + do { \ + size_t oldx = x; \ + x = (x+sizeof(void*)-1) & ~(sizeof(void*)-1L); \ + if(x != oldx) \ + botimport.Print(PRT_MESSAGE, "size %zd -> %zd\n", oldx, x); \ + } while(0) +#else +#define ALIGN(x) +#endif + /***************************************************************************** * name: be_ai_chat.c * @@ -689,7 +701,8 @@ bot_synonymlist_t *BotLoadSynonyms(char *filename) FreeSource(source); return NULL; } //end if - len = (strlen(token.string) + 1 +sizeof(void*)-1) & ~(sizeof(void*)-1); + len = strlen(token.string) + 1; + ALIGN(len); size += sizeof(bot_synonym_t) + len; if (pass) { @@ -987,7 +1000,8 @@ bot_randomlist_t *BotLoadRandomStrings(char *filename) FreeSource(source); return NULL; } //end if - len = (strlen(token.string) + 1 +sizeof(void*)-1) & ~(sizeof(void*)-1); + len = strlen(token.string) + 1; + ALIGN(len); size += sizeof(bot_randomlist_t) + len; if (pass) { @@ -1017,7 +1031,8 @@ bot_randomlist_t *BotLoadRandomStrings(char *filename) FreeSource(source); return NULL; } //end if - len = (strlen(chatmessagestring) + 1 +sizeof(void*)-1) & ~(sizeof(void*)-1); + len = strlen(chatmessagestring) + 1; + ALIGN(len); size += sizeof(bot_randomstring_t) + len; if (pass) { @@ -2120,6 +2135,7 @@ bot_chat_t *BotLoadInitialChat(char *chatfile, char *chatname) } //end if if (pass) { + size_t len; chatmessage = (bot_chatmessage_t *) ptr; chatmessage->time = -2*CHATMESSAGE_RECENTTIME; //put the chat message in the list @@ -2129,7 +2145,9 @@ bot_chat_t *BotLoadInitialChat(char *chatfile, char *chatname) ptr += sizeof(bot_chatmessage_t); chatmessage->chatmessage = ptr; strcpy(chatmessage->chatmessage, chatmessagestring); - ptr += (strlen(chatmessagestring) + 1 +sizeof(void*)-1) & ~(sizeof(void*)-1); + len = strlen(chatmessagestring) + 1; + ALIGN(len); + ptr += len; //the number of chat messages increased chattype->numchatmessages++; } //end if -- cgit v1.2.3