source: svn/newcon3bcm2_21bu/dst/dlib/src/ZLIB/infutil.c

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1/*
2 * $Id: //suprahd/releases/suprahd_163/suprahd_ztvapp640_163/drivers/graphics/ZLIB/infutil.c#1 $
3 * $Revision: #1 $
4 * $DateTime: 2006/02/24 17:51:46 $
5 * $Change: 42566 $
6 * $Author: pryush.sharma $
7 */
8
9/* inflate_util.c -- data and routines common to blocks and codes
10 * Copyright (C) 1995-1998 Mark Adler
11 * For conditions of distribution and use, see copyright notice in zlib.h
12 */
13
14#include "zutil.h"
15#include "infblock.h"
16#include "inftrees.h"
17#include "infcodes.h"
18#include "infutil.h"
19
20struct inflate_codes_state {int dummy;}; /* for buggy compilers */
21
22/* And'ing with mask[n] masks the lower n bits */
23uInt inflate_mask[17] = {
24    0x0000,
25    0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
26    0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
27};
28
29
30/* copy as much as possible from the sliding window to the output area */
31int inflate_flush(
32    inflate_blocks_statef *s,
33    z_streamp z,
34    int r)
35{
36  uInt n;
37  Bytef *p;
38  Bytef *q;
39
40  /* local copies of source and destination pointers */
41  p = z->next_out;
42  q = s->read;
43
44  /* compute number of bytes to copy as far as end of window */
45  n = (uInt)((q <= s->write ? s->write : s->end) - q);
46  if (n > z->avail_out) n = z->avail_out;
47  if (n && r == Z_BUF_ERROR) r = Z_OK;
48
49  /* update counters */
50  z->avail_out -= n;
51  z->total_out += n;
52
53  /* update check information */
54  if (s->checkfn != Z_NULL)
55    z->adler = s->check = (*s->checkfn)(s->check, q, n);
56
57  /* copy as far as end of window */
58  zmemcpy(p, q, n);
59  p += n;
60  q += n;
61
62  /* see if more to copy at beginning of window */
63  if (q == s->end)
64  {
65    /* wrap pointers */
66    q = s->window;
67    if (s->write == s->end)
68      s->write = s->window;
69
70    /* compute bytes to copy */
71    n = (uInt)(s->write - q);
72    if (n > z->avail_out) n = z->avail_out;
73    if (n && r == Z_BUF_ERROR) r = Z_OK;
74
75    /* update counters */
76    z->avail_out -= n;
77    z->total_out += n;
78
79    /* update check information */
80    if (s->checkfn != Z_NULL)
81      z->adler = s->check = (*s->checkfn)(s->check, q, n);
82
83    /* copy */
84    zmemcpy(p, q, n);
85    p += n;
86    q += n;
87  }
88
89  /* update pointers */
90  z->next_out = p;
91  s->read = q;
92
93  /* done */
94  return r;
95}
Note: See TracBrowser for help on using the repository browser.