Replace all le64 non-zero test conditions with "!le64_cmpz(...)".

edge.strict_endians
Erik Larsson 2016-01-28 08:28:41 +01:00
parent ed87a4dffa
commit 17a2c5f58e
7 changed files with 11 additions and 9 deletions

View File

@ -314,4 +314,6 @@
#define le32_cmpz(a) (!(a))
#define le64_cmpz(a) (!(a))
#endif /* defined _NTFS_ENDIANS_H */

View File

@ -1985,7 +1985,7 @@ static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk)
if (wipe)
nr_used_mft_records++;
if (ni->mrec->base_mft_record)
if (!le64_cmpz(ni->mrec->base_mft_record))
goto out;
walk->image->ni = ni;

View File

@ -363,7 +363,7 @@ static int inode_open(ntfs_volume *vol, MFT_REF mref, ntfs_inode **ni)
return NTFSCMP_INODE_OPEN_ERROR;
}
if ((*ni)->mrec->base_mft_record) {
if (!le64_cmpz((*ni)->mrec->base_mft_record)) {
if (inode_close(*ni) != 0)
return NTFSCMP_INODE_CLOSE_ERROR;

View File

@ -2221,7 +2221,7 @@ static void ntfs_dump_inode_general_info(ntfs_inode *inode)
(unsigned)le32_to_cpu(mrec->bytes_allocated),
(unsigned)le32_to_cpu(mrec->bytes_allocated));
if (mrec->base_mft_record) {
if (!le64_cmpz(mrec->base_mft_record)) {
printf("Base MFT Record:\t %llu (0x%llx)\n",
(unsigned long long)
MREF_LE(mrec->base_mft_record),

View File

@ -1083,7 +1083,7 @@ static int build_allocation_bitmap(ntfs_volume *vol, ntfsck_t *fsck)
return -1;
}
if (ni->mrec->base_mft_record)
if (!le64_cmpz(ni->mrec->base_mft_record))
goto close_inode;
fsck->ni = ni;
@ -1157,7 +1157,7 @@ static void set_resize_constraints(ntfs_resize_t *resize)
(long long)inode);
}
if (ni->mrec->base_mft_record)
if (!le64_cmpz(ni->mrec->base_mft_record))
goto close_inode;
resize->ni = ni;
@ -1404,7 +1404,7 @@ static void replace_later(ntfs_resize_t *resize, runlist *rl, runlist *head_rl)
delayed = (struct DELAYED*)ntfs_malloc(sizeof(struct DELAYED));
if (delayed && (attr_name || !name_len)) {
lemref = resize->ctx->mrec->base_mft_record;
if (lemref)
if (!le64_cmpz(lemref))
mref = le64_to_cpu(lemref);
else
mref = resize->mref;

View File

@ -885,7 +885,7 @@ static s64 wipe_tails(ntfs_volume *vol, int byte, enum action act)
continue;
}
if (ni->mrec->base_mft_record) {
if (!le64_cmpz(ni->mrec->base_mft_record)) {
ntfs_log_verbose("Not base mft record. Skipping\n");
goto close_inode;
}
@ -1247,7 +1247,7 @@ static s64 wipe_directory(ntfs_volume *vol, int byte, enum action act)
continue;
}
if (ni->mrec->base_mft_record) {
if (!le64_cmpz(ni->mrec->base_mft_record)) {
if (opts.verbose > 2)
ntfs_log_verbose("Not base mft record. Skipping\n");
else

View File

@ -867,7 +867,7 @@ int utils_is_metadata(ntfs_inode *inode)
return 1;
file = inode->mrec;
if (file && (file->base_mft_record != 0)) {
if (file && !le64_cmpz(file->base_mft_record)) {
num = MREF_LE(file->base_mft_record);
if (__metadata(vol, num) == 1)
return 1;