/*-
* Copyright (c) 1996, 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matthias Drochner. and UCHIYAMA Yasushi.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
class FileManager : public File {
// GZIP staff
#define Z_BUFSIZE 1024
private:
enum flags {
ASCII_FLAG = 0x01, /* bit 0 set: file probably ascii text */
HEAD_CRC = 0x02, /* bit 1 set: header CRC present */
EXTRA_FIELD = 0x04, /* bit 2 set: extra field present */
ORIG_NAME = 0x08, /* bit 3 set: original file name present */
COMMENT = 0x10, /* bit 4 set: file comment present */
RESERVED = 0xE0 /* bits 5..7: reserved */
};
struct z_stream_s *_stream;
int _gz_magic[2];
int _z_err; /* error code for last stream operation */
int _z_eof; /* set if end of input file */
uint8_t _inbuf[Z_BUFSIZE]; /* input buffer */
uint32_t _crc; /* crc32 of uncompressed data */
BOOL _compressed;
void _reset(void);
int _get_byte(void);
uint32_t _get_long(void);
void _check_header(void);
size_t _skip_compressed(off_t);