MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / zipCloseFileInZipRaw64

Function zipCloseFileInZipRaw64

lib/QuaZip/quazip/zip.c:1561–1814  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1559}
1560
1561extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_size, uLong crc32)
1562{
1563 zip64_internal* zi;
1564 ZPOS64_T compressed_size;
1565 uLong invalidValue = 0xffffffff;
1566 short datasize = 0;
1567 int err=ZIP_OK;
1568
1569 if (file == NULL)
1570 return ZIP_PARAMERROR;
1571 zi = (zip64_internal*)file;
1572
1573 if (zi->in_opened_file_inzip == 0)
1574 return ZIP_PARAMERROR;
1575 zi->ci.stream.avail_in = 0;
1576
1577 if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
1578 {
1579 while (err==ZIP_OK)
1580 {
1581 uLong uAvailOutBefore;
1582 if (zi->ci.stream.avail_out == 0)
1583 {
1584 if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO)
1585 err = ZIP_ERRNO;
1586 zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
1587 zi->ci.stream.next_out = zi->ci.buffered_data;
1588 }
1589 uAvailOutBefore = zi->ci.stream.avail_out;
1590 err=deflate(&zi->ci.stream, Z_FINISH);
1591 zi->ci.pos_in_buffered_data += uAvailOutBefore - zi->ci.stream.avail_out;
1592 }
1593 }
1594 else if ((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw))
1595 {
1596#ifdef HAVE_BZIP2
1597 err = BZ_FINISH_OK;
1598 while (err==BZ_FINISH_OK)
1599 {
1600 uLong uTotalOutBefore;
1601 if (zi->ci.bstream.avail_out == 0)
1602 {
1603 if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO)
1604 err = ZIP_ERRNO;
1605 zi->ci.bstream.avail_out = (uInt)Z_BUFSIZE;
1606 zi->ci.bstream.next_out = (char*)zi->ci.buffered_data;
1607 }
1608 uTotalOutBefore = zi->ci.bstream.total_out_lo32;
1609 err=BZ2_bzCompress(&zi->ci.bstream, BZ_FINISH);
1610 if(err == BZ_STREAM_END)
1611 err = Z_STREAM_END;
1612
1613 zi->ci.pos_in_buffered_data += (uInt)(zi->ci.bstream.total_out_lo32 - uTotalOutBefore);
1614 }
1615
1616 if(err == BZ_FINISH_OK)
1617 err = ZIP_OK;
1618#endif

Callers 2

closeMethod · 0.85
zipCloseFileInZipRawFunction · 0.85

Calls 4

zip64FlushWriteBufferFunction · 0.85
add_data_in_datablockFunction · 0.85
zip64local_putValueFunction · 0.85

Tested by

no test coverage detected