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