aboutsummaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
authorludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-11-02 21:46:05 +0000
committerludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-11-02 21:46:05 +0000
commit44ef6f7a402c74c458ec8d5def37930005af4dcd (patch)
treeefec743c1aff359939332b6489d6a1332e51ad68 /code
parent05f81cf9ddf76aad655e7045948fbf59e23a73cf (diff)
downloadioquake3-aero-44ef6f7a402c74c458ec8d5def37930005af4dcd.tar.gz
ioquake3-aero-44ef6f7a402c74c458ec8d5def37930005af4dcd.zip
more alignment fixes
git-svn-id: svn://svn.icculus.org/quake3/trunk@236 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code')
-rw-r--r--code/botlib/be_ai_chat.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/code/botlib/be_ai_chat.c b/code/botlib/be_ai_chat.c
index 898aa4b..c21292f 100644
--- a/code/botlib/be_ai_chat.c
+++ b/code/botlib/be_ai_chat.c
@@ -980,19 +980,21 @@ bot_randomlist_t *BotLoadRandomStrings(char *filename)
//
while(PC_ReadToken(source, &token))
{
+ size_t len;
if (token.type != TT_NAME)
{
SourceError(source, "unknown random %s", token.string);
FreeSource(source);
return NULL;
} //end if
- size += sizeof(bot_randomlist_t) + strlen(token.string) + 1;
+ len = (strlen(token.string) + 1 +sizeof(void*)-1) & ~(sizeof(void*)-1);
+ size += sizeof(bot_randomlist_t) + len;
if (pass)
{
random = (bot_randomlist_t *) ptr;
ptr += sizeof(bot_randomlist_t);
random->string = ptr;
- ptr += strlen(token.string) + 1;
+ ptr += len;
strcpy(random->string, token.string);
random->firstrandomstring = NULL;
random->numstrings = 0;
@@ -1009,18 +1011,20 @@ bot_randomlist_t *BotLoadRandomStrings(char *filename)
} //end if
while(!PC_CheckTokenString(source, "}"))
{
+ size_t len;
if (!BotLoadChatMessage(source, chatmessagestring))
{
FreeSource(source);
return NULL;
} //end if
- size += sizeof(bot_randomstring_t) + strlen(chatmessagestring) + 1;
+ len = (strlen(chatmessagestring) + 1 +sizeof(void*)-1) & ~(sizeof(void*)-1);
+ size += sizeof(bot_randomstring_t) + len;
if (pass)
{
randomstring = (bot_randomstring_t *) ptr;
ptr += sizeof(bot_randomstring_t);
randomstring->string = ptr;
- ptr += strlen(chatmessagestring) + 1;
+ ptr += len;
strcpy(randomstring->string, chatmessagestring);
//
random->numstrings++;
@@ -2125,7 +2129,7 @@ bot_chat_t *BotLoadInitialChat(char *chatfile, char *chatname)
ptr += sizeof(bot_chatmessage_t);
chatmessage->chatmessage = ptr;
strcpy(chatmessage->chatmessage, chatmessagestring);
- ptr += strlen(chatmessagestring) + 1;
+ ptr += (strlen(chatmessagestring) + 1 +sizeof(void*)-1) & ~(sizeof(void*)-1);
//the number of chat messages increased
chattype->numchatmessages++;
} //end if