Diff for /libaitio/src/bufio.c between versions 1.2 and 1.4

version 1.2, 2012/02/02 21:32:42 version 1.4, 2012/03/29 01:31:34
Line 1 Line 1
   /*************************************************************************
   * (C) 2011 AITNET ltd - Sofia/Bulgaria - <misho@aitnet.org>
   *  by Michael Pounov <misho@elwix.org>
   *
   * $Author$
   * $Id$
   *
   **************************************************************************
   The ELWIX and AITNET software is distributed under the following
   terms:
   
   All of the documentation and software included in the ELWIX and AITNET
   Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
   Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
           by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:
   1. Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
   2. Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
   3. All advertising materials mentioning features or use of this software
      must display the following acknowledgement:
   This product includes software developed by Michael Pounov <misho@elwix.org>
   ELWIX - Embedded LightWeight unIX and its contributors.
   4. Neither the name of AITNET nor the names of its contributors
      may be used to endorse or promote products derived from this software
      without specific prior written permission.
   
   THIS SOFTWARE IS PROVIDED BY AITNET AND CONTRIBUTORS ``AS IS'' AND
   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   SUCH DAMAGE.
   */
 #include "global.h"  #include "global.h"
   
   
Line 25  cf_(struct tagBufIO *buf) Line 70  cf_(struct tagBufIO *buf)
         return 0;          return 0;
 }  }
   
   #ifdef __NetBSD__
   static off_t
   sf_lim(struct tagBufIO *buf, off_t pos, int w)
   #else
 static fpos_t  static fpos_t
 sf_lim(struct tagBufIO *buf, fpos_t pos, int w)  sf_lim(struct tagBufIO *buf, fpos_t pos, int w)
   #endif
 {  {
         if (!buf)          if (!buf)
                 goto err;                  goto err;
Line 89  wf_lim(struct tagBufIO *buf, const char *dat, int siz) Line 139  wf_lim(struct tagBufIO *buf, const char *dat, int siz)
         return siz;          return siz;
 }  }
   
   #ifdef __NetBSD__
   static off_t
   sf_inf(struct tagBufIO *buf, off_t pos, int w)
   #else
 static fpos_t  static fpos_t
 sf_inf(struct tagBufIO *buf, fpos_t pos, int w)  sf_inf(struct tagBufIO *buf, fpos_t pos, int w)
   #endif
 {  {
         void *b;          void *b;
   
Line 228  io_fmemopen(void ** __restrict base, off_t basesize) Line 283  io_fmemopen(void ** __restrict base, off_t basesize)
         buf->buf_base = *base;          buf->buf_base = *base;
         buf->buf_size = basesize;          buf->buf_size = basesize;
   
   #ifdef __NetBSD__
         if (buf->buf_mode == BUFIO_MODE_INFINIT)          if (buf->buf_mode == BUFIO_MODE_INFINIT)
                 f = funopen(buf, (int (*)(void *, char *, int)) rf_lim,                   f = funopen(buf, (int (*)(void *, char *, int)) rf_lim, 
                                 (int (*)(void *, char const *, int)) wf_inf,                                   (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,                                   (fpos_t (*)(void *, fpos_t, int)) sf_inf, 
                                 (int (*)(void *)) cf_);                                  (int (*)(void *)) cf_);
         else          else
Line 238  io_fmemopen(void ** __restrict base, off_t basesize) Line 305  io_fmemopen(void ** __restrict base, off_t basesize)
                                 (int (*)(void *, char const *, int)) wf_lim,                                   (int (*)(void *, char const *, int)) wf_lim, 
                                 (fpos_t (*)(void *, fpos_t, int)) sf_lim,                                   (fpos_t (*)(void *, fpos_t, int)) sf_lim, 
                                 (int (*)(void *)) cf_);                                  (int (*)(void *)) cf_);
   #endif
         if (!f) {          if (!f) {
                 LOGERR;                  LOGERR;
                 if (buf->buf_mode == BUFIO_MODE_INFINIT) {                  if (buf->buf_mode == BUFIO_MODE_INFINIT) {
Line 318  io_fmapopen(const char *csFile, int mode, int perm, in Line 386  io_fmapopen(const char *csFile, int mode, int perm, in
         buf->buf_size = basesize;          buf->buf_size = basesize;
         buf->buf_unmap = unmap_cf;          buf->buf_unmap = unmap_cf;
   
   #ifdef __NetBSD__
         f = funopen(buf, (int (*)(void *, char *, int)) rf_lim,           f = funopen(buf, (int (*)(void *, char *, int)) rf_lim, 
                         (int (*)(void *, char const *, int)) wf_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,                           (fpos_t (*)(void *, fpos_t, int)) sf_lim, 
                         (int (*)(void *)) cf_);                          (int (*)(void *)) cf_);
   #endif
         if (!f) {          if (!f) {
                 LOGERR;                  LOGERR;
                 free(buf);                  free(buf);

Removed from v.1.2  
changed lines
  Added in v.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>