-/* $Id: sgmlread.c,v 1.1 2006-07-03 14:27:09 adam Exp $
- Copyright (C) 1995-2005
+/* $Id: sgmlread.c,v 1.3 2006-08-22 13:39:28 adam Exp $
+ Copyright (C) 1995-2006
Index Data ApS
This file is part of the Zebra server.
for more details.
You should have received a copy of the GNU General Public License
-along with Zebra; see the file LICENSE.zebra. If not, write to the
-Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
*/
int buf_size;
int size;
int off;
+ struct ZebraRecStream *stream;
off_t moffset;
- void *fh;
- int (*readf)(void *, char *, size_t);
WRBUF wrbuf;
};
p->moffset += p->off;
p->off = 0;
p->size = 0;
- res = (*p->readf)(p->fh, p->buf, p->buf_size);
+ res = p->stream->readf(p->stream, p->buf, p->buf_size);
if (res > 0)
{
p->size += res;
data1_node *node;
int res;
- sgi->moffset = p->offset;
- sgi->fh = p->fh;
- sgi->readf = p->readf;
+ sgi->moffset = p->stream->tellf(p->stream);
+ sgi->stream = p->stream;
sgi->off = 0;
sgi->size = 0;
- res = (*sgi->readf)(sgi->fh, sgi->buf, sgi->buf_size);
+ res = sgi->stream->readf(sgi->stream, sgi->buf, sgi->buf_size);
if (res > 0)
sgi->size += res;
else
return 0;
- node = data1_read_nodex (p->dh, p->mem, sgml_getc, sgi, sgi->wrbuf);
- if (node && p->endf)
- (*p->endf)(sgi->fh, sgi->moffset + sgi->off);
+ node = data1_read_nodex(p->dh, p->mem, sgml_getc, sgi, sgi->wrbuf);
+ if (node && p->stream->endf)
+ {
+ off_t end_offset = sgi->moffset + sgi->off;
+ p->stream->endf(sgi->stream, &end_offset);
+ }
return node;
}