]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/hfs/hfscommon/BTree/BTreeScanner.c
xnu-517.12.7.tar.gz
[apple/xnu.git] / bsd / hfs / hfscommon / BTree / BTreeScanner.c
index 8cc50aaa18d8d41629ac7088b34994a6081c0a0e..06e15a8078a44dd22f57883c6a46f5d25a3df843 100644 (file)
@@ -22,6 +22,7 @@
  *     @(#)BTreeScanner.c
  */
 #include <sys/kernel.h>
+#include "../../hfs_endian.h"
 
 #include "../headers/BTreeScanner.h"
 
@@ -179,6 +180,23 @@ static int FindNextLeafNode(       BTScanState *scanState, Boolean avoidIO )
                        (u_int8_t *) scanState->currentNodePtr += scanState->btcb->nodeSize;
                }
                
+#if BYTE_ORDER == LITTLE_ENDIAN
+               {
+               BlockDescriptor block;
+               FileReference fref;
+
+               /* Fake a BlockDescriptor */
+               block.buffer = scanState->currentNodePtr;
+               block.blockSize = scanState->btcb->nodeSize;
+               block.blockReadFromDisk = 1;
+               block.isModified = 0;
+               
+               fref = scanState->btcb->fileRefNum;
+               
+               SWAP_BT_NODE(&block, ISHFSPLUS(VTOVCB(fref)), VTOC(fref)->c_fileid, 0);
+               }
+#endif
+
                // Make sure this is a valid node
                if ( CheckNode( scanState->btcb, scanState->currentNodePtr ) != noErr )
                {