MCPcopy Create free account
hub / github.com/MariaDB/server / zipCloseFileInZipRaw64

Function zipCloseFileInZipRaw64

storage/connect/zip.c:1753–1986  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1751}
1752
1753extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_size, uLong crc32) {
1754 zip64_internal* zi;
1755 ZPOS64_T compressed_size;
1756 uLong invalidValue = 0xffffffff;
1757 unsigned datasize = 0;
1758 int err=ZIP_OK;
1759
1760 if (file == NULL)
1761 return ZIP_PARAMERROR;
1762 zi = (zip64_internal*)file;
1763
1764 if (zi->in_opened_file_inzip == 0)
1765 return ZIP_PARAMERROR;
1766 zi->ci.stream.avail_in = 0;
1767
1768 if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
1769 {
1770 while (err==ZIP_OK)
1771 {
1772 uLong uTotalOutBefore;
1773 if (zi->ci.stream.avail_out == 0)
1774 {
1775 if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO)
1776 err = ZIP_ERRNO;
1777 zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
1778 zi->ci.stream.next_out = zi->ci.buffered_data;
1779 }
1780 uTotalOutBefore = zi->ci.stream.total_out;
1781 err=deflate(&zi->ci.stream, Z_FINISH);
1782 zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
1783 }
1784 }
1785 else if ((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw))
1786 {
1787#ifdef HAVE_BZIP2
1788 err = BZ_FINISH_OK;
1789 while (err==BZ_FINISH_OK)
1790 {
1791 uLong uTotalOutBefore;
1792 if (zi->ci.bstream.avail_out == 0)
1793 {
1794 if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO)
1795 err = ZIP_ERRNO;
1796 zi->ci.bstream.avail_out = (uInt)Z_BUFSIZE;
1797 zi->ci.bstream.next_out = (char*)zi->ci.buffered_data;
1798 }
1799 uTotalOutBefore = zi->ci.bstream.total_out_lo32;
1800 err=BZ2_bzCompress(&zi->ci.bstream, BZ_FINISH);
1801 if(err == BZ_STREAM_END)
1802 err = Z_STREAM_END;
1803
1804 zi->ci.pos_in_buffered_data += (uInt)(zi->ci.bstream.total_out_lo32 - uTotalOutBefore);
1805 }
1806
1807 if(err == BZ_FINISH_OK)
1808 err = ZIP_OK;
1809#endif
1810 }

Callers 1

zipCloseFileInZipRawFunction · 0.85

Calls 7

zip64FlushWriteBufferFunction · 0.85
deflateFunction · 0.85
deflateEndFunction · 0.85
add_data_in_datablockFunction · 0.85
freeFunction · 0.85
zip64local_putValueFunction · 0.85

Tested by

no test coverage detected