256{
258 z_const
unsigned char FAR *
next;
259 unsigned char FAR *put;
264 unsigned char FAR *from;
267 unsigned len;
268 int ret;
269 static const unsigned short order[19] =
270 {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
271
272
276
277
288
289
290 for (;;)
291 switch (state->
mode) {
293
297 break;
298 }
303 case 0:
304 Tracev((stderr,
"inflate: stored block%s\n",
305 state->
last ?
" (last)" :
""));
307 break;
308 case 1:
310 Tracev((stderr,
"inflate: fixed codes block%s\n",
311 state->
last ?
" (last)" :
""));
313 break;
314 case 2:
315 Tracev((stderr,
"inflate: dynamic codes block%s\n",
316 state->
last ?
" (last)" :
""));
318 break;
319 case 3:
320 strm->msg = (
char *)
"invalid block type";
322 }
324 break;
325
327
330 if ((
hold & 0xffff) != ((
hold >> 16) ^ 0xffff)) {
331 strm->msg = (
char *)
"invalid stored block lengths";
333 break;
334 }
336 Tracev((stderr,
"inflate: stored length %u\n",
339
340
341 while (state->
length != 0) {
346 if (copy > left)
copy = left;
353 }
354 Tracev((stderr,
"inflate: stored end\n"));
356 break;
357
359
367#ifndef PKZIP_BUG_WORKAROUND
368 if (state->
nlen > 286 || state->
ndist > 30) {
369 strm->msg = (
char *)
"too many length or distance symbols";
371 break;
372 }
373#endif
374 Tracev((stderr,
"inflate: table sizes ok\n"));
375
376
380 state->
lens[order[state->
have++]] = (
unsigned short)
BITS(3);
382 }
383 while (state->
have < 19)
384 state->
lens[order[state->
have++]] = 0;
390 if (ret) {
391 strm->msg = (
char *)
"invalid code lengths set";
393 break;
394 }
395 Tracev((stderr,
"inflate: code lengths ok\n"));
396
397
400 for (;;) {
402 if ((
unsigned)(here.
bits) <=
bits)
break;
404 }
408 }
409 else {
410 if (here.
val == 16) {
413 if (state->
have == 0) {
414 strm->msg = (
char *)
"invalid bit length repeat";
416 break;
417 }
418 len = (unsigned)(state->
lens[state->
have - 1]);
421 }
422 else if (here.
val == 17) {
425 len = 0;
428 }
429 else {
432 len = 0;
435 }
437 strm->msg = (
char *)
"invalid bit length repeat";
439 break;
440 }
441 while (copy--)
442 state->
lens[state->
have++] = (
unsigned short)len;
443 }
444 }
445
446
448
449
450 if (state->
lens[256] == 0) {
451 strm->msg = (
char *)
"invalid code -- missing end-of-block";
453 break;
454 }
455
456
457
458
464 if (ret) {
465 strm->msg = (
char *)
"invalid literal/lengths set";
467 break;
468 }
473 if (ret) {
474 strm->msg = (
char *)
"invalid distances set";
476 break;
477 }
478 Tracev((stderr,
"inflate: codes ok\n"));
480
481
483
484 if (
have >= 6 && left >= 258) {
490 break;
491 }
492
493
494 for (;;) {
496 if ((
unsigned)(here.
bits) <=
bits)
break;
498 }
499 if (here.
op && (here.
op & 0xf0) == 0) {
501 for (;;) {
506 }
508 }
511
512
515 "inflate: literal '%c'\n" :
516 "inflate: literal 0x%02x\n", here.
val));
518 *put++ = (
unsigned char)(state->
length);
519 left--;
521 break;
522 }
523
524
526 Tracevv((stderr,
"inflate: end of block\n"));
528 break;
529 }
530
531
533 strm->msg = (
char *)
"invalid literal/length code";
535 break;
536 }
537
538
539 state->
extra = (unsigned)(here.
op) & 15;
540 if (state->
extra != 0) {
544 }
546
547
548 for (;;) {
550 if ((
unsigned)(here.
bits) <=
bits)
break;
552 }
553 if ((here.
op & 0xf0) == 0) {
555 for (;;) {
560 }
562 }
565 strm->msg = (
char *)
"invalid distance code";
567 break;
568 }
570
571
572 state->
extra = (
unsigned)(here.
op) & 15;
573 if (state->
extra != 0) {
577 }
579 left : 0)) {
580 strm->msg = (
char *)
"invalid distance too far back";
582 break;
583 }
585
586
587 do {
590 if (copy < left) {
593 }
594 else {
595 from = put - state->
offset;
597 }
601 do {
602 *put++ = *from++;
603 } while (--copy);
604 }
while (state->
length != 0);
605 break;
606
608
610 if (left < state->
wsize) {
611 if (out(out_desc, state->
window, state->
wsize - left))
613 }
614 goto inf_leave;
615
618 goto inf_leave;
619
620 default:
622 goto inf_leave;
623 }
624
625
626 inf_leave:
629 return ret;
630}
void fixedtables(struct inflate_state FAR *state)
void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start)
void copy(G4double dst[], const G4double src[], std::size_t size=G4FieldTrack::ncompSVEC)
code const FAR * distcode
unsigned char FAR * window
void ZLIB_INTERNAL zmemcpy(Bytef *dest, const Bytef *source, uInt len)