From 5ece0477c82a7fb87ceaebc170943bb3c9e73596 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 5 Aug 2004 10:15:54 +0000 Subject: [PATCH] Fix a bug in the cluster allocator. Also several debug output bugs. (Logical change 1.475) --- libntfs/lcnalloc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 1027f842..860dee2a 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -255,10 +255,11 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, "*byte = 0x%x.\n", __FUNCTION__, buf_size, (long long)lcn, (long long)bmp_pos, need_writeback, - lcn >> 3, *byte); + (unsigned int)(lcn >> 3), + (unsigned int)*byte); /* Skip full bytes. */ if (*byte == 0xff) { - lcn += 8; + lcn = (lcn + 8) & ~7; Dprintf("%s(): continuing while loop 1.\n", __FUNCTION__); continue; @@ -277,7 +278,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, /* We need to write this bitmap buffer back to disk! */ need_writeback = 1; Dprintf("%s(): *byte = 0x%x, need_writeback is set.\n", - __FUNCTION__, *byte); + __FUNCTION__, (unsigned int)*byte); /* Reallocate memory if necessary. */ if ((rlpos + 2) * (int)sizeof(runlist) >= rlsize) { Dprintf("%s(): Reallocating space.\n",