MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / zipCloseFileInZipRaw64

Function zipCloseFileInZipRaw64

extlibs/minizip/src/zip.c:1500–1733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1498}
1499
1500extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_size, uLong crc32)
1501{
1502 zip64_internal* zi;
1503 ZPOS64_T compressed_size;
1504 uLong invalidValue = 0xffffffff;
1505 short datasize = 0;
1506 int err = ZIP_OK;
1507
1508 if (file == NULL)
1509 return ZIP_PARAMERROR;
1510 zi = (zip64_internal*)file;
1511
1512 if (zi->in_opened_file_inzip == 0)
1513 return ZIP_PARAMERROR;
1514 zi->ci.stream.avail_in = 0;
1515
1516 if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
1517 {
1518 while (err == ZIP_OK)
1519 {
1520 uLong uTotalOutBefore;
1521 if (zi->ci.stream.avail_out == 0)
1522 {
1523 if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO)
1524 err = ZIP_ERRNO;
1525 zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
1526 zi->ci.stream.next_out = zi->ci.buffered_data;
1527 }
1528 uTotalOutBefore = zi->ci.stream.total_out;
1529 err = deflate(&zi->ci.stream, Z_FINISH);
1530 zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore);
1531 }
1532 }
1533 else if ((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw))
1534 {
1535#ifdef HAVE_BZIP2
1536 err = BZ_FINISH_OK;
1537 while (err==BZ_FINISH_OK)
1538 {
1539 uLong uTotalOutBefore;
1540 if (zi->ci.bstream.avail_out == 0)
1541 {
1542 if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO)
1543 err = ZIP_ERRNO;
1544 zi->ci.bstream.avail_out = (uInt)Z_BUFSIZE;
1545 zi->ci.bstream.next_out = (char*)zi->ci.buffered_data;
1546 }
1547 uTotalOutBefore = zi->ci.bstream.total_out_lo32;
1548 err=BZ2_bzCompress(&zi->ci.bstream, BZ_FINISH);
1549 if(err == BZ_STREAM_END)
1550 err = Z_STREAM_END;
1551
1552 zi->ci.pos_in_buffered_data += (uInt)(zi->ci.bstream.total_out_lo32 - uTotalOutBefore);
1553 }
1554
1555 if(err == BZ_FINISH_OK)
1556 err = ZIP_OK;
1557#endif

Callers 1

zipCloseFileInZipRawFunction · 0.85

Calls 6

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

Tested by

no test coverage detected