Commit 9e57d5f2 authored by Morten Welinder's avatar Morten Welinder Committed by Arturo Tena/libole2

Correct allocation of BBD blocks, take in count the FAT blocks.

1999-12-18  Morten Welinder  <terra@diku.dk>

	* ms-ole.c (write_bb): Correct allocation of BBD blocks, take in count
	  the FAT blocks.
parent b632c50b
1999-12-18 Morten Welinder <terra@diku.dk>
* ms-ole.c (write_bb): Correct allocation of BBD blocks, take in count
the FAT blocks.
1999-12-18 Michael Meeks <mmeeks@gnu.org>
* ms-ole.c (ms_ole_create_vfs): NULL pointer after free in error state.
......
......@@ -805,14 +805,13 @@ write_bb (MsOle *f)
{
guint32 numbbd;
BLP lp, lpblk;
int a = BB_BLOCK_SIZE / 4;
g_return_val_if_fail (f, 0);
g_return_val_if_fail (f->mem, 0);
g_return_val_if_fail (f->bb, 0);
numbbd = f->bb->len/(BB_BLOCK_SIZE/4);
if (f->bb->len%(BB_BLOCK_SIZE/4))
numbbd++;
numbbd = (f->bb->len + a - 2) / (a - 1); /* Think really hard! */
SET_NUM_BBD_BLOCKS (f, numbbd);
for (lp=0;lp<numbbd;lp++) {
......@@ -822,13 +821,13 @@ write_bb (MsOle *f)
}
lpblk = 0;
while (lpblk<f->bb->len) { /* Described blocks */
while (lpblk < f->bb->len) { /* Described blocks */
guint8 *mem = BB_W_PTR(f, GET_BBD_LIST(f, lpblk/(BB_BLOCK_SIZE/4)));
MS_OLE_SET_GUINT32 (mem + (lpblk%(BB_BLOCK_SIZE/4))*4,
g_array_index (f->bb, BLP, lpblk));
lpblk++;
}
while (lpblk%(BB_BLOCK_SIZE/4) != 0) { /* Undescribed blocks */
while (lpblk % (BB_BLOCK_SIZE/4) != 0) { /* Undescribed blocks */
guint8 *mem;
g_assert (lpblk/(BB_BLOCK_SIZE/4) < numbbd);
mem = BB_W_PTR(f, GET_BBD_LIST(f, lpblk/(BB_BLOCK_SIZE/4)));
......
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