~ubuntu-branches/ubuntu/karmic/fastjar/karmic-security

1 by Matthias Klose
Import upstream version 0.95~pre1
1
/*
2
  zipfile.h - defines for indexing zipfile headers
3
  Copyright (C) 1999  Bryan Burns
4
  Copyright (C) 2007  Dalibor Topic
5
  
6
  This program is free software; you can redistribute it and/or
7
  modify it under the terms of the GNU General Public License
8
  as published by the Free Software Foundation; either version 2
9
  of the License, or (at your option) any later version.
10
  
11
  This program is distributed in the hope that it will be useful,
12
  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
  GNU General Public License for more details.
15
  
16
  You should have received a copy of the GNU General Public License
17
  along with this program; if not, write to the Free Software
18
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19
 */
20
21
#ifndef __FASTJAR_ZIPFILE_H__
22
#define __FASTJAR_ZIPFILE_H__
23
 
24
#define LOC_EXTRA   6  /* extra bytes */
25
#define LOC_COMP    8  /* compression method */
26
#define LOC_MODTIME 10 /* last modification time */
27
#define LOC_MODDATE 12 /* last modification date */
28
#define LOC_CRC     14 /* CRC */
29
#define LOC_CSIZE   18 /* compressed size */
30
#define LOC_USIZE   22 /* uncompressed size */
31
#define LOC_FNLEN   26 /* filename length */
32
#define LOC_EFLEN   28 /* extra-field length */
33
34
#define CEN_FLAGS    8
35
#define CEN_COMP    10 /* compression method */
36
#define CEN_MODTIME 12
37
#define CEN_MODDATE 14
38
#define CEN_CRC     16
39
#define CEN_CSIZE   20
40
#define CEN_USIZE   24
41
#define CEN_FNLEN   28
42
#define CEN_EFLEN   30
43
#define CEN_COMLEN  32
44
#define CEN_OFFSET  42
45
46
47
/* macros */
48
#define PACK_UB4(d, o, v) d[o] = (ub1)((v) & 0x000000ff); \
49
                          d[o + 1] = (ub1)(((v) & 0x0000ff00) >> 8); \
50
                          d[o + 2] = (ub1)(((v) & 0x00ff0000) >> 16); \
51
                          d[o + 3] = (ub1)(((v) & 0xff000000) >> 24)
52
53
#define PACK_UB2(d, o, v) d[o] = (ub1)((v) & 0x00ff); \
54
                          d[o + 1] = (ub1)(((v) & 0xff00) >> 8)
55
56
#define UNPACK_UB4(s, o) (ub4)s[o] + (((ub4)s[o + 1]) << 8) +\
57
                         (((ub4)s[o + 2]) << 16) + (((ub4)s[o + 3]) << 24)
58
59
#define UNPACK_UB2(s, o)  (ub2)s[o] + (((ub2)s[o + 1]) << 8)
60
61
#endif /* __FASTJAR_ZIPFILE_H__ */