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 <string.h>
27 #include "wv.h"
28 
29 void
wvGetDCS_internal(DCS * item,wvStream * fd,U8 * pointer)30 wvGetDCS_internal (DCS * item, wvStream * fd, U8 * pointer)
31 {
32     U16 temp16;
33     temp16 = dread_16ubit (fd, &pointer);
34     item->fdct = temp16 & 0x0007;
35     item->count = (temp16 & 0x00F8) >> 3;
36     item->reserved = (temp16 & 0xff00) >> 8;
37 }
38 
39 void
wvGetDCS(DCS * item,wvStream * fd)40 wvGetDCS (DCS * item, wvStream * fd)
41 {
42     wvGetDCS_internal (item, fd, NULL);
43 }
44 
45 void
wvGetDCSFromBucket(DCS * item,U8 * pointer)46 wvGetDCSFromBucket (DCS * item, U8 * pointer)
47 {
48     wvGetDCS_internal (item, NULL, pointer);
49 }
50 
51 void
wvCopyDCS(DCS * dest,DCS * src)52 wvCopyDCS (DCS * dest, DCS * src)
53 {
54     memcpy (dest, src, sizeof (DCS));
55 }
56 
57 void
wvInitDCS(DCS * item)58 wvInitDCS (DCS * item)
59 {
60     item->fdct = 0;
61     item->count = 0;
62     item->reserved = 0;
63 }
64