Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/ntfstools
In directory usw-pr-cvs1:/tmp/cvs-serv31580/ntfstools
Modified Files:
Makefile.am Makefile.in mkntfs.c sd.c upcase.c
Log Message:
Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major).
Index: Makefile.am
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/Makefile.am,v
retrieving revision 1.15
retrieving revision 1.16
diff -U2 -r1.15 -r1.16
--- Makefile.am 12 Apr 2002 15:23:48 -0000 1.15
+++ Makefile.am 15 Apr 2002 20:04:29 -0000 1.16
@@ -1,5 +1,5 @@
# Need this to enable 64-bit (device) file access functions and parameters.
if DEBUG
-AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG
+AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall
else
AM_CFLAGS = -D_FILE_OFFSET_BITS=64
Index: Makefile.in
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/Makefile.in,v
retrieving revision 1.19
retrieving revision 1.20
diff -U2 -r1.19 -r1.20
--- Makefile.in 12 Apr 2002 15:23:48 -0000 1.19
+++ Makefile.in 15 Apr 2002 20:04:29 -0000 1.20
@@ -89,5 +89,5 @@
all_includes = @all_includes@
all_libraries = @all_libraries@
-@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -g -DDEBUG
+@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall
@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64
Index: mkntfs.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/mkntfs.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -U2 -r1.62 -r1.63
--- mkntfs.c 15 Apr 2002 19:02:41 -0000 1.62
+++ mkntfs.c 15 Apr 2002 20:04:29 -0000 1.63
@@ -111,4 +111,5 @@
#include "attrib.h"
#include "bitmap.h"
+#include "mst.h"
extern const unsigned char attrdef_ntfs12_array[2400];
@@ -399,5 +400,5 @@
int ucsnlen(const uchar_t *s, int maxlen)
{
- int i, len;
+ int i;
for (i = 0; i < maxlen; i++)
@@ -493,5 +494,5 @@
return;
case $VOLUME_NAME:
- printf("Volume name length = %i\n", i);
+ printf("Volume name length = %i\n", val_len);
if (val_len) {
buf = calloc(1, val_len);
@@ -807,5 +808,5 @@
m->magic = magic_FILE;
/* Aligned to 2-byte boundary. */
- m->usa_ofs = cpu_to_le16(sizeof(MFT_RECORD) + 1 & ~1);
+ m->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD) + 1) & ~1);
if (opt.mft_record_size >= NTFS_SECTOR_SIZE)
m->usa_count = cpu_to_le16(opt.mft_record_size /
@@ -820,11 +821,11 @@
}
/* Set the update sequence number to 1. */
- *(__u16*)((char*)m + (sizeof(MFT_RECORD) + 1 & ~1)) = cpu_to_le16(1);
+ *(__u16*)((char*)m + ((sizeof(MFT_RECORD) + 1) & ~1)) = cpu_to_le16(1);
m->lsn = cpu_to_le64(0LL);
m->sequence_number = cpu_to_le16(1);
m->link_count = cpu_to_le16(0);
/* Aligned to 8-byte boundary. */
- m->attrs_offset = cpu_to_le16(le16_to_cpu(m->usa_ofs) +
- (le16_to_cpu(m->usa_count) << 1) + 7 & ~7);
+ m->attrs_offset = cpu_to_le16((le16_to_cpu(m->usa_ofs) +
+ (le16_to_cpu(m->usa_count) << 1) + 7) & ~7);
m->flags = cpu_to_le16(0);
/*
@@ -832,5 +833,6 @@
* aligned to 8-byte boundary.
*/
- m->bytes_in_use = cpu_to_le32(le16_to_cpu(m->attrs_offset) + 8+7 & ~7);
+ m->bytes_in_use = cpu_to_le32((le16_to_cpu(m->attrs_offset) + 8 + 7) &
+ ~7);
m->bytes_allocated = cpu_to_le32(opt.mft_record_size);
m->base_mft_record = cpu_to_le64((MFT_REF)0);
@@ -875,5 +877,5 @@
{
int i;
- LCN prev_lcn, delta_lcn;
+ LCN prev_lcn;
/* Terminator byte. */
int rls = 1;
@@ -950,5 +952,5 @@
int build_mapping_pairs(char *dest, const int dest_len, const run_list *rl)
{
- int i, j;
+ int i;
__s8 len_len, lcn_len;
char *dest_max;
@@ -1017,5 +1019,5 @@
* appropriate codes exist for simplicity of parsing the return value.
*/
- if (size != (size + 7 & ~7)) {
+ if (size != ((size + 7) & ~7)) {
Eprintf("make_room_for_attribute() received non 8-byte aligned"
"size.\n");
@@ -1050,6 +1052,6 @@
/* New attribute length and mft record bytes used. */
- new_alen = le32_to_cpu(a->length) - le32_to_cpu(a->value_length) +
- new_vsize + 7 & ~7;
+ new_alen = (le32_to_cpu(a->length) - le32_to_cpu(a->value_length) +
+ new_vsize + 7) & ~7;
new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) +
new_alen;
@@ -1188,5 +1190,5 @@
__u16 hdr_size;
int asize, mpa_size, err, i;
- __s64 bw, inited_size;
+ __s64 bw = 0, inited_size;
VCN highest_vcn;
uchar_t *uname;
@@ -1249,5 +1251,5 @@
}
/* Mapping pairs array and next attribute must be 8-byte aligned. */
- asize = ((int)hdr_size + (name_len + 7 & ~7) + mpa_size) + 7 & ~7;
+ asize = (((int)hdr_size + ((name_len + 7) & ~7) + mpa_size) + 7) & ~7;
/* Get the highest vcn. */
for (i = 0, highest_vcn = 0LL; rl[i].length; i++)
@@ -1293,9 +1295,9 @@
a->flags = flags;
a->instance = m->next_attr_instance;
- m->next_attr_instance = cpu_to_le16(le16_to_cpu(m->next_attr_instance)
- + 1 & 0xffff);
+ m->next_attr_instance = cpu_to_le16((le16_to_cpu(m->next_attr_instance)
+ + 1) & 0xffff);
a->lowest_vcn = cpu_to_le64(0);
a->highest_vcn = cpu_to_le64(highest_vcn - 1LL);
- a->mapping_pairs_offset = cpu_to_le16(hdr_size + (name_len + 7 & ~7));
+ a->mapping_pairs_offset = cpu_to_le16(hdr_size + ((name_len + 7) & ~7));
memset(a->reserved1, 0, sizeof(a->reserved1));
// FIXME: Allocated size depends on compression.
@@ -1325,5 +1327,5 @@
"\n");
err = build_mapping_pairs((char*)a + hdr_size +
- (name_len + 7 & ~7), mpa_size, rl);
+ ((name_len + 7) & ~7), mpa_size, rl);
}
a->initialized_size = cpu_to_le64(inited_size);
@@ -1355,6 +1357,6 @@
__u16 hdr_size;
int asize, mpa_size, err, i;
- run_list *rl;
- __s64 bw;
+ run_list *rl = NULL;
+ __s64 bw = 0;
uchar_t *uname;
/*
@@ -1427,5 +1429,5 @@
}
/* Mapping pairs array and next attribute must be 8-byte aligned. */
- asize = ((int)hdr_size + (name_len + 7 & ~7) + mpa_size) + 7 & ~7;
+ asize = (((int)hdr_size + ((name_len + 7) & ~7) + mpa_size) + 7) & ~7;
err = make_room_for_attribute(m, (char*)a, asize);
if (err == -ENOSPC) {
@@ -1462,14 +1464,14 @@
a->flags = flags;
a->instance = m->next_attr_instance;
- m->next_attr_instance = cpu_to_le16(le16_to_cpu(m->next_attr_instance)
- + 1 & 0xffff);
+ m->next_attr_instance = cpu_to_le16((le16_to_cpu(m->next_attr_instance)
+ + 1) & 0xffff);
a->lowest_vcn = cpu_to_le64(0);
for (i = 0; rl[i].length; i++)
;
a->highest_vcn = cpu_to_le64(rl[i].vcn - 1);
- a->mapping_pairs_offset = cpu_to_le16(hdr_size + (name_len + 7 & ~7));
+ a->mapping_pairs_offset = cpu_to_le16(hdr_size + ((name_len + 7) & ~7));
memset(a->reserved1, 0, sizeof(a->reserved1));
// FIXME: Allocated size depends on compression.
- a->allocated_size = cpu_to_le64(val_len + (opt.cluster_size - 1) &
+ a->allocated_size = cpu_to_le64((val_len + (opt.cluster_size - 1)) &
~(opt.cluster_size - 1));
a->data_size = cpu_to_le64(val_len);
@@ -1497,5 +1499,5 @@
"\n");
err = build_mapping_pairs((char*)a + hdr_size +
- (name_len + 7 & ~7), mpa_size, rl);
+ ((name_len + 7) & ~7), mpa_size, rl);
}
if (err < 0 || bw != val_len) {
@@ -1526,5 +1528,5 @@
{
attr_search_context *ctx;
- ATTR_RECORD *a;
+ ATTR_RECORD *a = NULL;
int asize, err, i;
uchar_t *uname;
@@ -1556,5 +1558,5 @@
a = ctx->attr;
/* sizeof(resident attribute record header) == 24 */
- asize = (24 + (name_len + 7 & ~7) + val_len) + 7 & ~7;
+ asize = ((24 + ((name_len + 7) & ~7) + val_len) + 7) & ~7;
err = make_room_for_attribute(m, (char*)a, asize);
if (err == -ENOSPC) {
@@ -1591,8 +1593,8 @@
a->flags = cpu_to_le16(flags);
a->instance = m->next_attr_instance;
- m->next_attr_instance = cpu_to_le16(le16_to_cpu(m->next_attr_instance)
- + 1 & 0xffff);
+ m->next_attr_instance = cpu_to_le16((le16_to_cpu(m->next_attr_instance)
+ + 1) & 0xffff);
a->value_length = cpu_to_le32(val_len);
- a->value_offset = cpu_to_le16(24 + (name_len + 7 & ~7));
+ a->value_offset = cpu_to_le16(24 + ((name_len + 7) & ~7));
a->resident_flags = res_flags;
a->reservedR = 0;
@@ -1604,5 +1606,5 @@
if (uname)
free(uname);
- if (val_len)
+ if (val_len && a)
memcpy((char*)a + le16_to_cpu(a->value_offset), val, val_len);
return err;
@@ -1877,5 +1879,5 @@
INDEX_ROOT *r;
INDEX_ENTRY_HEADER *e;
- int i, err, val_len;
+ int err, val_len;
val_len = sizeof(INDEX_ROOT) + sizeof(INDEX_ENTRY_HEADER);
@@ -1903,5 +1905,5 @@
opt.cluster_size;
} else /* if (opt.cluster_size > index_block_size) */ {
- if (index_block_size & index_block_size - 1) {
+ if (index_block_size & (index_block_size - 1)) {
Eprintf("add_attr_index_root: index block size is not "
"a power of 2.\n");
@@ -2023,10 +2025,10 @@
ATTR_RECORD *a;
INDEX_ROOT *r;
- INDEX_ENTRY *re, *ae;
+ INDEX_ENTRY *re;
INDEX_ALLOCATION *ia_val = NULL;
uchar_t *uname;
char bmp[8];
char *re_start, *re_end;
- int i, err, r_size, index_block_size;
+ int i, err, index_block_size;
if (name_len) {
@@ -2099,6 +2101,6 @@
ia_val->index.flags = LEAF_NODE;
/* Align to 8-byte boundary. */
- ia_val->index.entries_offset = cpu_to_le32(sizeof(INDEX_HEADER) +
- le16_to_cpu(ia_val->usa_count) * 2 + 7 & ~7);
+ ia_val->index.entries_offset = cpu_to_le32((sizeof(INDEX_HEADER) +
+ le16_to_cpu(ia_val->usa_count) * 2 + 7) & ~7);
ia_val->index.allocated_size = cpu_to_le32(index_block_size -
(sizeof(INDEX_ALLOCATION) - sizeof(INDEX_HEADER)));
@@ -2182,5 +2184,5 @@
* appropriate codes exist for simplicity of parsing the return value.
*/
- if (size != (size + 7 & ~7)) {
+ if (size != ((size + 7) & ~7)) {
Eprintf("make_room_for_index_entry_in_index_block() received "
"non 8-byte aligned size.\n");
@@ -2225,5 +2227,5 @@
FILE_NAME_ATTR *file_name, __u32 file_name_size)
{
- int err, ie_key_len, i;
+ int err, i;
INDEX_ENTRY *ie;
char *index_end;
@@ -2325,5 +2327,5 @@
ie = (INDEX_ENTRY*)((char*)ie + le16_to_cpu(ie->length));
};
- i = sizeof(INDEX_ENTRY_HEADER) + file_name_size + 7 & ~7;
+ i = (sizeof(INDEX_ENTRY_HEADER) + file_name_size + 7) & ~7;
err = make_room_for_index_entry_in_index_block(index, ie, i);
if (err) {
@@ -2724,6 +2726,4 @@
int main(int argc, char **argv)
{
- const char *OK = "OK";
- const char *FAILED = "FAILED";
int i, j, err;
ssize_t bw;
@@ -2922,8 +2922,8 @@
opt.nr_clusters);
/* Determine lcn bitmap byte size and allocate it. */
- lcn_bitmap_byte_size = opt.nr_clusters + 7 >> 3;
+ lcn_bitmap_byte_size = (opt.nr_clusters + 7) >> 3;
/* Needs to be multiple of 8 bytes. */
- lcn_bitmap_byte_size = lcn_bitmap_byte_size + 7 & ~7;
- i = lcn_bitmap_byte_size + opt.cluster_size - 1 &
+ lcn_bitmap_byte_size = (lcn_bitmap_byte_size + 7) & ~7;
+ i = (lcn_bitmap_byte_size + opt.cluster_size - 1) &
~(opt.cluster_size - 1);
Dprintf("lcn_bitmap_byte_size = %i, allocated = %i\n",
@@ -2949,7 +2949,7 @@
mft_bitmap_size = opt.mft_size / opt.mft_record_size;
/* Convert to bytes, at least one. */
- mft_bitmap_byte_size = mft_bitmap_size + 7 >> 3;
+ mft_bitmap_byte_size = (mft_bitmap_size + 7) >> 3;
/* Mft bitmap is allocated in multiples of 8 bytes. */
- mft_bitmap_byte_size = mft_bitmap_byte_size + 7 & ~7;
+ mft_bitmap_byte_size = (mft_bitmap_byte_size + 7) & ~7;
Dprintf("mft_bitmap_size = %i, mft_bitmap_byte_size = %i\n",
mft_bitmap_size, mft_bitmap_byte_size);
@@ -3396,5 +3396,5 @@
err = create_hardlink(index_block, root_ref, m,
MAKE_MFT_REF(FILE_$AttrDef, FILE_$AttrDef),
- buf2_size + opt.cluster_size - 1 &
+ (buf2_size + opt.cluster_size - 1) &
~(opt.cluster_size - 1), buf2_size,
FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0,
@@ -3415,5 +3415,5 @@
err = create_hardlink(index_block, root_ref, m,
MAKE_MFT_REF(FILE_$Bitmap, FILE_$Bitmap),
- lcn_bitmap_byte_size + opt.cluster_size - 1 &
+ (lcn_bitmap_byte_size + opt.cluster_size - 1) &
~(opt.cluster_size - 1), lcn_bitmap_byte_size,
FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0,
@@ -3494,5 +3494,5 @@
err = create_hardlink(index_block, root_ref, m,
MAKE_MFT_REF(FILE_$Boot, FILE_$Boot),
- 8192 + opt.cluster_size - 1 &
+ (8192 + opt.cluster_size - 1) &
~(opt.cluster_size - 1), 8192,
FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0,
@@ -3579,5 +3579,5 @@
err = create_hardlink(index_block, root_ref, m,
MAKE_MFT_REF(FILE_$UpCase, FILE_$UpCase),
- (opt.upcase_len << 1) + opt.cluster_size - 1 &
+ ((opt.upcase_len << 1) + opt.cluster_size - 1) &
~(opt.cluster_size - 1), opt.upcase_len << 1,
FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0,
Index: sd.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/sd.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -U2 -r1.2 -r1.3
--- sd.c 10 Jun 2001 15:54:20 -0000 1.2
+++ sd.c 15 Apr 2002 20:04:30 -0000 1.3
@@ -31,5 +31,4 @@
SECURITY_DESCRIPTOR_RELATIVE *sd;
ACL *acl;
- ACE_HEADER *ace_hdr;
ACCESS_ALLOWED_ACE *aa_ace;
SID *sid;
Index: upcase.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/upcase.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -U2 -r1.2 -r1.3
--- upcase.c 10 Jun 2001 02:25:38 -0000 1.2
+++ upcase.c 15 Apr 2002 20:04:31 -0000 1.3
@@ -23,4 +23,6 @@
*/
+#include <string.h>
+
#include "types.h"
|