* @(#)BTreeScanner.c
*/
#include <sys/kernel.h>
+#include "../../hfs_endian.h"
#include "../headers/BTreeScanner.h"
(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 )
{
// release old buffer if we have one
if ( theScanStatePtr->bufferPtr != NULL )
{
- theScanStatePtr->bufferPtr->b_flags |= (B_INVAL | B_AGE);
+ theScanStatePtr->bufferPtr->b_flags |= (B_INVAL | B_AGE);
brelse( theScanStatePtr->bufferPtr );
theScanStatePtr->bufferPtr = NULL;
theScanStatePtr->currentNodePtr = NULL;
// now read blocks from the device
myErr = bread( myDevPtr,
- myPhyBlockNum,
- myBufferSize,
- NOCRED,
- &theScanStatePtr->bufferPtr );
+ myPhyBlockNum,
+ myBufferSize,
+ NOCRED,
+ &theScanStatePtr->bufferPtr );
if ( myErr != E_NONE )
{
goto ExitThisRoutine;
if ( scanState->bufferPtr != NULL )
{
scanState->bufferPtr->b_flags |= (B_INVAL | B_AGE);
- brelse( scanState->bufferPtr );
+ brelse( scanState->bufferPtr );
scanState->bufferPtr = NULL;
scanState->currentNodePtr = NULL;
}