diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3268211 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.*.sw? diff --git a/CMakeLists.txt b/CMakeLists.txt index c5b01e0..8c47b14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,3 +62,15 @@ add_executable(example6 ${EXAMPLE6_SRC_LIST}) target_link_libraries(example6 m) add_executable(miniz_tester ${MINIZ_TESTER_SRC_LIST}) + +# Allow user to 'make install' into the build dir, +# so that library user can add to the -I include path: +# INSTALLDIR / include +# and then they can include miniz like so: +# #include +# +# Also allows for future option to customise the generated +# files via cmake (ie can control the #define options via +# cmake OS detection routines). +# +install(FILES miniz.c tinfl.c DESTINATION include/miniz) diff --git a/README.md b/README.md new file mode 100644 index 0000000..12d8980 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +miniz +===== + +Patches on top of the original svn repo. + +https://code.google.com/p/miniz/ + +svn checkout http://miniz.googlecode.com/svn/trunk/ miniz-read-only + +This git repo also includes all the upstream SVN checkins too. + +I have: +* Rearranged the file structure to make it easier to #include into my project, +* Added a CMake build (just for the examples, but could also be used to build it as a library), +* Fix various compiler warnings (GCC, and later will fix for MSVC 2010). diff --git a/miniz.c b/miniz.c index 358143a..be6ed0b 100644 --- a/miniz.c +++ b/miniz.c @@ -2810,7 +2810,7 @@ void *tdefl_write_image_to_png_file_in_memory_ex(const void *pImage, int w, int for (z = 41; z; --z) tdefl_output_buffer_putter(&z, 1, &out_buf); // compress image data tdefl_init(pComp, tdefl_output_buffer_putter, &out_buf, s_tdefl_png_num_probes[MZ_MIN(10, level)] | TDEFL_WRITE_ZLIB_HEADER); - for (y = 0; y < h; ++y) { tdefl_compress_buffer(pComp, &z, 1, TDEFL_NO_FLUSH); tdefl_compress_buffer(pComp, (mz_uint8*)pImage + (flip ? (h - 1 - y) : y) * bpl, bpl, TDEFL_NO_FLUSH); } + for (y = 0; y < h; ++y) { tdefl_compress_buffer(pComp, &z, 1, TDEFL_NO_FLUSH); tdefl_compress_buffer(pComp, (mz_uint8 const*)pImage + (flip ? (h - 1 - y) : y) * bpl, bpl, TDEFL_NO_FLUSH); } if (tdefl_compress_buffer(pComp, NULL, 0, TDEFL_FINISH) != TDEFL_STATUS_DONE) { MZ_FREE(pComp); MZ_FREE(out_buf.m_pBuf); return NULL; } // write real header *pLen_out = out_buf.m_size-41;