+ } else if (fileID == kHFSAttributesFileID) {
+ HFSPlusAttrKey *srcKey;
+ HFSPlusAttrRecord *srcRec;
+
+ for (i = 0; i < srcDesc->numRecords; i++) {
+ srcKey = (HFSPlusAttrKey *)((char *)src->buffer + srcOffs[i]);
+
+ if (!unswap) srcKey->keyLength = SWAP_BE16(srcKey->keyLength);
+ srcRec = (HFSPlusAttrRecord *)((char *)srcKey + srcKey->keyLength + 2);
+ if (unswap) srcKey->keyLength = SWAP_BE16(srcKey->keyLength);
+
+ srcKey->fileID = SWAP_BE32(srcKey->fileID);
+ srcKey->startBlock = SWAP_BE32(srcKey->startBlock);
+
+ if (!unswap) srcKey->attrNameLen = SWAP_BE16(srcKey->attrNameLen);
+ for (j = 0; j < srcKey->attrNameLen; j++)
+ srcKey->attrName[j] = SWAP_BE16(srcKey->attrName[j]);
+ if (unswap) srcKey->attrNameLen = SWAP_BE16(srcKey->attrNameLen);
+
+ /* If this is an index node, just swap the child node number */
+ if (srcDesc->kind == kBTIndexNode) {
+ *((UInt32 *)srcRec) = SWAP_BE32 (*((UInt32 *)srcRec));
+ continue;
+ }
+
+ /* Swap the data record */
+ if (!unswap) srcRec->recordType = SWAP_BE32(srcRec->recordType);
+ switch (srcRec->recordType) {
+ case kHFSPlusAttrInlineData:
+ /* We're not swapping the reserved fields */
+ srcRec->attrData.attrSize = SWAP_BE32(srcRec->attrData.attrSize);
+ /* Not swapping the attrData */
+ break;
+ case kHFSPlusAttrForkData:
+ /* We're not swapping the reserved field */
+ hfs_swap_HFSPlusForkData(&srcRec->forkData.theFork);
+ break;
+ case kHFSPlusAttrExtents:
+ /* We're not swapping the reserved field */
+ for (j = 0; j < kHFSPlusExtentDensity; j++) {
+ srcRec->overflowExtents.extents[j].startBlock =
+ SWAP_BE32(srcRec->overflowExtents.extents[j].startBlock);
+ srcRec->overflowExtents.extents[j].blockCount =
+ SWAP_BE32(srcRec->overflowExtents.extents[j].blockCount);
+ }
+ break;
+ }
+ if (unswap) srcRec->recordType = SWAP_BE32(srcRec->recordType);
+ }
+ } 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));
+ }