FireBirdLib - Topfield TMS PVR TAP Programming Library
TFDSize.c
Go to the documentation of this file.
1
#include "
libFireBird.h
"
2
#include "
FBLib_compression.h
"
3
4
dword
TFDSize
(
byte
*pTFD)
5
{
6
TRACEENTER
();
7
8
word NrBlocks = 0;
9
dword i;
10
byte
*p = pTFD;
11
12
if
(!pTFD)
13
{
14
TRACEEXIT
();
15
return
0;
16
}
17
18
if
(
LOAD_WORD
(p) != 8)
19
{
20
//Invalid header
21
TRACEEXIT
();
22
return
0;
23
}
24
25
if
(
CRC16
(0, p + 4, 6) !=
LOAD_WORD
(p + 2))
26
{
27
//Invalid header CRC
28
TRACEEXIT
();
29
return
0;
30
}
31
32
if
(
LOAD_WORD
(p + 6) != 1)
33
{
34
//Invalid file version
35
TRACEEXIT
();
36
return
0;
37
}
38
39
NrBlocks =
LOAD_WORD
(p + 8);
40
p += 10;
41
for
(i = 0; i < NrBlocks; i++)
42
p +=
LOAD_WORD
(p) + 2;
43
44
TRACEEXIT
();
45
return
p - pTFD;
46
}
CRC16
word CRC16(word StartValue, void *StartAddress, dword Length)
Definition:
CRC16.c:23
FBLib_compression.h
LOAD_WORD
#define LOAD_WORD(x)
Definition:
FBLib_compression.h:25
TFDSize
dword TFDSize(byte *pTFD)
Definition:
TFDSize.c:4
libFireBird.h
TRACEEXIT
#define TRACEEXIT()
Definition:
libFireBird.h:1244
TRACEENTER
#define TRACEENTER()
Definition:
libFireBird.h:1243
compression
TFDSize.c
Generated on Fri Apr 29 2022 13:34:00 for FireBirdLib - Topfield TMS PVR TAP Programming Library by
1.9.3