[Zlib-devel] zlib gzopen_w function added

Mark Adler madler at madler.net
Sun Mar 18 12:42:29 EDT 2012


On Mar 17, 2012, at 10:48 PM, Cosmin Truta wrote:
> I tested it, and you still forgot to #include <stddef.h> or <wchar.h>

I didn't forget -- I just didn't do it well enough.  I had put it in gzguts.h, but it also needs to be there for zlib.h.

> And BTW, that requires both the filename and the mode to be const wchar_t*.

I deliberately did not make the mode wchar_t * in order to avoid having to add a conversion that does who knows what depending on the environment.  There is no reason for the mode to be anything but roman characters in a char *, since that is all that will be interpreted.  Because I did not follow exactly the convention of _wfopen(), I didn't call this function _wgzopen() to avoid the implication that it has the same interface.  Hence the name gzopen_w().

> e.g. I see that you're calling strlen on something that
> could be wchar_t* instead of char*,

Yes, that is a bug.  I have worked around that.  There are no other uses of path.

There is a new version up on github.

I apologize for the iterative process for getting Windows things to work.  I now have Parallels with Windows 7 and Microsoft Visual Studio 2010 Express loaded.  Hopefully that will suffice for this.  Next I need to figure out how to use it.

Mark





More information about the Zlib-devel mailing list