-
Notifications
You must be signed in to change notification settings - Fork 0
/
ByteSection.cpp
73 lines (60 loc) · 1 KB
/
ByteSection.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include "ByteSection.h"
ByteSection::~ByteSection()
{
}
void ByteSection::insert(char c)
{
dw[cnt++] = c;
if (cnt == 4)
{
Table<dword>::endInsert(dw);
cnt = 0;
}
}
void ByteSection::endInsert(dword dw)
{
for (int i = 3; i >= 0; i--)
{
insert(dw[i]);
}
}
void ByteSection::insertWord(char* w)
{
for(int i = 1; i >= 0; i--) // i = 2?
{
insert(w[i]);
}
}
void ByteSection::replace(dword dw, int offset)
{
dword *tek;
resetIterator();
for (int i = 0; i < offset / INS_SIZE; i++)
iteratorNext();
tek = getItEntPointer();
tek->sumOr(dw);
}
void ByteSection::outTab(ofstream *output)
{
ofstream &out = *output;
// dopunjavanje do 4 bajta
/*for (int i = cnt; i < 4; i++)
{
dw[i] = 0;
}
endInsert(dw);
cnt = 0;*/
out << "#" << this->getName() << endl;
dword *tek;
int i=0;
for (resetIterator(); getBoolIt(); iteratorNext())
{
tek = getItEntPointer();
tek->outDword(output);
out << " ";
if ((i % 4) == 3) out << endl;
i++;
}
if(i == 0) out << "(empty)";
out << endl;
}