gzip.h #1

  • //
  • guest/
  • perforce_software/
  • p4/
  • 2014_1/
  • zlib/
  • gzip.h
  • View
  • Commits
  • Open Download .zip Download (1 KB)
/*
 * Copyright 1995, 2003 Perforce Software.  All rights reserved.
 *
 * This file is part of Perforce - the FAST SCM System.
 */

/*
 * gzip.h - a Gzip class for producing gzip streams
 *
 * Classes Defined:
 *
 *	Gzip - a compressor/uncompressor
 *
 * Public variables:
 *
 *	buf[4096] - convenient buffer for input or output 
 *			Not used internally, but is/os can point there.
 *
 *	is, ie - start and end of input buffer
 *	os, oe - start and end of output buffer
 *
 * Public methods:
 *
 *	Compress() - compress data in is->ie into os->oe.
 *			Set is = 0 to flush.  Returns 0 when
 *			flushing complete.
 *
 *	Uncompress() - expand data in is->ie into os->oe.
 *			Returns 0 when uncompression complete.
 *
 *	InputEmpty() - Available input consumed.  
 *			Always returns 0 when flushing.
 *
 *	OutputFull() - Available output full.
 */

typedef struct z_stream_s z_stream;

class Gzip
{
    public:
			Gzip();
			~Gzip();

	int		Compress( Error *e );
	int		Uncompress( Error *e );

	// input/output start/end

	const char 	*is, *ie;
	char 		*os, *oe;

	int		InputEmpty() { return is && is == ie; }
	int		OutputFull() { return os == oe; }

    private:

	z_stream	*zstream;
	int		isInflate;
	int		isDeflate;
	int		state;

	// temp buffer writing

	char		*ws, *we;

	unsigned long	crc;
	char		tmpbuf[10];	// sizeof gz_magic

	// header handling 

	int		hflags;
	int		hxlen;

} ;
# Change User Description Committed
#2 15902 Matt Attaway A second renaming that I will not obliterate as a badge of shame
#1 15901 Matt Attaway Clean up code to fit modern Workshop naming standards
//guest/perforce_software/p4/2014.1/zlib/gzip.h
#1 12188 Matt Attaway Move 'main' p4 into a release specific directory in prep for new releases
//guest/perforce_software/p4/zlib/gzip.h
#1 9129 Matt Attaway Initial commit of the 2014.1 p4/p4api source code