ReactOS  0.4.14-dev-98-gb0d4763
infutil.c File Reference
#include "zutil.h"
#include "infblock.h"
#include "inftrees.h"
#include "infcodes.h"
#include "infutil.h"
Include dependency graph for infutil.c:

Go to the source code of this file.

Functions

int inflate_flush (inflate_blocks_statef *s, z_streamp z, int r)
 

Variables

const uInt inflate_mask [17]
 

Function Documentation

◆ inflate_flush()

int inflate_flush ( inflate_blocks_statef s,
z_streamp  z,
int  r 
)

Definition at line 22 of file infutil.c.

26 {
27  uInt n;
28  Bytef *p;
29  Bytef *q;
30 
31  /* local copies of source and destination pointers */
32  p = z->next_out;
33  q = s->read;
34 
35  /* compute number of bytes to copy as far as end of window */
36  n = (uInt)((q <= s->write ? s->write : s->end) - q);
37  if (n > z->avail_out) n = z->avail_out;
38  if (n && r == Z_BUF_ERROR) r = Z_OK;
39 
40  /* update counters */
41  z->avail_out -= n;
42  z->total_out += n;
43 
44  /* update check information */
45  if (s->checkfn != Z_NULL)
46  z->adler = s->check = (*s->checkfn)(s->check, q, n);
47 
48  /* copy as far as end of window */
49  zmemcpy(p, q, n);
50  p += n;
51  q += n;
52 
53  /* see if more to copy at beginning of window */
54  if (q == s->end)
55  {
56  /* wrap pointers */
57  q = s->window;
58  if (s->write == s->end)
59  s->write = s->window;
60 
61  /* compute bytes to copy */
62  n = (uInt)(s->write - q);
63  if (n > z->avail_out) n = z->avail_out;
64  if (n && r == Z_BUF_ERROR) r = Z_OK;
65 
66  /* update counters */
67  z->avail_out -= n;
68  z->total_out += n;
69 
70  /* update check information */
71  if (s->checkfn != Z_NULL)
72  z->adler = s->check = (*s->checkfn)(s->check, q, n);
73 
74  /* copy */
75  zmemcpy(p, q, n);
76  p += n;
77  q += n;
78  }
79 
80  /* update pointers */
81  z->next_out = p;
82  s->read = q;
83 
84  /* done */
85  return r;
86 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble n
Definition: glext.h:7729
Byte FAR Bytef
Definition: zconf.h:400
#define write
Definition: acwin.h:97
#define Z_BUF_ERROR
Definition: zlib.h:184
#define Z_OK
Definition: zlib.h:177
GLdouble GLdouble z
Definition: glext.h:5874
void zmemcpy(Bytef *dest, const Bytef *source, uInt len)
Definition: zutil.c:17
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLdouble s
Definition: gl.h:2039
GLfloat GLfloat p
Definition: glext.h:8902
#define Z_NULL
Definition: zlib.h:212
unsigned int uInt
Definition: zconf.h:393

Referenced by inflate_blocks().

Variable Documentation

◆ inflate_mask

const uInt inflate_mask[17]
Initial value:
= {
0x0000,
0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
}

Definition at line 14 of file infutil.c.

Referenced by inflate_blocks(), and inflate_codes().