openwrt-packages/utils/hfsprogs/patches/0004-Fix-compilation-on-64-...

124 lines
4.4 KiB
Diff

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(-)
--- 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 { /
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;
--- 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;
}
}
}
--- a/fsck_hfs.tproj/dfalib/SVerify1.c
+++ b/fsck_hfs.tproj/dfalib/SVerify1.c
@@ -789,8 +789,8 @@ OSErr CreateExtentsBTreeControlBlock( SG
//
// 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( SG
// 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(
//
// 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(
}
else
{
- if ( btcb->refCon == (UInt32)nil ) {
+ if ( btcb->refCon == nil ) {
err = R_NoMem;
goto exit;
}
--- 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) {