X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=recctrl%2Fmarcread.c;h=a6924a823b7436d1d9462e15e5fe1c792b2968e3;hb=a0da17360613c183107d78449bda31fcb97911fa;hp=d2a293873287b2e23305c7a4543c3d629c6df4d9;hpb=42a51f164decd9a67018749836b40833b285162e;p=idzebra-moved-to-github.git diff --git a/recctrl/marcread.c b/recctrl/marcread.c index d2a2938..a6924a8 100644 --- a/recctrl/marcread.c +++ b/recctrl/marcread.c @@ -1,10 +1,31 @@ /* - * Copyright (C) 1997, Index Data I/S + * Copyright (C) 1997-1999, Index Data * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: marcread.c,v $ - * Revision 1.4 1997-10-27 14:34:26 adam + * Revision 1.11 2000-05-15 15:32:51 adam + * Added support for 64 bit input file support. + * + * Revision 1.10 1999/11/30 13:48:04 adam + * Improved installation. Updated for inclusion of YAZ header files. + * + * Revision 1.9 1999/06/25 13:47:25 adam + * Minor change that prevents MSVC warning. + * + * Revision 1.8 1999/05/26 07:49:14 adam + * C++ compilation. + * + * Revision 1.7 1999/05/20 12:57:18 adam + * Implemented TCL filter. Updated recctrl system. + * + * Revision 1.6 1999/02/02 14:51:27 adam + * Updated WIN32 code specific sections. Changed header. + * + * Revision 1.5 1997/11/18 10:03:24 adam + * Member num_children removed from data1_node. + * + * Revision 1.4 1997/10/27 14:34:26 adam * Fixed bug - data1 root node wasn't tagged at all! * * Revision 1.3 1997/09/24 13:36:51 adam @@ -23,9 +44,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "grsread.h" data1_node *data1_mk_node_wp (data1_handle dh, NMEM mem, data1_node *parent) @@ -42,7 +63,6 @@ data1_node *data1_mk_node_wp (data1_handle dh, NMEM mem, data1_node *parent) parent->child = parent->last_child = res; else parent->last_child->next = res; - parent->num_children++; parent->last_child = res; } return res; @@ -63,7 +83,7 @@ data1_node *data1_mk_node_text (data1_handle dh, NMEM mem, data1_node *parent, res->u.data.what = DATA1I_text; res->u.data.len = len; if (res->u.data.len > DATA1_LOCALDATA) { - res->u.data.data = xmalloc (res->u.data.len); + res->u.data.data = (char *) xmalloc (res->u.data.len); res->destroy = destroy_data; } else @@ -149,7 +169,8 @@ data1_node *grs_read_marc (struct grs_read_info *p) if (read_bytes == record_length - 4) { off_t cur_offset = (*p->tellf)(p->fh); - assert (cur_offset > 26); + if (cur_offset <= 27) + return NULL; if (p->endf) (*p->endf)(p->fh, cur_offset - 1); } @@ -162,7 +183,7 @@ data1_node *grs_read_marc (struct grs_read_info *p) } res_root = data1_mk_node_wp (p->dh, p->mem, NULL); res_root->which = DATA1N_root; - res_root->u.root.type = nmem_malloc (p->mem, strlen(absynName)+1); + res_root->u.root.type = (char *) nmem_malloc (p->mem, strlen(absynName)+1); strcpy (res_root->u.root.type, absynName); res_root->u.root.absyn = absyn; @@ -280,3 +301,21 @@ data1_node *grs_read_marc (struct grs_read_info *p) } return res_root; } + +static void *grs_init_marc(void) +{ + return 0; +} + +static void grs_destroy_marc(void *clientData) +{ +} + +static struct recTypeGrs marc_type = { + "marc", + grs_init_marc, + grs_destroy_marc, + grs_read_marc +}; + +RecTypeGrs recTypeGrs_marc = &marc_type;