0010-Rename-custom-macro-nil-with-NULL.patch 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319
  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: Rename custom macro nil with NULL
  4. ---
  5. fsck_hfs.tproj/dfalib/BTree.c | 142 +++++++++++++++++-----------------
  6. fsck_hfs.tproj/dfalib/BTreeAllocate.c | 14 ++--
  7. fsck_hfs.tproj/dfalib/BTreeMiscOps.c | 26 +++----
  8. fsck_hfs.tproj/dfalib/BTreeNodeOps.c | 30 +++----
  9. fsck_hfs.tproj/dfalib/BTreeTreeOps.c | 38 ++++-----
  10. fsck_hfs.tproj/dfalib/SControl.c | 56 +++++++-------
  11. fsck_hfs.tproj/dfalib/SRepair.c | 6 +-
  12. fsck_hfs.tproj/dfalib/SUtils.c | 6 +-
  13. fsck_hfs.tproj/dfalib/SVerify1.c | 32 ++++----
  14. fsck_hfs.tproj/dfalib/SVerify2.c | 4 +-
  15. 10 files changed, 177 insertions(+), 177 deletions(-)
  16. diff --git a/fsck_hfs.tproj/dfalib/BTree.c b/fsck_hfs.tproj/dfalib/BTree.c
  17. index 7ad9fe0..c0c8744 100644
  18. --- a/fsck_hfs.tproj/dfalib/BTree.c
  19. +++ b/fsck_hfs.tproj/dfalib/BTree.c
  20. @@ -163,21 +163,21 @@ OSStatus BTInitialize (FCB *filePtr,
  21. ////////////////////// Preliminary Error Checking ///////////////////////////
  22. - headerNode.buffer = nil;
  23. + headerNode.buffer = NULL;
  24. - if (pathPtr == nil) return paramErr;
  25. + if (pathPtr == NULL) return paramErr;
  26. setEndOfForkProc = pathPtr->agentPtr->agent.setEndOfForkProc;
  27. setBlockSizeProc = pathPtr->agentPtr->agent.setBlockSizeProc;
  28. - if (pathPtr->agentPtr->agent.getBlockProc == nil) return E_NoGetBlockProc;
  29. - if (pathPtr->agentPtr->agent.releaseBlockProc == nil) return E_NoReleaseBlockProc;
  30. - if (setEndOfForkProc == nil) return E_NoSetEndOfForkProc;
  31. - if (setBlockSizeProc == nil) return E_NoSetBlockSizeProc;
  32. + if (pathPtr->agentPtr->agent.getBlockProc == NULL) return E_NoGetBlockProc;
  33. + if (pathPtr->agentPtr->agent.releaseBlockProc == NULL) return E_NoReleaseBlockProc;
  34. + if (setEndOfForkProc == NULL) return E_NoSetEndOfForkProc;
  35. + if (setBlockSizeProc == NULL) return E_NoSetBlockSizeProc;
  36. forkPtr = pathPtr->path.forkPtr;
  37. - if (forkPtr->fork.btreePtr != nil) return fsBTrFileAlreadyOpenErr;
  38. + if (forkPtr->fork.btreePtr != NULL) return fsBTrFileAlreadyOpenErr;
  39. if ((maxKeyLength == 0) ||
  40. (maxKeyLength > kMaxKeyLength)) return fsBTInvalidKeyLengthErr;
  41. @@ -209,7 +209,7 @@ OSStatus BTInitialize (FCB *filePtr,
  42. //////////////////////// Allocate Control Block /////////////////////////////
  43. M_RESIDENT_ALLOCATE_FIXED_CLEAR( &btreePtr, sizeof( BTreeControlBlock ), kFSBTreeControlBlockType );
  44. - if (btreePtr == nil)
  45. + if (btreePtr == NULL)
  46. {
  47. err = memFullErr;
  48. goto ErrorExit;
  49. @@ -220,7 +220,7 @@ OSStatus BTInitialize (FCB *filePtr,
  50. btreePtr->flags = 0;
  51. btreePtr->attributes = 0;
  52. btreePtr->forkPtr = forkPtr;
  53. - btreePtr->keyCompareProc = nil;
  54. + btreePtr->keyCompareProc = NULL;
  55. btreePtr->keyDescPtr = keyDescPtr;
  56. btreePtr->btreeType = btreeType;
  57. btreePtr->treeDepth = 0;
  58. @@ -282,7 +282,7 @@ OSStatus BTInitialize (FCB *filePtr,
  59. ///////////////////// Copy Key Descriptor To Header /////////////////////////
  60. #if SupportsKeyDescriptors
  61. - if (keyDescPtr != nil)
  62. + if (keyDescPtr != NULL)
  63. {
  64. err = CheckKeyDescriptor (keyDescPtr, maxKeyLength);
  65. M_ExitOnError (err);
  66. @@ -309,7 +309,7 @@ OSStatus BTInitialize (FCB *filePtr,
  67. err = UpdateHeader (btreePtr);
  68. M_ExitOnError (err);
  69. - pathPtr->path.forkPtr->fork.btreePtr = nil;
  70. + pathPtr->path.forkPtr->fork.btreePtr = NULL;
  71. M_RESIDENT_DEALLOCATE_FIXED( btreePtr, sizeof( BTreeControlBlock ), kFSBTreeControlBlockType );
  72. return noErr;
  73. @@ -320,7 +320,7 @@ OSStatus BTInitialize (FCB *filePtr,
  74. ErrorExit:
  75. (void) ReleaseNode (btreePtr, &headerNode);
  76. - if (btreePtr != nil)
  77. + if (btreePtr != NULL)
  78. M_RESIDENT_DEALLOCATE_FIXED( btreePtr, sizeof( BTreeControlBlock ), kFSBTreeControlBlockType );
  79. return err;
  80. @@ -342,7 +342,7 @@ Input: filePtr - pointer to file to open as a B-tree
  81. setEndOfForkProc - pointer to client's SetEOF function
  82. Result: noErr - success
  83. - paramErr - required ptr was nil
  84. + paramErr - required ptr was NULL
  85. fsBTInvalidFileErr -
  86. memFullErr -
  87. != noErr - failure
  88. @@ -364,16 +364,16 @@ OSStatus BTOpenPath (SFCB *filePtr,
  89. ////////////////////// Preliminary Error Checking ///////////////////////////
  90. - if ( filePtr == nil ||
  91. - getBlockProc == nil ||
  92. - releaseBlockProc == nil ||
  93. - setEndOfForkProc == nil ||
  94. - setBlockSizeProc == nil )
  95. + if (filePtr == NULL ||
  96. + getBlockProc == NULL ||
  97. + releaseBlockProc == NULL ||
  98. + setEndOfForkProc == NULL ||
  99. + setBlockSizeProc == NULL)
  100. {
  101. return paramErr;
  102. }
  103. - if ( filePtr->fcbBtree != nil ) // already has a BTreeCB
  104. + if (filePtr->fcbBtree != NULL) // already has a BTreeCB
  105. return noErr;
  106. // is file large enough to contain header node?
  107. @@ -384,7 +384,7 @@ OSStatus BTOpenPath (SFCB *filePtr,
  108. //////////////////////// Allocate Control Block /////////////////////////////
  109. btreePtr = (BTreeControlBlock*) AllocateClearMemory( sizeof( BTreeControlBlock ) );
  110. - if (btreePtr == nil)
  111. + if (btreePtr == NULL)
  112. {
  113. Panic ("\pBTOpen: no memory for btreePtr.");
  114. return memFullErr;
  115. @@ -397,7 +397,7 @@ OSStatus BTOpenPath (SFCB *filePtr,
  116. /////////////////////////// Read Header Node ////////////////////////////////
  117. - nodeRec.buffer = nil; // so we can call ReleaseNode
  118. + nodeRec.buffer = NULL; // so we can call ReleaseNode
  119. btreePtr->fcbPtr = filePtr;
  120. filePtr->fcbBtree = (void *) btreePtr; // attach btree cb to file
  121. @@ -487,7 +487,7 @@ OSStatus BTOpenPath (SFCB *filePtr,
  122. ////////////////////////// Get Key Descriptor ///////////////////////////////
  123. #if SupportsKeyDescriptors
  124. - if ( keyCompareProc == nil ) // if no key compare proc then get key descriptor
  125. + if (keyCompareProc == NULL) // if no key compare proc then get key descriptor
  126. {
  127. err = GetKeyDescriptor (btreePtr, nodeRec.buffer); //¥¥ it should check amount of memory allocated...
  128. M_ExitOnError (err);
  129. @@ -499,7 +499,7 @@ OSStatus BTOpenPath (SFCB *filePtr,
  130. else
  131. #endif
  132. {
  133. - btreePtr->keyDescPtr = nil; // clear it so we don't dispose garbage later
  134. + btreePtr->keyDescPtr = NULL; // clear it so we don't dispose garbage later
  135. }
  136. err = ReleaseNode (btreePtr, &nodeRec);
  137. @@ -528,7 +528,7 @@ OSStatus BTOpenPath (SFCB *filePtr,
  138. ErrorExit:
  139. - filePtr->fcbBtree = nil;
  140. + filePtr->fcbBtree = NULL;
  141. (void) ReleaseNode (btreePtr, &nodeRec);
  142. DisposeMemory( btreePtr );
  143. @@ -567,7 +567,7 @@ OSStatus BTClosePath (SFCB *filePtr)
  144. btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree;
  145. - if (btreePtr == nil)
  146. + if (btreePtr == NULL)
  147. return fsBTInvalidFileErr;
  148. ////////////////////// Check for other BTree Paths //////////////////////////
  149. @@ -603,14 +603,14 @@ OSStatus BTClosePath (SFCB *filePtr)
  150. M_ExitOnError (err);
  151. #if SupportsKeyDescriptors
  152. - if (btreePtr->keyDescPtr != nil) // deallocate keyDescriptor, if any
  153. + if (btreePtr->keyDescPtr != NULL) // deallocate keyDescriptor, if any
  154. {
  155. DisposeMemory( btreePtr->keyDescPtr );
  156. }
  157. #endif
  158. DisposeMemory( btreePtr );
  159. - filePtr->fcbBtree = nil;
  160. + filePtr->fcbBtree = NULL;
  161. // LogEndTime(kTraceCloseBTree, noErr);
  162. @@ -643,7 +643,7 @@ Function: Search for position in B*Tree indicated by searchKey. If a valid node
  163. Input: pathPtr - pointer to path for BTree file.
  164. searchKey - pointer to search key to match.
  165. - hintPtr - pointer to hint (may be nil)
  166. + hintPtr - pointer to hint (may be NULL)
  167. Output: record - pointer to BufferDescriptor containing record
  168. recordLen - length of data at recordPtr
  169. @@ -678,14 +678,14 @@ OSStatus BTSearchRecord (SFCB *filePtr,
  170. // LogStartTime(kTraceSearchBTree);
  171. - if (filePtr == nil) return paramErr;
  172. - if (searchIterator == nil) return paramErr;
  173. + if (filePtr == NULL) return paramErr;
  174. + if (searchIterator == NULL) return paramErr;
  175. btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree;
  176. - if (btreePtr == nil) return fsBTInvalidFileErr;
  177. + if (btreePtr == NULL) return fsBTInvalidFileErr;
  178. #if SupportsKeyDescriptors
  179. - if (btreePtr->keyCompareProc == nil) // CheckKey if we using Key Descriptor
  180. + if (btreePtr->keyCompareProc == NULL) // CheckKey if we using Key Descriptor
  181. {
  182. err = CheckKey (&searchIterator->key, btreePtr->keyDescPtr, btreePtr->maxKeyLength);
  183. M_ExitOnError (err);
  184. @@ -775,9 +775,9 @@ OSStatus BTSearchRecord (SFCB *filePtr,
  185. //¥¥ Should check for errors! Or BlockMove could choke on recordPtr!!!
  186. GetRecordByIndex (btreePtr, node.buffer, index, &keyPtr, &recordPtr, &len);
  187. - if (recordLen != nil) *recordLen = len;
  188. + if (recordLen != NULL) *recordLen = len;
  189. - if (record != nil)
  190. + if (record != NULL)
  191. {
  192. ByteCount recordSize;
  193. @@ -794,7 +794,7 @@ OSStatus BTSearchRecord (SFCB *filePtr,
  194. /////////////////////// Success - Update Iterator ///////////////////////////
  195. - if (resultIterator != nil)
  196. + if (resultIterator != NULL)
  197. {
  198. resultIterator->hint.writeCount = btreePtr->writeCount;
  199. resultIterator->hint.nodeNum = nodeNum;
  200. @@ -825,10 +825,10 @@ OSStatus BTSearchRecord (SFCB *filePtr,
  201. ErrorExit:
  202. - if (recordLen != nil)
  203. + if (recordLen != NULL)
  204. *recordLen = 0;
  205. - if (resultIterator != nil)
  206. + if (resultIterator != NULL)
  207. {
  208. resultIterator->hint.writeCount = 0;
  209. resultIterator->hint.nodeNum = 0;
  210. @@ -892,18 +892,18 @@ OSStatus BTIterateRecord (SFCB *filePtr,
  211. ////////////////////////// Priliminary Checks ///////////////////////////////
  212. - left.buffer = nil;
  213. - right.buffer = nil;
  214. - node.buffer = nil;
  215. + left.buffer = NULL;
  216. + right.buffer = NULL;
  217. + node.buffer = NULL;
  218. - if (filePtr == nil)
  219. + if (filePtr == NULL)
  220. {
  221. return paramErr;
  222. }
  223. btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree;
  224. - if (btreePtr == nil)
  225. + if (btreePtr == NULL)
  226. {
  227. return fsBTInvalidFileErr; //¥¥ handle properly
  228. }
  229. @@ -968,7 +968,7 @@ OSStatus BTIterateRecord (SFCB *filePtr,
  230. }
  231. else
  232. {
  233. - if (left.buffer == nil)
  234. + if (left.buffer == NULL)
  235. {
  236. nodeNum = ((NodeDescPtr) node.buffer)->bLink;
  237. if ( nodeNum > 0)
  238. @@ -981,13 +981,13 @@ OSStatus BTIterateRecord (SFCB *filePtr,
  239. }
  240. }
  241. // Before we stomp on "right", we'd better release it if needed
  242. - if (right.buffer != nil) {
  243. + if (right.buffer != NULL) {
  244. err = ReleaseNode(btreePtr, &right);
  245. M_ExitOnError(err);
  246. }
  247. right = node;
  248. node = left;
  249. - left.buffer = nil;
  250. + left.buffer = NULL;
  251. index = ((NodeDescPtr) node.buffer)->numRecords -1;
  252. }
  253. }
  254. @@ -1012,7 +1012,7 @@ OSStatus BTIterateRecord (SFCB *filePtr,
  255. }
  256. else
  257. {
  258. - if (right.buffer == nil)
  259. + if (right.buffer == NULL)
  260. {
  261. nodeNum = ((NodeDescPtr) node.buffer)->fLink;
  262. if ( nodeNum > 0)
  263. @@ -1025,13 +1025,13 @@ OSStatus BTIterateRecord (SFCB *filePtr,
  264. }
  265. }
  266. // Before we stomp on "left", we'd better release it if needed
  267. - if (left.buffer != nil) {
  268. + if (left.buffer != NULL) {
  269. err = ReleaseNode(btreePtr, &left);
  270. M_ExitOnError(err);
  271. }
  272. left = node;
  273. node = right;
  274. - right.buffer = nil;
  275. + right.buffer = NULL;
  276. index = 0;
  277. }
  278. }
  279. @@ -1054,9 +1054,9 @@ CopyData:
  280. err = GetRecordByIndex (btreePtr, node.buffer, index, &keyPtr, &recordPtr, &len);
  281. M_ExitOnError (err);
  282. - if (recordLen != nil) *recordLen = len;
  283. + if (recordLen != NULL) *recordLen = len;
  284. - if (record != nil)
  285. + if (record != NULL)
  286. {
  287. ByteCount recordSize;
  288. @@ -1069,7 +1069,7 @@ CopyData:
  289. CopyMemory (recordPtr, record->bufferAddress, len);
  290. }
  291. - if (iterator != nil) // first & last do not require iterator
  292. + if (iterator != NULL) // first & last do not require iterator
  293. {
  294. iterator->hint.writeCount = btreePtr->writeCount;
  295. iterator->hint.nodeNum = nodeNum;
  296. @@ -1089,13 +1089,13 @@ CopyData:
  297. err = ReleaseNode (btreePtr, &node);
  298. M_ExitOnError (err);
  299. - if (left.buffer != nil)
  300. + if (left.buffer != NULL)
  301. {
  302. err = ReleaseNode (btreePtr, &left);
  303. M_ExitOnError (err);
  304. }
  305. - if (right.buffer != nil)
  306. + if (right.buffer != NULL)
  307. {
  308. err = ReleaseNode (btreePtr, &right);
  309. M_ExitOnError (err);
  310. @@ -1113,10 +1113,10 @@ ErrorExit:
  311. (void) ReleaseNode (btreePtr, &node);
  312. (void) ReleaseNode (btreePtr, &right);
  313. - if (recordLen != nil)
  314. + if (recordLen != NULL)
  315. *recordLen = 0;
  316. - if (iterator != nil)
  317. + if (iterator != NULL)
  318. {
  319. iterator->hint.writeCount = 0;
  320. iterator->hint.nodeNum = 0;
  321. @@ -1157,7 +1157,7 @@ OSStatus BTInsertRecord (SFCB *filePtr,
  322. ////////////////////////// Priliminary Checks ///////////////////////////////
  323. - nodeRec.buffer = nil; // so we can call ReleaseNode
  324. + nodeRec.buffer = NULL; // so we can call ReleaseNode
  325. err = CheckInsertParams (filePtr, iterator, record, recordLen);
  326. if (err != noErr)
  327. @@ -1317,7 +1317,7 @@ OSStatus BTSetRecord (SFCB *filePtr,
  328. ////////////////////////// Priliminary Checks ///////////////////////////////
  329. - nodeRec.buffer = nil; // so we can call ReleaseNode
  330. + nodeRec.buffer = NULL; // so we can call ReleaseNode
  331. err = CheckInsertParams (filePtr, iterator, record, recordLen);
  332. if (err != noErr)
  333. @@ -1506,7 +1506,7 @@ OSStatus BTReplaceRecord (SFCB *filePtr,
  334. ////////////////////////// Priliminary Checks ///////////////////////////////
  335. - nodeRec.buffer = nil; // so we can call ReleaseNode
  336. + nodeRec.buffer = NULL; // so we can call ReleaseNode
  337. err = CheckInsertParams (filePtr, iterator, record, recordLen);
  338. if (err != noErr)
  339. @@ -1645,20 +1645,20 @@ OSStatus BTDeleteRecord (SFCB *filePtr,
  340. ////////////////////////// Priliminary Checks ///////////////////////////////
  341. - nodeRec.buffer = nil; // so we can call ReleaseNode
  342. + nodeRec.buffer = NULL; // so we can call ReleaseNode
  343. - M_ReturnErrorIf (filePtr == nil, paramErr);
  344. - M_ReturnErrorIf (iterator == nil, paramErr);
  345. + M_ReturnErrorIf (filePtr == NULL, paramErr);
  346. + M_ReturnErrorIf (iterator == NULL, paramErr);
  347. btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree;
  348. - if (btreePtr == nil)
  349. + if (btreePtr == NULL)
  350. {
  351. err = fsBTInvalidFileErr;
  352. goto ErrorExit;
  353. }
  354. #if SupportsKeyDescriptors
  355. - if (btreePtr->keyDescPtr != nil)
  356. + if (btreePtr->keyDescPtr != NULL)
  357. {
  358. err = CheckKey (&iterator->key, btreePtr->keyDescPtr, btreePtr->maxKeyLength);
  359. M_ExitOnError (err);
  360. @@ -1712,12 +1712,12 @@ OSStatus BTGetInformation (SFCB *filePtr,
  361. BTreeControlBlockPtr btreePtr;
  362. - M_ReturnErrorIf (filePtr == nil, paramErr);
  363. + M_ReturnErrorIf (filePtr == NULL, paramErr);
  364. btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree;
  365. - M_ReturnErrorIf (btreePtr == nil, fsBTInvalidFileErr);
  366. - M_ReturnErrorIf (info == nil, paramErr);
  367. + M_ReturnErrorIf (btreePtr == NULL, fsBTInvalidFileErr);
  368. + M_ReturnErrorIf (info == NULL, paramErr);
  369. //¥¥ check version?
  370. @@ -1730,7 +1730,7 @@ OSStatus BTGetInformation (SFCB *filePtr,
  371. info->keyDescriptor = btreePtr->keyDescPtr; //¥¥ this won't do at all...
  372. info->reserved = 0;
  373. - if (btreePtr->keyDescPtr == nil)
  374. + if (btreePtr->keyDescPtr == NULL)
  375. info->keyDescLength = 0;
  376. else
  377. info->keyDescLength = (UInt32) btreePtr->keyDescPtr->length;
  378. @@ -1762,11 +1762,11 @@ OSStatus BTFlushPath (SFCB *filePtr)
  379. // LogStartTime(kTraceFlushBTree);
  380. - M_ReturnErrorIf (filePtr == nil, paramErr);
  381. + M_ReturnErrorIf (filePtr == NULL, paramErr);
  382. btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree;
  383. - M_ReturnErrorIf (btreePtr == nil, fsBTInvalidFileErr);
  384. + M_ReturnErrorIf (btreePtr == NULL, fsBTInvalidFileErr);
  385. err = UpdateHeader (btreePtr);
  386. @@ -1788,13 +1788,13 @@ Input: iterator - pointer to BTreeIterator
  387. Output: iterator - iterator with the hint.nodeNum cleared
  388. Result: noErr - success
  389. - paramErr - iterator == nil
  390. + paramErr - iterator == NULL
  391. -------------------------------------------------------------------------------*/
  392. OSStatus BTInvalidateHint (BTreeIterator *iterator )
  393. {
  394. - if (iterator == nil)
  395. + if (iterator == NULL)
  396. return paramErr;
  397. iterator->hint.nodeNum = 0;
  398. diff --git a/fsck_hfs.tproj/dfalib/BTreeAllocate.c b/fsck_hfs.tproj/dfalib/BTreeAllocate.c
  399. index 485d867..02bdd8d 100644
  400. --- a/fsck_hfs.tproj/dfalib/BTreeAllocate.c
  401. +++ b/fsck_hfs.tproj/dfalib/BTreeAllocate.c
  402. @@ -83,7 +83,7 @@ OSStatus AllocateNode (BTreeControlBlockPtr btreePtr, UInt32 *nodeNum)
  403. nodeNumber = 0; // first node number of header map record
  404. - node.buffer = nil; // clear node.buffer to get header node
  405. + node.buffer = NULL; // clear node.buffer to get header node
  406. // - and for ErrorExit
  407. while (true)
  408. @@ -192,7 +192,7 @@ OSStatus FreeNode (BTreeControlBlockPtr btreePtr, UInt32 nodeNum)
  409. //////////////////////////// Find Map Record ////////////////////////////////
  410. nodeIndex = 0; // first node number of header map record
  411. - node.buffer = nil; // invalidate node.buffer to get header node
  412. + node.buffer = NULL; // invalidate node.buffer to get header node
  413. while (nodeNum >= nodeIndex)
  414. {
  415. @@ -278,8 +278,8 @@ OSStatus ExtendBTree (BTreeControlBlockPtr btreePtr,
  416. nodeSize = btreePtr->nodeSize;
  417. filePtr = btreePtr->fcbPtr;
  418. - mapNode.buffer = nil;
  419. - newNode.buffer = nil;
  420. + mapNode.buffer = NULL;
  421. + newNode.buffer = NULL;
  422. mapNodeRecSize = nodeSize - sizeof(BTNodeDescriptor) - 6; // 2 bytes of free space (see note)
  423. @@ -448,7 +448,7 @@ ErrorExit:
  424. Routine: GetMapNode - Get the next map node and pointer to the map record.
  425. Function: Given a BlockDescriptor to a map node in nodePtr, GetMapNode releases
  426. - it and gets the next node. If nodePtr->buffer is nil, then the header
  427. + it and gets the next node. If nodePtr->buffer is NULL, then the header
  428. node is retrieved.
  429. @@ -474,7 +474,7 @@ OSStatus GetMapNode (BTreeControlBlockPtr btreePtr,
  430. UInt16 mapIndex;
  431. UInt32 nextNodeNum;
  432. - if (nodePtr->buffer != nil) // if iterator is valid...
  433. + if (nodePtr->buffer != NULL) // if iterator is valid...
  434. {
  435. nextNodeNum = ((NodeDescPtr)nodePtr->buffer)->fLink;
  436. if (nextNodeNum == 0)
  437. @@ -521,7 +521,7 @@ ErrorExit:
  438. (void) ReleaseNode (btreePtr, nodePtr);
  439. - *mapPtr = nil;
  440. + *mapPtr = NULL;
  441. *mapSize = 0;
  442. return err;
  443. diff --git a/fsck_hfs.tproj/dfalib/BTreeMiscOps.c b/fsck_hfs.tproj/dfalib/BTreeMiscOps.c
  444. index 7c9edca..997f34b 100644
  445. --- a/fsck_hfs.tproj/dfalib/BTreeMiscOps.c
  446. +++ b/fsck_hfs.tproj/dfalib/BTreeMiscOps.c
  447. @@ -236,13 +236,13 @@ OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr,
  448. // assume index points to UInt16
  449. // assume foundRecord points to Boolean
  450. - left->buffer = nil;
  451. - middle->buffer = nil;
  452. - right->buffer = nil;
  453. + left->buffer = NULL;
  454. + middle->buffer = NULL;
  455. + right->buffer = NULL;
  456. foundIt = false;
  457. - if (iterator == nil) // do we have an iterator?
  458. + if (iterator == NULL) // do we have an iterator?
  459. {
  460. err = fsBTInvalidIteratorErr;
  461. goto ErrorExit;
  462. @@ -250,7 +250,7 @@ OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr,
  463. #if SupportsKeyDescriptors
  464. //¥¥ verify iterator key (change CheckKey to take btreePtr instead of keyDescPtr?)
  465. - if (btreePtr->keyDescPtr != nil)
  466. + if (btreePtr->keyDescPtr != NULL)
  467. {
  468. err = CheckKey (&iterator->key, btreePtr->keyDescPtr, btreePtr->maxKeyLength );
  469. M_ExitOnError (err);
  470. @@ -309,7 +309,7 @@ OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr,
  471. {
  472. *right = *middle;
  473. *middle = *left;
  474. - left->buffer = nil;
  475. + left->buffer = NULL;
  476. index = leftIndex;
  477. goto SuccessfulExit;
  478. @@ -330,7 +330,7 @@ OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr,
  479. {
  480. *right = *middle;
  481. *middle = *left;
  482. - left->buffer = nil;
  483. + left->buffer = NULL;
  484. index = leftIndex;
  485. goto SuccessfulExit;
  486. @@ -363,7 +363,7 @@ OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr,
  487. {
  488. *left = *middle;
  489. *middle = *right;
  490. - right->buffer = nil;
  491. + right->buffer = NULL;
  492. index = rightIndex;
  493. goto SuccessfulExit;
  494. @@ -427,15 +427,15 @@ OSStatus CheckInsertParams (SFCB *filePtr,
  495. {
  496. BTreeControlBlockPtr btreePtr;
  497. - if (filePtr == nil) return paramErr;
  498. + if (filePtr == NULL) return paramErr;
  499. btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree;
  500. - if (btreePtr == nil) return fsBTInvalidFileErr;
  501. - if (iterator == nil) return paramErr;
  502. - if (record == nil) return paramErr;
  503. + if (btreePtr == NULL) return fsBTInvalidFileErr;
  504. + if (iterator == NULL) return paramErr;
  505. + if (record == NULL) return paramErr;
  506. #if SupportsKeyDescriptors
  507. - if (btreePtr->keyDescPtr != nil)
  508. + if (btreePtr->keyDescPtr != NULL)
  509. {
  510. OSStatus err;
  511. diff --git a/fsck_hfs.tproj/dfalib/BTreeNodeOps.c b/fsck_hfs.tproj/dfalib/BTreeNodeOps.c
  512. index da07cc7..ef2bd7b 100644
  513. --- a/fsck_hfs.tproj/dfalib/BTreeNodeOps.c
  514. +++ b/fsck_hfs.tproj/dfalib/BTreeNodeOps.c
  515. @@ -105,7 +105,7 @@ Function: Gets an existing BTree node from FS Agent and verifies it.
  516. Input: btreePtr - pointer to BTree control block
  517. nodeNum - number of node to request
  518. -Output: nodePtr - pointer to beginning of node (nil if error)
  519. +Output: nodePtr - pointer to beginning of node (NULL if error)
  520. Result:
  521. noErr - success
  522. @@ -139,7 +139,7 @@ OSStatus GetNode (BTreeControlBlockPtr btreePtr,
  523. if (err != noErr)
  524. {
  525. Panic ("\pGetNode: getNodeProc returned error.");
  526. - nodePtr->buffer = nil;
  527. + nodePtr->buffer = NULL;
  528. goto ErrorExit;
  529. }
  530. ++btreePtr->numGetNodes;
  531. @@ -156,8 +156,8 @@ OSStatus GetNode (BTreeControlBlockPtr btreePtr,
  532. return noErr;
  533. ErrorExit:
  534. - nodePtr->buffer = nil;
  535. - nodePtr->blockHeader = nil;
  536. + nodePtr->buffer = NULL;
  537. + nodePtr->blockHeader = NULL;
  538. // LogEndTime(kTraceGetNode, err);
  539. @@ -176,7 +176,7 @@ Function: Gets a new BTree node from FS Agent and initializes it to an empty
  540. Input: btreePtr - pointer to BTree control block
  541. nodeNum - number of node to request
  542. -Output: returnNodePtr - pointer to beginning of node (nil if error)
  543. +Output: returnNodePtr - pointer to beginning of node (NULL if error)
  544. Result: noErr - success
  545. != noErr - failure
  546. @@ -203,7 +203,7 @@ OSStatus GetNewNode (BTreeControlBlockPtr btreePtr,
  547. if (err != noErr)
  548. {
  549. Panic ("\pGetNewNode: getNodeProc returned error.");
  550. - returnNodePtr->buffer = nil;
  551. + returnNodePtr->buffer = NULL;
  552. return err;
  553. }
  554. ++btreePtr->numGetNewNodes;
  555. @@ -248,7 +248,7 @@ OSStatus ReleaseNode (BTreeControlBlockPtr btreePtr,
  556. err = noErr;
  557. - if (nodePtr->buffer != nil)
  558. + if (nodePtr->buffer != NULL)
  559. {
  560. /*
  561. * The nodes must remain in the cache as big endian!
  562. @@ -267,8 +267,8 @@ OSStatus ReleaseNode (BTreeControlBlockPtr btreePtr,
  563. ++btreePtr->numReleaseNodes;
  564. }
  565. - nodePtr->buffer = nil;
  566. - nodePtr->blockHeader = nil;
  567. + nodePtr->buffer = NULL;
  568. + nodePtr->blockHeader = NULL;
  569. // LogEndTime(kTraceReleaseNode, err);
  570. @@ -299,7 +299,7 @@ OSStatus TrashNode (BTreeControlBlockPtr btreePtr,
  571. err = noErr;
  572. - if (nodePtr->buffer != nil)
  573. + if (nodePtr->buffer != NULL)
  574. {
  575. releaseNodeProc = btreePtr->releaseBlockProc;
  576. err = releaseNodeProc (btreePtr->fcbPtr,
  577. @@ -309,8 +309,8 @@ OSStatus TrashNode (BTreeControlBlockPtr btreePtr,
  578. ++btreePtr->numReleaseNodes;
  579. }
  580. - nodePtr->buffer = nil;
  581. - nodePtr->blockHeader = nil;
  582. + nodePtr->buffer = NULL;
  583. + nodePtr->blockHeader = NULL;
  584. return err;
  585. }
  586. @@ -338,7 +338,7 @@ OSStatus UpdateNode (BTreeControlBlockPtr btreePtr,
  587. err = noErr;
  588. - if (nodePtr->buffer != nil) //¥¥ why call UpdateNode if nil ?!?
  589. + if (nodePtr->buffer != NULL) //¥¥ why call UpdateNode if NULL ?!?
  590. {
  591. // LogStartTime(kTraceReleaseNode);
  592. err = hfs_swap_BTNode(nodePtr, btreePtr->fcbPtr, kSwapBTNodeHostToBig);
  593. @@ -358,8 +358,8 @@ OSStatus UpdateNode (BTreeControlBlockPtr btreePtr,
  594. ++btreePtr->numUpdateNodes;
  595. }
  596. - nodePtr->buffer = nil;
  597. - nodePtr->blockHeader = nil;
  598. + nodePtr->buffer = NULL;
  599. + nodePtr->blockHeader = NULL;
  600. return noErr;
  601. diff --git a/fsck_hfs.tproj/dfalib/BTreeTreeOps.c b/fsck_hfs.tproj/dfalib/BTreeTreeOps.c
  602. index 37fb170..73e1fda 100644
  603. --- a/fsck_hfs.tproj/dfalib/BTreeTreeOps.c
  604. +++ b/fsck_hfs.tproj/dfalib/BTreeTreeOps.c
  605. @@ -177,7 +177,7 @@ Output: nodeNum - number of the node containing the key position
  606. Result: noErr - key found, index is record index
  607. fsBTRecordNotFoundErr - key not found, index is insert index
  608. - fsBTEmptyErr - key not found, return params are nil
  609. + fsBTEmptyErr - key not found, return params are NULL
  610. otherwise - catastrophic failure (GetNode/ReleaseNode failed)
  611. -------------------------------------------------------------------------------*/
  612. @@ -321,8 +321,8 @@ ReleaseAndExit:
  613. ErrorExit:
  614. *nodeNum = 0;
  615. - nodePtr->buffer = nil;
  616. - nodePtr->blockHeader = nil;
  617. + nodePtr->buffer = NULL;
  618. + nodePtr->blockHeader = NULL;
  619. *returnIndex = 0;
  620. return err;
  621. @@ -354,7 +354,7 @@ OSStatus InsertTree ( BTreeControlBlockPtr btreePtr,
  622. primaryKey.replacingKey = replacingKey;
  623. primaryKey.skipRotate = false;
  624. - err = InsertLevel (btreePtr, treePathTable, &primaryKey, nil,
  625. + err = InsertLevel (btreePtr, treePathTable, &primaryKey, NULL,
  626. targetNode, index, level, insertNode );
  627. return err;
  628. @@ -385,7 +385,7 @@ OSStatus InsertLevel (BTreeControlBlockPtr btreePtr,
  629. #if defined(applec) && !defined(__SC__)
  630. PanicIf ((level == 1) && (((NodeDescPtr)targetNode->buffer)->kind != kBTLeafNode), "\P InsertLevel: non-leaf at level 1! ");
  631. #endif
  632. - siblingNode.buffer = nil;
  633. + siblingNode.buffer = NULL;
  634. targetNodeNum = treePathTable [level].node;
  635. insertParent = false;
  636. @@ -420,7 +420,7 @@ OSStatus InsertLevel (BTreeControlBlockPtr btreePtr,
  637. ////// process second insert (if any) //////
  638. - if ( secondaryKey != nil )
  639. + if (secondaryKey != NULL)
  640. {
  641. Boolean temp;
  642. @@ -446,7 +446,7 @@ OSStatus InsertLevel (BTreeControlBlockPtr btreePtr,
  643. UInt8 * recPtr;
  644. UInt16 recSize;
  645. - secondaryKey = nil;
  646. + secondaryKey = NULL;
  647. PanicIf ( (level == btreePtr->treeDepth), "InsertLevel: unfinished insert!?");
  648. @@ -606,9 +606,9 @@ static OSErr InsertNode (BTreeControlBlockPtr btreePtr,
  649. if ( leftNodeNum > 0 )
  650. {
  651. - PanicIf ( siblingNode->buffer != nil, "InsertNode: siblingNode already aquired!");
  652. + PanicIf(siblingNode->buffer != NULL, "InsertNode: siblingNode already aquired!");
  653. - if ( siblingNode->buffer == nil )
  654. + if (siblingNode->buffer == NULL)
  655. {
  656. err = GetNode (btreePtr, leftNodeNum, siblingNode); // will be released by caller or a split below
  657. M_ExitOnError (err);
  658. @@ -703,7 +703,7 @@ OSStatus DeleteTree (BTreeControlBlockPtr btreePtr,
  659. targetNodeNum = treePathTable[level].node;
  660. targetNodePtr = targetNode->buffer;
  661. - PanicIf (targetNodePtr == nil, "DeleteTree: targetNode has nil buffer!");
  662. + PanicIf (targetNodePtr == NULL, "DeleteTree: targetNode has NULL buffer!");
  663. DeleteRecord (btreePtr, targetNodePtr, index);
  664. @@ -766,7 +766,7 @@ OSStatus DeleteTree (BTreeControlBlockPtr btreePtr,
  665. deleteRequired = false;
  666. updateRequired = false;
  667. - if ( targetNode->buffer == nil ) // then root was freed and the btree is empty
  668. + if (targetNode->buffer == NULL) // then root was freed and the btree is empty
  669. {
  670. btreePtr->rootNode = 0;
  671. btreePtr->treeDepth = 0;
  672. @@ -1124,7 +1124,7 @@ static OSStatus SplitLeft (BTreeControlBlockPtr btreePtr,
  673. if ( (right->height == 1) && (right->kind != kBTLeafNode) )
  674. return fsBTInvalidNodeErr;
  675. - if ( left != nil )
  676. + if (left != NULL)
  677. {
  678. if ( left->fLink != rightNodeNum )
  679. return fsBTInvalidNodeErr; //¥¥ E_BadSibling ?
  680. @@ -1145,7 +1145,7 @@ static OSStatus SplitLeft (BTreeControlBlockPtr btreePtr,
  681. /////////////// Update Forward Link In Original Left Node ///////////////////
  682. - if ( left != nil )
  683. + if (left != NULL)
  684. {
  685. left->fLink = newNodeNum;
  686. err = UpdateNode (btreePtr, leftNode);
  687. @@ -1240,8 +1240,8 @@ static OSStatus AddNewRootNode (BTreeControlBlockPtr btreePtr,
  688. Boolean didItFit;
  689. UInt16 keyLength;
  690. - PanicIf (leftNode == nil, "AddNewRootNode: leftNode == nil");
  691. - PanicIf (rightNode == nil, "AddNewRootNode: rightNode == nil");
  692. + PanicIf (leftNode == NULL, "AddNewRootNode: leftNode == NULL");
  693. + PanicIf (rightNode == NULL, "AddNewRootNode: rightNode == NULL");
  694. /////////////////////// Initialize New Root Node ////////////////////////////
  695. @@ -1362,7 +1362,7 @@ static OSStatus SplitRight (BTreeControlBlockPtr btreePtr,
  696. if ( (leftPtr->height == 1) && (leftPtr->kind != kBTLeafNode) )
  697. return fsBTInvalidNodeErr;
  698. - if ( rightPtr != nil )
  699. + if (rightPtr != NULL)
  700. {
  701. if ( rightPtr->bLink != nodeNum )
  702. return fsBTInvalidNodeErr; //¥¥ E_BadSibling ?
  703. @@ -1382,7 +1382,7 @@ static OSStatus SplitRight (BTreeControlBlockPtr btreePtr,
  704. /////////////// Update backward Link In Original Right Node ///////////////////
  705. - if ( rightPtr != nil )
  706. + if (rightPtr != NULL)
  707. {
  708. rightPtr->bLink = newNodeNum;
  709. err = UpdateNode (btreePtr, rightNodePtr);
  710. @@ -1739,7 +1739,7 @@ static int DoKeyCheck( NodeDescPtr nodeP, BTreeControlBlock *btcb )
  711. UInt16 keyLength;
  712. KeyPtr keyPtr;
  713. UInt8 *dataPtr;
  714. - KeyPtr prevkeyP = nil;
  715. + KeyPtr prevkeyP = NULL;
  716. if ( nodeP->numRecords == 0 )
  717. @@ -1766,7 +1766,7 @@ static int DoKeyCheck( NodeDescPtr nodeP, BTreeControlBlock *btcb )
  718. return( -1 );
  719. }
  720. - if ( prevkeyP != nil )
  721. + if (prevkeyP != NULL)
  722. {
  723. if ( CompareKeys( (BTreeControlBlockPtr)btcb, prevkeyP, keyPtr ) >= 0 )
  724. {
  725. diff --git a/fsck_hfs.tproj/dfalib/SControl.c b/fsck_hfs.tproj/dfalib/SControl.c
  726. index 8b03ece..d3145e0 100644
  727. --- a/fsck_hfs.tproj/dfalib/SControl.c
  728. +++ b/fsck_hfs.tproj/dfalib/SControl.c
  729. @@ -82,7 +82,7 @@ CheckHFS( int fsReadRef, int fsWriteRef, int checkLevel, int repairLevel,
  730. {
  731. SGlob dataArea; // Allocate the scav globals
  732. short temp;
  733. - FileIdentifierTable *fileIdentifierTable = nil;
  734. + FileIdentifierTable *fileIdentifierTable = NULL;
  735. OSErr err = noErr;
  736. OSErr scavError = 0;
  737. int scanCount = 0;
  738. @@ -228,7 +228,7 @@ DoAgain:
  739. }
  740. // Set up structures for post processing
  741. - if ( (autoRepair == true) && (dataArea.fileIdentifierTable != nil) )
  742. + if ((autoRepair == true) && (dataArea.fileIdentifierTable != NULL))
  743. {
  744. // *repairInfo = *repairInfo | kVolumeHadOverlappingExtents; // Report back that volume has overlapping extents
  745. fileIdentifierTable = (FileIdentifierTable *) AllocateMemory( GetHandleSize( (Handle) dataArea.fileIdentifierTable ) );
  746. @@ -239,7 +239,7 @@ DoAgain:
  747. //
  748. // Post processing
  749. //
  750. - if ( fileIdentifierTable != nil )
  751. + if (fileIdentifierTable != NULL)
  752. {
  753. DisposeMemory( fileIdentifierTable );
  754. }
  755. @@ -682,7 +682,7 @@ short CheckForStop( SGlob *GPtr )
  756. //if ( ((ticks - 10) > GPtr->lastTickCount) || (dfaStage == kAboutToRepairStage) ) // To reduce cursor flicker on fast machines, call through on a timed interval
  757. //{
  758. - if ( GPtr->userCancelProc != nil )
  759. + if (GPtr->userCancelProc != NULL)
  760. {
  761. UInt64 progress = 0;
  762. Boolean progressChanged;
  763. @@ -761,7 +761,7 @@ static int ScavSetUp( SGlob *GPtr)
  764. short ioRefNum;
  765. #endif
  766. - GPtr->MinorRepairsP = nil;
  767. + GPtr->MinorRepairsP = NULL;
  768. GPtr->itemsProcessed = 0;
  769. GPtr->lastProgress = 0;
  770. @@ -774,7 +774,7 @@ static int ScavSetUp( SGlob *GPtr)
  771. ScavStaticStructures *pointer;
  772. pointer = (ScavStaticStructures *) AllocateClearMemory( sizeof(ScavStaticStructures) );
  773. - if ( pointer == nil ) {
  774. + if (pointer == NULL) {
  775. if ( GPtr->logLevel >= kDebugLog ) {
  776. printf( "\t error %d - could not allocate %i bytes of memory \n",
  777. R_NoMem, sizeof(ScavStaticStructures) );
  778. @@ -831,7 +831,7 @@ static int ScavSetUp( SGlob *GPtr)
  779. // Save current value of vcbWrCnt, to detect modifications to volume by other apps etc
  780. if ( GPtr->volumeFeatures & volumeIsMountedMask )
  781. {
  782. - FlushVol( nil, GPtr->realVCB->vcbVRefNum ); // Ask HFS to update all changes to disk
  783. + FlushVol(NULL, GPtr->realVCB->vcbVRefNum); // Ask HFS to update all changes to disk
  784. GPtr->wrCnt = GPtr->realVCB->vcbWrCnt; // Remember write count after writing changes
  785. }
  786. #endif
  787. @@ -949,7 +949,7 @@ static int ScavSetUp( SGlob *GPtr)
  788. // Keep a valid file id list for HFS volumes
  789. GPtr->validFilesList = (UInt32**)NewHandle( 0 );
  790. - if ( GPtr->validFilesList == nil ) {
  791. + if (GPtr->validFilesList == NULL) {
  792. if ( GPtr->logLevel >= kDebugLog ) {
  793. printf( "\t error %d - could not allocate file ID list \n", R_NoMem );
  794. }
  795. @@ -995,17 +995,17 @@ static int ScavTerm( SGlobPtr GPtr )
  796. (void) BitMapCheckEnd();
  797. - while( (rP = GPtr->MinorRepairsP) != nil ) // loop freeing leftover (undone) repair orders
  798. + while((rP = GPtr->MinorRepairsP) != NULL) // loop freeing leftover (undone) repair orders
  799. {
  800. GPtr->MinorRepairsP = rP->link; // (in case repairs were not made)
  801. DisposeMemory(rP);
  802. err = MemError();
  803. }
  804. - if( GPtr->validFilesList != nil )
  805. + if (GPtr->validFilesList != NULL)
  806. DisposeHandle( (Handle) GPtr->validFilesList );
  807. - if( GPtr->overlappedExtents != nil ) {
  808. + if (GPtr->overlappedExtents != NULL) {
  809. extentsTableH = GPtr->overlappedExtents;
  810. /* Overlapped extents list also allocated memory for attribute name */
  811. @@ -1021,44 +1021,44 @@ static int ScavTerm( SGlobPtr GPtr )
  812. DisposeHandle( (Handle) GPtr->overlappedExtents );
  813. }
  814. - if( GPtr->fileIdentifierTable != nil )
  815. + if (GPtr->fileIdentifierTable != NULL)
  816. DisposeHandle( (Handle) GPtr->fileIdentifierTable );
  817. - if( GPtr->calculatedVCB == nil ) // already freed?
  818. + if (GPtr->calculatedVCB == NULL) // already freed?
  819. return( noErr );
  820. // If the FCB's and BTCB's have been set up, dispose of them
  821. fcbP = GPtr->calculatedExtentsFCB; // release extent file BTree bit map
  822. - if ( fcbP != nil )
  823. + if (fcbP != NULL)
  824. {
  825. btcbP = (BTreeControlBlock*)fcbP->fcbBtree;
  826. - if ( btcbP != nil)
  827. + if (btcbP != NULL)
  828. {
  829. - if( btcbP->refCon != nil )
  830. + if (btcbP->refCon != NULL)
  831. {
  832. - if(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != nil)
  833. + if (((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != NULL)
  834. {
  835. DisposeMemory(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr);
  836. err = MemError();
  837. }
  838. DisposeMemory( (Ptr)btcbP->refCon );
  839. err = MemError();
  840. - btcbP->refCon = nil;
  841. + btcbP->refCon = NULL;
  842. }
  843. fcbP = GPtr->calculatedCatalogFCB; // release catalog BTree bit map
  844. btcbP = (BTreeControlBlock*)fcbP->fcbBtree;
  845. - if( btcbP->refCon != nil )
  846. + if (btcbP->refCon != NULL)
  847. {
  848. - if(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != nil)
  849. + if (((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr != NULL)
  850. {
  851. DisposeMemory(((BTreeExtensionsRec*)btcbP->refCon)->BTCBMPtr);
  852. err = MemError();
  853. }
  854. DisposeMemory( (Ptr)btcbP->refCon );
  855. err = MemError();
  856. - btcbP->refCon = nil;
  857. + btcbP->refCon = NULL;
  858. }
  859. }
  860. }
  861. @@ -1066,7 +1066,7 @@ static int ScavTerm( SGlobPtr GPtr )
  862. DisposeMemory( GPtr->calculatedVCB ); // Release our block of data structures
  863. err = MemError();
  864. - GPtr->calculatedVCB = nil;
  865. + GPtr->calculatedVCB = NULL;
  866. return( noErr );
  867. }
  868. @@ -1113,7 +1113,7 @@ Boolean IsBlueBoxSharedDrive ( DrvQElPtr dqPtr )
  869. // Now look at the name of the Driver name. If it is .BlueBoxShared keep it out of the list of available disks.
  870. driverDCtlHandle = GetDCtlEntry(dqPtr->dQRefNum);
  871. driverDCtlPtr = *driverDCtlHandle;
  872. - if((((driverDCtlPtr->dCtlFlags) & Is_Native_Mask) == 0) && (driverDCtlPtr->dCtlDriver != nil))
  873. + if((((driverDCtlPtr->dCtlFlags) & Is_Native_Mask) == 0) && (driverDCtlPtr->dCtlDriver != NULL))
  874. {
  875. if (((driverDCtlPtr->dCtlFlags) & Is_Ram_Based_Mask) == 0)
  876. {
  877. @@ -1127,19 +1127,19 @@ Boolean IsBlueBoxSharedDrive ( DrvQElPtr dqPtr )
  878. }
  879. driverName = (StringPtr)&(drvrHeaderPtr->drvrName);
  880. - if (!(IdenticalString(driverName,blueBoxSharedDriverName,nil)))
  881. + if (!(IdenticalString(driverName,blueBoxSharedDriverName,NULL)))
  882. {
  883. return( true );
  884. }
  885. // Special case for the ".Sony" floppy driver which might be accessed in Shared mode inside the Blue Box
  886. // Test its "where" string instead of the driver name.
  887. - if (!(IdenticalString(driverName,sonyDriverName,nil)))
  888. + if (!(IdenticalString(driverName,sonyDriverName,NULL)))
  889. {
  890. CntrlParam paramBlock;
  891. - paramBlock.ioCompletion = nil;
  892. - paramBlock.ioNamePtr = nil;
  893. + paramBlock.ioCompletion = NULL;
  894. + paramBlock.ioNamePtr = NULL;
  895. paramBlock.ioVRefNum = dqPtr->dQDrive;
  896. paramBlock.ioCRefNum = dqPtr->dQRefNum;
  897. paramBlock.csCode = kDriveIcon; // return physical icon
  898. @@ -1152,7 +1152,7 @@ Boolean IsBlueBoxSharedDrive ( DrvQElPtr dqPtr )
  899. iconAndStringRecPtr = * (IconAndStringRecPtr*) & paramBlock.csParam;
  900. whereStringPtr = (StringPtr) & iconAndStringRecPtr->string;
  901. - if (!(IdenticalString(whereStringPtr,blueBoxFloppyWhereString,nil)))
  902. + if (!(IdenticalString(whereStringPtr,blueBoxFloppyWhereString,NULL)))
  903. {
  904. return( true );
  905. }
  906. diff --git a/fsck_hfs.tproj/dfalib/SRepair.c b/fsck_hfs.tproj/dfalib/SRepair.c
  907. index 89c12d6..b261c37 100644
  908. --- a/fsck_hfs.tproj/dfalib/SRepair.c
  909. +++ b/fsck_hfs.tproj/dfalib/SRepair.c
  910. @@ -844,7 +844,7 @@ static int DelFThd( SGlobPtr GPtr, UInt32 fid ) // the file ID
  911. isHFSPlus = VolumeObjectIsHFSPlus( );
  912. - BuildCatalogKey( fid, (const CatalogName*) nil, isHFSPlus, &key );
  913. + BuildCatalogKey(fid, NULL, isHFSPlus, &key);
  914. result = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, &foundKey, &record, &recSize, &hint );
  915. if ( result ) return ( IntError( GPtr, result ) );
  916. @@ -910,7 +910,7 @@ static OSErr FixDirThread( SGlobPtr GPtr, UInt32 did ) // the dir ID
  917. isHFSPlus = VolumeObjectIsHFSPlus( );
  918. - BuildCatalogKey( did, (const CatalogName*) nil, isHFSPlus, &key );
  919. + BuildCatalogKey(did, NULL, isHFSPlus, &key);
  920. result = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, &foundKey, &record, &recSize, &hint );
  921. if ( result )
  922. @@ -2171,7 +2171,7 @@ static OSErr FixOrphanedFiles ( SGlobPtr GPtr )
  923. }
  924. //-- Build the key for the file thread
  925. - BuildCatalogKey( cNodeID, nil, isHFSPlus, &key );
  926. + BuildCatalogKey(cNodeID, NULL, isHFSPlus, &key);
  927. err = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint,
  928. &tempKey, &threadRecord, &recordSize, &hint2 );
  929. diff --git a/fsck_hfs.tproj/dfalib/SUtils.c b/fsck_hfs.tproj/dfalib/SUtils.c
  930. index 6e9253e..491afbf 100644
  931. --- a/fsck_hfs.tproj/dfalib/SUtils.c
  932. +++ b/fsck_hfs.tproj/dfalib/SUtils.c
  933. @@ -395,11 +395,11 @@ OSErr GetVolumeFeatures( SGlobPtr GPtr )
  934. err = GetVCBDriveNum( &GPtr->realVCB, GPtr->DrvNum );
  935. ReturnIfError( err );
  936. - if ( GPtr->realVCB != nil )
  937. + if (GPtr->realVCB != NULL)
  938. {
  939. GPtr->volumeFeatures |= volumeIsMountedMask;
  940. - pb.ioParam.ioNamePtr = nil;
  941. + pb.ioParam.ioNamePtr = NULL;
  942. pb.ioParam.ioVRefNum = GPtr->realVCB->vcbVRefNum;
  943. pb.ioParam.ioBuffer = (Ptr) &buffer;
  944. pb.ioParam.ioReqCount = sizeof( buffer );
  945. @@ -2282,7 +2282,7 @@ void print_prime_buckets(PrimeBuckets *cur);
  946. * 4. btreetye - can be kHFSPlusCatalogRecord or kHFSPlusAttributeRecord
  947. * indicates which btree prime number bucket should be incremented
  948. *
  949. - * Output: nil
  950. + * Output: NULL
  951. */
  952. void RecordXAttrBits(SGlobPtr GPtr, UInt16 flags, HFSCatalogNodeID fileid, UInt16 btreetype)
  953. {
  954. diff --git a/fsck_hfs.tproj/dfalib/SVerify1.c b/fsck_hfs.tproj/dfalib/SVerify1.c
  955. index 39bda5c..c33155f 100644
  956. --- a/fsck_hfs.tproj/dfalib/SVerify1.c
  957. +++ b/fsck_hfs.tproj/dfalib/SVerify1.c
  958. @@ -790,13 +790,13 @@ OSErr CreateExtentsBTreeControlBlock( SGlobPtr GPtr )
  959. // set up our DFA extended BTCB area. Will we have enough memory on all HFS+ volumes.
  960. //
  961. btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
  962. - if ( btcb->refCon == nil ) {
  963. + if (btcb->refCon == NULL) {
  964. err = R_NoMem;
  965. goto exit;
  966. }
  967. size = (btcb->totalNodes + 7) / 8; // size of BTree bit map
  968. ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr = AllocateClearMemory(size); // get precleared bitmap
  969. - if ( ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == nil )
  970. + if (((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == NULL)
  971. {
  972. err = R_NoMem;
  973. goto exit;
  974. @@ -1145,13 +1145,13 @@ OSErr CreateCatalogBTreeControlBlock( SGlobPtr GPtr )
  975. //
  976. btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
  977. - if ( btcb->refCon == nil ) {
  978. + if (btcb->refCon == NULL) {
  979. err = R_NoMem;
  980. goto exit;
  981. }
  982. size = (btcb->totalNodes + 7) / 8; // size of BTree bit map
  983. ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr = AllocateClearMemory(size); // get precleared bitmap
  984. - if ( ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == nil )
  985. + if (((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == NULL)
  986. {
  987. err = R_NoMem;
  988. goto exit;
  989. @@ -1339,7 +1339,7 @@ OSErr CatHChk( SGlobPtr GPtr )
  990. //¥¥ Can we ignore this part by just taking advantage of setting the selCode = 0x8001;
  991. {
  992. - BuildCatalogKey( 1, (const CatalogName *)nil, isHFSPlus, &key );
  993. + BuildCatalogKey(1, NULL, isHFSPlus, &key);
  994. result = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, &foundKey, &threadRecord, &recSize, &hint );
  995. GPtr->TarBlock = hint; /* set target block */
  996. @@ -1443,7 +1443,7 @@ OSErr CatHChk( SGlobPtr GPtr )
  997. /*
  998. * Find thread record
  999. */
  1000. - BuildCatalogKey( dprP->directoryID, (const CatalogName *) nil, isHFSPlus, &key );
  1001. + BuildCatalogKey(dprP->directoryID, NULL, isHFSPlus, &key);
  1002. result = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, &foundKey, &threadRecord, &recSize, &hint );
  1003. if ( result != noErr ) {
  1004. char idStr[16];
  1005. @@ -1780,26 +1780,26 @@ OSErr CreateAttributesBTreeControlBlock( SGlobPtr GPtr )
  1006. // set up our DFA extended BTCB area. Will we have enough memory on all HFS+ volumes.
  1007. //
  1008. btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
  1009. - if ( btcb->refCon == nil ) {
  1010. + if (btcb->refCon == NULL) {
  1011. err = R_NoMem;
  1012. goto exit;
  1013. }
  1014. if (btcb->totalNodes == 0)
  1015. {
  1016. - ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr = nil;
  1017. + ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr = NULL;
  1018. ((BTreeExtensionsRec*)btcb->refCon)->BTCBMSize = 0;
  1019. ((BTreeExtensionsRec*)btcb->refCon)->realFreeNodeCount = 0;
  1020. }
  1021. else
  1022. {
  1023. - if ( btcb->refCon == nil ) {
  1024. + if (btcb->refCon == NULL) {
  1025. err = R_NoMem;
  1026. goto exit;
  1027. }
  1028. size = (btcb->totalNodes + 7) / 8; // size of BTree bit map
  1029. ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr = AllocateClearMemory(size); // get precleared bitmap
  1030. - if ( ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == nil )
  1031. + if (((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr == NULL)
  1032. {
  1033. err = R_NoMem;
  1034. goto exit;
  1035. @@ -2358,7 +2358,7 @@ static OSErr RcdMDBEmbededVolDescriptionErr( SGlobPtr GPtr, OSErr type, HFSMaste
  1036. RcdError( GPtr, type ); // first, record the error
  1037. p = AllocMinorRepairOrder( GPtr, sizeof(EmbededVolDescription) ); // get the node
  1038. - if ( p == nil ) return( R_NoMem );
  1039. + if (p == NULL) return( R_NoMem );
  1040. p->type = type; // save error info
  1041. desc = (EmbededVolDescription *) &(p->name);
  1042. @@ -2397,7 +2397,7 @@ static OSErr RcdInvalidWrapperExtents( SGlobPtr GPtr, OSErr type )
  1043. RcdError( GPtr, type ); // first, record the error
  1044. p = AllocMinorRepairOrder( GPtr, 0 ); // get the node
  1045. - if ( p == nil ) return( R_NoMem );
  1046. + if (p == NULL) return( R_NoMem );
  1047. p->type = type; // save error info
  1048. @@ -3029,7 +3029,7 @@ OSErr CheckFileExtents( SGlobPtr GPtr, UInt32 fileNumber, UInt8 forkType,
  1049. foundBadExtent = false;
  1050. lastExtentIndex = GPtr->numExtents;
  1051. - while ( (extents != nil) && (err == noErr) )
  1052. + while ((extents != NULL) && (err == noErr))
  1053. {
  1054. // checkout the extent record first
  1055. err = ChkExtRec( GPtr, extents, &lastExtentIndex );
  1056. @@ -3105,7 +3105,7 @@ OSErr CheckFileExtents( SGlobPtr GPtr, UInt32 fileNumber, UInt8 forkType,
  1057. if ( err == btNotFound )
  1058. {
  1059. err = noErr; // no more extent records
  1060. - extents = nil;
  1061. + extents = NULL;
  1062. break;
  1063. }
  1064. else if ( err != noErr )
  1065. @@ -3121,7 +3121,7 @@ OSErr CheckFileExtents( SGlobPtr GPtr, UInt32 fileNumber, UInt8 forkType,
  1066. if ( err == btNotFound )
  1067. {
  1068. err = noErr; // no more extent records
  1069. - extents = nil;
  1070. + extents = NULL;
  1071. break;
  1072. }
  1073. else if ( err != noErr )
  1074. @@ -3205,7 +3205,7 @@ static OSErr AddExtentToOverlapList( SGlobPtr GPtr, HFSCatalogNodeID fileNumber,
  1075. }
  1076. // If it's uninitialized
  1077. - if ( GPtr->overlappedExtents == nil )
  1078. + if (GPtr->overlappedExtents == NULL)
  1079. {
  1080. GPtr->overlappedExtents = (ExtentsTable **) NewHandleClear( sizeof(ExtentsTable) );
  1081. extentsTableH = GPtr->overlappedExtents;
  1082. diff --git a/fsck_hfs.tproj/dfalib/SVerify2.c b/fsck_hfs.tproj/dfalib/SVerify2.c
  1083. index c68f3d8..da1a982 100644
  1084. --- a/fsck_hfs.tproj/dfalib/SVerify2.c
  1085. +++ b/fsck_hfs.tproj/dfalib/SVerify2.c
  1086. @@ -1013,7 +1013,7 @@ static int BTKeyChk( SGlobPtr GPtr, NodeDescPtr nodeP, BTreeControlBlock *btcb )
  1087. UInt16 keyLength;
  1088. KeyPtr keyPtr;
  1089. UInt8 *dataPtr;
  1090. - KeyPtr prevkeyP = nil;
  1091. + KeyPtr prevkeyP = NULL;
  1092. if ( nodeP->numRecords == 0 )
  1093. @@ -1044,7 +1044,7 @@ static int BTKeyChk( SGlobPtr GPtr, NodeDescPtr nodeP, BTreeControlBlock *btcb )
  1094. return( E_KeyLen );
  1095. }
  1096. - if ( prevkeyP != nil )
  1097. + if (prevkeyP != NULL)
  1098. {
  1099. if ( CompareKeys( (BTreeControlBlockPtr)btcb, prevkeyP, keyPtr ) >= 0 )
  1100. {