diff --git a/libntfs-3g/attrib.c b/libntfs-3g/attrib.c index 44f3e367..c209c08a 100644 --- a/libntfs-3g/attrib.c +++ b/libntfs-3g/attrib.c @@ -187,7 +187,7 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, /* Attribute is not resident. */ /* If no data, return 0. */ - if (!(a->data_size)) { + if (sle64_cmpz(a->data_size)) { errno = 0; return 0; } @@ -455,7 +455,7 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, a->flags = 0; if (le32_eq(type, AT_DATA) - && (a->non_resident ? !a->initialized_size : le32_cmpz(a->value_length))) { + && (a->non_resident ? sle64_cmpz(a->initialized_size) : le32_cmpz(a->value_length))) { /* * Define/redefine the compression state if stream is * empty, based on the compression mark on parent @@ -655,7 +655,7 @@ static int ntfs_attr_map_partial_runlist(ntfs_attr *na, VCN vcn) done = TRUE; } needed = highest_vcn + 1; - if (!a->lowest_vcn) + if (sle64_cmpz(a->lowest_vcn)) startseen = TRUE; } } else { @@ -5654,7 +5654,7 @@ retry: CASE_SENSITIVE, from_vcn, NULL, 0, ctx)) { a = ctx->attr; m = ctx->mrec; - if (!a->lowest_vcn) + if (sle64_cmpz(a->lowest_vcn)) first_updated = TRUE; /* * If runlist is updating not from the beginning, then set diff --git a/libntfs-3g/runlist.c b/libntfs-3g/runlist.c index 7e158d44..a55b6aac 100644 --- a/libntfs-3g/runlist.c +++ b/libntfs-3g/runlist.c @@ -940,7 +940,7 @@ mpa_err: goto err_out; } /* Setup not mapped runlist element if this is the base extent. */ - if (!attr->lowest_vcn) { + if (sle64_cmpz(attr->lowest_vcn)) { VCN max_cluster; max_cluster = ((sle64_to_cpu(attr->allocated_size) + diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index f6dd8c73..dfbccddb 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1739,7 +1739,7 @@ static void walk_runs(struct ntfs_walk_cluster *walk) * because its logical blocks may be larger than * a cluster and split over two extents. */ - if (mft_data && !a->lowest_vcn) { + if (mft_data && sle64_cmpz(a->lowest_vcn)) { na = ntfs_attr_open(walk->image->ni, AT_DATA, NULL, 0); if (na) { @@ -1755,7 +1755,7 @@ static void walk_runs(struct ntfs_walk_cluster *walk) perr_exit("Failed to open data of inode %lld", (long long)walk->image->ni->mft_no); } - if (index_i30 && !a->lowest_vcn) { + if (index_i30 && sle64_cmpz(a->lowest_vcn)) { na = ntfs_attr_open(walk->image->ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4); if (na) { diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index bc58b0ab..08d9e885 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1346,7 +1346,7 @@ static void ntfs_dump_attribute_header(ntfs_attr_search_ctx *ctx, (unsigned)a->compression_unit); /* TODO: dump the 5 reserved bytes here in verbose mode */ - if (!a->lowest_vcn) { + if (sle64_cmpz(a->lowest_vcn)) { printf("\tData size:\t\t %llu (0x%llx)\n", (long long)sle64_to_cpu(a->data_size), (unsigned long long)sle64_to_cpu(a->data_size)); diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 59836941..1db11ca2 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -900,7 +900,7 @@ static s64 wipe_tails(ntfs_volume *vol, int byte, enum action act) NULL, 0, ctx)) { a = ctx->attr; - if (!ctx->al_entry || !ctx->al_entry->lowest_vcn) { + if (!ctx->al_entry || sle64_cmpz(ctx->al_entry->lowest_vcn)) { name = (ntfschar*)((u8*)a + le16_to_cpu(a->name_offset)); attr_wiped = wipe_attr_tail(ni, name,