X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/43866e378188c25dd1e2208016ab3cbeb086ae6c..55e303ae13a4cf49d70f2294092726f2fffb9ef2:/bsd/hfs/hfs_endian.c diff --git a/bsd/hfs/hfs_endian.c b/bsd/hfs/hfs_endian.c index 47bb66a7f..c46c2295b 100644 --- a/bsd/hfs/hfs_endian.c +++ b/bsd/hfs/hfs_endian.c @@ -358,10 +358,32 @@ hfs_swap_HFSPlusBTInternalNode ( if (unswap) srcPtr[0] = SWAP_BE16 (srcPtr[0]); } + } else if (fileID > kHFSFirstUserCatalogNodeID) { + HotFileKey *srcKey; + UInt32 *srcRec; + + for (i = 0; i < srcDesc->numRecords; i++) { + srcKey = (HotFileKey *)((char *)src->buffer + srcOffs[i]); + + if (!unswap) + srcKey->keyLength = SWAP_BE16 (srcKey->keyLength); + srcRec = (u_int32_t *)((char *)srcKey + srcKey->keyLength + 2); + if (unswap) + srcKey->keyLength = SWAP_BE16 (srcKey->keyLength); + + /* Don't swap srcKey->forkType */ + /* Don't swap srcKey->pad */ + + srcKey->temperature = SWAP_BE32 (srcKey->temperature); + srcKey->fileID = SWAP_BE32 (srcKey->fileID); + + *((UInt32 *)srcRec) = SWAP_BE32 (*((UInt32 *)srcRec)); + } } else { panic ("%s unrecognized B-Tree type", "hfs_swap_BTNode:"); } + return (0); }