Skip to content

Commit

Permalink
v1.13 initial checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed May 20, 2012
1 parent 6b95156 commit 56fb6c2
Show file tree
Hide file tree
Showing 18 changed files with 3,046 additions and 133 deletions.
14 changes: 7 additions & 7 deletions example1.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int main(int argc, char *argv[])
uLong uncomp_len = src_len;
uint8 *pCmp, *pUncomp;
uint total_succeeded = 0;
argc, argv;
(void)argc, (void)argv;

printf("miniz.c version: %s\n", MZ_VERSION);

Expand All @@ -49,7 +49,7 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}

printf("Compressed from %u to %u bytes\n", src_len, cmp_len);
printf("Compressed from %u to %u bytes\n", (mz_uint32)src_len, (mz_uint32)cmp_len);

if (step)
{
Expand All @@ -61,11 +61,11 @@ int main(int argc, char *argv[])
pCmp[i] ^= (rand() & 0xFF);
}
}

// Decompress.
cmp_status = uncompress(pUncomp, &uncomp_len, pCmp, cmp_len);
total_succeeded += (cmp_status == Z_OK);

if (step)
{
printf("Simple fuzzy test: step %u total_succeeded: %u\n", step, total_succeeded);
Expand All @@ -80,7 +80,7 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}

printf("Decompressed from %u to %u bytes\n", cmp_len, uncomp_len);
printf("Decompressed from %u to %u bytes\n", (mz_uint32)cmp_len, (mz_uint32)uncomp_len);

// Ensure uncompress() returned the expected data.
if ((uncomp_len != src_len) || (memcmp(pUncomp, s_pStr, (size_t)src_len)))
Expand All @@ -96,9 +96,9 @@ int main(int argc, char *argv[])
free(pUncomp);

step++;

// Keep on fuzzy testing if there's a non-empty command line.
} while (argc >= 2);
} while (argc >= 2);

printf("Success.\n");
return EXIT_SUCCESS;
Expand Down
88 changes: 88 additions & 0 deletions example1.cbp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="example1" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug Win32">
<Option output="$(SolutionDir)bin_mingw\example1D" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example1\Debug Win32_Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add option="-O0" />
<Add option="-m32" />
<Add option="-DWIN32" />
<Add option="-D_DEBUG" />
<Add option="-D_CONSOLE" />
<Add option="-D_CRT_SECURE_NO_WARNINGS" />
</Compiler>
<Linker>
<Add option="-m32" />
</Linker>
</Target>
<Target title="Debug x64">
<Option output="$(SolutionDir)bin_mingw\example1_x64D" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example1\Debug x64_Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-DWIN32" />
<Add option="-D_DEBUG" />
<Add option="-D_CONSOLE" />
<Add option="-D_CRT_SECURE_NO_WARNINGS" />
<Add option="-Wall" />
<Add option="-O0" />
</Compiler>
</Target>
<Target title="Release Win32">
<Option output="$(SolutionDir)bin_mingw\example1" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example1\Release Win32_Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O3" />
<Add option="-Wall" />
<Add option="-m32" />
<Add option="-DWIN32" />
<Add option="-DNDEBUG" />
<Add option="-D_CONSOLE" />
<Add option="-D_CRT_SECURE_NO_WARNINGS" />
</Compiler>
<Linker>
<Add option="-s" />
<Add option="-m32" />
</Linker>
</Target>
<Target title="Release x64">
<Option output="$(SolutionDir)bin_mingw\example1_x64" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example1\Release x64_Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-DWIN32" />
<Add option="-DNDEBUG" />
<Add option="-D_CONSOLE" />
<Add option="-D_CRT_SECURE_NO_WARNINGS" />
<Add option="-Wall" />
<Add option="-O3" />
</Compiler>
</Target>
</Build>
<Unit filename="example1.c">
<Option compilerVar="CC" />
</Unit>
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
82 changes: 41 additions & 41 deletions example2.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ typedef unsigned short uint16;
typedef unsigned int uint;

// The string to compress.
static const char *s_pStr =
"MISSION CONTROL I wouldn't worry too much about the computer. First of all, there is still a chance that he is right, despite your tests, and" \
"if it should happen again, we suggest eliminating this possibility by allowing the unit to remain in place and seeing whether or not it" \
"actually fails. If the computer should turn out to be wrong, the situation is still not alarming. The type of obsessional error he may be" \
"guilty of is not unknown among the latest generation of HAL 9000 computers. It has almost always revolved around a single detail, such as" \
"the one you have described, and it has never interfered with the integrity or reliability of the computer's performance in other areas." \
"No one is certain of the cause of this kind of malfunctioning. It may be over-programming, but it could also be any number of reasons. In any" \
"event, it is somewhat analogous to human neurotic behavior. Does this answer your query? Zero-five-three-Zero, MC, transmission concluded.";
static const char *s_pStr =
"MISSION CONTROL I wouldn't worry too much about the computer. First of all, there is still a chance that he is right, despite your tests, and" \
"if it should happen again, we suggest eliminating this possibility by allowing the unit to remain in place and seeing whether or not it" \
"actually fails. If the computer should turn out to be wrong, the situation is still not alarming. The type of obsessional error he may be" \
"guilty of is not unknown among the latest generation of HAL 9000 computers. It has almost always revolved around a single detail, such as" \
"the one you have described, and it has never interfered with the integrity or reliability of the computer's performance in other areas." \
"No one is certain of the cause of this kind of malfunctioning. It may be over-programming, but it could also be any number of reasons. In any" \
"event, it is somewhat analogous to human neurotic behavior. Does this answer your query? Zero-five-three-Zero, MC, transmission concluded.";

static const char *s_pComment = "This is a comment";

int main(int argc, char *argv[])
{
uint i;
mz_bool status;
size_t uncomp_size;
mz_zip_archive zip_archive;
void *p;
uint i;
mz_bool status;
size_t uncomp_size;
mz_zip_archive zip_archive;
void *p;

printf("miniz.c version: %s\n", MZ_VERSION);
printf("miniz.c version: %s\n", MZ_VERSION);

argc, argv;
(void)argc, (void)argv;

// Append a bunch of text files to test.zip
for (i = 0; i < 50; i++)
Expand All @@ -43,29 +43,29 @@ int main(int argc, char *argv[])
}
}

// Now try to open the archive.
memset(&zip_archive, 0, sizeof(zip_archive));
status = mz_zip_reader_init_file(&zip_archive, "test.zip", 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 < 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);
// Now try to open the archive.
memset(&zip_archive, 0, sizeof(zip_archive));
status = mz_zip_reader_init_file(&zip_archive, "test.zip", 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 < 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\n", file_stat.m_filename, file_stat.m_comment, (uint)file_stat.m_uncomp_size, (uint)file_stat.m_comp_size);
}

printf("Filename: \"%s\", Comment: \"%s\", Uncompressed size: %u, Compressed size: %u\n", file_stat.m_filename, file_stat.m_comment, (uint)file_stat.m_uncomp_size, (uint)file_stat.m_comp_size);
}

// Try to extract 0.txt to the heap.
p = mz_zip_reader_extract_file_to_heap(&zip_archive, "0.txt", &uncomp_size, 0);
if (!p)
Expand All @@ -86,10 +86,10 @@ int main(int argc, char *argv[])

printf("Successfully extracted file \"0.txt\", size %u\n", (uint)uncomp_size);

// We're done.
free(p);
mz_zip_reader_end(&zip_archive);
// We're done.
free(p);
mz_zip_reader_end(&zip_archive);

printf("Success.\n");
return EXIT_SUCCESS;
printf("Success.\n");
return EXIT_SUCCESS;
}
88 changes: 88 additions & 0 deletions example2.cbp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="example2" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug Win32">
<Option output="$(SolutionDir)bin_mingw\example2D" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example2\Debug Win32_Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add option="-O0" />
<Add option="-m32" />
<Add option="-DWIN32" />
<Add option="-D_DEBUG" />
<Add option="-D_CONSOLE" />
<Add option="-D_CRT_SECURE_NO_WARNINGS" />
</Compiler>
<Linker>
<Add option="-m32" />
</Linker>
</Target>
<Target title="Debug x64">
<Option output="$(SolutionDir)bin_mingw\example2_x64D" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example2\Debug x64_Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-DWIN32" />
<Add option="-D_DEBUG" />
<Add option="-D_CONSOLE" />
<Add option="-D_CRT_SECURE_NO_WARNINGS" />
<Add option="-Wall" />
<Add option="-O0" />
</Compiler>
</Target>
<Target title="Release Win32">
<Option output="$(SolutionDir)bin_mingw\example2" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example2\Release Win32_Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O3" />
<Add option="-Wall" />
<Add option="-m32" />
<Add option="-DWIN32" />
<Add option="-DNDEBUG" />
<Add option="-D_CONSOLE" />
<Add option="-D_CRT_SECURE_NO_WARNINGS" />
</Compiler>
<Linker>
<Add option="-s" />
<Add option="-m32" />
</Linker>
</Target>
<Target title="Release x64">
<Option output="$(SolutionDir)bin_mingw\example2_x64" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example2\Release x64_Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-DWIN32" />
<Add option="-DNDEBUG" />
<Add option="-D_CONSOLE" />
<Add option="-D_CRT_SECURE_NO_WARNINGS" />
<Add option="-Wall" />
<Add option="-O3" />
</Compiler>
</Target>
</Build>
<Unit filename="example2.c">
<Option compilerVar="CC" />
</Unit>
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
Loading

0 comments on commit 56fb6c2

Please sign in to comment.