Function report |
Source Code:lib\zlib_inflate\inflate.c |
Create Date:2022-07-28 06:57:59 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:late() uses a state machine to process as much input data and generate asmuch output data as possible before returning
Proto:int zlib_inflate(z_streamp strm, int flush)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| z_streamp | strm | >next_out, given the space available and the provided input--the effect |
| int | flush |
| 332 | static const unsigned short order[19] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15} |
| 338 | If >next_out, given the space available and the provided input--the effect == NULL || not visible by applications == NULL || next input byte == NULL && number of bytes available at next_in != 0 Then Return Z_STREAM_ERROR |
| 344 | If current inflate mode == waiting for type bits, including last-flag bit Then current inflate mode = same, but skip check to exit inflate on new block |
| 349 | cycle switch current inflate mode |
| 351 | Case current inflate mode == waiting for magic header |
| 352 | If 0 true for zlib, bit 1 true for gzip == 0 Then |
| 357 | If ((Return the low n bits of the bit accumulator (n < 16) (8) << 8) + (hold >> 8)) % 31 Then |
| 359 | last error message, NULL if no error = "incorrect header check" |
| 361 | Break |
| 364 | last error message, NULL if no error = "unknown compression method" |
| 366 | Break |
| 369 | len = Return the low n bits of the bit accumulator (n < 16) (4) + 8 |
| 370 | If len > log base 2 of requested window size Then |
| 371 | last error message, NULL if no error = "invalid window size" |
| 373 | Break |
| 375 | zlib header max distance (INFLATE_STRICT) = 1U << len |
| 377 | current inflate mode = If hold & 0x200 Then waiting for dictionary check value Else waiting for type bits, including last-flag bit |
| 379 | Break |
| 387 | If rue if dictionary provided == 0 Then |
| 389 | Return Z_NEED_DICT |
| 395 | If flush == Only for inflate at present Then Go to inf_leave |
| 398 | If rue if processing last block Then |
| 401 | Break |
| 407 | Case Return the low n bits of the bit accumulator (n < 16) (2) == 0 |
| 409 | Break |
| 410 | Case Return the low n bits of the bit accumulator (n < 16) (2) == 1 |
| 413 | Break |
| 414 | Case Return the low n bits of the bit accumulator (n < 16) (2) == 2 |
| 416 | Break |
| 417 | Case Return the low n bits of the bit accumulator (n < 16) (2) == 3 |
| 418 | last error message, NULL if no error = "invalid block type" |
| 422 | Break |
| 427 | last error message, NULL if no error = "invalid stored block lengths" |
| 429 | Break |
| 431 | literal or length of data to copy = hold & 0xffff |
| 457 | umber of code length code lengths = Return the low n bits of the bit accumulator (n < 16) (4) + 4 |
| 460 | If umber of length code lengths > 286 || umber of distance code lengths > 30 Then |
| 461 | last error message, NULL if no error = "too many length or distance symbols" |
| 463 | Break |
| 466 | umber of code lengths in lens[] = 0 |
| 475 | When umber of code lengths in lens[] < 19 cycle |
| 479 | dex bits for lencode = 7 |
| 480 | ret = zlib_inflate_table(CODES, mporary storage for code lengths , 19, & (xt available space in codes[] ), & (dex bits for lencode ), work area for code table building ) |
| 482 | If ret Then |
| 483 | last error message, NULL if no error = "invalid code lengths set" |
| 485 | Break |
| 487 | umber of code lengths in lens[] = 0 |
| 492 | cycle |
| 493 | this = starting table for length/literal codes [Return the low n bits of the bit accumulator (n < 16) (dex bits for lencode )] |
| 494 | If s in this part of the code <= bits Then Break |
| 497 | If ffset in table or code value < 16 Then |
| 502 | Else |
| 503 | If ffset in table or code value == 16 Then |
| 504 | Assure that there are at least n bits in the bit accumulator. If there isnot enough available input to do that, then return from inflate(). (s in this part of the code + 2) |
| 506 | If umber of code lengths in lens[] == 0 Then |
| 507 | last error message, NULL if no error = "invalid bit length repeat" |
| 509 | Break |
| 512 | copy = 3 + Return the low n bits of the bit accumulator (n < 16) (2) |
| 515 | Else if ffset in table or code value == 17 Then |
| 516 | Assure that there are at least n bits in the bit accumulator. If there isnot enough available input to do that, then return from inflate(). (s in this part of the code + 3) |
| 518 | len = 0 |
| 519 | copy = 3 + Return the low n bits of the bit accumulator (n < 16) (3) |
| 522 | Else |
| 523 | Assure that there are at least n bits in the bit accumulator. If there isnot enough available input to do that, then return from inflate(). (s in this part of the code + 7) |
| 525 | len = 0 |
| 526 | copy = 11 + Return the low n bits of the bit accumulator (n < 16) (7) |
| 530 | last error message, NULL if no error = "invalid bit length repeat" |
| 532 | Break |
| 540 | If current inflate mode == got a data error -- remain here until reset Then Break |
| 545 | dex bits for lencode = 9 |
| 546 | ret = zlib_inflate_table(LENS, mporary storage for code lengths , umber of length code lengths , & (xt available space in codes[] ), & (dex bits for lencode ), work area for code table building ) |
| 548 | If ret Then |
| 549 | last error message, NULL if no error = "invalid literal/lengths set" |
| 551 | Break |
| 554 | dex bits for distcode = 6 |
| 557 | If ret Then |
| 558 | last error message, NULL if no error = "invalid distances set" |
| 560 | Break |
| 564 | Case current inflate mode == waiting for length/lit code |
| 569 | Break |
| 571 | cycle |
| 572 | this = starting table for length/literal codes [Return the low n bits of the bit accumulator (n < 16) (dex bits for lencode )] |
| 573 | If s in this part of the code <= bits Then Break |
| 576 | If peration, extra bits, table bits && (peration, extra bits, table bits & 0xf0) == 0 Then |
| 577 | last = this |
| 578 | cycle |
| 581 | If s in this part of the code + s in this part of the code <= bits Then Break |
| 588 | If peration, extra bits, table bits == 0 Then |
| 590 | Break |
| 592 | If peration, extra bits, table bits & 32 Then |
| 594 | Break |
| 596 | If peration, extra bits, table bits & 64 Then |
| 597 | last error message, NULL if no error = "invalid literal/length code" |
| 599 | Break |
| 601 | xtra bits needed = peration, extra bits, table bits & 15 |
| 604 | Case current inflate mode == waiting for length extra bits |
| 605 | If xtra bits needed Then |
| 612 | Case current inflate mode == waiting for distance code |
| 613 | cycle |
| 614 | this = starting table for distance codes [Return the low n bits of the bit accumulator (n < 16) (dex bits for distcode )] |
| 615 | If s in this part of the code <= bits Then Break |
| 618 | If (peration, extra bits, table bits & 0xf0) == 0 Then |
| 619 | last = this |
| 620 | cycle |
| 623 | If s in this part of the code + s in this part of the code <= bits Then Break |
| 629 | If peration, extra bits, table bits & 64 Then |
| 630 | last error message, NULL if no error = "invalid distance code" |
| 632 | Break |
| 635 | xtra bits needed = peration, extra bits, table bits & 15 |
| 638 | Case current inflate mode == waiting for distance extra bits |
| 639 | If xtra bits needed Then |
| 640 | Assure that there are at least n bits in the bit accumulator. If there isnot enough available input to do that, then return from inflate(). (xtra bits needed ) |
| 651 | If distance back to copy string from > valid bytes in the window + out - left Then |
| 652 | last error message, NULL if no error = "invalid distance too far back" |
| 654 | Break |
| 661 | If distance back to copy string from > copy Then |
| 663 | If copy > window write index Then |
| 664 | copy -= window write index |
| 667 | Else from = allocated sliding window, if needed + window write index - copy |
| 669 | If copy > literal or length of data to copy Then copy = literal or length of data to copy |
| 671 | Else |
| 678 | Do |
| 681 | If literal or length of data to copy == 0 Then current inflate mode = waiting for length/lit code |
| 682 | Break |
| 689 | Case current inflate mode == waiting for 32-bit check value |
| 690 | If 0 true for zlib, bit 1 true for gzip Then |
| 695 | If out Then adler32 value of the uncompressed data = protected copy of check value = check function to use adler32() for zlib or crc32() for gzip (protected copy of check value , put - out, out) |
| 699 | If Reverse the bytes in a 32-bit value (hold) != protected copy of check value Then |
| 701 | last error message, NULL if no error = "incorrect data check" |
| 703 | Break |
| 710 | ret = Z_STREAM_END |
| 711 | Go to inf_leave |
| 713 | ret = Z_DATA_ERROR |
| 714 | Go to inf_leave |
| 716 | Return Z_MEM_ERROR |
| 717 | Case current inflate mode == SYNC |
| 718 | Default |
| 719 | Return Z_STREAM_ERROR |
| 727 | inf_leave : |
| 741 | best guess about the data type: ascii or binary = umber of bits in "in" + If rue if processing last block Then 64 Else 0 + If current inflate mode == waiting for type bits, including last-flag bit Then 128 Else 0 |
| 748 | If ( in == 0 && out == 0 || flush == Z_FINISH ) && ret == Allowed flush values; see deflate() and inflate() below for details Then ret = Z_BUF_ERROR |
| 751 | Return ret |
| Name | Describe |
|---|---|
| zlib_inflate_blob | Utility function: initialize zlib, unpack binary blob, clean up zlib,* return len or negative error code. |
| __gunzip | Included from initramfs et al code |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |