[ros-diffs] [tkreuzer] 44465: Cleanup test code, improve comments.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Tue Dec 8 03:18:42 CET 2009


Author: tkreuzer
Date: Tue Dec  8 03:18:42 2009
New Revision: 44465

URL: http://svn.reactos.org/svn/reactos?rev=44465&view=rev
Log:
Cleanup test code, improve comments.

Modified:
    trunk/reactos/lib/rtl/bitmap.c

Modified: trunk/reactos/lib/rtl/bitmap.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/bitmap.c?rev=44465&r1=44464&r2=44465&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] Tue Dec  8 03:18:42 2009
@@ -83,11 +83,12 @@
     /* Calculate length up to where we read */
     Length = (Buffer - BitMapHeader->Buffer) * 32 - StartingIndex;
     Length += BitPos - 32;
-    
+
+    /* Make sure we don't go past the last bit */
     if (Length > BitMapHeader->SizeOfBitMap - StartingIndex)
         Length = BitMapHeader->SizeOfBitMap - StartingIndex;
 
-    /* The result is guaranteed to be < BitMapHeader->SizeOfBitMap */
+    /* Return the result */
     return Length;
 }
 
@@ -132,10 +133,11 @@
     Length = (Buffer - BitMapHeader->Buffer) * 32 - StartingIndex;
     Length += BitPos - 32;
 
+    /* Make sure we don't go past the last bit */
     if (Length > BitMapHeader->SizeOfBitMap - StartingIndex)
         Length = BitMapHeader->SizeOfBitMap - StartingIndex;
 
-    /* The result is guaranteed to be < BitMapHeader->SizeOfBitMap */
+    /* Return the result */
     return Length;
 }
 
@@ -436,12 +438,10 @@
     /* Loop until something is found or the end is reached */
     while (CurrentBit + NumberToFind < BitMapHeader->SizeOfBitMap)
     {
-        ULONG test;
         /* Search for the next clear run, by skipping a set run */
-        test = RtlpGetLengthOfRunSet(BitMapHeader,
+        CurrentBit += RtlpGetLengthOfRunSet(BitMapHeader,
                                             CurrentBit,
                                             MAXULONG);
-        CurrentBit += test;
 
         /* Get length of the clear bit run */
         CurrentLength = RtlpGetLengthOfRunClear(BitMapHeader,




More information about the Ros-diffs mailing list