if (method == LZHAM_Z_DEFLATED)
{
// Force Deflate to LZHAM with default window_bits.
method = LZHAM_Z_LZHAM;
window_bits = LZHAM_Z_DEFAULT_WINDOW_BITS;
}
if (window_bits > 0)
comp_params.m_compress_flags |= LZHAM_COMP_FLAG_WRITE_ZLIB_STREAM;
This means that if you pass deflate as methods and -15 as window_bits as you would with zlib and expect it not to write zlib header/adler-32 footer you will be disappointed. The first piece of code will change -15 to 15, and then the second piece of code happily will add the header/footer flag.
In lzham_lib_z_deflateInit2 function of lzham_lzcomp.cpp there is following code:
A little bit down below we see this:
This means that if you pass
deflate
as methods and -15 as window_bits as you would with zlib and expect it not to write zlib header/adler-32 footer you will be disappointed. The first piece of code will change -15 to 15, and then the second piece of code happily will add the header/footer flag.Is this intentional?