void LoadCreatureZipJSONData(const std::string& filename_in, CreatureLoadDataPacket& load_data) { mz_bool status; size_t uncomp_size; mz_zip_archive zip_archive; // Now try to open the archive. memset(&zip_archive, 0, sizeof(zip_archive)); status = mz_zip_reader_init_file(&zip_archive, filename_in.c_str(), 0); if (!status) { printf("mz_zip_reader_init_file() failed!\n"); return; } mz_zip_archive_file_stat file_stat; if (!mz_zip_reader_file_stat(&zip_archive, 0, &file_stat)) { printf("mz_zip_reader_file_stat() failed!\n"); mz_zip_reader_end(&zip_archive); return; } void * extract_obj = mz_zip_reader_extract_file_to_heap(&zip_archive, file_stat.m_filename, &uncomp_size, 0); if(!extract_obj) { printf("mz_zip_reader_extract_file_to_heap() failed!\n"); mz_zip_reader_end(&zip_archive); return; } std::string real_string((char *)extract_obj); LoadCreatureJSONDataFromString(real_string, load_data); }
BYTE uncomp_zip_control_in_archive(void) { mz_zip_archive zip_archive; int a, mode; memset(&zip_archive, 0, sizeof(zip_archive)); if (!mz_zip_reader_init_file(&zip_archive, info.rom_file, 0)) { fprintf(stderr, "mz_zip_reader_init_file() failed!\n"); return (EXIT_ERROR); } for (mode = UNCOMP_CTRL_FILE_COUNT_ROMS; mode <= UNCOMP_CTRL_FILE_SAVE_DATA; mode++) { uncomp.files_founded = 0; for (a = 0; a < (int) mz_zip_reader_get_num_files(&zip_archive); a++) { mz_zip_archive_file_stat file_stat; int b; if (!mz_zip_reader_file_stat(&zip_archive, a, &file_stat)) { fprintf(stderr, "mz_zip_reader_file_stat() failed!\n"); mz_zip_reader_end(&zip_archive); return (EXIT_ERROR); } /* se e' una directory continuo */ if (mz_zip_reader_is_file_a_directory(&zip_archive, a)) { continue; } for (b = 0; b < LENGTH(format_supported); b++) { char *ext = strrchr(file_stat.m_filename, '.'); if ((ext != NULL) && (strcasecmp(ext, format_supported[b].ext) == 0)) { if (mode == UNCOMP_CTRL_FILE_SAVE_DATA) { uncomp.file[uncomp.files_founded].num = file_stat.m_file_index; uncomp.file[uncomp.files_founded].format = format_supported[b].id; } uncomp.files_founded++; break; } } } if ((mode == UNCOMP_CTRL_FILE_COUNT_ROMS) && (uncomp.files_founded > 0)) { uncomp.file = (_uncomp_file_data *) malloc( uncomp.files_founded * sizeof(_uncomp_file_data)); } } mz_zip_reader_end(&zip_archive); return (EXIT_OK); }
static int lmz_reader_gc(lua_State *L) { lmz_file_t* zip = luaL_checkudata(L, 1, "miniz_reader"); uv_fs_close(zip->loop, &(zip->req), zip->fd, NULL); uv_fs_req_cleanup(&(zip->req)); mz_zip_reader_end(&(zip->archive)); return 0; }
void adapt_stop_serving(adapt_serving_context* context) { int i; if (context->server_context) { mg_stop(context->server_context); } if (context->options) { for (i = 0; context->options[i]; i++) { free(context->options[i]); } free(context->options); } if (context->init_call) { free(context->init_call); } if (context->content) { free(context->content); } if (context->file_info) { int file_count = mz_zip_reader_get_num_files(&context->zip); for (i = 0; i < file_count; i++) { adapt_file_info_clear(&context->file_info[i]); } free(context->file_info); } mz_zip_reader_end(&context->zip); free(context); }
BYTE uncomp_zip_file_from_archive(_uncomp_file_data *file) { mz_zip_archive zip_archive; memset(&zip_archive, 0, sizeof(zip_archive)); if (!mz_zip_reader_init_file(&zip_archive, info.rom_file, 0)) { fprintf(stderr, "mz_zip_reader_init_file() failed!\n"); return (EXIT_ERROR); } mz_zip_reader_get_filename(&zip_archive, file->num, uncomp.buffer, sizeof(uncomp.buffer)); snprintf(uncomp.uncompress_file, sizeof(uncomp.uncompress_file), "%s" TMP_FOLDER "/%s", info.base_folder, basename(uncomp.buffer)); if (mz_zip_reader_extract_to_file(&zip_archive, file->num, uncomp.uncompress_file, 0)) { strncpy(uncomp.compress_archive, info.rom_file, sizeof(uncomp.compress_archive)); strncpy(info.rom_file, uncomp.uncompress_file, sizeof(info.rom_file)); info.uncompress_rom = TRUE; } else { fprintf(stderr, "unzip file failed!\n"); } // Close the archive, freeing any resources it was using mz_zip_reader_end(&zip_archive); return (EXIT_OK); }
static void on_zip_downloaded(_unused_ void* userdata, void* buffer, int size) { log_info("Done."); mz_zip_archive za; if (!mz_zip_reader_init_mem(&za, buffer, size, 0)) { log_error("Cannot unzip game files: invalid archive"); return; } for (mz_uint i = 0; i < mz_zip_reader_get_num_files(&za); i++) { mz_zip_archive_file_stat file_stat; if (!mz_zip_reader_file_stat(&za, i, &file_stat)) { log_error("Cannot unzip game files"); break; } const char* filename = file_stat.m_filename; int r = mkdir_p(filename); if (r < 0) { log_error("Cannot unzip game files: %s", strerror(-r)); break; } if (!mz_zip_reader_is_file_a_directory(&za, i)) { mz_zip_reader_extract_to_file(&za, i, filename, 0); } } mz_zip_reader_end(&za); engine_load(); }
static int Lreader_close(lua_State *L) { mz_zip_archive* za = luaL_checkudata(L, 1, LMZ_ZIP_READER); lua_pushboolean(L, mz_zip_reader_end(za)); lua_pushnil(L); lua_rawsetp(L, LUA_REGISTRYINDEX, za); return 1; }
void ZipArchive::reset() { // Close and free the miniz archive (if null, this is a no-op). mz_zip_reader_end(&minizData); mz_zip_zero_struct(&minizData); // Empty the buffer and entry list. buffer.clear(); entryList.clear(); }
void ZipIO::closeArchive(){ if (_kisopen) { if (_kmode == OpenMode::READ) { mz_zip_reader_end(&_kzarchive); } else if (_kmode == OpenMode::WRITE) { mz_zip_writer_end(&_kzarchive); }; } _kisopen = false; _kready = false; }
int FileReader::unzipFile(QString &filename, QByteArray &file) { mz_bool status; mz_zip_archive archive; memset(&archive, 0, sizeof(archive)); status = mz_zip_reader_init_file(&archive, filename.toStdString().c_str(), 0); if (status < MZ_OK) return status; if (mz_zip_reader_get_num_files(&archive) != 1) { emit ErrorMessage(trUtf8("The archive %1 more than one file, or no files in the archive").arg(filename)); return MZ_PARAM_ERROR; } mz_zip_archive_file_stat file_stat; status = mz_zip_reader_file_stat(&archive, 0, &file_stat); if (status < MZ_OK) { emit ErrorMessage(trUtf8("Error reading the file %1").arg(filename)); mz_zip_reader_end(&archive); return MZ_PARAM_ERROR; } size_t uncompressed_size = file_stat.m_uncomp_size; void *p = mz_zip_reader_extract_file_to_heap(&archive, file_stat.m_filename, &uncompressed_size, 0); if (!p) { emit ErrorMessage(trUtf8("Error extracting file %1").arg(filename)); mz_zip_reader_end(&archive); return MZ_PARAM_ERROR; } file.append(static_cast<char *>(p)); mz_zip_reader_end(&archive); return 0; }
bool decompress_archive( const char* data, std::size_t size, const std::string& directory ) { auto zip_archive = sys::create_zeroed<mz_zip_archive>(); if( !mz_zip_reader_init_mem( &zip_archive, data, size, 0 ) ) { std::cout << "mz_zip_reader_init_mem() failed!\n"; return false; } for( unsigned int i = 0; i < mz_zip_reader_get_num_files( &zip_archive ); i++ ) { mz_zip_archive_file_stat file_stat; if( !mz_zip_reader_file_stat( &zip_archive, i, &file_stat ) ) { std::cout << "mz_zip_reader_file_stat() failed!\n"; mz_zip_reader_end( &zip_archive ); return false; } if( !mz_zip_reader_is_file_a_directory( &zip_archive, i ) ) { auto filename = directory + ( directory.empty() ? "" : "/" ) + file_stat.m_filename; if( !sys::create_directory_if_required( filename ) ) { std::cout << "decompress_archive could not create directory.\n"; return false; } if( !mz_zip_reader_extract_to_file( &zip_archive, i, filename.c_str(), 0 ) ) { std::cout << "mz_zip_reader_extract_to_file() failed!\n"; mz_zip_reader_end( &zip_archive ); return false; } } } if( !mz_zip_reader_end( &zip_archive ) ) { std::cout << "mz_zip_reader_end() failed!\n"; return false; } return true; }
CZipArchive::~CZipArchive() //------------------------- { mz_zip_archive *zip = static_cast<mz_zip_archive*>(zipFile); if(zip) { mz_zip_reader_end(zip); delete zip; zipFile = nullptr; } }
BYTE uncomp_zip_name_file_compress(_uncomp_file_data *file) { mz_zip_archive zip_archive; memset(&zip_archive, 0, sizeof(zip_archive)); if (!mz_zip_reader_init_file(&zip_archive, info.rom_file, 0)) { fprintf(stderr, "mz_zip_reader_init_file() failed!\n"); return (EXIT_ERROR); } mz_zip_reader_get_filename(&zip_archive, file->num, uncomp.buffer, sizeof(uncomp.buffer)); // Close the archive, freeing any resources it was using mz_zip_reader_end(&zip_archive); return (EXIT_OK); }
bool fe_zip_get_dir( const char *archive, std::vector<std::string> &result ) { mz_zip_archive zip; memset( &zip, 0, sizeof( zip ) ); if ( !mz_zip_reader_init_file( &zip, archive, 0 ) ) { std::cerr << "Error initializing zip: " << archive << std::endl; return false; } for ( int i=0; i<(int)mz_zip_reader_get_num_files(&zip); i++) { mz_zip_archive_file_stat file_stat; if ( mz_zip_reader_file_stat(&zip, i, &file_stat) ) result.push_back( file_stat.m_filename ); } mz_zip_reader_end( &zip ); return true; }
//--------------------------------------------------------------------------- ZipFile::~ZipFile() { mz_zip_reader_end( &m_zipArchive ); }
extern int process_pptx(char *pptx_file) { // Returns the number of slides, -1 in case of severe failure // (if the file doesn't exist, 0 is returned) mz_bool status; mz_zip_archive zip_archive; char *xml_slide; size_t xml_sz; char *p; char *q; char *s; char *t; int i; int deckid; int maxslide = 0; int notenum; int slidenum = 0; int slideid; char xmlrel[FILENAME_MAX]; short kw; short level; memset(&zip_archive, 0, sizeof(zip_archive)); status = mz_zip_reader_init_file(&zip_archive, pptx_file, 0); if (!status) { fprintf(stderr, "Cannot read %s!\n", pptx_file); } else { deckid = new_deck(pptx_file); // Get and print information about each file in the archive. for (i = 0; i < (int)mz_zip_reader_get_num_files(&zip_archive); i++) { mz_zip_archive_file_stat file_stat; if (!mz_zip_reader_file_stat(&zip_archive, i, &file_stat)) { fprintf(stderr, "mz_zip_reader_file_stat() failed!\n"); mz_zip_reader_end(&zip_archive); return -1; } if (!mz_zip_reader_is_file_a_directory(&zip_archive, i)) { if ((strncmp(file_stat.m_filename, "ppt/notesSlides/", 16) == 0) && strncmp(file_stat.m_filename, "ppt/notesSlides/_rels/", 22)) { // Notes // // *** ACHTUNG *** // Note numbers don't match the corresponding slide number, // that would be too easy. You have to dig into "_rels" // if (!sscanf(&(file_stat.m_filename[26]), "%d", ¬enum)) { fprintf(stderr, "Failed to extract note num from %s\n", &(file_stat.m_filename[16])); return -1; } sprintf(xmlrel, "ppt/notesSlides/_rels/notesSlide%d.xml.rels", notenum); if ((xml_slide = (char *)mz_zip_reader_extract_file_to_heap(&zip_archive, (const char *)xmlrel, &xml_sz, (mz_uint)0)) != (char *)NULL) { // Try to find the b****y slide number if ((p = strstr(xml_slide, "Target=\"../slides/slide")) != NULL) { if (!sscanf(&(p[23]), "%d", &slidenum)) { fprintf(stderr, "Failed to extract slidenum from %s\n", &(p[36])); return -1; } } free(xml_slide); } if (slidenum) { if (slidenum > maxslide) { maxslide = slidenum; } slideid = new_slide(deckid, slidenum); xml_sz = 0; if ((xml_slide = (char *)mz_zip_reader_extract_file_to_heap(&zip_archive, (const char *)file_stat.m_filename, &xml_sz, (mz_uint)0)) != (char *)NULL) { if (get_mode() & OPT_TAGS) { // Exclusively look for indexing words in the notes q = xml_slide; level = 0; while ((p = strchr(q, '[')) != (char *)NULL) { level++; do { p++; } while (isspace(*p)); q = p + 1; while (*q && ((*q != ']') || (level > 1))) { switch (*q) { case '[': level++; break; case ']': level--; break; default: break; } q++; } if (*q == ']') { *q = '\0'; if (get_sep() == ';') { // Replace HTML entities if there are any replace_entities(p); } while ((s = strchr(p, get_sep())) != (char *)NULL) { *s++ = '\0'; if (*p == get_kw()) { p++; kw = 1; } else { if (autokw()) { kw = lowercase_word(p); } else { kw = 0; } } if ((t = cleanup(p)) != (char *)NULL) { new_word_as_is(t, slideid, 'T', kw); free(t); } p = s; while (isspace(*p)) { p++; } } if (*p == get_kw()) { p++; kw = 1; } else { if (autokw()) { kw = lowercase_word(p); } else { kw = 0; } } if ((t = cleanup(p)) != (char *)NULL) { new_word_as_is(t, slideid, 'T', kw); free(t); } p = 1 + q; } else { break; } } } else { // Analyze text analyze_text(slideid, xml_slide, 'N'); } free(xml_slide); } else { fprintf(stderr, "Extract flopped\n"); return -1; } } } // We look at regular slides even if we are only interested // in tags to check that we aren't missing any slide without // notes and that our tag count is correct if ((strncmp(file_stat.m_filename, "ppt/slides/", 11) == 0) && strncmp(file_stat.m_filename, "ppt/slides/_rels/", 17)) { // Regular slide if (!sscanf(&(file_stat.m_filename[16]), "%d", &slidenum)) { fprintf(stderr, "Failed to extract num from %s\n", &(file_stat.m_filename[11])); return -1; } if (slidenum > maxslide) { maxslide = slidenum; } slideid = new_slide(deckid, slidenum); if (!(get_mode() & OPT_TAGS)) { xml_sz = 0; if ((xml_slide = (char *)mz_zip_reader_extract_file_to_heap(&zip_archive, (const char *)file_stat.m_filename, &xml_sz, (mz_uint)0)) != (char *)NULL) { // Analyze text analyze_text(slideid, xml_slide, 'S'); // Analyze images analyze_pic(slideid, xml_slide); free(xml_slide); } else { fprintf(stderr, "Extract flopped\n"); return -1; } } } } } // Close the archive, freeing any resources it was using mz_zip_reader_end(&zip_archive); } return maxslide; }
dataFile::~dataFile() { mz_zip_reader_end( (mz_zip_archive*) zip_archive ); free( zip_archive ); }
ZipIO::~ZipIO(){ if (_kisopen){ mz_zip_reader_end(&_kzarchive); } }
bool pak::bin( const std::string &bin_import ) //const { this->clear(); std::vector<pakfile> result; if( !bin_import.size() ) return true; // :) if( type == paktype::ZIP ) { // Try to open the archive. mz_zip_archive zip_archive; memset(&zip_archive, 0, sizeof(zip_archive)); mz_bool status = mz_zip_reader_init_mem( &zip_archive, (void *)bin_import.c_str(), bin_import.size(), 0 ); if( !status ) return "mz_zip_reader_init_file() failed!", false; // Get and print information about each file in the archive. for( unsigned int i = 0; i < mz_zip_reader_get_num_files(&zip_archive); i++ ) { mz_zip_archive_file_stat file_stat; if( !mz_zip_reader_file_stat( &zip_archive, i, &file_stat ) ) { mz_zip_reader_end( &zip_archive ); return "mz_zip_reader_file_stat() failed!", false; } result.push_back( pakfile() ); result.back()["filename"] = file_stat.m_filename; result.back()["comment"] = file_stat.m_comment; result.back()["size"] = (unsigned int)file_stat.m_uncomp_size; result.back()["size_z"] = (unsigned int)file_stat.m_comp_size; //result.back()["modify_time"] = ze.mtime; //result.back()["access_time"] = ze.atime; //result.back()["create_time"] = ze.ctime; //result.back()["attributes"] = ze.attr; if( const bool decode = true ) { // Try to extract file to the heap. size_t uncomp_size; void *p = mz_zip_reader_extract_file_to_heap(&zip_archive, file_stat.m_filename, &uncomp_size, 0); if( !p ) { mz_zip_reader_end(&zip_archive); return "mz_zip_reader_extract_file_to_heap() failed!", false; } // Make sure the extraction really succeeded. /* if ((uncomp_size != strlen(s_pStr)) || (memcmp(p, s_pStr, strlen(s_pStr)))) { free(p); mz_zip_reader_end(&zip_archive); return "mz_zip_reader_extract_file_to_heap() failed to extract the proper data", false; } */ result.back()["content"].resize( uncomp_size ); memcpy( (void *)result.back()["content"].data(), p, uncomp_size ); free(p); } } // We're done. mz_zip_reader_end(&zip_archive); } else {} this->resize( result.size() ); std::copy( result.begin(), result.end(), this->begin() ); return true; }
bool fe_zip_open_to_buff( const char *archive, const char *filename, FE_ZIP_ALLOC_CALLBACK callback, void **buff, size_t *buff_size ) { ASSERT( buff != NULL ); mz_zip_archive zip; memset( &zip, 0, sizeof( zip ) ); if ( !mz_zip_reader_init_file( &zip, archive, 0 ) ) { std::cerr << "Error initializing zip. zip: " << archive << std::endl; return false; } int index = mz_zip_reader_locate_file( &zip, filename, NULL, 0 ); if ( index < 0 ) { std::cerr << "Error locating file. zip: " << archive << ", file: " << filename << std::endl; mz_zip_reader_end( &zip ); return false; } mz_zip_archive_file_stat file_stat; if ( !mz_zip_reader_file_stat(&zip, index, &file_stat) ) { std::cerr << "Error reading filestats. zip: " << archive << ", file: " << filename << std::endl; mz_zip_reader_end( &zip ); return false; } void *tb = callback( file_stat.m_uncomp_size ); if ( tb == NULL ) { std::cerr << "Error allocating zip buffer. zip: " << archive << ", file: " << filename << std::endl; mz_zip_reader_end( &zip ); return false; } if ( !mz_zip_reader_extract_to_mem( &zip, index, tb, file_stat.m_uncomp_size, 0 ) ) { std::cerr << "Error extracting to buffer. zip: " << archive << ", file: " << filename << std::endl; mz_zip_reader_end( &zip ); delete (char *)tb; return false; } mz_zip_reader_end( &zip ); *buff = tb; if ( buff_size ) *buff_size = file_stat.m_uncomp_size; return true; }
bool VFSDirZip::close(void) { mz_zip_reader_end(&_zip); _zf->close(); return true; }
FileSourceZip::~FileSourceZip() { if (!m_archive) return; mz_zip_archive *zip = reinterpret_cast<mz_zip_archive*>(m_archive); mz_zip_reader_end(zip); }
int test_zip(int argc, char *argv[]) { int i, sort_iter; mz_bool status; size_t uncomp_size; mz_zip_archive zip_archive; //mz_zip_archive is a struct of all stuff about the zip void *p; const int N = 50; char data[2048]; char archive_filename[64]; //static const char *s_Test_archive_filename = "__mz_example2_test__.zip"; #ifdef MSC static const char *s_Test_archive_filename = "hallelujah.zip"; #else static const char *s_Test_archive_filename = "E:\\hallelujah.zip"; #endif assert((strlen(s_pTest_str) + 64) < sizeof(data)); printf("miniz.c version: %s\n", MZ_VERSION); (void)argc, (void)argv; // Delete the test archive, so it doesn't keep growing as we run this test remove(s_Test_archive_filename); // Append a bunch of text files to the test archive for (i = (N - 1); i >= 0; --i) { sprintf(archive_filename, "%u.txt", i); sprintf(data, "%u %s %u", (N - 1) - i, s_pTest_str, i); //sprintf(archive_filename, "E://look_a.zip"); // Add a new file to the archive. Note this is an IN-PLACE operation, so if it fails your archive is probably hosed (its central directory may not be complete) but it should be recoverable using zip -F or -FF. So use caution with this guy. // A more robust way to add a file to an archive would be to read it into memory, perform the operation, then write a new archive out to a temp file and then delete/rename the files. // Or, write a new archive to disk to a temp file, then delete/rename the files. For this test this API is fine. status = mz_zip_add_mem_to_archive_file_in_place(s_Test_archive_filename, archive_filename, data, strlen(data) + 1, s_pComment, (uint16)strlen(s_pComment), MZ_BEST_COMPRESSION); if (!status) { printf("mz_zip_add_mem_to_archive_file_in_place failed!\n"); return EXIT_FAILURE; } } // Add a directory entry for testing status = mz_zip_add_mem_to_archive_file_in_place(s_Test_archive_filename, "directory/", NULL, 0, "no comment", (uint16)strlen("no comment"), MZ_BEST_COMPRESSION); if (!status) { printf("mz_zip_add_mem_to_archive_file_in_place failed!\n"); return EXIT_FAILURE; } // Now try to open the archive. memset(&zip_archive, 0, sizeof(zip_archive)); status = mz_zip_reader_init_file(&zip_archive, s_Test_archive_filename, 0); if (!status) { printf("mz_zip_reader_init_file() failed!\n"); return EXIT_FAILURE; } // Get and print information about each file in the archive. for (i = 0; i < (int)mz_zip_reader_get_num_files(&zip_archive); i++) { mz_zip_archive_file_stat file_stat; if (!mz_zip_reader_file_stat(&zip_archive, i, &file_stat)) { printf("mz_zip_reader_file_stat() failed!\n"); mz_zip_reader_end(&zip_archive); return EXIT_FAILURE; } printf("Filename: \"%s\", Comment: \"%s\", Uncompressed size: %u, Compressed size: %u, Is Dir: %u\n", file_stat.m_filename, file_stat.m_comment, (uint)file_stat.m_uncomp_size, (uint)file_stat.m_comp_size, mz_zip_reader_is_file_a_directory(&zip_archive, i)); if (!strcmp(file_stat.m_filename, "directory/")) { if (!mz_zip_reader_is_file_a_directory(&zip_archive, i)) { printf("mz_zip_reader_is_file_a_directory() didn't return the expected results!\n"); mz_zip_reader_end(&zip_archive); return EXIT_FAILURE; } } } // Close the archive, freeing any resources it was using mz_zip_reader_end(&zip_archive); // Now verify the compressed data for (sort_iter = 0; sort_iter < 2; sort_iter++) { memset(&zip_archive, 0, sizeof(zip_archive)); status = mz_zip_reader_init_file(&zip_archive, s_Test_archive_filename, sort_iter ? MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY : 0); if (!status) { printf("mz_zip_reader_init_file() failed!\n"); return EXIT_FAILURE; } for (i = 0; i < N; i++) { sprintf(archive_filename, "%u.txt", i); sprintf(data, "%u %s %u", (N - 1) - i, s_pTest_str, i); // Try to extract all the files to the heap. p = mz_zip_reader_extract_file_to_heap(&zip_archive, archive_filename, &uncomp_size, 0); if (!p) { printf("mz_zip_reader_extract_file_to_heap() failed!\n"); mz_zip_reader_end(&zip_archive); return EXIT_FAILURE; } // Make sure the extraction really succeeded. if ((uncomp_size != (strlen(data) + 1)) || (memcmp(p, data, strlen(data)))) { printf("mz_zip_reader_extract_file_to_heap() failed to extract the proper data\n"); mz_free(p); mz_zip_reader_end(&zip_archive); return EXIT_FAILURE; } printf("Successfully extracted file \"%s\", size %u\n", archive_filename, (uint)uncomp_size); printf("File data: \"%s\"\n", (const char *)p); // We're done. mz_free(p); } // Close the archive, freeing any resources it was using mz_zip_reader_end(&zip_archive); } printf("Success.\n"); return EXIT_SUCCESS; }