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