I've included a Visual Studio 2008 solution (examples.sln) with 6 examples:
-
example1.c: Demonstrates miniz.c's compress() and uncompress() functions (same as zlib's), also a crude decompressor fuzzy test. * example2.c: Demonstration of miniz.c's ZIP archive API's. Adds a bunch of files to test.zip, dumps file stat info on each file in the archive, then extracts a single file into memory.
-
example3.c: Command line tool for file compression/decompression. Demonstrates how to use miniz.c's deflate() and inflate() functions to handle streaming compression/decompression.
-
example4.c: Demonstrates memory to callback decompression of compressed zlib streams (can decompress files generated by example3). Simple demo of tinfl.c, which is just the Inflate functionality pulled from the larger miniz.c. tinfl.c is a full single-function Inflate implementation with zlib header parsing and Adler32 checking in ~550 lines of code+comments.
-
example5.c: Demonstrates how to use the lowest level (non-zlib compatible) API's for file to file compression. The low-level API's are less forgiving, but more flexible, faster, and don't ever touch the heap. The low-level API's are implemented as coroutines, so they can be efficiently used for any sort of streaming scenario.
-
example6.c: Simple PNG writing demonstration.
-
As of v1.13 I also include one of the test app (miniz_tester.cpp) I used to regression test miniz. This command line tool is only intended for testing, and it wasn't intended to be an example, but I'm releasing it in case someone finds it useful.
我附上了一个Visual Studio 2008解决方案(examples.sln),里面有6个示例:
-
example1.c:演示miniz.c的压缩()和uncompress()函数(与zlib相同),同时也是一个粗略的解压模糊测试。
-
example2.c:miniz.c 的 ZIP 压缩 API 演示。它会添加大量文件到test.zip,在归档中每个文件上倾倒文件状态信息,然后将单个文件解压到内存中。
-
example3.c:用于文件压缩/解压的命令行工具。演示如何使用miniz.c的放气()和膨胀()函数来处理流压缩/解压。
-
example4.c:演示内存回调压缩 zlib 流的解压(可解压由 example3 生成的文件)。tinfl.c 的简单演示,它只是从 miniz.c 中提取的 Inflate 功能。tinfl.c 是一个完整的单函数 Inflate 实现,支持 zlib 头部解析,Adler32 检查 ~550 行代码+注释。
-
example5.c:演示如何使用最低级别(非zlib兼容)API进行文件对文件压缩。底层API容错度较低,但更灵活、更快,且从不涉及堆。底层API以协程形式实现,因此可以高效地用于任何流式流场景。
-
example6.c:简单的PNG书写演示。
-
从v1.13开始,我还加入了我用来回归测试miniz的一个测试应用(miniz_tester.cpp)。这个命令行工具仅用于测试,并非用来做示例,但我发布它以防有人觉得有用。