forked from derandark/DungeonViewerAC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPackObj.cpp
45 lines (35 loc) · 754 Bytes
/
PackObj.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "StdAfx.h"
#include "PackObj.h"
PackObj::PackObj()
{
}
PackObj::~PackObj()
{
}
ULONG PackObj::GetPackSize()
{
return pack_size();
}
ULONG PackObj::pack_size()
{
return 0;
}
BOOL PackObj::ALIGN_PTR(BYTE** ppData, ULONG* piSize)
{
size_t alignBytes = 4 - (((size_t)*ppData) & 3);
if (alignBytes != 4)
{
if ((*piSize) < alignBytes)
return FALSE; // Not enough room.
// Adjust the size.
*piSize = (*piSize) - alignBytes;
// Write null bytes on the padding. (ugly, matches turbine -- this can be changed later?)
while (alignBytes > 0)
{
*(*ppData) = 0;
*ppData = *ppData + 1;
alignBytes--;
}
}
return TRUE;
}