Subject: bug#25633: porting gzip to Visual Studio 2015 failed due to redesign of CRT

From: Eric Blake <[email-masked]>
Date: Tue, 7 Feb 2017 08:24:31 -0600

On 02/07/2017 08:13 AM, Kees Dekker wrote:
> Based on what I found today: the changes at low-level stdio in the FILE struct are now complable (I did not have yet a chance to let pass gzip our own internal tests, will do so later today or tomorrow).
> But still some things are incorrect:
> 
> 1.      frexp.c is not needed, as Visual Studio already provides frexp() function via system libraries.

But probably with bugs.  And even if it is not needed on your platform,
it is part of the tarball to replace broken frexp() on systems where it
is buggy.  Part of configure determines if it is needed on your platform.

> 2.      memchr.c is not needed, as Visual Studio already provides memchr() function via system libraries.

Likewise.

> 3.      gzip.c/h, util.c: the strlwr() function conflicts with Visual Studio one. Added HAVE_STRLWR define in config.h and omit implementation + prototype.
> 4.      lseek.c: need to include winsock2.h before including windows.h
> 5.      utimens.c: need to include sys/times.c on Windows to get struct utimbuf + need to define HAVE_STRUCT_UTIMBUF in config.h +
> 6.      unzip.c: added xalloc.h to have consistent prototype for xalloc-die() (and removed this prototype from gzip.h). See also #9 which probably explains why a prototype exists in two places? Anyhow, util.c already included xalloc.h.
> 7.      config.h (stored in clearcase as config_win32.h): added typedefs for uid_t and gid_t.
> 8.      tailor.h/utimes.c: HAVE_SYS_UTIME_H is defined, but not used. Should this not become part of configure and add HAVE_SYS_UTIME_H define in config.h + adjust code in utimens.c?
> 9.      util.c/xalloc-die.c: both contain a xalloc_die() function. I guess this is intentionally?
> 
> For t#1, #2, #3, #5, #7, #8: I lack the knowledge to adjust configure in such way that correct defines in config.h are generated. Also the source code need to be adjusted (rely on system headers instead of own prototypes if there is a working 'system' counterpart. I added myself HAVE_STRLWR in config.h.

I'm less certain on the solutions for the others, although patches to
gnulib are welcome.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org