[Zlib-devel] zlib 1.2.3.4 Winter Solstice Edition

Pedro Alves alves.ped at gmail.com
Tue Dec 29 14:08:42 EST 2009


On Tuesday 29 December 2009 16:01:40, Vincent Torri wrote:
> 
> On Tue, 29 Dec 2009, Pedro Alves wrote:
> > Vincent, I can help with writing patches, if you're unavailable.
> 
> actually, writing a patch to use GetLastError() instead of the dummy errno 
> would be nice :-)

I'll give it a try.  grep tells me that errno isn't much used other
than being cleared before a library call, and for Z_ERRNO/zstrerror.

How about this for a plan:

1) Stop treating errno as an lvalue.  In zutil.h, probably:

 #if !<WinCE>
 # define seterrno(ERR) do { errno = (ERR); } while (0)
 # if NO_ERRNO_H
    ...
 # else
    ...
 # endif
 #else
 # define seterrno(ERR) SetLastError(ERR)
 # define errno GetLastError()
 #endif

2) Replace all `errno = 0' by (z)seterrno(0).

3) Write a zstrerror (and perror) for WinCE that
   uses FormatMessage.

Would something along these lines be acceptable?

-- 
Pedro Alves




More information about the Zlib-devel mailing list