FireBirdLib - Topfield TMS PVR TAP Programming Library
EPGInfo_CalculateStructSize.c
Go to the documentation of this file.
1#include <stdlib.h>
2#include "FBLib_EPG.h"
3
5{
7
8 tTreeEntry *Entry, *ListStart;
9 dword MinStructSize, d;
10
11 if(EPGInfoStructSize == 0)
12 {
13 ListStart = (tTreeEntry*)*(dword*)Appl_GetEvtListHeadInUsePool();
14
15 //If the list points to itself, no data is available
16 if(ListStart != (tTreeEntry*)ListStart->Next)
17 {
18
19 //Loop until we're back at the beginning of the pool
20 MinStructSize = 0xffffffff;
21 Entry = ListStart;
22 do
23 {
24 d = abs((dword)Entry - *Entry->Next);
25 if((d != 0) && (d < MinStructSize)) MinStructSize = d;
26
27 Entry = (tTreeEntry*)Entry->Next;
28 } while(Entry && (Entry->Next != ListStart->Prev));
29
30 if((MinStructSize != 0xffffffff) & (MinStructSize != 0))
31 {
32 EPGInfoStructSize = MinStructSize;
33 }
34 }
35 }
36
37 TRACEEXIT();
38 return EPGInfoStructSize;
39}
dword * Appl_GetEvtListHeadInUsePool(void)
dword EPGInfo_CalculateStructSize(void)
dword EPGInfoStructSize
#define TRACEEXIT()
Definition: libFireBird.h:1244
#define TRACEENTER()
Definition: libFireBird.h:1243
dword * Next
Definition: FBLib_EPG.h:36
dword * Prev
Definition: FBLib_EPG.h:37