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

Function unzOpenCurrentFile3

contrib/unzip/unzip.c:1343–1511  ·  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

1341 If there is no error and the file is opened, the return value is UNZ_OK.
1342*/
1343extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
1344 int* level, int raw, const char* password) {
1345 int err=UNZ_OK;
1346 uInt iSizeVar;
1347 unz64_s* s;
1348 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1349 ZPOS64_T offset_local_extrafield; /* offset of the local extra field */
1350 uInt size_local_extrafield; /* size of the local extra field */
1351# ifndef NOUNCRYPT
1352 char source[12];
1353# else
1354 if (password != NULL)
1355 return UNZ_PARAMERROR;
1356# endif
1357
1358 if (file==NULL)
1359 return UNZ_PARAMERROR;
1360 s=(unz64_s*)file;
1361 if (!s->current_file_ok)
1362 return UNZ_PARAMERROR;
1363
1364 if (s->pfile_in_zip_read != NULL)
1365 unzCloseCurrentFile(file);
1366
1367 if (unz64local_CheckCurrentFileCoherencyHeader(s,&iSizeVar, &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
1368 return UNZ_BADZIPFILE;
1369
1370 pfile_in_zip_read_info = (file_in_zip64_read_info_s*)ALLOC(sizeof(file_in_zip64_read_info_s));
1371 if (pfile_in_zip_read_info==NULL)
1372 return UNZ_INTERNALERROR;
1373
1374 pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE);
1375 pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
1376 pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
1377 pfile_in_zip_read_info->pos_local_extrafield=0;
1378 pfile_in_zip_read_info->raw=raw;
1379
1380 if (pfile_in_zip_read_info->read_buffer==NULL)
1381 {
1382 free(pfile_in_zip_read_info);
1383 return UNZ_INTERNALERROR;
1384 }
1385
1386 pfile_in_zip_read_info->stream_initialised=0;
1387
1388 if (method!=NULL)
1389 *method = (int)s->cur_file_info.compression_method;
1390
1391 if (level!=NULL)
1392 {
1393 *level = 6;
1394 switch (s->cur_file_info.flag & 0x06)
1395 {
1396 case 6 : *level = 1; break;
1397 case 4 : *level = 2; break;
1398 case 2 : *level = 9; break;
1399 }
1400 }

Callers 3

unzOpenCurrentFileFunction · 0.70
unzOpenCurrentFile2Function · 0.70

Calls 4

get_crc_tableFunction · 0.85
unzCloseCurrentFileFunction · 0.70
init_keysFunction · 0.70

Tested by

no test coverage detected