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