From 87d87073c78c5ec5df473f1cca5bf124060d3472 Mon Sep 17 00:00:00 2001 From: uvman Date: Sat, 28 Oct 2006 23:45:22 +0000 Subject: [PATCH] The periodic 'int is not neccessarily 32bit' fixes. --- include/ntfs/logging.h | 34 +++++++++++++++++----------------- libntfs/index.c | 7 ++++--- ntfsprogs/mkntfs.c | 16 ++++++++++------ ntfsprogs/ntfsinfo.c | 11 ++++++----- 4 files changed, 37 insertions(+), 31 deletions(-) diff --git a/include/ntfs/logging.h b/include/ntfs/logging.h index 0a66dbb3..982f90f2 100644 --- a/include/ntfs/logging.h +++ b/include/ntfs/logging.h @@ -65,25 +65,25 @@ int ntfs_log_redirect(const char *function, const char *file, int line, __attribute__((format(printf, 6, 7))); /* Logging levels - Determine what gets logged */ -#define NTFS_LOG_LEVEL_DEBUG (1 << 0) /* x = 42 */ -#define NTFS_LOG_LEVEL_TRACE (1 << 1) /* Entering function x() */ -#define NTFS_LOG_LEVEL_QUIET (1 << 2) /* Quietable output */ -#define NTFS_LOG_LEVEL_INFO (1 << 3) /* Volume needs defragmenting */ -#define NTFS_LOG_LEVEL_VERBOSE (1 << 4) /* Forced to continue */ -#define NTFS_LOG_LEVEL_PROGRESS (1 << 5) /* 54% complete */ -#define NTFS_LOG_LEVEL_WARNING (1 << 6) /* You should backup before starting */ -#define NTFS_LOG_LEVEL_ERROR (1 << 7) /* Operation failed, no damage done */ -#define NTFS_LOG_LEVEL_PERROR (1 << 8) /* Message : standard error description */ -#define NTFS_LOG_LEVEL_CRITICAL (1 << 9) /* Operation failed,damage may have occurred */ -#define NTFS_LOG_LEVEL_REASON (1 << 10) /* Human readable reason for failure */ +#define NTFS_LOG_LEVEL_DEBUG ((u32)1 << 0) /* x = 42 */ +#define NTFS_LOG_LEVEL_TRACE ((u32)1 << 1) /* Entering function x() */ +#define NTFS_LOG_LEVEL_QUIET ((u32)1 << 2) /* Quietable output */ +#define NTFS_LOG_LEVEL_INFO ((u32)1 << 3) /* Volume needs defragmenting */ +#define NTFS_LOG_LEVEL_VERBOSE ((u32)1 << 4) /* Forced to continue */ +#define NTFS_LOG_LEVEL_PROGRESS ((u32)1 << 5) /* 54% complete */ +#define NTFS_LOG_LEVEL_WARNING ((u32)1 << 6) /* You should backup before starting */ +#define NTFS_LOG_LEVEL_ERROR ((u32)1 << 7) /* Operation failed, no damage done */ +#define NTFS_LOG_LEVEL_PERROR ((u32)1 << 8) /* Message : standard error description */ +#define NTFS_LOG_LEVEL_CRITICAL ((u32)1 << 9) /* Operation failed,damage may have occurred */ +#define NTFS_LOG_LEVEL_REASON ((u32)1 << 10) /* Human readable reason for failure */ /* Logging style flags - Manage the style of the output */ -#define NTFS_LOG_FLAG_PREFIX (1 << 0) /* Prefix messages with "ERROR: ", etc */ -#define NTFS_LOG_FLAG_FILENAME (1 << 1) /* Show the file origin of the message */ -#define NTFS_LOG_FLAG_LINE (1 << 2) /* Show the line number of the message */ -#define NTFS_LOG_FLAG_FUNCTION (1 << 3) /* Show the function name containing the message */ -#define NTFS_LOG_FLAG_ONLYNAME (1 << 4) /* Only display the filename, not the pathname */ -#define NTFS_LOG_FLAG_COLOUR (1 << 5) /* Colour highlight some messages */ +#define NTFS_LOG_FLAG_PREFIX ((u32)1 << 0) /* Prefix messages with "ERROR: ", etc */ +#define NTFS_LOG_FLAG_FILENAME ((u32)1 << 1) /* Show the file origin of the message */ +#define NTFS_LOG_FLAG_LINE ((u32)1 << 2) /* Show the line number of the message */ +#define NTFS_LOG_FLAG_FUNCTION ((u32)1 << 3) /* Show the function name containing the message */ +#define NTFS_LOG_FLAG_ONLYNAME ((u32)1 << 4) /* Only display the filename, not the pathname */ +#define NTFS_LOG_FLAG_COLOUR ((u32)1 << 5) /* Colour highlight some messages */ /* Macros to simplify logging. One for each level defined above. * Note, if NTFS_DISABLE_DEBUG_LOGGING is defined, then ntfs_log_debug/trace have no effect. diff --git a/libntfs/index.c b/libntfs/index.c index 4dd1cd97..8b301f31 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -398,7 +398,8 @@ static int ntfs_ia_check(ntfs_index_context *icx, INDEX_BLOCK *ib, VCN vcn) ntfs_log_error("Corrupt index block : VCN (%lld) of inode %llu " "has a size (%u) differing from the index " "specified size (%u)\n", (long long)vcn, - icx->ni->mft_no, ib_size, icx->block_size); + icx->ni->mft_no, (unsigned)ib_size, + (unsigned)icx->block_size); return -1; } return 0; @@ -656,8 +657,8 @@ int ntfs_index_lookup(const void *key, const int key_len, icx->block_size = le32_to_cpu(ir->index_block_size); if (icx->block_size < NTFS_BLOCK_SIZE) { errno = EINVAL; - ntfs_log_perror("Index block size (%d) is smaller than the " - "sector size (%d)", icx->block_size, + ntfs_log_perror("Index block size (%u) is smaller than the " + "sector size (%d)", (unsigned)icx->block_size, NTFS_BLOCK_SIZE); return -1; } diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 8212c27c..70904b2f 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -779,9 +779,12 @@ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) return; case AT_INDEX_ROOT: /* TODO */ - printf("collation_rule %u\n", le32_to_cpu(((INDEX_ROOT*)val)->collation_rule)); - printf("index.entries_offset %u\n", le32_to_cpu(((INDEX_ROOT*)val)->index.entries_offset)); - printf("index.index_length %u\n", le32_to_cpu(((INDEX_ROOT*)val)->index.index_length)); + printf("collation_rule %u\n", (unsigned)le32_to_cpu + (((INDEX_ROOT*)val)->collation_rule)); + printf("index.entries_offset %u\n", (unsigned)le32_to_cpu + (((INDEX_ROOT*)val)->index.entries_offset)); + printf("index.index_length %u\n", (unsigned)le32_to_cpu + (((INDEX_ROOT*)val)->index.index_length)); printf("%s\n", todo); return; case AT_INDEX_ALLOCATION: @@ -3615,8 +3618,8 @@ static BOOL mkntfs_override_vol_params(ntfs_volume *vol) return FALSE; } } - ntfs_log_quiet("Cluster size has been automatically set to %d " - "bytes.\n", vol->cluster_size); + ntfs_log_quiet("Cluster size has been automatically set to %u " + "bytes.\n", (unsigned)vol->cluster_size); } /* Validate cluster size. */ if (vol->cluster_size & (vol->cluster_size - 1)) { @@ -3723,7 +3726,8 @@ static BOOL mkntfs_override_vol_params(ntfs_volume *vol) ntfs_log_warning("Index record size (%u bytes) exceeds system " "page size (%li bytes). You will not be able " "to mount this volume using the NTFS kernel " - "driver.\n", vol->indx_record_size, page_size); + "driver.\n", (unsigned)vol->indx_record_size, + page_size); vol->indx_record_size_bits = ffs(vol->indx_record_size) - 1; ntfs_log_debug("index record size = %u bytes\n", (unsigned)vol->indx_record_size); diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 58fdc473..5e356694 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1106,7 +1106,8 @@ static void ntfs_dump_sds_entry(SECURITY_DESCRIPTOR_HEADER *sds) SECURITY_DESCRIPTOR_RELATIVE *sd; ntfs_log_verbose("\n"); - ntfs_log_verbose("\t\tHash:\t\t\t 0x%08x\n", le32_to_cpu(sds->hash)); + ntfs_log_verbose("\t\tHash:\t\t\t 0x%08x\n", + (unsigned)le32_to_cpu(sds->hash)); ntfs_log_verbose("\t\tSecurity id:\t\t %u (0x%x)\n", (unsigned)le32_to_cpu(sds->security_id), (unsigned)le32_to_cpu(sds->security_id)); @@ -1366,7 +1367,7 @@ static void ntfs_dump_index_key(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) break; default: ntfs_log_verbose("\t\tIndex attr type is UNKNOWN: \t 0x%08x\n", - le32_to_cpu(type)); + (unsigned)le32_to_cpu(type)); break; } } @@ -1415,7 +1416,7 @@ static void ntfs_dump_index_data(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) (unsigned)le32_to_cpu(data->sdh.length), (unsigned)le32_to_cpu(data->sdh.length)); ntfs_log_verbose("\t\tUnknown (padding):\t 0x%08x\n", - le32_to_cpu(data->sdh.reserved_II)); + (unsigned)le32_to_cpu(data->sdh.reserved_II)); break; case INDEX_ATTR_OBJID_O: { OBJ_ID_INDEX_DATA *object_id_data; @@ -1925,8 +1926,8 @@ static void ntfs_dump_attr_ea(ATTR_RECORD *attr, ntfs_volume *vol) if (ea->name_length == 11 && !strncmp((const char*)"SETFILEBITS", (const char*)ea->name, 11)) - printf("0%o\n", le32_to_cpu(*(le32*)(ea->value + - ea->name_length + 1))); + printf("0%o\n", (unsigned)le32_to_cpu(*(le32*) + (ea->value + ea->name_length + 1))); else printf("'%s'\n", ea->value + ea->name_length + 1); if (ea->next_entry_offset)