aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-11-02 20:36:30 +0000
committerludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-11-02 20:36:30 +0000
commit461eedf7bd6e40db9ebd4561e44a1ca2cb7a87b2 (patch)
treea902464adcbf2422b1d8a7ad324025e24a3afcb8
parente5697ba729c2bebfde7d60b3b8d3339d0f2f62b5 (diff)
downloadioquake3-aero-461eedf7bd6e40db9ebd4561e44a1ca2cb7a87b2.tar.gz
ioquake3-aero-461eedf7bd6e40db9ebd4561e44a1ca2cb7a87b2.zip
round string length for pointer alignment
git-svn-id: svn://svn.icculus.org/quake3/trunk@232 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--code/botlib/be_ai_chat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/code/botlib/be_ai_chat.c b/code/botlib/be_ai_chat.c
index 77bd8a9..898aa4b 100644
--- a/code/botlib/be_ai_chat.c
+++ b/code/botlib/be_ai_chat.c
@@ -675,6 +675,7 @@ bot_synonymlist_t *BotLoadSynonyms(char *filename)
lastsynonym = NULL;
while(1)
{
+ size_t len;
if (!PC_ExpectTokenString(source, "(") ||
!PC_ExpectTokenType(source, TT_STRING, 0, &token))
{
@@ -688,13 +689,14 @@ bot_synonymlist_t *BotLoadSynonyms(char *filename)
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;