Ruby: ext/zlib/zlib-1.2.13/contrib/puff/puff.c File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Data Structures | Macros | Functions
puff.c File Reference
`#include <setjmp.h>`
`#include "puff.h"`

Go to the source code of this file.

## Data Structures
struct | state
struct | huffman

## Macros
#define | local static /* for local function definitions */
#define | MAXBITS 15 /* maximum bits in a code */
#define | MAXLCODES 286 /* maximum number of literal/length codes */
#define | MAXDCODES 30 /* maximum number of distance codes */
#define | MAXCODES (MAXLCODES+MAXDCODES) /* maximum codes lengths to read */
#define | FIXLCODES 288 /* number of fixed literal/length codes */

## Functions
int | bits (struct state *s, int need)
int | stored (struct state *s)
int | decode (struct state *s, const struct huffman *h)
int | construct (struct huffman *h, const short *length, int n)
int | codes (struct state *s, const struct huffman *lencode, const struct huffman *distcode)
int | fixed (struct state *s)
int | dynamic (struct state *s)
int | puff (unsigned char *dest, unsigned long *destlen, const unsigned char *source, unsigned long *sourcelen)

## Macro Definition Documentation

## ◆ FIXLCODES

#define FIXLCODES 288 /* number of fixed literal/length codes */

Definition at line 95 of file puff.c.

## ◆ local

#define local static /* for local function definitions */

Definition at line 85 of file puff.c.

## ◆ MAXBITS

#define MAXBITS 15 /* maximum bits in a code */

Definition at line 91 of file puff.c.

## ◆ MAXCODES

#define MAXCODES (MAXLCODES+MAXDCODES) /* maximum codes lengths to read */

Definition at line 94 of file puff.c.

## ◆ MAXDCODES

#define MAXDCODES 30 /* maximum number of distance codes */

Definition at line 93 of file puff.c.

## ◆ MAXLCODES

#define MAXLCODES 286 /* maximum number of literal/length codes */

Definition at line 92 of file puff.c.

## Function Documentation

## ◆ bits()

int bits | ( | struct state * | s,
|  | int | need
| ) |  |

Definition at line 126 of file puff.c.

References state::bitbuf, state::bitcnt, state::env, state::in, state::incnt, state::inlen, int(), and long().

Referenced by codes(), dynamic(), and puff().

## ◆ codes()

int codes | ( | struct state * | s,
|  | const struct huffman * | lencode,
|  | const struct huffman * | distcode
| ) |  |

Definition at line 436 of file puff.c.

References bits(), decode(), len, NIL, state::out, state::outcnt, and state::outlen.

Referenced by dynamic(), fixed(), inflate_table(), and inflate_table9().

## ◆ construct()

int construct | ( | struct huffman * | h,
|  | const short * | length,
|  | int | n
| ) |  |

Definition at line 340 of file puff.c.

References huffman::count, len, MAXBITS, and huffman::symbol.

Referenced by dynamic(), and fixed().

## ◆ decode()

int decode | ( | struct state * | s,
|  | const struct huffman * | h
| ) |  |

Definition at line 263 of file puff.c.

References state::bitbuf, state::bitcnt, count, huffman::count, state::env, state::in, state::incnt, state::inlen, len, MAXBITS, and huffman::symbol.

Referenced by codes(), and dynamic().

## ◆ dynamic()

int dynamic | ( | struct state * | s | ) |

Definition at line 665 of file puff.c.

References bits(), codes(), construct(), huffman::count, decode(), err, len, MAXBITS, MAXCODES, MAXDCODES, MAXLCODES, and huffman::symbol.

Referenced by puff().

## ◆ fixed()

int fixed | ( | struct state * | s | ) |

Definition at line 536 of file puff.c.

References codes(), construct(), huffman::count, FIXLCODES, MAXBITS, MAXDCODES, and huffman::symbol.

Referenced by fixedtables(), and puff().

## ◆ puff()

int puff | ( | unsigned char * | dest,
|  | unsigned long * | destlen,
|  | const unsigned char * | source,
|  | unsigned long * | sourcelen
| ) |  |

Definition at line 793 of file puff.c.

References state::bitbuf, state::bitcnt, bits(), dynamic(), state::env, err, fixed(), state::in, state::incnt, state::inlen, last, state::out, state::outcnt, state::outlen, and stored().

Referenced by main().

## ◆ stored()

int stored | ( | struct state * | s | ) |

Definition at line 164 of file puff.c.

References state::bitbuf, state::bitcnt, state::in, state::incnt, state::inlen, len, NIL, state::out, state::outcnt, and state::outlen.

Referenced by puff().