/* function prototypes */
local int inflateStateCheck OF((z_streamp strm));
local void fixedtables OF((struct inflate_state FAR *state));
local int updatewindow OF((z_streamp strm, constunsignedchar FAR *end, unsigned copy)); #ifdef BUILDFIXED void makefixed OF((void)); #endif
local unsigned syncsearch OF((unsigned FAR *have, constunsignedchar FAR *buf, unsigned len));
local int inflateStateCheck(strm)
z_streamp strm;
{ struct inflate_state FAR *state; if (strm == Z_NULL ||
strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) return1;
state = (struct inflate_state FAR *)strm->state; if (state == Z_NULL || state->strm != strm ||
state->mode < HEAD || state->mode > SYNC) return1; return0;
}
int ZEXPORT inflateResetKeep(strm)
z_streamp strm;
{ struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state;
strm->total_in = strm->total_out = state->total = 0;
strm->msg = Z_NULL; if (state->wrap) /* to support ill-conceived Java test suite */
strm->adler = state->wrap & 1;
state->mode = HEAD;
state->last = 0;
state->havedict = 0;
state->flags = -1;
state->dmax = 32768U;
state->head = Z_NULL;
state->hold = 0;
state->bits = 0;
state->lencode = state->distcode = state->next = state->codes;
state->sane = 1;
state->back = -1;
Tracev((stderr, "inflate: reset\n")); return Z_OK;
}
int ZEXPORT inflateReset(strm)
z_streamp strm;
{ struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state;
state->wsize = 0;
state->whave = 0;
state->wnext = 0; return inflateResetKeep(strm);
}
int ZEXPORT inflateReset2(strm, windowBits)
z_streamp strm; int windowBits;
{ int wrap; struct inflate_state FAR *state;
/* get the state */ if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state;
/* set number of window bits, free window if different */ if (windowBits && (windowBits < 8 || windowBits > 15)) return Z_STREAM_ERROR; if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
ZFREE(strm, state->window);
state->window = Z_NULL;
}
/* update state and reset the rest of it */
state->wrap = wrap;
state->wbits = (unsigned)windowBits; return inflateReset(strm);
}
int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
z_streamp strm; int windowBits; constchar *version; int stream_size;
{ int ret; struct inflate_state FAR *state;
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
stream_size != (int)(sizeof(z_stream))) return Z_VERSION_ERROR; if (strm == Z_NULL) return Z_STREAM_ERROR;
strm->msg = Z_NULL; /* in case we return an error */ if (strm->zalloc == (alloc_func)0) { #ifdef Z_SOLO return Z_STREAM_ERROR; #else
strm->zalloc = zcalloc;
strm->opaque = (voidpf)0; #endif
} if (strm->zfree == (free_func)0) #ifdef Z_SOLO return Z_STREAM_ERROR; #else
strm->zfree = zcfree; #endif
state = (struct inflate_state FAR *)
ZALLOC(strm, 1, sizeof(struct inflate_state)); if (state == Z_NULL) return Z_MEM_ERROR;
Tracev((stderr, "inflate: allocated\n"));
strm->state = (struct internal_state FAR *)state;
state->strm = strm;
state->window = Z_NULL;
state->mode = HEAD; /* to pass state test in inflateReset2() */
ret = inflateReset2(strm, windowBits); if (ret != Z_OK) {
ZFREE(strm, state);
strm->state = Z_NULL;
} return ret;
}
int ZEXPORT inflateInit_(strm, version, stream_size)
z_streamp strm; constchar *version; int stream_size;
{ return inflateInit2_(strm, DEF_WBITS, version, stream_size);
}
int ZEXPORT inflatePrime(strm, bits, value)
z_streamp strm; int bits; int value;
{ struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state; if (bits < 0) {
state->hold = 0;
state->bits = 0; return Z_OK;
} if (bits > 16 || state->bits + (uInt)bits > 32) return Z_STREAM_ERROR;
value &= (1L << bits) - 1;
state->hold += (unsigned)value << state->bits;
state->bits += (uInt)bits; return Z_OK;
}
Providingoutputbufferslargerthan32Ktoinflate()shouldprovideaspeed advantage,sinceonlythelast32Kofoutputiscopiedtotheslidingwindow uponreturnfrominflate(),andsincealldistancesafterthefirst32Kof outputwillfallintheoutputdata,makingmatchcopiessimplerandfaster. Theadvantagemaybedependentonthesizeoftheprocessor'sdatacaches.
*/
local int updatewindow(strm, end, copy)
z_streamp strm; const Bytef *end; unsigned copy;
{ struct inflate_state FAR *state; unsigned dist;
state = (struct inflate_state FAR *)strm->state;
/* if it hasn't been done already, allocate space for the window */ if (state->window == Z_NULL) {
state->window = (unsignedchar FAR *)
ZALLOC(strm, 1U << state->wbits, sizeof(unsignedchar)); if (state->window == Z_NULL) return1;
}
/* if window not in use yet, initialize */ if (state->wsize == 0) {
state->wsize = 1U << state->wbits;
state->wnext = 0;
state->whave = 0;
}
/* copy state->wsize or less output bytes into the circular window */ if (copy >= state->wsize) {
zmemcpy(state->window, end - state->wsize, state->wsize);
state->wnext = 0;
state->whave = state->wsize;
} else {
dist = state->wsize - state->wnext; if (dist > copy) dist = copy;
zmemcpy(state->window + state->wnext, end - copy, dist);
copy -= dist; if (copy) {
zmemcpy(state->window, end - copy, copy);
state->wnext = copy;
state->whave = state->wsize;
} else {
state->wnext += dist; if (state->wnext == state->wsize) state->wnext = 0; if (state->whave < state->wsize) state->whave += dist;
}
} return0;
}
/* Macros for inflate(): */
/* check function to use adler32() for zlib or crc32() for gzip */ #ifdef GUNZIP # define UPDATE_CHECK(check, buf, len) \
(state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) #else # define UPDATE_CHECK(check, buf, len) adler32(check, buf, len) #endif
/* Load registers with state in inflate() for speed */ #define LOAD() \ do { \
put = strm->next_out; \
left = strm->avail_out; \
next = strm->next_in; \
have = strm->avail_in; \
hold = state->hold; \
bits = state->bits; \
} while (0)
/* Restore state from registers in inflate() */ #define RESTORE() \ do { \
strm->next_out = put; \
strm->avail_out = left; \
strm->next_in = next; \
strm->avail_in = have; \
state->hold = hold; \
state->bits = bits; \
} while (0)
/* Clear the input bit accumulator */ #define INITBITS() \ do { \
hold = 0; \
bits = 0; \
} while (0)
/* Get a byte of input into the bit accumulator, or return from inflate()
if there is no input available. */ #define PULLBYTE() \ do { \ if (have == 0) goto inf_leave; \
have--; \
hold += (unsignedlong)(*next++) << bits; \
bits += 8; \
} while (0)
/* Assure that there are at least n bits in the bit accumulator. If there is
not enough available input to do that, then return from inflate(). */ #define NEEDBITS(n) \ do { \ while (bits < (unsigned)(n)) \
PULLBYTE(); \
} while (0)
/* Return the low n bits of the bit accumulator (n < 16) */ #define BITS(n) \
((unsigned)hold & ((1U << (n)) - 1))
/* Remove n bits from the bit accumulator */ #define DROPBITS(n) \ do { \
hold >>= (n); \
bits -= (unsigned)(n); \
} while (0)
/* Remove zero to seven bits as needed to go to a byte boundary */ #define BYTEBITS() \ do { \
hold >>= bits & 7; \
bits -= bits & 7; \
} while (0)
int ZEXPORT inflate(strm, flush)
z_streamp strm; int flush;
{ struct inflate_state FAR *state;
z_const unsignedchar FAR *next; /* next input */ unsignedchar FAR *put; /* next output */ unsigned have, left; /* available input and output */ unsignedlong hold; /* bit buffer */ unsigned bits; /* bits in bit buffer */ unsigned in, out; /* save starting available input and output */ unsigned copy; /* number of stored or match bytes to copy */ unsignedchar FAR *from; /* where to copy match bytes from */
code here; /* current decoding table entry */
code last; /* parent table entry */ unsigned len; /* length to copy for repeats, bits to drop */ int ret; /* return code */ #ifdef GUNZIP unsignedchar hbuf[4]; /* buffer for gzip header crc calculation */ #endif staticconstunsignedshort order[19] = /* permutation of code lengths */
{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
z_streamp strm; const Bytef *dictionary;
uInt dictLength;
{ struct inflate_state FAR *state; unsignedlong dictid; int ret;
/* check state */ if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state; if (state->wrap != 0 && state->mode != DICT) return Z_STREAM_ERROR;
/* check for correct dictionary identifier */ if (state->mode == DICT) {
dictid = adler32(0L, Z_NULL, 0);
dictid = adler32(dictid, dictionary, dictLength); if (dictid != state->check) return Z_DATA_ERROR;
}
/* copy dictionary to window using updatewindow(), which will amend the
existing dictionary if appropriate */
ret = updatewindow(strm, dictionary + dictLength, dictLength); if (ret) {
state->mode = MEM; return Z_MEM_ERROR;
}
state->havedict = 1;
Tracev((stderr, "inflate: dictionary set\n")); return Z_OK;
}
int ZEXPORT inflateGetHeader(strm, head)
z_streamp strm;
gz_headerp head;
{ struct inflate_state FAR *state;
/* check state */ if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state; if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
int ZEXPORT inflateSync(strm)
z_streamp strm;
{ unsigned len; /* number of bytes to look at or looked at */ int flags; /* temporary to save header status */ unsignedlong in, out; /* temporary to save total_in and total_out */ unsignedchar buf[4]; /* to restore bit buffer to byte string */ struct inflate_state FAR *state;
/* check parameters */ if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state; if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
/* if first time, start search in bit buffer */ if (state->mode != SYNC) {
state->mode = SYNC;
state->hold <<= state->bits & 7;
state->bits -= state->bits & 7;
len = 0; while (state->bits >= 8) {
buf[len++] = (unsignedchar)(state->hold);
state->hold >>= 8;
state->bits -= 8;
}
state->have = 0;
syncsearch(&(state->have), buf, len);
}
/* search available input */
len = syncsearch(&(state->have), strm->next_in, strm->avail_in);
strm->avail_in -= len;
strm->next_in += len;
strm->total_in += len;
/* return no joy or set up to restart inflate() on a new block */ if (state->have != 4) return Z_DATA_ERROR; if (state->flags == -1)
state->wrap = 0; /* if no header yet, treat as raw */ else
state->wrap &= ~4; /* no point in computing a check value now */
flags = state->flags;
in = strm->total_in; out = strm->total_out;
inflateReset(strm);
strm->total_in = in; strm->total_out = out;
state->flags = flags;
state->mode = TYPE; return Z_OK;
}
/* Returnstrueifinflateiscurrentlyattheendofablockgeneratedby Z_SYNC_FLUSHorZ_FULL_FLUSH.ThisfunctionisusedbyonePPP implementationtoprovideanadditionalsafetycheck.PPPuses Z_SYNC_FLUSHbutremovesthelengthbytesoftheresultingemptystored block.Whendecompressing,PPPchecksthatattheendofinputpacket, inflateiswaitingfortheselengthbytes.
*/ int ZEXPORT inflateSyncPoint(strm)
z_streamp strm;
{ struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state; return state->mode == STORED && state->bits == 0;
}
int ZEXPORT inflateCopy(dest, source)
z_streamp dest;
z_streamp source;
{ struct inflate_state FAR *state; struct inflate_state FAR *copy; unsignedchar FAR *window; unsigned wsize;
/* check input */ if (inflateStateCheck(source) || dest == Z_NULL) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)source->state;
/* allocate space */
copy = (struct inflate_state FAR *)
ZALLOC(source, 1, sizeof(struct inflate_state)); if (copy == Z_NULL) return Z_MEM_ERROR;
window = Z_NULL; if (state->window != Z_NULL) {
window = (unsignedchar FAR *)
ZALLOC(source, 1U << state->wbits, sizeof(unsignedchar)); if (window == Z_NULL) {
ZFREE(source, copy); return Z_MEM_ERROR;
}
}
int ZEXPORT inflateUndermine(strm, subvert)
z_streamp strm; int subvert;
{ struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state; #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
state->sane = !subvert; return Z_OK; #else
(void)subvert;
state->sane = 1; return Z_DATA_ERROR; #endif
}
int ZEXPORT inflateValidate(strm, check)
z_streamp strm; int check;
{ struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state; if (check && state->wrap)
state->wrap |= 4; else
state->wrap &= ~4; return Z_OK;
}
long ZEXPORT inflateMark(strm)
z_streamp strm;
{ struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return -(1L << 16);
state = (struct inflate_state FAR *)strm->state; return (long)(((unsignedlong)((long)state->back)) << 16) +
(state->mode == COPY ? state->length :
(state->mode == MATCH ? state->was - state->length : 0));
}
unsignedlong ZEXPORT inflateCodesUsed(strm)
z_streamp strm;
{ struct inflate_state FAR *state; if (inflateStateCheck(strm)) return (unsignedlong)-1;
state = (struct inflate_state FAR *)strm->state; return (unsignedlong)(state->next - state->codes);
}
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.42Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-10-06)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.