Enable lots of compiler warnings and fix warning from libntfs.

(Logical change 1.257)
This commit is contained in:
cantab.net!aia21 2004-01-07 15:03:17 +00:00
parent 8d166264dc
commit 3244f17522
18 changed files with 44 additions and 37 deletions

4
configure vendored
View File

@ -8249,9 +8249,9 @@ echo "${ECHO_T}$cc_version" >&6
# enable 64-bit (device) file access functions and parameters.
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -Wall"
# Add extra warnings if in maintainer mode.
# Add lots of extra warnings if in maintainer mode.
if test "$USE_MAINTAINER_MODE" = "yes";then
CFLAGS="$CFLAGS -Wstrict-prototypes -Wsign-compare"
CFLAGS="$CFLAGS -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare"
fi
# Add -fms-extensions for gcc-3.2+.

View File

@ -136,9 +136,9 @@ AC_MSG_RESULT($cc_version)
# enable 64-bit (device) file access functions and parameters.
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -Wall"
# Add extra warnings if in maintainer mode.
# Add lots of extra warnings if in maintainer mode.
if test "$USE_MAINTAINER_MODE" = "yes";then
CFLAGS="$CFLAGS -Wstrict-prototypes -Wsign-compare"
CFLAGS="$CFLAGS -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare"
fi
# Add -fms-extensions for gcc-3.2+.

View File

@ -262,6 +262,8 @@ extern int ntfs_attr_size_bounds_check(const ntfs_volume *vol,
const ATTR_TYPES type, const s64 size);
extern int ntfs_attr_can_be_non_resident(const ntfs_volume *vol,
const ATTR_TYPES type);
extern int ntfs_attr_can_be_resident(const ntfs_volume *vol,
const ATTR_TYPES type);
extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a,
const u32 newsize);

View File

@ -39,8 +39,7 @@
* disregarding the value of silent (but only if configure was run with
* --enable-debug).
*/
extern BOOL ntfs_boot_sector_is_ntfs(const NTFS_BOOT_SECTOR *b,
const BOOL silent);
extern BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, BOOL silent);
extern int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b);
#endif /* defined _NTFS_BOOTSECT_H */

View File

@ -68,10 +68,10 @@ extern void ntfs_debug_runlist_dump(const runlist_element *rl);
#else /* if !DEBUG */
static __inline__ void Dprintf(const char *fmt, ...) {}
static __inline__ void Dputs(const char *s) {}
static __inline__ void Dperror(const char *s) {}
static __inline__ void ntfs_debug_runlist_dump(const runlist_element *rl) {}
static __inline__ void Dprintf(const char *fmt __attribute__((unused)), ...) {}
static __inline__ void Dputs(const char *s __attribute__((unused))) {}
static __inline__ void Dperror(const char *s __attribute__((unused))) {}
static __inline__ void ntfs_debug_runlist_dump(const runlist_element *rl __attribute__((unused))) {}
#endif /* !DEBUG */

View File

@ -96,7 +96,7 @@ extern s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count,
extern s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count,
const u32 bksize, void *b);
extern s64 ntfs_mst_pwrite(struct ntfs_device *dev, const s64 pos, s64 count,
const u32 bksize, const void *b);
const u32 bksize, void *b);
extern s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn,
const s64 count, void *b);

View File

@ -101,7 +101,7 @@ static __inline__ u32 ntfs_mft_record_get_data_size(const MFT_RECORD *m)
return le32_to_cpu(m->bytes_in_use);
}
extern ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, u64 start);
extern ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, s64 start);
extern int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni);

View File

@ -174,6 +174,8 @@ extern ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev,
extern ntfs_volume *ntfs_device_mount(struct ntfs_device *dev,
unsigned long rwflag);
extern int ntfs_device_umount(ntfs_volume *vol, const BOOL force);
extern ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag);
extern int ntfs_umount(ntfs_volume *vol, const BOOL force);

View File

@ -64,7 +64,7 @@ s64 ntfs_get_attribute_value_length(const ATTR_RECORD *a)
* ntfs_get_attribute_value
*/
s64 ntfs_get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m,
const ATTR_RECORD *a, u8 *b)
const ATTR_RECORD *a, u8 *b)
{
runlist *rl;
s64 total, r;
@ -91,7 +91,7 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m,
return 0;
}
memcpy(b, (char*)a + le16_to_cpu(a->value_offset),
memcpy(b, (const char*)a + le16_to_cpu(a->value_offset),
le32_to_cpu(a->value_length));
errno = 0;
return (s64)le32_to_cpu(a->value_length);

View File

@ -43,7 +43,7 @@
*
* Return TRUE if @b contains a valid ntfs boot sector and FALSE if not.
*/
BOOL ntfs_boot_sector_is_ntfs(const NTFS_BOOT_SECTOR *b, const BOOL silent)
BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent)
{
u32 i;

View File

@ -213,7 +213,7 @@ s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count,
NDevSetDirty(dev);
/* Write the data. */
for (total = 0; count; count -= written, total += written) {
written = dops->write(dev, (char*)b + total, count);
written = dops->write(dev, (const char*)b + total, count);
/* If everything ok, continue. */
if (written > 0)
continue;
@ -316,7 +316,7 @@ s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count,
* achieved.
*/
s64 ntfs_mst_pwrite(struct ntfs_device *dev, const s64 pos, s64 count,
const u32 bksize, const void *b)
const u32 bksize, void *b)
{
s64 written, i;

View File

@ -47,6 +47,8 @@ static __inline__ ntfs_inode *__ntfs_inode_allocate(ntfs_volume *vol)
return ni;
}
extern ntfs_inode *ntfs_inode_allocate(ntfs_volume *vol);
/**
* Internal:
*

View File

@ -106,7 +106,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn,
(long long)start_lcn,
zone == MFT_ZONE ? "MFT" : "DATA");
if (!vol || count < 0 || start_lcn < -1 || !vol->lcnbmp_na ||
zone < FIRST_ZONE || zone > LAST_ZONE) {
(s8)zone < FIRST_ZONE || zone > LAST_ZONE) {
fprintf(stderr, "%s(): Invalid arguments!\n", __FUNCTION__);
errno = EINVAL;
return NULL;

View File

@ -129,7 +129,7 @@ int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref,
if (m + count > vol->nr_mft_records) {
// TODO: Need to extend $MFT. This is not just normal attribute
// extension as many rules need to be observed. (AIA)
if (bmirr);
if (bmirr)
free(bmirr);
errno = ENOTSUP;
return -1;
@ -253,9 +253,9 @@ read_failed:
*
* On error return NULL with errno set to the error code.
*/
ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, u64 start)
ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, s64 start)
{
if (!vol || !vol->mftbmp_na) {
if (!vol || !vol->mftbmp_na || start < -1) {
errno = EINVAL;
return NULL;
}

View File

@ -727,8 +727,8 @@ runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol,
LCN lcn; /* Current lcn. */
s64 deltaxcn; /* Change in [vl]cn. */
runlist_element *rl; /* The output runlist. */
u8 *buf; /* Current position in mapping pairs array. */
u8 *attr_end; /* End of attribute. */
const u8 *buf; /* Current position in mapping pairs array. */
const u8 *attr_end; /* End of attribute. */
int err, rlsize; /* Size of runlist buffer. */
u16 rlpos; /* Current runlist position in units of
runlist_elements. */
@ -746,9 +746,9 @@ runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol,
vcn = sle64_to_cpu(attr->lowest_vcn);
lcn = 0;
/* Get start of the mapping pairs array. */
buf = (u8*)attr + le16_to_cpu(attr->mapping_pairs_offset);
attr_end = (u8*)attr + le32_to_cpu(attr->length);
if (buf < (u8*)attr || buf > attr_end) {
buf = (const u8*)attr + le16_to_cpu(attr->mapping_pairs_offset);
attr_end = (const u8*)attr + le32_to_cpu(attr->length);
if (buf < (const u8*)attr || buf > attr_end) {
Dputs("Corrupt attribute.");
errno = EIO;
return NULL;

View File

@ -976,7 +976,8 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag)
* function returns success. If it returns an error then nothing has been done
* so it is safe to continue using @vol.
*/
int ntfs_device_umount(ntfs_volume *vol, const BOOL force)
int ntfs_device_umount(ntfs_volume *vol,
const BOOL force __attribute__((unused)))
{
if (!vol) {
errno = EINVAL;
@ -1008,7 +1009,8 @@ int ntfs_device_umount(ntfs_volume *vol, const BOOL force)
* function returns success. If it returns an error then nothing has been done
* so it is safe to continue using @vol.
*/
int ntfs_umount(ntfs_volume *vol, const BOOL force)
int ntfs_umount(ntfs_volume *vol,
const BOOL force __attribute__((unused)))
{
struct ntfs_device *dev;

View File

@ -298,23 +298,23 @@ int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale)
/**
* ntfs2utc - Convert an NTFS time to Unix time
* @time: An NTFS time in 100ns units since 1601
* @ntfs_time: An NTFS time in 100ns units since 1601
*
* NTFS stores times as the number of 100ns intervals since January 1st 1601 at
* 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD.
*
* Return: n A Unix time (number of seconds since 1970)
*/
time_t ntfs2utc (s64 time)
time_t ntfs2utc (s64 ntfs_time)
{
return (time - (NTFS_TIME_OFFSET)) / 10000000;
return (ntfs_time - (NTFS_TIME_OFFSET)) / 10000000;
}
/**
* utc2ntfs - Convert Linux time to NTFS time
* @time: Linux time to convert to NTFS
* @utc_time: Linux time to convert to NTFS
*
* Convert the Linux time @time to its corresponding NTFS time.
* Convert the Linux time @utc_time to its corresponding NTFS time.
*
* Linux stores time in a long at present and measures it as the number of
* 1-second intervals since 1st January 1970, 00:00:00 UTC.
@ -325,10 +325,10 @@ time_t ntfs2utc (s64 time)
*
* Return: n An NTFS time (100ns units since Jan 1601)
*/
s64 utc2ntfs (time_t time)
s64 utc2ntfs (time_t utc_time)
{
/* Convert to 100ns intervals and then add the NTFS time offset. */
return (s64)time * 10000000 + NTFS_TIME_OFFSET;
return (s64)utc_time * 10000000 + NTFS_TIME_OFFSET;
}
/**

View File

@ -80,8 +80,8 @@ int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref);
int utils_is_metadata (ntfs_inode *inode);
ntfs_inode * utils_pathname_to_inode (ntfs_volume *vol, ntfs_inode *parent, const char *pathname);
time_t ntfs2utc (s64 time);
s64 utc2ntfs (time_t time);
time_t ntfs2utc (s64 ntfs_time);
s64 utc2ntfs (time_t utc_time);
ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx);
ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft);