-
Notifications
You must be signed in to change notification settings - Fork 0
/
TagInstance.cpp
53 lines (46 loc) · 1.13 KB
/
TagInstance.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
/*
* File: TagInstance.cpp
* Author: brucewang
*
* Created on October 27, 2009, 6:31 PM
*/
#include "TagInstance.h"
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
TagInstance::TagInstance() {
binbuff=0;
}
TagInstance::TagInstance(const TagInstance& orig) {
binbuff=0;
}
TagInstance::~TagInstance() {
if(binbuff) free(binbuff);
}
ulong TagInstance::GetLength(void){
return this->length;
}
void TagInstance::SetLength(ulong len){
this->length = len;
}
/*
* Virtual function
* */
void TagInstance::ReadData(SWFReader *swf, int length){
binbuff = (byte*)malloc(length);
// For now, just skip the remainder of the tag
// ** This is normally where you'd process each tag in the file **
for (ulong index = 0; index < length; index++) {
binbuff[index] = swf->ReadByte();
}
}
/*
* Virtual function
* */
void TagInstance::WriteData(SWFWriter *swf, int length){
// For now, just skip the remainder of the tag
// ** This is normally where you'd process each tag in the file **
for (ulong index = 0; index < length; index++) {
swf->WriteByte( binbuff[index] );
}
}