+ if (!bf->compact_flag)
+ bf_write (bf->bf, p->no, 0, 0, p->data);
+ else
+ {
+ int effective_block = p->no / bf->block_size;
+ int effective_offset = p->no -
+ effective_block * bf->block_size;
+ int remain = bf->block_size - effective_offset;
+
+ if (remain >= p->nbytes)
+ {
+ bf_write (bf->bf, effective_block, effective_offset,
+ p->nbytes, p->data);
+#if 0
+ yaz_log (YLOG_LOG, "bf_write no=%d offset=%d size=%d",
+ effective_block, effective_offset,
+ p->nbytes);
+#endif
+
+ }
+ else
+ {
+#if 0
+ yaz_log (YLOG_LOG, "bf_write1 no=%d offset=%d size=%d",
+ effective_block, effective_offset,
+ remain);
+#endif
+ bf_write (bf->bf, effective_block, effective_offset,
+ remain, p->data);
+#if 0
+ yaz_log (YLOG_LOG, "bf_write2 no=%d offset=%d size=%d",
+ effective_block+1, 0, p->nbytes - remain);
+#endif
+ bf_write (bf->bf, effective_block+1, 0,
+ p->nbytes - remain, (char*)p->data + remain);
+ }
+ }