1 /* wvWare
2  * Copyright (C) Caolan McNamara, Dom Lachowicz, and others
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17  * 02111-1307, USA.
18  */
19 
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
23 
24 #include <stdlib.h>
25 #include <stdio.h>
26 #include "wv.h"
27 #include "wvinternal.h"
28 
29 void
wvInitOLST(OLST * item)30 wvInitOLST (OLST * item)
31 {
32     U8 i;
33     for (i = 0; i < 9; i++)
34 	wvInitANLV (&item->rganlv[i]);
35     item->fRestartHdr = 0;
36     item->fSpareOlst2 = 0;
37     item->fSpareOlst3 = 0;
38     item->fSpareOlst4 = 0;
39     for (i = 0; i < 64; i++)
40 	item->rgxch[i] = 0;
41 }
42 
43 
44 void
wvGetOLST_internal(wvVersion ver,OLST * item,wvStream * fd,U8 * pointer)45 wvGetOLST_internal (wvVersion ver, OLST * item, wvStream * fd, U8 * pointer)
46 {
47     U8 i;
48     for (i = 0; i < 9; i++)
49 	wvGetANLV_internal (&item->rganlv[i], fd, pointer);
50     item->fRestartHdr = dread_8ubit (fd, &pointer);
51     item->fSpareOlst2 = dread_8ubit (fd, &pointer);
52     item->fSpareOlst3 = dread_8ubit (fd, &pointer);
53     item->fSpareOlst4 = dread_8ubit (fd, &pointer);
54     if (ver == WORD8)
55       {
56 	  for (i = 0; i < 32; i++)
57 	      item->rgxch[i] = dread_16ubit (fd, &pointer);
58       }
59     else
60       {
61 	  for (i = 0; i < 64; i++)
62 	      item->rgxch[i] = dread_8ubit (fd, &pointer);
63       }
64 }
65 
66 void
wvGetOLST(wvVersion ver,OLST * item,wvStream * fd)67 wvGetOLST (wvVersion ver, OLST * item, wvStream * fd)
68 {
69     wvGetOLST_internal (ver, item, fd, NULL);
70 }
71 
72 void
wvGetOLSTFromBucket(wvVersion ver,OLST * item,U8 * pointer)73 wvGetOLSTFromBucket (wvVersion ver, OLST * item, U8 * pointer)
74 {
75     wvGetOLST_internal (ver, item, NULL, pointer);
76 }
77