Beispiel #1
0
unsigned int VFSDirZip::load(bool /*ignored*/)
{
    close();

    if(!zip_reader_init_vfsfile(&_zip, _zf, 0))
        return 0;

    unsigned int files = mz_zip_reader_get_num_files(&_zip);

    mz_zip_archive_file_stat fs;
    for (unsigned int i = 0; i < files; ++i)
    {
        // FIXME: do we want empty dirs in the tree?
        if(mz_zip_reader_is_file_a_directory(&_zip, i))
            continue;
        if(mz_zip_reader_is_file_encrypted(&_zip, i))
            continue;
        if(!mz_zip_reader_file_stat(&_zip, i, &fs))
            continue;
        if(getFile(fs.m_filename))
            continue;

        VFSFileZip *vf = new VFSFileZip(&_zip);
        vf->_setOrigin(this);
        memcpy(vf->getZipFileStat(), &fs, sizeof(mz_zip_archive_file_stat));
        vf->_init();
        addRecursive(vf, true, VFSDir::NONE);
        vf->ref--;
    }

    // Not necessary to keep open all the time, VFSFileZip will re-open the archive if needed
    //close();

    return files;
}
Beispiel #2
0
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();
}
Beispiel #3
0
FileSourceZip::FileSourceZip(FileSourceFS &fs, const std::string &zipPath) : FileSource(zipPath), m_archive(0)
{
	mz_zip_archive *zip = static_cast<mz_zip_archive*>(std::calloc(1, sizeof(mz_zip_archive)));
	FILE *file = fs.OpenReadStream(zipPath);
	if (!mz_zip_reader_init_file_stream(zip, file, 0)) {
		Output("FileSourceZip: unable to open '%s'\n", zipPath.c_str());
		std::free(zip);
		return;
	}

	mz_zip_archive_file_stat zipStat;

	Uint32 numFiles = mz_zip_reader_get_num_files(zip);
	for (Uint32 i = 0; i < numFiles; i++) {
		if (mz_zip_reader_file_stat(zip, i, &zipStat)) {
			bool is_dir = mz_zip_reader_is_file_a_directory(zip, i);
			if (!mz_zip_reader_is_file_encrypted(zip, i)) {
				std::string fname = zipStat.m_filename;
				if ((fname.size() > 1) && (fname[fname.size()-1] == '/')) {
					fname.resize(fname.size() - 1);
				}
				AddFile(zipStat.m_filename, FileStat(i, zipStat.m_uncomp_size,
					MakeFileInfo(fname, is_dir ? FileInfo::FT_DIR : FileInfo::FT_FILE)));
			}
		}
	}

	m_archive = static_cast<void*>(zip);
}
Beispiel #4
0
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);
}
Beispiel #5
0
	bool ZipIO::openFile(U32 FileIndex){
		_kready = false;
		_kfindex = FileIndex;
		_kcurOfst = 0;
		_kfileCurOfst = 0;
		if (!_kisopen || _kmode == OpenMode::WRITE || _kmode == OpenMode::APPEND)
			return false;

		if (!mz_zip_reader_file_stat(&_kzarchive, FileIndex, &_kfstat))
			return false;

		// Empty file, or a directory (but not always a directory - I've seen odd zips with directories that have compressed data which inflates to 0 bytes)
		if (!_kfstat.m_comp_size)
			return false;

		// Entry is a subdirectory (I've seen old zips with dir entries which have compressed deflate data which inflates to 0 bytes, but these entries claim to uncompress to 512 bytes in the headers).
		// I'm torn how to handle this case - should it fail instead?
		if (mz_zip_reader_is_file_a_directory(&_kzarchive, _kfindex))
			return false;

		// Encryption and patch files are not supported.
		if (_kfstat.m_bit_flag & (1 | 32))
			return false;

		// This function only supports stored and deflate.
		if ((!(0 & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (_kfstat.m_method != 0) && (_kfstat.m_method != MZ_DEFLATED))
			return false;

		// Read and parse the local directory entry.
		mz_uint32 local_header_u32[(MZ_ZIP_LOCAL_DIR_HEADER_SIZE + sizeof(mz_uint32)-1) / sizeof(mz_uint32)]; mz_uint8 *pLocal_header = (mz_uint8 *)local_header_u32;
		_kcurOfst = _kfstat.m_local_header_ofs;
		if (_kzarchive.m_pRead(_kzarchive.m_pIO_opaque, _kcurOfst, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != MZ_ZIP_LOCAL_DIR_HEADER_SIZE)
			return false;
		if (MZ_READ_LE32(pLocal_header) != MZ_ZIP_LOCAL_DIR_HEADER_SIG)
			return false;

		_kcurOfst += MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_FILENAME_LEN_OFS) + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_EXTRA_LEN_OFS);
		if ((_kcurOfst + _kfstat.m_comp_size) > _kzarchive.m_archive_size)
			return false;

		if (_kfstat.m_method == MZ_DEFLATED)
			_kisCmprsd = true;
		else if (_kfstat.m_method == 0 && _kfstat.m_uncomp_size == _kfstat.m_comp_size)
			_kisCmprsd = false;

		_kfname = _kfstat.m_filename;
		_kready = true;
		return true;
	}
Beispiel #6
0
CZipArchive::CZipArchive(FileReader &file) : ArchiveBase(file)
//------------------------------------------------------------
{
	zipFile = new mz_zip_archive();
	
	mz_zip_archive *zip = static_cast<mz_zip_archive*>(zipFile);
	
	MemsetZero(*zip);
	if(!mz_zip_reader_init_mem(zip, file.GetRawData(), file.GetLength(), 0))
	{
		delete zip;
		zip = nullptr;
		zipFile = nullptr;
	}

	if(!zip)
	{
		return;
	}

	for(mz_uint i = 0; i < mz_zip_reader_get_num_files(zip); ++i)
	{
		ArchiveFileInfo info;
		info.type = ArchiveFileInvalid;
		mz_zip_archive_file_stat stat;
		MemsetZero(stat);
		if(mz_zip_reader_file_stat(zip, i, &stat))
		{
			info.type = ArchiveFileNormal;
			info.name = mpt::PathString::FromWide(mpt::ToWide(mpt::CharsetCP437, stat.m_filename));
			info.size = stat.m_uncomp_size;
		}
		if(mz_zip_reader_is_file_a_directory(zip, i))
		{
			info.type = ArchiveFileSpecial;
		} else if(mz_zip_reader_is_file_encrypted(zip, i))
		{
			info.type = ArchiveFileSpecial;
		}
		contents.push_back(info);
	}

}
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;
}
Beispiel #8
0
FileSourceZip::FileSourceZip(const std::string &zipPath) : FileSource(zipPath), m_archive(0)
{
	mz_zip_archive *zip = reinterpret_cast<mz_zip_archive*>(std::calloc(1, sizeof(mz_zip_archive)));
	if (!mz_zip_reader_init_file(zip, zipPath.c_str(), 0)) {
		printf("FileSourceZip: unable to open '%s'\n", zipPath.c_str());
		std::free(zip);
		return;
	}

	mz_zip_archive_file_stat zipStat;

	Uint32 numFiles = mz_zip_reader_get_num_files(zip);
	for (Uint32 i = 0; i < numFiles; i++) {
		if (mz_zip_reader_file_stat(zip, i, &zipStat)) {
			bool is_dir = mz_zip_reader_is_file_a_directory(zip, i);
			if (!mz_zip_reader_is_file_encrypted(zip, i))
				AddFile(zipStat.m_filename, FileStat(i, zipStat.m_uncomp_size, MakeFileInfo(zipStat.m_filename, is_dir ? FileInfo::FT_DIR : FileInfo::FT_FILE)));
		}
	}

	m_archive = reinterpret_cast<void*>(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;
}
Beispiel #10
0
static int lmz_reader_is_file_a_directory(lua_State  *L) {
  lmz_file_t* zip = luaL_checkudata(L, 1, "miniz_reader");
  mz_uint file_index = (mz_uint)luaL_checkinteger(L, 2) - 1;
  lua_pushboolean(L, mz_zip_reader_is_file_a_directory(&(zip->archive), file_index));
  return 1;
}
Beispiel #11
0
static int Lreader_is_file_a_directory(lua_State  *L) {
    mz_zip_archive *za = luaL_checkudata(L, 1, LMZ_ZIP_READER);
    mz_uint file_index = (mz_uint)luaL_checkinteger(L, 2) - 1;
    lua_pushboolean(L, mz_zip_reader_is_file_a_directory(za, file_index));
    return 1;
}
Beispiel #12
0
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", &notenum)) {
            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;
}