fixed a possible crash within snapshot handling and some misspellings. Closes #1382

This commit is contained in:
oy 2015-08-23 19:19:36 +02:00
parent d41c4b4dbd
commit b5095427b2
2 changed files with 7 additions and 5 deletions

View file

@ -330,6 +330,8 @@ int CSnapshotDelta::UnpackDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pSrcData
return -1;
Type = *pData++;
if(Type < 0)
return -1;
ID = *pData++;
if(m_aItemSizes[Type])
ItemSize = m_aItemSizes[Type];
@ -355,7 +357,7 @@ int CSnapshotDelta::UnpackDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pSrcData
FromIndex = pFrom->GetItemIndex(Key);
if(FromIndex != -1)
{
// we got an update so we need pTo apply the diff
// we got an update so we need to apply the diff
UndiffItem((int *)pFrom->GetItem(FromIndex)->Data(), pData, pNewData, ItemSize/4);
m_aSnapshotDataUpdates[m_SnapshotCurrent]++;
}
@ -527,10 +529,10 @@ int *CSnapshotBuilder::GetItemData(int Key)
return 0;
}
int CSnapshotBuilder::Finish(void *SpnapData)
int CSnapshotBuilder::Finish(void *pSpnapData)
{
// flattern and make the snapshot
CSnapshot *pSnap = (CSnapshot *)SpnapData;
CSnapshot *pSnap = (CSnapshot *)pSpnapData;
int OffsetSize = sizeof(int)*m_NumItems;
pSnap->m_DataSize = m_DataSize;
pSnap->m_NumItems = m_NumItems;

View file

@ -107,7 +107,7 @@ public:
void PurgeAll();
void PurgeUntil(int Tick);
void Add(int Tick, int64 Tagtime, int DataSize, void *pData, int CreateAlt);
int Get(int Tick, int64 *Tagtime, CSnapshot **pData, CSnapshot **ppAltData);
int Get(int Tick, int64 *pTagtime, CSnapshot **ppData, CSnapshot **ppAltData);
};
class CSnapshotBuilder
@ -132,7 +132,7 @@ public:
CSnapshotItem *GetItem(int Index);
int *GetItemData(int Key);
int Finish(void *Snapdata);
int Finish(void *pSnapdata);
};