--- libaitio/src/bufio.c 2012/03/15 01:52:23 1.3 +++ libaitio/src/bufio.c 2012/03/29 01:31:34 1.4 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: bufio.c,v 1.3 2012/03/15 01:52:23 misho Exp $ +* $Id: bufio.c,v 1.4 2012/03/29 01:31:34 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -70,8 +70,13 @@ cf_(struct tagBufIO *buf) return 0; } +#ifdef __NetBSD__ +static off_t +sf_lim(struct tagBufIO *buf, off_t pos, int w) +#else static fpos_t sf_lim(struct tagBufIO *buf, fpos_t pos, int w) +#endif { if (!buf) goto err; @@ -134,8 +139,13 @@ wf_lim(struct tagBufIO *buf, const char *dat, int siz) return siz; } +#ifdef __NetBSD__ +static off_t +sf_inf(struct tagBufIO *buf, off_t pos, int w) +#else static fpos_t sf_inf(struct tagBufIO *buf, fpos_t pos, int w) +#endif { void *b; @@ -273,9 +283,21 @@ io_fmemopen(void ** __restrict base, off_t basesize) buf->buf_base = *base; buf->buf_size = basesize; +#ifdef __NetBSD__ if (buf->buf_mode == BUFIO_MODE_INFINIT) f = funopen(buf, (int (*)(void *, char *, int)) rf_lim, (int (*)(void *, char const *, int)) wf_inf, + (off_t (*)(void *, off_t, int)) sf_inf, + (int (*)(void *)) cf_); + else + f = funopen(buf, (int (*)(void *, char *, int)) rf_lim, + (int (*)(void *, char const *, int)) wf_lim, + (off_t (*)(void *, off_t, int)) sf_lim, + (int (*)(void *)) cf_); +#else + if (buf->buf_mode == BUFIO_MODE_INFINIT) + f = funopen(buf, (int (*)(void *, char *, int)) rf_lim, + (int (*)(void *, char const *, int)) wf_inf, (fpos_t (*)(void *, fpos_t, int)) sf_inf, (int (*)(void *)) cf_); else @@ -283,6 +305,7 @@ io_fmemopen(void ** __restrict base, off_t basesize) (int (*)(void *, char const *, int)) wf_lim, (fpos_t (*)(void *, fpos_t, int)) sf_lim, (int (*)(void *)) cf_); +#endif if (!f) { LOGERR; if (buf->buf_mode == BUFIO_MODE_INFINIT) { @@ -363,10 +386,17 @@ io_fmapopen(const char *csFile, int mode, int perm, in buf->buf_size = basesize; buf->buf_unmap = unmap_cf; +#ifdef __NetBSD__ f = funopen(buf, (int (*)(void *, char *, int)) rf_lim, (int (*)(void *, char const *, int)) wf_lim, + (off_t (*)(void *, off_t, int)) sf_lim, + (int (*)(void *)) cf_); +#else + f = funopen(buf, (int (*)(void *, char *, int)) rf_lim, + (int (*)(void *, char const *, int)) wf_lim, (fpos_t (*)(void *, fpos_t, int)) sf_lim, (int (*)(void *)) cf_); +#endif if (!f) { LOGERR; free(buf);