diff options
author | Björn Gustavsson <[email protected]> | 2014-01-10 12:52:20 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2014-01-14 09:30:34 +0100 |
commit | 8a147a73651713efebb9ac973f618a6d66685eca (patch) | |
tree | 7c766bdaeec0957e4847a8762d1e47685ecc507e /erts/emulator/drivers/common/efile_drv.c | |
parent | 9205b6671892e7516e8571e4ecf19bfa2ade1130 (diff) | |
download | otp-8a147a73651713efebb9ac973f618a6d66685eca.tar.gz otp-8a147a73651713efebb9ac973f618a6d66685eca.tar.bz2 otp-8a147a73651713efebb9ac973f618a6d66685eca.zip |
Don't make gzio.c dependent on the zutil.h header file
gzio.c is our own replacement for zlib's gzopen() etc
(based on a version of gzio.c that was included in an old version
of zlib).
Unfortunately, gzio.c still depends on the *internal* zlib header file
zutil.h which is not supposed to be used outside of the zlib source
code. The dependencies are the use of the gzFile typedef and the
F_OPEN() macro.
Instead of gzFile, define and use our own ErtsGzFile.
To get rid of the F_OPEN() macro, call open() of _wfopen() directly.
Diffstat (limited to 'erts/emulator/drivers/common/efile_drv.c')
-rw-r--r-- | erts/emulator/drivers/common/efile_drv.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/erts/emulator/drivers/common/efile_drv.c b/erts/emulator/drivers/common/efile_drv.c index 8de578d8b7..dca979c13a 100644 --- a/erts/emulator/drivers/common/efile_drv.c +++ b/erts/emulator/drivers/common/efile_drv.c @@ -111,7 +111,6 @@ #include "erl_driver.h" #include "erl_efile.h" #include "erl_threads.h" -#include "zlib.h" #include "gzio.h" #include "dtrace-wrapper.h" #include <ctype.h> @@ -818,7 +817,7 @@ file_start(ErlDrvPort port, char* command) static void do_close(int flags, SWord fd) { if (flags & EFILE_COMPRESSED) { - erts_gzclose((gzFile)(fd)); + erts_gzclose((ErtsGzFile)(fd)); } else { efile_closefile((int) fd); } @@ -1136,7 +1135,7 @@ static void invoke_read(void *data) } read_size = size; if (d->flags & EFILE_COMPRESSED) { - read_size = erts_gzread((gzFile)d->fd, + read_size = erts_gzread((ErtsGzFile)d->fd, d->c.read.binp->orig_bytes + d->c.read.bin_offset, size); status = (read_size != (size_t) -1); @@ -1209,7 +1208,7 @@ static void invoke_read_line(void *data) size = need - d->c.read_line.read_size; } if (d->flags & EFILE_COMPRESSED) { - read_size = erts_gzread((gzFile)d->fd, + read_size = erts_gzread((ErtsGzFile)d->fd, d->c.read_line.binp->orig_bytes + d->c.read_line.read_offset + d->c.read_line.read_size, size); @@ -1250,7 +1249,7 @@ static void invoke_read_line(void *data) d->c.read_line.read_size -= too_much; ASSERT(d->c.read_line.read_size >= 0); if (d->flags & EFILE_COMPRESSED) { - Sint64 location = erts_gzseek((gzFile)d->fd, + Sint64 location = erts_gzseek((ErtsGzFile)d->fd, -((Sint64) too_much), EFILE_SEEK_CUR); if (location == -1) { d->result_ok = 0; @@ -1535,7 +1534,7 @@ static void invoke_writev(void *data) { */ errno = EINVAL; if (! (status = - erts_gzwrite((gzFile)d->fd, + erts_gzwrite((ErtsGzFile)d->fd, iov[i].iov_base, iov[i].iov_len)) == iov[i].iov_len) { d->errInfo.posix_errno = @@ -1797,7 +1796,7 @@ static void invoke_lseek(void *data) d->errInfo.posix_errno = EINVAL; status = 0; } else { - d->c.lseek.location = erts_gzseek((gzFile)d->fd, + d->c.lseek.location = erts_gzseek((ErtsGzFile)d->fd, offset, d->c.lseek.origin); if (d->c.lseek.location == -1) { d->errInfo.posix_errno = errno; @@ -1885,7 +1884,7 @@ static void invoke_open(void *data) if (status || (d->errInfo.posix_errno != EISDIR)) { mode = (d->flags & EFILE_MODE_READ) ? "rb" : "wb"; d->fd = (SWord) erts_gzopen(d->b, mode); - if ((gzFile)d->fd) { + if ((ErtsGzFile)d->fd) { status = 1; } else { if (errno == 0) { |