aboutsummaryrefslogtreecommitdiffstats
path: root/code/botlib
diff options
context:
space:
mode:
authorludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-11-03 22:26:59 +0000
committerludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-11-03 22:26:59 +0000
commitc4c5858eb3ae32e3b21d53003bfd437c93cbf6a1 (patch)
tree4588b689fe24eddad7cba87408563ad85f4ec461 /code/botlib
parent765d9f7b655022e5ecd89a589b846945d64d79ae (diff)
downloadioquake3-aero-c4c5858eb3ae32e3b21d53003bfd437c93cbf6a1.tar.gz
ioquake3-aero-c4c5858eb3ae32e3b21d53003bfd437c93cbf6a1.zip
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
Diffstat (limited to 'code/botlib')
-rw-r--r--code/botlib/be_ai_chat.c26
1 files changed, 22 insertions, 4 deletions
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