summaryrefslogtreecommitdiffstats
path: root/system/hfsprogs/patches/0004-Fix-compilation-on-64-bit-arches.patch
blob: 57f6011084addcf572658861a3e1dcab227557d4 (plain)
From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= <rbrito@ime.usp.br>
Date: Thu, 24 Oct 2013 01:11:21 -0200
Subject: Fix compilation on 64-bit arches

---
 fsck_hfs.tproj/dfalib/BTreePrivate.h |  5 ++++-
 fsck_hfs.tproj/dfalib/SControl.c     |  8 ++++----
 fsck_hfs.tproj/dfalib/SVerify1.c     | 14 +++++++-------
 fsck_hfs.tproj/dfalib/hfs_endian.c   |  2 +-
 4 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/fsck_hfs.tproj/dfalib/BTreePrivate.h b/fsck_hfs.tproj/dfalib/BTreePrivate.h
index 058c75b..2fc2f28 100644
--- a/fsck_hfs.tproj/dfalib/BTreePrivate.h
+++ b/fsck_hfs.tproj/dfalib/BTreePrivate.h
@@ -104,6 +104,9 @@ typedef enum {
 
 ///////////////////////////////////// Types /////////////////////////////////////
 
+// Forward declaration from Scavenger.h
+struct BTreeExtensionsRec;
+
 typedef struct BTreeControlBlock {					// fields specific to BTree CBs
 
 	UInt8		keyCompareType;   /* Key string Comparison Type */
@@ -144,7 +147,7 @@ typedef struct BTreeControlBlock {					// fields specific to BTree CBs
 	UInt32						 numPossibleHints;	// Looks like a formated hint
 	UInt32						 numValidHints;		// Hint used to find correct record.
 	
-	UInt32						 refCon;			//	Used by DFA to point to private data.
+	struct BTreeExtensionsRec			*refCon;			//	Used by DFA to point to private data.
 	SFCB						*fcbPtr;		// fcb of btree file
 	
 } BTreeControlBlock, *BTreeControlBlockPtr;
diff --git a/fsck_hfs.tproj/dfalib/SControl.c b/fsck_hfs.tproj/dfalib/SControl.c
index 37eb242..4ce9e16 100644
--- a/fsck_hfs.tproj/dfalib/SControl.c
+++ b/fsck_hfs.tproj/dfalib/SControl.c
@@ -1034,7 +1034,7 @@ static int ScavTerm( SGlobPtr GPtr )
 		btcbP = (BTreeControlBlock*)fcbP->fcbBtree;
 		if ( btcbP != nil)
 		{
-			if( btcbP->refCon != (UInt32)nil )
+			if( btcbP->refCon != nil )
 			{
 				if(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != nil)
 				{
@@ -1043,13 +1043,13 @@ static int ScavTerm( SGlobPtr GPtr )
 				}
 				DisposeMemory( (Ptr)btcbP->refCon );
 				err = MemError();
-				btcbP->refCon = (UInt32)nil;
+				btcbP->refCon = nil;
 			}
 				
 			fcbP = GPtr->calculatedCatalogFCB;	//	release catalog BTree bit map
 			btcbP = (BTreeControlBlock*)fcbP->fcbBtree;
 				
-			if( btcbP->refCon != (UInt32)nil )
+			if( btcbP->refCon != nil )
 			{
 				if(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != nil)
 				{
@@ -1058,7 +1058,7 @@ static int ScavTerm( SGlobPtr GPtr )
 				}
 				DisposeMemory( (Ptr)btcbP->refCon );
 				err = MemError();
-				btcbP->refCon = (UInt32)nil;
+				btcbP->refCon = nil;
 			}
 		}
 	}
diff --git a/fsck_hfs.tproj/dfalib/SVerify1.c b/fsck_hfs.tproj/dfalib/SVerify1.c
index c272d4d..a273bf3 100644
--- a/fsck_hfs.tproj/dfalib/SVerify1.c
+++ b/fsck_hfs.tproj/dfalib/SVerify1.c
@@ -789,8 +789,8 @@ OSErr	CreateExtentsBTreeControlBlock( SGlobPtr GPtr )
 	//
 	//	set up our DFA extended BTCB area.  Will we have enough memory on all HFS+ volumes.
 	//
-	btcb->refCon = (UInt32) AllocateClearMemory( sizeof(BTreeExtensionsRec) );			// allocate space for our BTCB extensions
-	if ( btcb->refCon == (UInt32) nil ) {
+	btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) );			// allocate space for our BTCB extensions
+	if ( btcb->refCon == nil ) {
 		err = R_NoMem;
 		goto exit;
 	}
@@ -1144,8 +1144,8 @@ OSErr	CreateCatalogBTreeControlBlock( SGlobPtr GPtr )
 	//	set up our DFA extended BTCB area.  Will we have enough memory on all HFS+ volumes.
 	//
 
-	btcb->refCon = (UInt32) AllocateClearMemory( sizeof(BTreeExtensionsRec) );			// allocate space for our BTCB extensions
-	if ( btcb->refCon == (UInt32)nil ) {
+	btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) );			// allocate space for our BTCB extensions
+	if ( btcb->refCon == nil ) {
 		err = R_NoMem;
 		goto exit;
 	}
@@ -1779,8 +1779,8 @@ OSErr	CreateAttributesBTreeControlBlock( SGlobPtr GPtr )
 	//
 	//	set up our DFA extended BTCB area.  Will we have enough memory on all HFS+ volumes.
 	//
-	btcb->refCon = (UInt32) AllocateClearMemory( sizeof(BTreeExtensionsRec) );			// allocate space for our BTCB extensions
-	if ( btcb->refCon == (UInt32)nil ) {
+	btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) );			// allocate space for our BTCB extensions
+	if ( btcb->refCon == nil ) {
 		err = R_NoMem;
 		goto exit;
 	}
@@ -1793,7 +1793,7 @@ OSErr	CreateAttributesBTreeControlBlock( SGlobPtr GPtr )
 	}
 	else
 	{
-		if ( btcb->refCon == (UInt32)nil ) {
+		if ( btcb->refCon == nil ) {
 			err = R_NoMem;
 			goto exit;
 		}
diff --git a/fsck_hfs.tproj/dfalib/hfs_endian.c b/fsck_hfs.tproj/dfalib/hfs_endian.c
index 69500c1..3cc9eb4 100755
--- a/fsck_hfs.tproj/dfalib/hfs_endian.c
+++ b/fsck_hfs.tproj/dfalib/hfs_endian.c
@@ -437,7 +437,7 @@ hfs_swap_HFSPlusBTInternalNode (
     BTNodeDescriptor *srcDesc = src->buffer;
     UInt16 *srcOffs = (UInt16 *)((char *)src->buffer + (src->blockSize - (srcDesc->numRecords * sizeof (UInt16))));
 	char *nextRecord;	/*  Points to start of record following current one */
-    UInt32 i;
+    int i;
     UInt32 j;
 
     if (fileID == kHFSExtentsFileID) {