Commit 75d8087c authored by Michael Meeks's avatar Michael Meeks
Browse files

OLE_DEBUG = 0 fixed silly bug in small block chain writing.

OLE_DEBUG = 0
fixed silly bug in small block chain writing.
parent ddc5bfd2
1999-05-24 Michael Meeks <michael@imaginator.com>
* ms-ole.c (write_sb): Fixed up sbf chain.
1999-05-23 Michael Meeks <michael@imaginator.com>
* ms-ole.c (ms_ole_directory_create): Setup 'dir' properly
......
......@@ -18,7 +18,7 @@
/* Implementational detail - not for global header */
#define OLE_DEBUG 2
#define OLE_DEBUG 0
/* These take a _guint8_ pointer */
#define GET_GUINT8(p) (*((const guint8 *)(p)+0))
......@@ -619,12 +619,29 @@ write_sb (MS_OLE *f)
guint32 lp, lastused;
PPS *root;
BLP sbd_start = END_OF_CHAIN;
BLP sbf_start = END_OF_CHAIN;
g_return_val_if_fail (f, 0);
g_return_val_if_fail (f->pps, 0);
root = g_ptr_array_index (f->pps, PPS_ROOT_BLOCK);
if (f->sbf->len * BB_BLOCK_SIZE < f->sb->len*SB_BLOCK_SIZE) {
printf ("Not enough descriptor / blocks being written %d %d\n",
f->sbf->len, f->sb->len);
}
if (f->sbf->len>0)
sbf_start = g_array_index (f->sbf, BLP, 0);
/* Chain up the sbf blocks */
for (lp=0;lp<f->sbf->len-1;lp++) {
BLP blk, next ;
blk = g_array_index (f->sbf, BLP, lp);
next = g_array_index (f->sbf, BLP, lp+1);
/* this assert is not really important, its just how we left it */
g_assert (g_array_index (f->bb, BLP, blk) == END_OF_CHAIN);
g_array_index (f->bb, BLP, blk) = next;
}
lastused = END_OF_CHAIN;
for (lp=0;lp<f->sb->len;lp++) {
if (g_array_index (f->sb, BLP, lp) != UNUSED_BLOCK)
......@@ -662,9 +679,10 @@ write_sb (MS_OLE *f)
#if OLE_DEBUG > 0
printf ("Blank SB allocation\n");
#endif
root->start = END_OF_CHAIN;
sbf_start = END_OF_CHAIN;
}
root->start = sbf_start;
SET_SBD_STARTBLOCK (f, sbd_start);
g_array_free (f->sb, TRUE);
g_array_free (f->sbf, TRUE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment