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

Function unzOpenCurrentFile3

extlibs/minizip/src/unzip.c:1464–1634  ·  view source on GitHub ↗

Open for reading data the current file in the zipfile. If there is no error and the file is opened, the return value is UNZ_OK. */

Source from the content-addressed store, hash-verified

1462 If there is no error and the file is opened, the return value is UNZ_OK.
1463*/
1464extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
1465 int* level, int raw, const char* password)
1466{
1467 int err = UNZ_OK;
1468 uInt iSizeVar;
1469 unz64_s* s;
1470 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1471 ZPOS64_T offset_local_extrafield; /* offset of the local extra field */
1472 uInt size_local_extrafield; /* size of the local extra field */
1473# ifndef NOUNCRYPT
1474 char source[12];
1475# else
1476 if (password != NULL)
1477 return UNZ_PARAMERROR;
1478# endif
1479
1480 if (file == NULL)
1481 return UNZ_PARAMERROR;
1482 s = (unz64_s*)file;
1483 if (!s->current_file_ok)
1484 return UNZ_PARAMERROR;
1485
1486 if (s->pfile_in_zip_read != NULL)
1487 unzCloseCurrentFile(file);
1488
1489 if (unz64local_CheckCurrentFileCoherencyHeader(s, &iSizeVar, &offset_local_extrafield, &size_local_extrafield) != UNZ_OK)
1490 return UNZ_BADZIPFILE;
1491
1492 pfile_in_zip_read_info = (file_in_zip64_read_info_s*)ALLOC(sizeof(file_in_zip64_read_info_s));
1493 if (pfile_in_zip_read_info == NULL)
1494 return UNZ_INTERNALERROR;
1495
1496 pfile_in_zip_read_info->read_buffer = (char*)ALLOC(UNZ_BUFSIZE);
1497 pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
1498 pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
1499 pfile_in_zip_read_info->pos_local_extrafield = 0;
1500 pfile_in_zip_read_info->raw = raw;
1501
1502 if (pfile_in_zip_read_info->read_buffer == NULL)
1503 {
1504 TRYFREE(pfile_in_zip_read_info);
1505 return UNZ_INTERNALERROR;
1506 }
1507
1508 pfile_in_zip_read_info->stream_initialised = 0;
1509
1510 if (method != NULL)
1511 *method = (int)s->cur_file_info.compression_method;
1512
1513 if (level != NULL)
1514 {
1515 *level = 6;
1516 switch (s->cur_file_info.flag & 0x06)
1517 {
1518 case 6: *level = 1;
1519 break;
1520 case 4: *level = 2;
1521 break;

Callers 3

unzOpenCurrentFileFunction · 0.85
unzOpenCurrentFile2Function · 0.85

Calls 4

unzCloseCurrentFileFunction · 0.85
get_crc_tableFunction · 0.85
init_keysFunction · 0.85

Tested by

no test coverage detected