I am using RB-zlib (zlib binding) from Boredom Software.
I am using the built in zlib in Mac OS X 10.10.5
When I build a 32 bit application and execute it, I get a “Incompatible Version” error
Any pointers ?
The error occurs in the following routine
Sub Constructor(CompressionLevel As Integer = zlib.Z_DEFAULT_COMPRESSION, CompressionStrategy As Integer = zlib.Z_DEFAULT_STRATEGY, Encoding As Integer = zlib.DEFLATE_ENCODING, MemoryLevel As Integer = zlib.DEFAULT_MEM_LVL)
’ Construct a new Deflater instance using the specified compression options.
’ If the deflate engine could not be initialized an exception will be raised.
// Calling the overridden superclass constructor.
// Constructor() – From zlib.FlateEngine
Super.Constructor()
If CompressionStrategy <> Z_DEFAULT_STRATEGY Or Encoding <> DEFLATE_ENCODING Or MemoryLevel <> DEFAULT_MEM_LVL Then
’ Open the compressed stream using custom options
mLastError = deflateInit2_(zstruct, CompressionLevel, Z_DEFLATED, Encoding, MemoryLevel, CompressionStrategy, zlib.Version, zstruct.Size)
Else
’ process zlib-wrapped deflate data
mLastError = deflateInit_(zstruct, CompressionLevel, zlib.Version, zstruct.Size)
End If
If mLastError <> Z_OK Then Raise New zlibException(mLastError)
mLevel = CompressionLevel
mStrategy = CompressionStrategy
End Sub
64 bit builds are not yet supported. The error coming from zlib is the result of a size mismatch for a shared data structure. The zlibx64 branch fixes the mismatch and a few other showstoppers but still in an experimental stage.
I did a short test on your zlibx64. I use your library with the latest Xojo under macOS 10.14.1, 64-Bit and got the following error message: “The zlib library is a different version than what was expected.”
yes you can install the latest zlib with Homebrew (https://brew.sh). However, to my knowledge, be aware that it will not be installed in /usr/local/lib because it may cause bad interferences with the System zlib. Instead, it would be installed somewhere in /usr/local/Cellar and you will have to explicitly indicate the full path in your Xojo project.
Hi Jean,
I need to do Flate encoding and decoding.
The example at https://github.com/declaresub/zlib_rb does not seem to do that.
Or am I missing something here ?
Well, for PDF, we just let DynaPDF do that in our plugin.
The global function here should simply do that:
CompressZLibMBS(buf as string, level as integer) as string CompressZLibMBS(buf as string, level as integer, byref error as integer) as string DecompressZLibMBS(buf as string, size as integer) as string DecompressZLibMBS(buf as string, size as integer, byref error as integer) as string
I tried CompressZLibMBS and DecompressZLibMBS functions and it worked fine in both Mac and Win.
How does one determine the size parameter in the decompress function ?
It probably is n times the input string. Any thumb rule for determining ‘n’ ?
I know the length of the compressed string. I thought a factor of 2 or 3 should be sufficient.
Is my assumption right ?
I think a version which does not require the output size makes more sense.
Is it possible to get it in the near future ?