(svn r3948) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help). Backport of r3529, r3553 from trunk

This commit is contained in:
Darkvater
2006-03-18 15:12:24 +00:00
parent 8353c1260a
commit 5f2e2ef32a
5 changed files with 29 additions and 23 deletions

View File

@@ -499,6 +499,7 @@ static char *FormatString(char *buff, const char *str, const int32 *argv, uint c
break;
case 0x81: // {STRINL}
buff = GetStringWithArgs(buff, ReadLE16Unaligned(str), argv);
str += 2;
buff = GetStringWithArgs(buff, READ_LE_UINT16(str-2), argv);
break;
@@ -1013,7 +1014,7 @@ bool ReadLanguagePack(int lang_index)
#if defined(TTD_BIG_ENDIAN)
for (i = 0; i != 32; i++) {
lang_pack->offsets[i] = READ_LE_UINT16(&lang_pack->offsets[i]);
lang_pack->offsets[i] = ReadLE16Aligned(&lang_pack->offsets[i]);
}
#endif