ZLIB
Loading...
Searching...
No Matches
gzread.c File Reference

Functions for reading gzip files. More...

#include "gzguts.h"

Functions

local int gz_load (gz_statep state, unsigned char *buf, unsigned len, unsigned *have)
 Use read() to load a buffer – return -1 on error, otherwise 0.
 
local int gz_avail (gz_statep state)
 Load up input buffer and set eof flag if last data loaded – return -1 on error, 0 otherwise.
 
local int gz_look (gz_statep state)
 
local int gz_decomp (gz_statep state)
 
local int gz_fetch (gz_statep state)
 
local int gz_skip (gz_statep state, z_off64_t len)
 
local z_size_t gz_read (gz_statep state, voidp buf, z_size_t len)
 
int ZEXPORT gzread (gzFile file, voidp buf, unsigned len)
 Read and decompress up to len uncompressed bytes from file into buf.
 
z_size_t ZEXPORT gzfread (voidp buf, z_size_t size, z_size_t nitems, gzFile file)
 Read and decompress up to nitems items of size size from file into buf, otherwise operating as gzread() does.
 
int ZEXPORT gzgetc (gzFile file)
 Read and decompress one byte from file.
 
int ZEXPORT gzgetc_ (gzFile file)
 
int ZEXPORT gzungetc (int c, gzFile file)
 Push c back onto the stream for file to be read as the first character on the next read.
 
char *ZEXPORT gzgets (gzFile file, char *buf, int len)
 Read and decompress bytes from file into buf, until len-1 characters are read, or until a newline character is read and transferred to buf, or an end-of-file condition is encountered.
 
int ZEXPORT gzdirect (gzFile file)
 Return true (1) if file is being copied directly while reading, or false (0) if file is a gzip stream being decompressed.
 
int ZEXPORT gzclose_r (gzFile file)
 Same as gzclose(), but gzclose_r() is only for use when reading, and gzclose_w() is only for use when writing or appending.
 

Detailed Description

Functions for reading gzip files.

Copyright (C) 2004-2017 Mark Adler For conditions of distribution and use, see copyright notice in zlib.h

Function Documentation

◆ gz_avail()

local int gz_avail ( gz_statep  state)

Load up input buffer and set eof flag if last data loaded – return -1 on error, 0 otherwise.

Note that the eof flag is set when the end of the input file is reached, even though there may be unused data in the buffer. Once that data has been used, no more attempts will be made to read the file. If strm->avail_in != 0, then the current data is moved to the beginning of the input buffer, and then the remainder of the buffer is loaded with the available data from the input file.

◆ gz_load()

local int gz_load ( gz_statep  state,
unsigned char *  buf,
unsigned  len,
unsigned *  have 
)

Use read() to load a buffer – return -1 on error, otherwise 0.

Read from state->fd, and update state->eof, state->err, and state->msg as appropriate. This function needs to loop on read(), since read() is not guaranteed to read the number of bytes requested, depending on the type of descriptor.