Fixed endianness bugs in ntfscluster

ntfscluster was not suitable for big-endian CPUs
edge.strict_endians
Jean-Pierre André 2014-03-11 10:43:31 +01:00
parent 15f300412a
commit 977abdefa2
3 changed files with 7 additions and 4 deletions

View File

@ -68,7 +68,8 @@ int cluster_find(ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void
while ((rec = find_attribute(AT_UNUSED, a_ctx))) {
if (!rec->non_resident) {
ntfs_log_verbose("0x%02x skipped - attr is resident\n", a_ctx->attr->type);
ntfs_log_verbose("0x%02x skipped - attr is resident\n",
(int)le32_to_cpu(a_ctx->attr->type));
continue;
}
@ -78,7 +79,8 @@ int cluster_find(ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void
goto done;
}
ntfs_log_verbose("\t[0x%02X]\n", a_ctx->attr->type);
ntfs_log_verbose("\t[0x%02X]\n",
(int)le32_to_cpu(a_ctx->attr->type));
ntfs_log_verbose("\t\tVCN\tLCN\tLength\n");
for (j = 0; runs[j].length > 0; j++) {

View File

@ -397,7 +397,7 @@ static int dump_file(ntfs_volume *vol, ntfs_inode *ino)
ctx = ntfs_attr_get_search_ctx(ino, NULL);
while ((rec = find_attribute(AT_UNUSED, ctx))) {
ntfs_log_info(" 0x%02x - ", rec->type);
ntfs_log_info(" 0x%02x - ", (int)le32_to_cpu(rec->type));
if (rec->non_resident) {
ntfs_log_info("non-resident\n");
runs = ntfs_mapping_pairs_decompress(vol, rec, NULL);

View File

@ -676,7 +676,8 @@ int utils_attr_get_name(ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int b
name = NULL;
namelen = attr->name_length;
if (ntfs_ucstombs((ntfschar *)((char *)attr + attr->name_offset),
if (ntfs_ucstombs((ntfschar *)((char *)attr
+ le16_to_cpu(attr->name_offset)),
namelen, &name, 0) < 0) {
ntfs_log_error("Couldn't translate attribute name to current "
"locale.\n");