X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=index%2Fmarcread.c;h=93abbc5ad87bc875106c9b2a72c391d30c5cb550;hb=179f0d2cd10868f92ee68bed25fb87cf25adf923;hp=e030cf9026529900f81d62785f40876947e01a09;hpb=7415d28c149c1bab51fe93aeaccdd14085b69bd9;p=idzebra-moved-to-github.git diff --git a/index/marcread.c b/index/marcread.c index e030cf9..93abbc5 100644 --- a/index/marcread.c +++ b/index/marcread.c @@ -1,5 +1,5 @@ -/* $Id: marcread.c,v 1.1 2006-07-03 14:27:09 adam Exp $ - Copyright (C) 1995-2005 +/* $Id: marcread.c,v 1.3 2006-08-22 13:39:27 adam Exp $ + Copyright (C) 1995-2006 Index Data ApS This file is part of the Zebra server. @@ -15,9 +15,9 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 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 + */ #include @@ -58,7 +58,7 @@ static data1_node *grs_read_iso2709 (struct grs_read_info *p, int marc_xml) char *absynName; data1_marctab *marctab; - if ((*p->readf)(p->fh, buf, 5) != 5) + if (p->stream->readf(p->stream, buf, 5) != 5) return NULL; while (*buf < '0' || *buf > '9') { @@ -69,7 +69,7 @@ static data1_node *grs_read_iso2709 (struct grs_read_info *p, int marc_xml) for (i = 0; i<4; i++) buf[i] = buf[i+1]; - if ((*p->readf)(p->fh, buf+4, 1) != 1) + if (p->stream->readf(p->stream, buf+4, 1) != 1) return NULL; } record_length = atoi_n (buf, 5); @@ -79,7 +79,7 @@ static data1_node *grs_read_iso2709 (struct grs_read_info *p, int marc_xml) return NULL; } /* read remaining part - attempt to read one byte furhter... */ - read_bytes = (*p->readf)(p->fh, buf+5, record_length-4); + read_bytes = p->stream->readf(p->stream, buf+5, record_length-4); if (read_bytes < record_length-5) { yaz_log (YLOG_WARN, "Couldn't read whole MARC record"); @@ -87,11 +87,14 @@ static data1_node *grs_read_iso2709 (struct grs_read_info *p, int marc_xml) } if (read_bytes == record_length - 4) { - off_t cur_offset = (*p->tellf)(p->fh); + off_t cur_offset = p->stream->tellf(p->stream); if (cur_offset <= 27) return NULL; - if (p->endf) - (*p->endf)(p->fh, cur_offset - 1); + if (p->stream->endf) + { + off_t end_offset = cur_offset - 1; + p->stream->endf(p->stream, &end_offset); + } } absynName = mi->type; res_root = data1_mk_root (p->dh, p->mem, absynName);