]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
COMP: Fix missing header unistd.h
authorHans Johnson <hans-johnson@uiowa.edu>
Wed, 16 Jan 2019 16:37:30 +0000 (10:37 -0600)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 21 Jan 2019 09:28:07 +0000 (10:28 +0100)
zlib-ng/gzlib.c:196:9: warning: implicit declaration of function 'lseek' is invalid in C99 [-Wimplicit-function-declaration]
        LSEEK(state->fd, 0, SEEK_END);  /* so gzoffset() is correct */
        ^
zlib-ng/gzlib.c:17:17: note: expanded from macro 'LSEEK'
                ^
[ 61%] Building C object CMakeFiles/zlibstatic.dir/gzread.c.o
zlib-ng/gzread.c:27:15: warning: implicit declaration of function 'read' is invalid in C99 [-Wimplicit-function-declaration]
        ret = read(state->fd, buf + *have, len - *have);
              ^
zlib-ng/gzread.c:596:11: warning: implicit declaration of function 'close' is invalid in C99 [-Wimplicit-function-declaration]
    ret = close(state->fd);
          ^
[ 62%] Building C object CMakeFiles/zlibstatic.dir/gzwrite.c.o
zlib-ng/gzwrite.c:84:15: warning: implicit declaration of function 'write' is invalid in C99 [-Wimplicit-function-declaration]
        got = write(state->fd, strm->next_in, strm->avail_in);
              ^
zlib-ng/gzwrite.c:100:33: warning: implicit declaration of function 'write' is invalid in C99 [-Wimplicit-function-declaration]
            if (have && ((got = write(state->fd, state->x.next, (unsigned long)have)) < 0 || (unsigned)got != have)) {
                                ^
zlib-ng/gzwrite.c:512:9: warning: implicit declaration of function 'close' is invalid in C99 [-Wimplicit-function-declaration]
    if (close(state->fd) == -1)"

gzguts.h

index c32b6320ededecad162fbc40376d8c26bef9f5e1..5c1d7d8e6afaca8c02e020e8139976ad22cb2960 100644 (file)
--- a/gzguts.h
+++ b/gzguts.h
 #  include <stddef.h>
 #endif
 
+#if !defined(_MSC_VER) || defined(__MINGW__)
+#  include <unistd.h>       /* for lseek(), read(), close(), write(), unlink() */
+#endif
+
 #if defined(_MSC_VER) || defined(WIN32)
 #  include <io.h>
 #endif