mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-07 17:29:36 +00:00
misaligment fixes
This commit is contained in:
@@ -560,7 +560,7 @@ int SaveReadNameAndComment( FileHandle_t f, OUT_Z_CAP(nameSize) char *name, int
|
||||
int nNumberOfFields;
|
||||
|
||||
char *pData;
|
||||
int nFieldSize;
|
||||
short nFieldSize;
|
||||
|
||||
pData = pSaveData;
|
||||
|
||||
@@ -580,9 +580,12 @@ int SaveReadNameAndComment( FileHandle_t f, OUT_Z_CAP(nameSize) char *name, int
|
||||
pTokenList = NULL;
|
||||
|
||||
// short, short (size, index of field name)
|
||||
nFieldSize = *(short *)pData;
|
||||
memcpy( &nFieldSize, pData, sizeof(short) );
|
||||
|
||||
pData += sizeof(short);
|
||||
pFieldName = pTokenList[ *(short *)pData ];
|
||||
short index;
|
||||
memcpy( &index, pData, sizeof(short) );
|
||||
pFieldName = pTokenList[index];
|
||||
|
||||
if (stricmp(pFieldName, "GameHeader"))
|
||||
{
|
||||
@@ -592,7 +595,7 @@ int SaveReadNameAndComment( FileHandle_t f, OUT_Z_CAP(nameSize) char *name, int
|
||||
|
||||
// int (fieldcount)
|
||||
pData += sizeof(short);
|
||||
nNumberOfFields = *(int*)pData;
|
||||
memcpy( &nNumberOfFields, pData, sizeof(int) );
|
||||
pData += nFieldSize;
|
||||
|
||||
// Each field is a short (size), short (index of name), binary string of "size" bytes (data)
|
||||
@@ -603,10 +606,12 @@ int SaveReadNameAndComment( FileHandle_t f, OUT_Z_CAP(nameSize) char *name, int
|
||||
// szName
|
||||
// Actual Data
|
||||
|
||||
nFieldSize = *(short *)pData;
|
||||
memcpy( &nFieldSize, pData, sizeof(short) );
|
||||
pData += sizeof(short);
|
||||
|
||||
pFieldName = pTokenList[ *(short *)pData ];
|
||||
short index;
|
||||
memcpy( &index, pData, sizeof(short));
|
||||
pFieldName = pTokenList[index];
|
||||
pData += sizeof(short);
|
||||
|
||||
if (!stricmp(pFieldName, "comment"))
|
||||
|
||||
Reference in New Issue
Block a user