1 Commits
v114 ... v109

Author SHA1 Message Date
richgel99@gmail.com
04debb7192 2011-05-17 09:39:27 +00:00
23 changed files with 356 additions and 4564 deletions

View File

@@ -1,5 +1,5 @@
// example1.c - Demonstrates miniz.c's compress() and uncompress() functions (same as zlib's). // example1.c - Demonstrates miniz.c's compress() and uncompress() functions (same as zlib's).
// Public domain, May 15 2011, Rich Geldreich, richgel99@gmail.com. See "unlicense" statement at the end of tinfl.c. // Public domain, May 15 2011, Rich Geldreich, richgel99@gmail.com
#include "miniz.c" #include "miniz.c"
typedef unsigned char uint8; typedef unsigned char uint8;
@@ -24,15 +24,13 @@ int main(int argc, char *argv[])
uLong uncomp_len = src_len; uLong uncomp_len = src_len;
uint8 *pCmp, *pUncomp; uint8 *pCmp, *pUncomp;
uint total_succeeded = 0; uint total_succeeded = 0;
(void)argc, (void)argv; argc, argv;
printf("miniz.c version: %s\n", MZ_VERSION);
do do
{ {
// Allocate buffers to hold compressed and uncompressed data. // Allocate buffers to hold compressed and uncompressed data.
pCmp = (mz_uint8 *)malloc((size_t)cmp_len); pCmp = (mz_uint8 *)malloc(cmp_len);
pUncomp = (mz_uint8 *)malloc((size_t)src_len); pUncomp = (mz_uint8 *)malloc(src_len);
if ((!pCmp) || (!pUncomp)) if ((!pCmp) || (!pUncomp))
{ {
printf("Out of memory!\n"); printf("Out of memory!\n");
@@ -49,7 +47,7 @@ int main(int argc, char *argv[])
return EXIT_FAILURE; return EXIT_FAILURE;
} }
printf("Compressed from %u to %u bytes\n", (mz_uint32)src_len, (mz_uint32)cmp_len); printf("Compressed from %u to %u bytes\n", src_len, cmp_len);
if (step) if (step)
{ {
@@ -80,10 +78,10 @@ int main(int argc, char *argv[])
return EXIT_FAILURE; return EXIT_FAILURE;
} }
printf("Decompressed from %u to %u bytes\n", (mz_uint32)cmp_len, (mz_uint32)uncomp_len); printf("Decompressed from %u to %u bytes\n", cmp_len, uncomp_len);
// Ensure uncompress() returned the expected data. // Ensure uncompress() returned the expected data.
if ((uncomp_len != src_len) || (memcmp(pUncomp, s_pStr, (size_t)src_len))) if ((uncomp_len != src_len) || (memcmp(pUncomp, s_pStr, src_len)))
{ {
printf("Decompression failed!\n"); printf("Decompression failed!\n");
free(pCmp); free(pCmp);

View File

@@ -1,88 +0,0 @@
<?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>

View File

@@ -22,7 +22,7 @@
<Configuration <Configuration
Name="Debug|Win32" Name="Debug|Win32"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
> >
@@ -94,7 +94,7 @@
<Configuration <Configuration
Name="Debug|x64" Name="Debug|x64"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
> >
@@ -167,7 +167,7 @@
<Configuration <Configuration
Name="Release|Win32" Name="Release|Win32"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
WholeProgramOptimization="1" WholeProgramOptimization="1"
@@ -244,7 +244,7 @@
<Configuration <Configuration
Name="Release|x64" Name="Release|x64"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
WholeProgramOptimization="1" WholeProgramOptimization="1"

View File

@@ -1,5 +1,5 @@
// example2.c - Simple demonstration of miniz.c's ZIP archive API's. // example2.c - Simple demonstration of miniz.c's ZIP archive API's.
// Public domain, May 15 2011, Rich Geldreich, richgel99@gmail.com. See "unlicense" statement at the end of tinfl.c. // Public domain, May 15 2011, Rich Geldreich, richgel99@gmail.com
#include "miniz.c" #include "miniz.c"
typedef unsigned char uint8; typedef unsigned char uint8;
@@ -26,9 +26,7 @@ int main(int argc, char *argv[])
mz_zip_archive zip_archive; mz_zip_archive zip_archive;
void *p; void *p;
printf("miniz.c version: %s\n", MZ_VERSION); argc, argv;
(void)argc, (void)argv;
// Append a bunch of text files to test.zip // Append a bunch of text files to test.zip
for (i = 0; i < 50; i++) for (i = 0; i < 50; i++)

View File

@@ -1,88 +0,0 @@
<?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>

View File

@@ -22,7 +22,7 @@
<Configuration <Configuration
Name="Debug|Win32" Name="Debug|Win32"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
> >
@@ -94,7 +94,7 @@
<Configuration <Configuration
Name="Debug|x64" Name="Debug|x64"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
> >
@@ -167,7 +167,7 @@
<Configuration <Configuration
Name="Release|Win32" Name="Release|Win32"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
WholeProgramOptimization="1" WholeProgramOptimization="1"
@@ -244,7 +244,7 @@
<Configuration <Configuration
Name="Release|x64" Name="Release|x64"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
WholeProgramOptimization="1" WholeProgramOptimization="1"

View File

@@ -1,8 +1,7 @@
// example3.c - Demonstrates how to use miniz.c's deflate() and inflate() functions for simple file compression. // example3.c - Demonstrates how to use miniz.c's deflate() and inflate() functions for simple file compression.
// Public domain, May 15 2011, Rich Geldreich, richgel99@gmail.com. See "unlicense" statement at the end of tinfl.c. // Public domain, May 15 2011, Rich Geldreich, richgel99@gmail.com
// For simplicity, this example is limited to files smaller than 4GB, but this is not a limitation of miniz.c. // For simplicity, this example is limited to files smaller than 4GB, but this is not a limitation of miniz.c.
#include "miniz.c" #include "miniz.c"
#include <limits.h>
typedef unsigned char uint8; typedef unsigned char uint8;
typedef unsigned short uint16; typedef unsigned short uint16;
@@ -20,74 +19,20 @@ int main(int argc, char *argv[])
const char *pMode; const char *pMode;
FILE *pInfile, *pOutfile; FILE *pInfile, *pOutfile;
uint infile_size; uint infile_size;
int level = Z_BEST_COMPRESSION;
z_stream stream; z_stream stream;
int p = 1;
const char *pSrc_filename;
const char *pDst_filename;
long file_loc;
printf("miniz.c version: %s\n", MZ_VERSION); if (argc != 4)
if (argc < 4)
{ {
printf("Usage: example3 [options] [mode:c or d] infile outfile\n"); printf("Usage: example3 [c/d] infile outfile\n");
printf("\nModes:\n");
printf("c - Compresses file infile to a zlib stream in file outfile\n"); printf("c - Compresses file infile to a zlib stream in file outfile\n");
printf("d - Decompress zlib stream in file infile to file outfile\n"); printf("d - Decompress zlib stream in file infile to file outfile\n");
printf("\nOptions:\n");
printf("-l[0-10] - Compression level, higher values are slower.\n");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
while ((p < argc) && (argv[p][0] == '-')) pMode = argv[1];
{
switch (argv[p][1])
{
case 'l':
{
level = atoi(&argv[1][2]);
if ((level < 0) || (level > 10))
{
printf("Invalid level!\n");
return EXIT_FAILURE;
}
break;
}
default:
{
printf("Invalid option: %s\n", argv[p]);
return EXIT_FAILURE;
}
}
p++;
}
if ((argc - p) < 3)
{
printf("Must specify mode, input filename, and output filename after options!\n");
return EXIT_FAILURE;
}
else if ((argc - p) > 3)
{
printf("Too many filenames!\n");
return EXIT_FAILURE;
}
pMode = argv[p++];
if (!strchr("cCdD", pMode[0]))
{
printf("Invalid mode!\n");
return EXIT_FAILURE;
}
pSrc_filename = argv[p++];
pDst_filename = argv[p++];
printf("Mode: %c, Level: %u\nInput File: \"%s\"\nOutput File: \"%s\"\n", pMode[0], level, pSrc_filename, pDst_filename);
// Open input file. // Open input file.
pInfile = fopen(pSrc_filename, "rb"); pInfile = fopen(argv[2], "rb");
if (!pInfile) if (!pInfile)
{ {
printf("Failed opening input file!\n"); printf("Failed opening input file!\n");
@@ -96,20 +41,11 @@ int main(int argc, char *argv[])
// Determine input file's size. // Determine input file's size.
fseek(pInfile, 0, SEEK_END); fseek(pInfile, 0, SEEK_END);
file_loc = ftell(pInfile); infile_size = ftell(pInfile);
fseek(pInfile, 0, SEEK_SET); fseek(pInfile, 0, SEEK_SET);
if ((file_loc < 0) || (file_loc > INT_MAX))
{
// This is not a limitation of miniz or tinfl, but this example.
printf("File is too large to be processed by this example.\n");
return EXIT_FAILURE;
}
infile_size = (uint)file_loc;
// Open output file. // Open output file.
pOutfile = fopen(pDst_filename, "wb"); pOutfile = fopen(argv[3], "wb");
if (!pOutfile) if (!pOutfile)
{ {
printf("Failed opening output file!\n"); printf("Failed opening output file!\n");
@@ -130,7 +66,7 @@ int main(int argc, char *argv[])
// Compression. // Compression.
uint infile_remaining = infile_size; uint infile_remaining = infile_size;
if (deflateInit(&stream, level) != Z_OK) if (deflateInit(&stream, Z_BEST_COMPRESSION) != Z_OK)
{ {
printf("deflateInit() failed!\n"); printf("deflateInit() failed!\n");
return EXIT_FAILURE; return EXIT_FAILURE;
@@ -154,7 +90,7 @@ int main(int argc, char *argv[])
stream.avail_in = n; stream.avail_in = n;
infile_remaining -= n; infile_remaining -= n;
//printf("Input bytes remaining: %u\n", infile_remaining); printf("Input bytes remaining: %u\n", infile_remaining);
} }
status = deflate(&stream, infile_remaining ? Z_NO_FLUSH : Z_FINISH); status = deflate(&stream, infile_remaining ? Z_NO_FLUSH : Z_FINISH);
@@ -261,8 +197,8 @@ int main(int argc, char *argv[])
return EXIT_FAILURE; return EXIT_FAILURE;
} }
printf("Total input bytes: %u\n", (mz_uint32)stream.total_in); printf("Total input bytes: %u\n", stream.total_in);
printf("Total output bytes: %u\n", (mz_uint32)stream.total_out); printf("Total output bytes: %u\n", stream.total_out);
printf("Success.\n"); printf("Success.\n");
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@@ -1,88 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="example3" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug Win32">
<Option output="$(SolutionDir)bin_mingw\example3D" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example3\Debug Win32_Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O0" />
<Add option="-m32" />
<Add option="-DWIN32" />
<Add option="-D_DEBUG" />
<Add option="-D_CONSOLE" />
<Add option="-D_CRT_SECURE_NO_WARNINGS" />
<Add option="-Wall" />
<Add option="-g" />
</Compiler>
<Linker>
<Add option="-m32" />
</Linker>
</Target>
<Target title="Debug x64">
<Option output="$(SolutionDir)bin_mingw\example3_x64D" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example3\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\example3" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example3\Release Win32_Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-m32" />
<Add option="-DWIN32" />
<Add option="-DNDEBUG" />
<Add option="-D_CONSOLE" />
<Add option="-D_CRT_SECURE_NO_WARNINGS" />
<Add option="-Wall" />
<Add option="-O3" />
</Compiler>
<Linker>
<Add option="-s" />
<Add option="-m32" />
</Linker>
</Target>
<Target title="Release x64">
<Option output="$(SolutionDir)bin_mingw\example3_x64" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example3\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="example3.c">
<Option compilerVar="CC" />
</Unit>
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

View File

@@ -22,7 +22,7 @@
<Configuration <Configuration
Name="Debug|Win32" Name="Debug|Win32"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
> >
@@ -94,7 +94,7 @@
<Configuration <Configuration
Name="Debug|x64" Name="Debug|x64"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
> >
@@ -167,7 +167,7 @@
<Configuration <Configuration
Name="Release|Win32" Name="Release|Win32"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
WholeProgramOptimization="1" WholeProgramOptimization="1"
@@ -244,7 +244,7 @@
<Configuration <Configuration
Name="Release|x64" Name="Release|x64"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
WholeProgramOptimization="1" WholeProgramOptimization="1"

View File

@@ -1,8 +1,7 @@
// example4.c - Uses tinfl.c to decompress a zlib stream in memory to an output file // example4.c - Uses tinfl.c to decompress a zlib stream in memory to an output file
// Public domain, May 15 2011, Rich Geldreich, richgel99@gmail.com. See "unlicense" statement at the end of tinfl.c. // Public domain, May 15 2011, Rich Geldreich, richgel99@gmail.com
#include "tinfl.c" #include "tinfl.c"
#include <stdio.h> #include <stdio.h>
#include <limits.h>
typedef unsigned char uint8; typedef unsigned char uint8;
typedef unsigned short uint16; typedef unsigned short uint16;
@@ -23,7 +22,6 @@ int main(int argc, char *argv[])
uint infile_size, outfile_size; uint infile_size, outfile_size;
size_t in_buf_size; size_t in_buf_size;
uint8 *pCmp_data; uint8 *pCmp_data;
long file_loc;
if (argc != 3) if (argc != 3)
{ {
@@ -43,18 +41,9 @@ int main(int argc, char *argv[])
// Determine input file's size. // Determine input file's size.
fseek(pInfile, 0, SEEK_END); fseek(pInfile, 0, SEEK_END);
file_loc = ftell(pInfile); infile_size = ftell(pInfile);
fseek(pInfile, 0, SEEK_SET); fseek(pInfile, 0, SEEK_SET);
if ((file_loc < 0) || (file_loc > INT_MAX))
{
// This is not a limitation of miniz or tinfl, but this example.
printf("File is too large to be processed by this example.\n");
return EXIT_FAILURE;
}
infile_size = (uint)file_loc;
pCmp_data = (uint8 *)malloc(infile_size); pCmp_data = (uint8 *)malloc(infile_size);
if (!pCmp_data) if (!pCmp_data)
{ {

View File

@@ -1,88 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="example4" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug Win32">
<Option output="$(SolutionDir)bin_mingw\example4D" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example4\Debug Win32_Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O0" />
<Add option="-m32" />
<Add option="-DWIN32" />
<Add option="-D_DEBUG" />
<Add option="-D_CONSOLE" />
<Add option="-D_CRT_SECURE_NO_WARNINGS" />
<Add option="-Wall" />
<Add option="-g" />
</Compiler>
<Linker>
<Add option="-m32" />
</Linker>
</Target>
<Target title="Debug x64">
<Option output="$(SolutionDir)bin_mingw\example4_x64D" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example4\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\example4" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example4\Release Win32_Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-m32" />
<Add option="-DWIN32" />
<Add option="-DNDEBUG" />
<Add option="-D_CONSOLE" />
<Add option="-D_CRT_SECURE_NO_WARNINGS" />
<Add option="-Wall" />
<Add option="-O3" />
</Compiler>
<Linker>
<Add option="-s" />
<Add option="-m32" />
</Linker>
</Target>
<Target title="Release x64">
<Option output="$(SolutionDir)bin_mingw\example4_x64" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example4\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="example4.c">
<Option compilerVar="CC" />
</Unit>
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

View File

@@ -22,7 +22,7 @@
<Configuration <Configuration
Name="Debug|Win32" Name="Debug|Win32"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
> >
@@ -94,7 +94,7 @@
<Configuration <Configuration
Name="Debug|x64" Name="Debug|x64"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
> >
@@ -167,7 +167,7 @@
<Configuration <Configuration
Name="Release|Win32" Name="Release|Win32"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
WholeProgramOptimization="1" WholeProgramOptimization="1"
@@ -244,7 +244,7 @@
<Configuration <Configuration
Name="Release|x64" Name="Release|x64"
OutputDirectory="$(SolutionDir)bin" OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
WholeProgramOptimization="1" WholeProgramOptimization="1"

View File

@@ -1,327 +0,0 @@
// example5.c - Demonstrates how to use miniz.c's low-level tdefl_compress() and tinfl_inflate() API's for simple file to file compression/decompression.
// The low-level API's are the fastest, make no use of dynamic memory allocation, and are the most flexible functions exposed by miniz.c.
// Public domain, April 11 2012, Rich Geldreich, richgel99@gmail.com. See "unlicense" statement at the end of tinfl.c.
// For simplicity, this example is limited to files smaller than 4GB, but this is not a limitation of miniz.c.
// Purposely disable a whole bunch of stuff this low-level example doesn't use.
#define MINIZ_NO_STDIO
#define MINIZ_NO_ARCHIVE_APIS
#define MINIZ_NO_TIME
#define MINIZ_NO_ZLIB_APIS
#define MINIZ_NO_MALLOC
#include "miniz.c"
// Now include stdio.h because this test uses fopen(), etc. (but we still don't want miniz.c's stdio stuff, for testing).
#include <stdio.h>
#include <limits.h>
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint;
#define my_max(a,b) (((a) > (b)) ? (a) : (b))
#define my_min(a,b) (((a) < (b)) ? (a) : (b))
// IN_BUF_SIZE is the size of the file read buffer.
// IN_BUF_SIZE must be >= 1
#define IN_BUF_SIZE (1024*512)
static uint8 s_inbuf[IN_BUF_SIZE];
// COMP_OUT_BUF_SIZE is the size of the output buffer used during compression.
// COMP_OUT_BUF_SIZE must be >= 1 and <= OUT_BUF_SIZE
#define COMP_OUT_BUF_SIZE (1024*512)
// OUT_BUF_SIZE is the size of the output buffer used during decompression.
// OUT_BUF_SIZE must be a power of 2 >= TINFL_LZ_DICT_SIZE (because the low-level decompressor not only writes, but reads from the output buffer as it decompresses)
//#define OUT_BUF_SIZE (TINFL_LZ_DICT_SIZE)
#define OUT_BUF_SIZE (1024*512)
static uint8 s_outbuf[OUT_BUF_SIZE];
// tdefl_compressor contains all the state needed by the low-level compressor so it's a pretty big struct (~300k).
// This example makes it a global vs. putting it on the stack, of course in real-world usage you'll probably malloc() or new it.
tdefl_compressor g_deflator;
int main(int argc, char *argv[])
{
const char *pMode;
FILE *pInfile, *pOutfile;
uint infile_size;
int level = 9;
int p = 1;
const char *pSrc_filename;
const char *pDst_filename;
const void *next_in = s_inbuf;
size_t avail_in = 0;
void *next_out = s_outbuf;
size_t avail_out = OUT_BUF_SIZE;
size_t total_in = 0, total_out = 0;
long file_loc;
assert(COMP_OUT_BUF_SIZE <= OUT_BUF_SIZE);
printf("miniz.c example5 (demonstrates tinfl/tdefl)\n");
if (argc < 4)
{
printf("File to file compression/decompression using the low-level tinfl/tdefl API's.\n");
printf("Usage: example5 [options] [mode:c or d] infile outfile\n");
printf("\nModes:\n");
printf("c - Compresses file infile to a zlib stream in file outfile\n");
printf("d - Decompress zlib stream in file infile to file outfile\n");
printf("\nOptions:\n");
printf("-l[0-10] - Compression level, higher values are slower, 0 is none.\n");
return EXIT_FAILURE;
}
while ((p < argc) && (argv[p][0] == '-'))
{
switch (argv[p][1])
{
case 'l':
{
level = atoi(&argv[1][2]);
if ((level < 0) || (level > 10))
{
printf("Invalid level!\n");
return EXIT_FAILURE;
}
break;
}
default:
{
printf("Invalid option: %s\n", argv[p]);
return EXIT_FAILURE;
}
}
p++;
}
if ((argc - p) < 3)
{
printf("Must specify mode, input filename, and output filename after options!\n");
return EXIT_FAILURE;
}
else if ((argc - p) > 3)
{
printf("Too many filenames!\n");
return EXIT_FAILURE;
}
pMode = argv[p++];
if (!strchr("cCdD", pMode[0]))
{
printf("Invalid mode!\n");
return EXIT_FAILURE;
}
pSrc_filename = argv[p++];
pDst_filename = argv[p++];
printf("Mode: %c, Level: %u\nInput File: \"%s\"\nOutput File: \"%s\"\n", pMode[0], level, pSrc_filename, pDst_filename);
// Open input file.
pInfile = fopen(pSrc_filename, "rb");
if (!pInfile)
{
printf("Failed opening input file!\n");
return EXIT_FAILURE;
}
// Determine input file's size.
fseek(pInfile, 0, SEEK_END);
file_loc = ftell(pInfile);
fseek(pInfile, 0, SEEK_SET);
if ((file_loc < 0) || (file_loc > INT_MAX))
{
// This is not a limitation of miniz or tinfl, but this example.
printf("File is too large to be processed by this example.\n");
return EXIT_FAILURE;
}
infile_size = (uint)file_loc;
// Open output file.
pOutfile = fopen(pDst_filename, "wb");
if (!pOutfile)
{
printf("Failed opening output file!\n");
return EXIT_FAILURE;
}
printf("Input file size: %u\n", infile_size);
if ((pMode[0] == 'c') || (pMode[0] == 'C'))
{
// The number of dictionary probes to use at each compression level (0-10). 0=implies fastest/minimal possible probing.
static const mz_uint s_tdefl_num_probes[11] = { 0, 1, 6, 32, 16, 32, 128, 256, 512, 768, 1500 };
tdefl_status status;
uint infile_remaining = infile_size;
// create tdefl() compatible flags (we have to compose the low-level flags ourselves, or use tdefl_create_comp_flags_from_zip_params() but that means MINIZ_NO_ZLIB_APIS can't be defined).
mz_uint comp_flags = TDEFL_WRITE_ZLIB_HEADER | s_tdefl_num_probes[MZ_MIN(10, level)] | ((level <= 3) ? TDEFL_GREEDY_PARSING_FLAG : 0);
if (!level)
comp_flags |= TDEFL_FORCE_ALL_RAW_BLOCKS;
// Initialize the low-level compressor.
status = tdefl_init(&g_deflator, NULL, NULL, comp_flags);
if (status != TDEFL_STATUS_OKAY)
{
printf("tdefl_init() failed!\n");
return EXIT_FAILURE;
}
avail_out = COMP_OUT_BUF_SIZE;
// Compression.
for ( ; ; )
{
size_t in_bytes, out_bytes;
if (!avail_in)
{
// Input buffer is empty, so read more bytes from input file.
uint n = my_min(IN_BUF_SIZE, infile_remaining);
if (fread(s_inbuf, 1, n, pInfile) != n)
{
printf("Failed reading from input file!\n");
return EXIT_FAILURE;
}
next_in = s_inbuf;
avail_in = n;
infile_remaining -= n;
//printf("Input bytes remaining: %u\n", infile_remaining);
}
in_bytes = avail_in;
out_bytes = avail_out;
// Compress as much of the input as possible (or all of it) to the output buffer.
status = tdefl_compress(&g_deflator, next_in, &in_bytes, next_out, &out_bytes, infile_remaining ? TDEFL_NO_FLUSH : TDEFL_FINISH);
next_in = (const char *)next_in + in_bytes;
avail_in -= in_bytes;
total_in += in_bytes;
next_out = (char *)next_out + out_bytes;
avail_out -= out_bytes;
total_out += out_bytes;
if ((status != TDEFL_STATUS_OKAY) || (!avail_out))
{
// Output buffer is full, or compression is done or failed, so write buffer to output file.
uint n = COMP_OUT_BUF_SIZE - (uint)avail_out;
if (fwrite(s_outbuf, 1, n, pOutfile) != n)
{
printf("Failed writing to output file!\n");
return EXIT_FAILURE;
}
next_out = s_outbuf;
avail_out = COMP_OUT_BUF_SIZE;
}
if (status == TDEFL_STATUS_DONE)
{
// Compression completed successfully.
break;
}
else if (status != TDEFL_STATUS_OKAY)
{
// Compression somehow failed.
printf("tdefl_compress() failed with status %i!\n", status);
return EXIT_FAILURE;
}
}
}
else if ((pMode[0] == 'd') || (pMode[0] == 'D'))
{
// Decompression.
uint infile_remaining = infile_size;
tinfl_decompressor inflator;
tinfl_init(&inflator);
for ( ; ; )
{
size_t in_bytes, out_bytes;
tinfl_status status;
if (!avail_in)
{
// Input buffer is empty, so read more bytes from input file.
uint n = my_min(IN_BUF_SIZE, infile_remaining);
if (fread(s_inbuf, 1, n, pInfile) != n)
{
printf("Failed reading from input file!\n");
return EXIT_FAILURE;
}
next_in = s_inbuf;
avail_in = n;
infile_remaining -= n;
}
in_bytes = avail_in;
out_bytes = avail_out;
status = tinfl_decompress(&inflator, (const mz_uint8 *)next_in, &in_bytes, s_outbuf, (mz_uint8 *)next_out, &out_bytes, (infile_remaining ? TINFL_FLAG_HAS_MORE_INPUT : 0) | TINFL_FLAG_PARSE_ZLIB_HEADER);
avail_in -= in_bytes;
next_in = (const mz_uint8 *)next_in + in_bytes;
total_in += in_bytes;
avail_out -= out_bytes;
next_out = (mz_uint8 *)next_out + out_bytes;
total_out += out_bytes;
if ((status <= TINFL_STATUS_DONE) || (!avail_out))
{
// Output buffer is full, or decompression is done, so write buffer to output file.
uint n = OUT_BUF_SIZE - (uint)avail_out;
if (fwrite(s_outbuf, 1, n, pOutfile) != n)
{
printf("Failed writing to output file!\n");
return EXIT_FAILURE;
}
next_out = s_outbuf;
avail_out = OUT_BUF_SIZE;
}
// If status is <= TINFL_STATUS_DONE then either decompression is done or something went wrong.
if (status <= TINFL_STATUS_DONE)
{
if (status == TINFL_STATUS_DONE)
{
// Decompression completed successfully.
break;
}
else
{
// Decompression failed.
printf("tinfl_decompress() failed with status %i!\n", status);
return EXIT_FAILURE;
}
}
}
}
else
{
printf("Invalid mode!\n");
return EXIT_FAILURE;
}
fclose(pInfile);
if (EOF == fclose(pOutfile))
{
printf("Failed writing to output file!\n");
return EXIT_FAILURE;
}
printf("Total input bytes: %u\n", (mz_uint32)total_in);
printf("Total output bytes: %u\n", (mz_uint32)total_out);
printf("Success.\n");
return EXIT_SUCCESS;
}

View File

@@ -1,88 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="example5" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug Win32">
<Option output="$(SolutionDir)bin_mingw\example5D" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example5\Debug Win32_Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O0" />
<Add option="-m32" />
<Add option="-DWIN32" />
<Add option="-D_DEBUG" />
<Add option="-D_CONSOLE" />
<Add option="-D_CRT_SECURE_NO_WARNINGS" />
<Add option="-Wall" />
<Add option="-g" />
</Compiler>
<Linker>
<Add option="-m32" />
</Linker>
</Target>
<Target title="Debug x64">
<Option output="$(SolutionDir)bin_mingw\example5_x64D" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example5\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\example5" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example5\Release Win32_Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-m32" />
<Add option="-DWIN32" />
<Add option="-DNDEBUG" />
<Add option="-D_CONSOLE" />
<Add option="-D_CRT_SECURE_NO_WARNINGS" />
<Add option="-Wall" />
<Add option="-O3" />
</Compiler>
<Linker>
<Add option="-s" />
<Add option="-m32" />
</Linker>
</Target>
<Target title="Release x64">
<Option output="$(SolutionDir)bin_mingw\example5_x64" prefix_auto="1" extension_auto="1" />
<Option working_dir="$(SolutionDir)bin_mingw" />
<Option object_output="example5\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="example5.c">
<Option compilerVar="CC" />
</Unit>
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

View File

@@ -1,346 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="example5"
ProjectGUID="{AE293522-92D8-4B60-95C7-B4AEE10A303F}"
RootNamespace="example5"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName)D.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName)_x64D.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName)_x64.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FD737F1-C7A5-4376-A066-2A32D752A31F}"
>
<File
RelativePath=".\example5.c"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{17DA6AB6-F800-4c08-8B7A-83BB121AAC02}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -9,10 +9,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example3", "example3.vcproj
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example4", "example4.vcproj", "{AE293522-92D8-4B60-95C7-C3AEE10A303F}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example4", "example4.vcproj", "{AE293522-92D8-4B60-95C7-C3AEE10A303F}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example5", "example5.vcproj", "{AE293522-92D8-4B60-95C7-B4AEE10A303F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniz_tester", "miniz_tester.vcproj", "{AE293522-92D9-1B60-95C7-B4AEE10A303F}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
@@ -53,22 +49,6 @@ Global
{AE293522-92D8-4B60-95C7-C3AEE10A303F}.Release|Win32.Build.0 = Release|Win32 {AE293522-92D8-4B60-95C7-C3AEE10A303F}.Release|Win32.Build.0 = Release|Win32
{AE293522-92D8-4B60-95C7-C3AEE10A303F}.Release|x64.ActiveCfg = Release|x64 {AE293522-92D8-4B60-95C7-C3AEE10A303F}.Release|x64.ActiveCfg = Release|x64
{AE293522-92D8-4B60-95C7-C3AEE10A303F}.Release|x64.Build.0 = Release|x64 {AE293522-92D8-4B60-95C7-C3AEE10A303F}.Release|x64.Build.0 = Release|x64
{AE293522-92D8-4B60-95C7-B4AEE10A303F}.Debug|Win32.ActiveCfg = Debug|Win32
{AE293522-92D8-4B60-95C7-B4AEE10A303F}.Debug|Win32.Build.0 = Debug|Win32
{AE293522-92D8-4B60-95C7-B4AEE10A303F}.Debug|x64.ActiveCfg = Debug|x64
{AE293522-92D8-4B60-95C7-B4AEE10A303F}.Debug|x64.Build.0 = Debug|x64
{AE293522-92D8-4B60-95C7-B4AEE10A303F}.Release|Win32.ActiveCfg = Release|Win32
{AE293522-92D8-4B60-95C7-B4AEE10A303F}.Release|Win32.Build.0 = Release|Win32
{AE293522-92D8-4B60-95C7-B4AEE10A303F}.Release|x64.ActiveCfg = Release|x64
{AE293522-92D8-4B60-95C7-B4AEE10A303F}.Release|x64.Build.0 = Release|x64
{AE293522-92D9-1B60-95C7-B4AEE10A303F}.Debug|Win32.ActiveCfg = Debug|Win32
{AE293522-92D9-1B60-95C7-B4AEE10A303F}.Debug|Win32.Build.0 = Debug|Win32
{AE293522-92D9-1B60-95C7-B4AEE10A303F}.Debug|x64.ActiveCfg = Debug|x64
{AE293522-92D9-1B60-95C7-B4AEE10A303F}.Debug|x64.Build.0 = Debug|x64
{AE293522-92D9-1B60-95C7-B4AEE10A303F}.Release|Win32.ActiveCfg = Release|Win32
{AE293522-92D9-1B60-95C7-B4AEE10A303F}.Release|Win32.Build.0 = Release|Win32
{AE293522-92D9-1B60-95C7-B4AEE10A303F}.Release|x64.ActiveCfg = Release|x64
{AE293522-92D9-1B60-95C7-B4AEE10A303F}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_workspace_file>
<Workspace title="Workspace">
<Project filename="example1.cbp" />
<Project filename="example2.cbp" active="1" />
<Project filename="example3.cbp" />
<Project filename="example4.cbp" />
<Project filename="example5.cbp" />
</Workspace>
</CodeBlocks_workspace_file>

1084
miniz.c

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,358 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="miniz_tester"
ProjectGUID="{AE293522-92D9-1B60-95C7-B4AEE10A303F}"
RootNamespace="miniz_tester"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName)D.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName)_x64D.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(ProjectName)\$(ConfigurationName)_$(PlatformName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName)_x64.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FD737F1-C7A5-4376-A066-2A32D752A31F}"
>
<File
RelativePath=".\miniz.c"
>
</File>
<File
RelativePath=".\miniz_tester.cpp"
>
</File>
<File
RelativePath=".\timer.cpp"
>
</File>
<File
RelativePath=".\timer.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{17DA6AB6-F800-4c08-8B7A-83BB121AAC02}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

152
timer.cpp
View File

@@ -1,152 +0,0 @@
// File: timer.cpp - Simple high-precision timer class. Supports Win32, X360, and POSIX/Linux
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <time.h>
#include "timer.h"
#if defined(WIN32)
#include <windows.h>
#elif defined(_XBOX)
#include <xtl.h>
#endif
unsigned long long timer::g_init_ticks;
unsigned long long timer::g_freq;
double timer::g_inv_freq;
#if defined(WIN32) || defined(_XBOX)
inline void query_counter(timer_ticks *pTicks)
{
QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(pTicks));
}
inline void query_counter_frequency(timer_ticks *pTicks)
{
QueryPerformanceFrequency(reinterpret_cast<LARGE_INTEGER*>(pTicks));
}
#elif defined(__GNUC__)
#include <sys/timex.h>
inline void query_counter(timer_ticks *pTicks)
{
struct timeval cur_time;
gettimeofday(&cur_time, NULL);
*pTicks = static_cast<unsigned long long>(cur_time.tv_sec)*1000000ULL + static_cast<unsigned long long>(cur_time.tv_usec);
}
inline void query_counter_frequency(timer_ticks *pTicks)
{
*pTicks = 1000000;
}
#endif
timer::timer() :
m_start_time(0),
m_stop_time(0),
m_started(false),
m_stopped(false)
{
if (!g_inv_freq)
init();
}
timer::timer(timer_ticks start_ticks)
{
if (!g_inv_freq)
init();
m_start_time = start_ticks;
m_started = true;
m_stopped = false;
}
void timer::start(timer_ticks start_ticks)
{
m_start_time = start_ticks;
m_started = true;
m_stopped = false;
}
void timer::start()
{
query_counter(&m_start_time);
m_started = true;
m_stopped = false;
}
void timer::stop()
{
assert(m_started);
query_counter(&m_stop_time);
m_stopped = true;
}
double timer::get_elapsed_secs() const
{
assert(m_started);
if (!m_started)
return 0;
timer_ticks stop_time = m_stop_time;
if (!m_stopped)
query_counter(&stop_time);
timer_ticks delta = stop_time - m_start_time;
return delta * g_inv_freq;
}
timer_ticks timer::get_elapsed_us() const
{
assert(m_started);
if (!m_started)
return 0;
timer_ticks stop_time = m_stop_time;
if (!m_stopped)
query_counter(&stop_time);
timer_ticks delta = stop_time - m_start_time;
return (delta * 1000000ULL + (g_freq >> 1U)) / g_freq;
}
void timer::init()
{
if (!g_inv_freq)
{
query_counter_frequency(&g_freq);
g_inv_freq = 1.0f / g_freq;
query_counter(&g_init_ticks);
}
}
timer_ticks timer::get_init_ticks()
{
if (!g_inv_freq)
init();
return g_init_ticks;
}
timer_ticks timer::get_ticks()
{
if (!g_inv_freq)
init();
timer_ticks ticks;
query_counter(&ticks);
return ticks - g_init_ticks;
}
double timer::ticks_to_secs(timer_ticks ticks)
{
if (!g_inv_freq)
init();
return ticks * g_inv_freq;
}

40
timer.h
View File

@@ -1,40 +0,0 @@
// File: timer.h
#pragma once
typedef unsigned long long timer_ticks;
class timer
{
public:
timer();
timer(timer_ticks start_ticks);
void start();
void start(timer_ticks start_ticks);
void stop();
double get_elapsed_secs() const;
inline double get_elapsed_ms() const { return get_elapsed_secs() * 1000.0f; }
timer_ticks get_elapsed_us() const;
static void init();
static inline timer_ticks get_ticks_per_sec() { return g_freq; }
static timer_ticks get_init_ticks();
static timer_ticks get_ticks();
static double ticks_to_secs(timer_ticks ticks);
static inline double ticks_to_ms(timer_ticks ticks) { return ticks_to_secs(ticks) * 1000.0f; }
static inline double get_secs() { return ticks_to_secs(get_ticks()); }
static inline double get_ms() { return ticks_to_ms(get_ticks()); }
private:
static timer_ticks g_init_ticks;
static timer_ticks g_freq;
static double g_inv_freq;
timer_ticks m_start_time;
timer_ticks m_stop_time;
bool m_started : 1;
bool m_stopped : 1;
};

44
tinfl.c
View File

@@ -1,6 +1,5 @@
/* tinfl.c v1.11 - public domain inflate with zlib header parsing/adler32 checking (inflate-only subset of miniz.c) /* tinfl.c v1.09 - public domain inflate with zlib header parsing/adler32 checking (inflate-only subset of miniz.c)
See "unlicense" statement at the end of this file. Rich Geldreich <richgel99@gmail.com>, last updated May 15, 2011
Rich Geldreich <richgel99@gmail.com>, last updated May 20, 2011
Implements RFC 1950: http://www.ietf.org/rfc/rfc1950.txt and RFC 1951: http://www.ietf.org/rfc/rfc1951.txt Implements RFC 1950: http://www.ietf.org/rfc/rfc1950.txt and RFC 1951: http://www.ietf.org/rfc/rfc1951.txt
The entire decompressor coroutine is implemented in tinfl_decompress(). The other functions are optional high-level helpers. The entire decompressor coroutine is implemented in tinfl_decompress(). The other functions are optional high-level helpers.
@@ -30,17 +29,9 @@ typedef unsigned long long mz_uint64;
#endif #endif
// Works around MSVC's spammy "warning C4127: conditional expression is constant" message. // Works around MSVC's spammy "warning C4127: conditional expression is constant" message.
#ifdef _MSC_VER #define MZ_MACRO_END while (0, 0)
#define MZ_MACRO_END while (0, 0)
#else
#define MZ_MACRO_END while (0)
#endif
// Decompression flags used by tinfl_decompress(). // Decompression flags.
// TINFL_FLAG_PARSE_ZLIB_HEADER: If set, the input has a valid zlib header and ends with an adler32 checksum (it's a valid zlib stream). Otherwise, the input is a raw deflate stream.
// TINFL_FLAG_HAS_MORE_INPUT: If set, there are more input bytes available beyond the end of the supplied input buffer. If clear, the input buffer contains all remaining input.
// TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF: If set, the output buffer is large enough to hold the entire decompressed stream. If clear, the output buffer is at least the size of the dictionary (typically 32KB).
// TINFL_FLAG_COMPUTE_ADLER32: Force adler-32 checksum computation of the decompressed bytes.
enum enum
{ {
TINFL_FLAG_PARSE_ZLIB_HEADER = 1, TINFL_FLAG_PARSE_ZLIB_HEADER = 1,
@@ -563,30 +554,3 @@ int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size,
} }
#endif // #ifndef TINFL_HEADER_FILE_ONLY #endif // #ifndef TINFL_HEADER_FILE_ONLY
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
*/