0004-Fix-compilation-on-64-bit-arches.patch 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= <rbrito@ime.usp.br>
  2. Date: Thu, 24 Oct 2013 01:11:21 -0200
  3. Subject: Fix compilation on 64-bit arches
  4. ---
  5. fsck_hfs.tproj/dfalib/BTreePrivate.h | 5 ++++-
  6. fsck_hfs.tproj/dfalib/SControl.c | 8 ++++----
  7. fsck_hfs.tproj/dfalib/SVerify1.c | 14 +++++++-------
  8. fsck_hfs.tproj/dfalib/hfs_endian.c | 2 +-
  9. 4 files changed, 16 insertions(+), 13 deletions(-)
  10. diff --git a/fsck_hfs.tproj/dfalib/BTreePrivate.h b/fsck_hfs.tproj/dfalib/BTreePrivate.h
  11. index 058c75b..2fc2f28 100644
  12. --- a/fsck_hfs.tproj/dfalib/BTreePrivate.h
  13. +++ b/fsck_hfs.tproj/dfalib/BTreePrivate.h
  14. @@ -104,6 +104,9 @@ typedef enum {
  15. ///////////////////////////////////// Types /////////////////////////////////////
  16. +// Forward declaration from Scavenger.h
  17. +struct BTreeExtensionsRec;
  18. +
  19. typedef struct BTreeControlBlock { // fields specific to BTree CBs
  20. UInt8 keyCompareType; /* Key string Comparison Type */
  21. @@ -144,7 +147,7 @@ typedef struct BTreeControlBlock { // fields specific to BTree CBs
  22. UInt32 numPossibleHints; // Looks like a formated hint
  23. UInt32 numValidHints; // Hint used to find correct record.
  24. - UInt32 refCon; // Used by DFA to point to private data.
  25. + struct BTreeExtensionsRec *refCon; // Used by DFA to point to private data.
  26. SFCB *fcbPtr; // fcb of btree file
  27. } BTreeControlBlock, *BTreeControlBlockPtr;
  28. diff --git a/fsck_hfs.tproj/dfalib/SControl.c b/fsck_hfs.tproj/dfalib/SControl.c
  29. index 37eb242..4ce9e16 100644
  30. --- a/fsck_hfs.tproj/dfalib/SControl.c
  31. +++ b/fsck_hfs.tproj/dfalib/SControl.c
  32. @@ -1034,7 +1034,7 @@ static int ScavTerm( SGlobPtr GPtr )
  33. btcbP = (BTreeControlBlock*)fcbP->fcbBtree;
  34. if ( btcbP != nil)
  35. {
  36. - if( btcbP->refCon != (UInt32)nil )
  37. + if( btcbP->refCon != nil )
  38. {
  39. if(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != nil)
  40. {
  41. @@ -1043,13 +1043,13 @@ static int ScavTerm( SGlobPtr GPtr )
  42. }
  43. DisposeMemory( (Ptr)btcbP->refCon );
  44. err = MemError();
  45. - btcbP->refCon = (UInt32)nil;
  46. + btcbP->refCon = nil;
  47. }
  48. fcbP = GPtr->calculatedCatalogFCB; // release catalog BTree bit map
  49. btcbP = (BTreeControlBlock*)fcbP->fcbBtree;
  50. - if( btcbP->refCon != (UInt32)nil )
  51. + if( btcbP->refCon != nil )
  52. {
  53. if(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != nil)
  54. {
  55. @@ -1058,7 +1058,7 @@ static int ScavTerm( SGlobPtr GPtr )
  56. }
  57. DisposeMemory( (Ptr)btcbP->refCon );
  58. err = MemError();
  59. - btcbP->refCon = (UInt32)nil;
  60. + btcbP->refCon = nil;
  61. }
  62. }
  63. }
  64. diff --git a/fsck_hfs.tproj/dfalib/SVerify1.c b/fsck_hfs.tproj/dfalib/SVerify1.c
  65. index c272d4d..a273bf3 100644
  66. --- a/fsck_hfs.tproj/dfalib/SVerify1.c
  67. +++ b/fsck_hfs.tproj/dfalib/SVerify1.c
  68. @@ -789,8 +789,8 @@ OSErr CreateExtentsBTreeControlBlock( SGlobPtr GPtr )
  69. //
  70. // set up our DFA extended BTCB area. Will we have enough memory on all HFS+ volumes.
  71. //
  72. - btcb->refCon = (UInt32) AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
  73. - if ( btcb->refCon == (UInt32) nil ) {
  74. + btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
  75. + if ( btcb->refCon == nil ) {
  76. err = R_NoMem;
  77. goto exit;
  78. }
  79. @@ -1144,8 +1144,8 @@ OSErr CreateCatalogBTreeControlBlock( SGlobPtr GPtr )
  80. // set up our DFA extended BTCB area. Will we have enough memory on all HFS+ volumes.
  81. //
  82. - btcb->refCon = (UInt32) AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
  83. - if ( btcb->refCon == (UInt32)nil ) {
  84. + btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
  85. + if ( btcb->refCon == nil ) {
  86. err = R_NoMem;
  87. goto exit;
  88. }
  89. @@ -1779,8 +1779,8 @@ OSErr CreateAttributesBTreeControlBlock( SGlobPtr GPtr )
  90. //
  91. // set up our DFA extended BTCB area. Will we have enough memory on all HFS+ volumes.
  92. //
  93. - btcb->refCon = (UInt32) AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
  94. - if ( btcb->refCon == (UInt32)nil ) {
  95. + btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
  96. + if ( btcb->refCon == nil ) {
  97. err = R_NoMem;
  98. goto exit;
  99. }
  100. @@ -1793,7 +1793,7 @@ OSErr CreateAttributesBTreeControlBlock( SGlobPtr GPtr )
  101. }
  102. else
  103. {
  104. - if ( btcb->refCon == (UInt32)nil ) {
  105. + if ( btcb->refCon == nil ) {
  106. err = R_NoMem;
  107. goto exit;
  108. }
  109. diff --git a/fsck_hfs.tproj/dfalib/hfs_endian.c b/fsck_hfs.tproj/dfalib/hfs_endian.c
  110. index 69500c1..3cc9eb4 100755
  111. --- a/fsck_hfs.tproj/dfalib/hfs_endian.c
  112. +++ b/fsck_hfs.tproj/dfalib/hfs_endian.c
  113. @@ -437,7 +437,7 @@ hfs_swap_HFSPlusBTInternalNode (
  114. BTNodeDescriptor *srcDesc = src->buffer;
  115. UInt16 *srcOffs = (UInt16 *)((char *)src->buffer + (src->blockSize - (srcDesc->numRecords * sizeof (UInt16))));
  116. char *nextRecord; /* Points to start of record following current one */
  117. - UInt32 i;
  118. + int i;
  119. UInt32 j;
  120. if (fileID == kHFSExtentsFileID) {