version 1.4.2.1, 2012/04/02 09:10:30
|
version 1.6, 2012/07/03 08:51:05
|
Line 62 cf_(struct tagBufIO *buf)
|
Line 62 cf_(struct tagBufIO *buf)
|
} |
} |
|
|
if (buf->buf_mode == BUFIO_MODE_INFINIT) |
if (buf->buf_mode == BUFIO_MODE_INFINIT) |
free(buf->buf_base); | io_free(buf->buf_base); |
else if (buf->buf_unmap) |
else if (buf->buf_unmap) |
buf->buf_unmap(buf); |
buf->buf_unmap(buf); |
|
|
free(buf); | io_free(buf); |
return 0; |
return 0; |
} |
} |
|
|
Line 157 sf_inf(struct tagBufIO *buf, fpos_t pos, int w)
|
Line 157 sf_inf(struct tagBufIO *buf, fpos_t pos, int w)
|
if (pos < 0) |
if (pos < 0) |
goto err; |
goto err; |
if (buf->buf_size < pos) { |
if (buf->buf_size < pos) { |
b = realloc(buf->buf_base, pos); | b = io_realloc(buf->buf_base, pos); |
if (!b) { |
if (!b) { |
LOGERR; |
LOGERR; |
return -1; |
return -1; |
Line 173 sf_inf(struct tagBufIO *buf, fpos_t pos, int w)
|
Line 173 sf_inf(struct tagBufIO *buf, fpos_t pos, int w)
|
if ((buf->buf_offset + pos) < 0) |
if ((buf->buf_offset + pos) < 0) |
goto err; |
goto err; |
if (buf->buf_size < (buf->buf_offset + pos)) { |
if (buf->buf_size < (buf->buf_offset + pos)) { |
b = realloc(buf->buf_base, buf->buf_offset + pos); | b = io_realloc(buf->buf_base, buf->buf_offset + pos); |
if (!b) { |
if (!b) { |
LOGERR; |
LOGERR; |
return -1; |
return -1; |
Line 190 sf_inf(struct tagBufIO *buf, fpos_t pos, int w)
|
Line 190 sf_inf(struct tagBufIO *buf, fpos_t pos, int w)
|
if ((buf->buf_size + pos) < 0) |
if ((buf->buf_size + pos) < 0) |
goto err; |
goto err; |
if (buf->buf_size < (buf->buf_size + pos)) { |
if (buf->buf_size < (buf->buf_size + pos)) { |
b = realloc(buf->buf_base, buf->buf_size + pos); | b = io_realloc(buf->buf_base, buf->buf_size + pos); |
if (!b) { |
if (!b) { |
LOGERR; |
LOGERR; |
return -1; |
return -1; |
Line 224 wf_inf(struct tagBufIO *buf, const char *dat, int siz)
|
Line 224 wf_inf(struct tagBufIO *buf, const char *dat, int siz)
|
} |
} |
|
|
if (buf->buf_offset + siz > buf->buf_size) { |
if (buf->buf_offset + siz > buf->buf_size) { |
b = realloc(buf->buf_base, buf->buf_offset + siz); | b = io_realloc(buf->buf_base, buf->buf_offset + siz); |
if (!b) { |
if (!b) { |
LOGERR; |
LOGERR; |
return -1; |
return -1; |
Line 260 io_fmemopen(void ** __restrict base, off_t basesize)
|
Line 260 io_fmemopen(void ** __restrict base, off_t basesize)
|
return NULL; |
return NULL; |
} |
} |
|
|
buf = malloc(sizeof(struct tagBufIO)); | buf = io_malloc(sizeof(struct tagBufIO)); |
if (!buf) { |
if (!buf) { |
LOGERR; |
LOGERR; |
return NULL; |
return NULL; |
Line 268 io_fmemopen(void ** __restrict base, off_t basesize)
|
Line 268 io_fmemopen(void ** __restrict base, off_t basesize)
|
memset(buf, 0, sizeof(struct tagBufIO)); |
memset(buf, 0, sizeof(struct tagBufIO)); |
|
|
if (!*base) { |
if (!*base) { |
*base = malloc(basesize); | *base = io_malloc(basesize); |
if (!*base) { |
if (!*base) { |
LOGERR; |
LOGERR; |
free(buf); | io_free(buf); |
return NULL; |
return NULL; |
} else |
} else |
memset(*base, 0, basesize); |
memset(*base, 0, basesize); |
Line 309 io_fmemopen(void ** __restrict base, off_t basesize)
|
Line 309 io_fmemopen(void ** __restrict base, off_t basesize)
|
if (!f) { |
if (!f) { |
LOGERR; |
LOGERR; |
if (buf->buf_mode == BUFIO_MODE_INFINIT) { |
if (buf->buf_mode == BUFIO_MODE_INFINIT) { |
free(*base); | io_free(*base); |
*base = NULL; |
*base = NULL; |
} |
} |
free(buf); | io_free(buf); |
return NULL; |
return NULL; |
} |
} |
|
|
Line 373 io_fmapopen(const char *csFile, int mode, int perm, in
|
Line 373 io_fmapopen(const char *csFile, int mode, int perm, in
|
} |
} |
|
|
|
|
buf = malloc(sizeof(struct tagBufIO)); | buf = io_malloc(sizeof(struct tagBufIO)); |
if (!buf) { |
if (!buf) { |
LOGERR; |
LOGERR; |
munmap(base, basesize); |
munmap(base, basesize); |
Line 399 io_fmapopen(const char *csFile, int mode, int perm, in
|
Line 399 io_fmapopen(const char *csFile, int mode, int perm, in
|
#endif |
#endif |
if (!f) { |
if (!f) { |
LOGERR; |
LOGERR; |
free(buf); | io_free(buf); |
munmap(base, basesize); |
munmap(base, basesize); |
return NULL; |
return NULL; |
} |
} |