👷 Upgrade miniz to 2.1.0

This commit is contained in:
C-3PO 2019-07-21 22:37:18 +02:00
parent cba048da4c
commit 380aa4457e
Signed by: c3po
GPG key ID: 62993C4BB4D86F24
5 changed files with 174 additions and 69 deletions

View file

@ -2,7 +2,6 @@
// Public domain, May 15 2011, Rich Geldreich, richgel99@gmail.com. See "unlicense" statement at the end of tinfl.c.
#include <stdio.h>
#include "miniz.h"
#include "miniz_zip.h"
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint;
@ -18,26 +17,6 @@ static const char *s_pStr = "Good morning Dr. Chandra. This is Hal. I am ready f
int main(int argc, char *argv[])
{
{
mz_zip_archive zip_archive;
memset(&zip_archive, 0, sizeof(zip_archive)); // mz_zip_archive contains a bunch of pointers. set all to nullptr
mz_bool status = mz_zip_writer_init(&zip_archive, 0);
if (!status)
return;
status = mz_zip_writer_add_file(&zip_archive, "Images.zip", "Images/title.png", NULL, 0, MZ_DEFAULT_COMPRESSION);
if (!status)
return;
status = mz_zip_writer_finalize_archive(&zip_archive);
if (!status)
return;
status = mz_zip_writer_end(&zip_archive);
if (!status)
return;
}
uint step = 0;
int cmp_status;
uLong src_len = (uLong)strlen(s_pStr);

View file

@ -61,7 +61,7 @@ int main(int argc, char *argv[])
// 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, 2, s_pComment, (uint16)strlen(s_pComment), MZ_BEST_COMPRESSION);
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");