2 * Copyright (C) 1994-1999, Index Data
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.3 1999-02-02 14:51:24 adam
8 * Updated WIN32 code specific sections. Changed header.
10 * Revision 1.2 1995/09/04 12:33:47 adam
11 * Various cleanup. YAZ util used instead.
13 * Revision 1.1 1994/09/26 16:08:00 quinn
14 * Most of the functionality in place.
19 * Read and write the blocktype header.
26 int is_rb_write(isam_blocktype *ib, is_type_header *hd)
28 int pt = 0, ct = 0, towrite;
30 while ((towrite = sizeof(*hd) - pt) > 0)
32 if (towrite > bf_blocksize(ib->bf))
33 towrite = bf_blocksize(ib->bf);
34 if (bf_write(ib->bf, ct, 0, towrite, (char *)hd + pt) < 0)
36 pt += bf_blocksize(ib->bf);
42 int is_rb_read(isam_blocktype *ib, is_type_header *hd)
44 int pt = 0, ct = 0, rs, toread;
46 while ((toread = sizeof(*hd) - pt) > 0)
48 if (toread > bf_blocksize(ib->bf))
49 toread = bf_blocksize(ib->bf);
50 if ((rs = bf_read(ib->bf, ct, 0, toread, (char*)hd + pt)) <= 0)
52 pt += bf_blocksize(ib->bf);