diff options
author | Theodore Ts'o <tytso@mit.edu> | 2003-07-06 00:36:48 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2003-07-06 00:36:48 -0400 |
commit | 48e6e81362f264aee4f3945c14928efaf71a06c9 (patch) | |
tree | f18871f13963fe9fbfba8103b2a4df408a4b7253 /lib | |
parent | 07a0db15b0447189fd98ff3169e82ca89e33f9d6 (diff) | |
download | e2fsprogs-48e6e81362f264aee4f3945c14928efaf71a06c9.tar.gz |
Fixx gcc -Wall nitpicks.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/blkid/ChangeLog | 8 | ||||
-rw-r--r-- | lib/blkid/blkid_types.h.in | 28 | ||||
-rw-r--r-- | lib/blkid/cache.c | 1 | ||||
-rw-r--r-- | lib/blkid/probe.c | 10 | ||||
-rw-r--r-- | lib/e2p/ChangeLog | 4 | ||||
-rw-r--r-- | lib/e2p/iod.c | 1 | ||||
-rw-r--r-- | lib/ext2fs/ChangeLog | 17 | ||||
-rw-r--r-- | lib/ext2fs/ext2_fs.h | 8 | ||||
-rw-r--r-- | lib/ext2fs/ext2_types.h.in | 28 | ||||
-rw-r--r-- | lib/ext2fs/flushb.c | 12 | ||||
-rw-r--r-- | lib/ext2fs/initialize.c | 18 | ||||
-rw-r--r-- | lib/ext2fs/ismounted.c | 14 | ||||
-rw-r--r-- | lib/ext2fs/kernel-jbd.h | 2 | ||||
-rw-r--r-- | lib/ext2fs/llseek.c | 4 | ||||
-rw-r--r-- | lib/ext2fs/lookup.c | 2 | ||||
-rw-r--r-- | lib/ext2fs/read_bb.c | 2 | ||||
-rw-r--r-- | lib/ext2fs/test_io.c | 4 |
17 files changed, 114 insertions, 49 deletions
diff --git a/lib/blkid/ChangeLog b/lib/blkid/ChangeLog index bdf1849d..45b75f81 100644 --- a/lib/blkid/ChangeLog +++ b/lib/blkid/ChangeLog @@ -1,3 +1,11 @@ +2003-07-06 Theodore Ts'o <tytso@mit.edu> + + * blkid_types.h.in: Fix gcc -Wall nitpicks (don't use #elsif) + + * cache.c: Fix gcc -Wall nitpicks (missing #include <string.h>) + + * probe.h: Fix gcc -Wall nitpicks (missing casts) + 2003-05-21 Theodore Ts'o <tytso@mit.edu> * Makefile.in (ELF_OTHER_LIBS): The blkid library depends on the diff --git a/lib/blkid/blkid_types.h.in b/lib/blkid/blkid_types.h.in index 9de6804e..15284070 100644 --- a/lib/blkid/blkid_types.h.in +++ b/lib/blkid/blkid_types.h.in @@ -13,39 +13,49 @@ typedef signed char __s8; #if (@SIZEOF_INT@ == 8) typedef int __s64; typedef unsigned int __u64; -#elif (@SIZEOF_LONG@ == 8) +#else +#if (@SIZEOF_LONG@ == 8) typedef long __s64; typedef unsigned long __u64; -#elif (@SIZEOF_LONG_LONG@ == 8) +#else +#if (@SIZEOF_LONG_LONG@ == 8) #if defined(__GNUC__) typedef __signed__ long long __s64; #else typedef signed long long __s64; -#endif +#endif /* __GNUC__ */ typedef unsigned long long __u64; -#endif +#endif /* SIZEOF_LONG_LONG == 8 */ +#endif /* SIZEOF_LONG == 8 */ +#endif /* SIZEOF_INT == 8 */ #if (@SIZEOF_INT@ == 2) typedef int __s16; typedef unsigned int __u16; -#elif (@SIZEOF_SHORT@ == 2) +#else +#if (@SIZEOF_SHORT@ == 2) typedef short __s16; typedef unsigned short __u16; #else ?==error: undefined 16 bit type -#endif +#endif /* SIZEOF_SHORT == 2 */ +#endif /* SIZEOF_INT == 2 */ #if (@SIZEOF_INT@ == 4) typedef int __s32; typedef unsigned int __u32; -#elif (@SIZEOF_LONG@ == 4) +#else +#if (@SIZEOF_LONG@ == 4) typedef long __s32; typedef unsigned long __u32; -#elif (@SIZEOF_SHORT@ == 4) +#else +#if (@SIZEOF_SHORT@ == 4) typedef short __s32; typedef unsigned short __u32; #else ?== error: undefined 32 bit type -#endif +#endif /* SIZEOF_SHORT == 4 */ +#endif /* SIZEOF_LONG == 4 */ +#endif /* SIZEOF_INT == 4 */ #endif /* _*_TYPES_H */ diff --git a/lib/blkid/cache.c b/lib/blkid/cache.c index bfa104e6..5d824d2f 100644 --- a/lib/blkid/cache.c +++ b/lib/blkid/cache.c @@ -11,6 +11,7 @@ */ #include <stdlib.h> +#include <string.h> #include "blkidP.h" int blkid_debug_mask = 0; diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c index 0fbbda37..a196ed52 100644 --- a/lib/blkid/probe.c +++ b/lib/blkid/probe.c @@ -220,8 +220,8 @@ static int probe_jfs(int fd, blkid_cache cache, blkid_dev dev, js = (struct jfs_super_block *)buf; - if (strlen(js->js_label)) - blkid_set_tag(dev, "LABEL", js->js_label, + if (strlen((char *) js->js_label)) + blkid_set_tag(dev, "LABEL", (char *) js->js_label, sizeof(js->js_label)); set_uuid(dev, js->js_uuid); return 0; @@ -235,9 +235,9 @@ static int probe_romfs(int fd, blkid_cache cache, blkid_dev dev, ros = (struct romfs_super_block *)buf; /* can be longer, padded to a 16 bytes boundary */ - if (strlen(ros->ros_volume)) { - blkid_set_tag(dev, "LABEL", ros->ros_volume, - (strlen(ros->ros_volume)|15)+1); + if (strlen((char *) ros->ros_volume)) { + blkid_set_tag(dev, "LABEL", (char *) ros->ros_volume, + (strlen((char *) ros->ros_volume)|15)+1); } return 0; } diff --git a/lib/e2p/ChangeLog b/lib/e2p/ChangeLog index 31a2de13..6722d099 100644 --- a/lib/e2p/ChangeLog +++ b/lib/e2p/ChangeLog @@ -1,3 +1,7 @@ +2003-07-06 Theodore Ts'o <tytso@mit.edu> + + * iod.c: Fix gcc -Wall nitpicks (missing #include <string.h>) + 2003-04-21 Theodore Ts'o <tytso@mit.edu> * Release of E2fsprogs 1.33 diff --git a/lib/e2p/iod.c b/lib/e2p/iod.c index 255bfdf2..808d3a39 100644 --- a/lib/e2p/iod.c +++ b/lib/e2p/iod.c @@ -19,6 +19,7 @@ #include <unistd.h> #endif #include <stdlib.h> +#include <string.h> int iterate_on_dir (const char * dir_name, int (*func) (const char *, struct dirent *, void *), diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 76102e58..9745e331 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,20 @@ +2003-07-06 Theodore Ts'o <tytso@mit.edu> + + * kernel-jbd.h, flushb.c: Fix gcc -Wall nitpicks (indented cpp + directives) + + * ext2_types.h.in, initialize.c: Fix gcc -Wall nitpicks + (don't use #elsif) + + * ismounted.c: Fix gcc -Wall nitpicks (Don't use exit as a goto label) + + * llseek.c: Fix gcc -Wall nitpicks (don't use #elsif) + + * lookup.c, read_bb.c: Fix gcc -Wall nitpicks (indent + non-traditional #pragma) + + * test_io.c: Fix gcc -Wall nitpicks (const/unsigned type issues) + 2003-06-24 <tytso@snap.thunk.org> * badblocks.c, ext2fs.h (ext2fs_u32_list_find, diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h index fc7e36c6..6ace0a91 100644 --- a/lib/ext2fs/ext2_fs.h +++ b/lib/ext2fs/ext2_fs.h @@ -315,7 +315,8 @@ struct ext2_inode { #define i_gid_high osd2.linux2.l_i_gid_high #define i_reserved2 osd2.linux2.l_i_reserved2 -#elif defined(__GNU__) +#else +#if defined(__GNU__) #define i_translator osd1.hurd1.h_i_translator #define i_frag osd2.hurd2.h_i_frag; @@ -324,13 +325,16 @@ struct ext2_inode { #define i_gid_high osd2.hurd2.h_i_gid_high #define i_author osd2.hurd2.h_i_author -#elif defined(__masix__) +#else +#if defined(__masix__) #define i_reserved1 osd1.masix1.m_i_reserved1 #define i_frag osd2.masix2.m_i_frag #define i_fsize osd2.masix2.m_i_fsize #define i_reserved2 osd2.masix2.m_i_reserved2 +#endif /* __masix__ */ +#endif /* __GNU__ */ #endif /* defined(__KERNEL__) || defined(__linux__) */ /* diff --git a/lib/ext2fs/ext2_types.h.in b/lib/ext2fs/ext2_types.h.in index 1d82c5d2..56897dd5 100644 --- a/lib/ext2fs/ext2_types.h.in +++ b/lib/ext2fs/ext2_types.h.in @@ -13,39 +13,49 @@ typedef signed char __s8; #if (@SIZEOF_INT@ == 8) typedef int __s64; typedef unsigned int __u64; -#elif (@SIZEOF_LONG@ == 8) +#else +#if (@SIZEOF_LONG@ == 8) typedef long __s64; typedef unsigned long __u64; -#elif (@SIZEOF_LONG_LONG@ == 8) +#else +#if (@SIZEOF_LONG_LONG@ == 8) #if defined(__GNUC__) typedef __signed__ long long __s64; #else typedef signed long long __s64; -#endif +#endif /* __GNUC__ */ typedef unsigned long long __u64; -#endif +#endif /* SIZEOF_LONG_LONG == 8 */ +#endif /* SIZEOF_LONG == 8 */ +#endif /* SIZEOF_INT == 8 */ #if (@SIZEOF_INT@ == 2) typedef int __s16; typedef unsigned int __u16; -#elif (@SIZEOF_SHORT@ == 2) +#else +#if (@SIZEOF_SHORT@ == 2) typedef short __s16; typedef unsigned short __u16; #else ?==error: undefined 16 bit type -#endif +#endif /* SIZEOF_SHORT == 2 */ +#endif /* SIZEOF_INT == 2 */ #if (@SIZEOF_INT@ == 4) typedef int __s32; typedef unsigned int __u32; -#elif (@SIZEOF_LONG@ == 4) +#else +#if (@SIZEOF_LONG@ == 4) typedef long __s32; typedef unsigned long __u32; -#elif (@SIZEOF_SHORT@ == 4) +#else +#if (@SIZEOF_SHORT@ == 4) typedef short __s32; typedef unsigned short __u32; #else ?== error: undefined 32 bit type -#endif +#endif /* SIZEOF_SHORT == 4 */ +#endif /* SIZEOF_LONG == 4 */ +#endif /* SIZEOF_INT == 4 */ #endif /* _*_TYPES_H */ diff --git a/lib/ext2fs/flushb.c b/lib/ext2fs/flushb.c index 80a21179..81d5adb0 100644 --- a/lib/ext2fs/flushb.c +++ b/lib/ext2fs/flushb.c @@ -65,16 +65,16 @@ errcode_t ext2fs_sync_device(int fd, int flushb) if (ioctl (fd, BLKFLSBUF, 0) == 0) return 0; #else - #ifdef __GNUC__ - #warning BLKFLSBUF not defined - #endif +#ifdef __GNUC__ + #warning BLKFLSBUF not defined +#endif /* __GNUC__ */ #endif #ifdef FDFLUSH ioctl (fd, FDFLUSH, 0); /* In case this is a floppy */ #else - #ifdef __GNUC__ - #warning FDFLUSH not defined - #endif +#ifdef __GNUC__ + #warning FDFLUSH not defined +#endif /* __GNUC__ */ #endif } return 0; diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c index 32b9c87a..0e2b8d49 100644 --- a/lib/ext2fs/initialize.c +++ b/lib/ext2fs/initialize.c @@ -27,18 +27,24 @@ #include "ext2_fs.h" #include "ext2fs.h" -#if defined(__linux__) && defined(EXT2_OS_LINUX) +#if defined(__linux__) && defined(EXT2_OS_LINUX) #define CREATOR_OS EXT2_OS_LINUX -#elif defined(__GNU__) && defined(EXT2_OS_HURD) +#else +#if defined(__GNU__) && defined(EXT2_OS_HURD) #define CREATOR_OS EXT2_OS_HURD -#elif defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) +#else +#if defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) #define CREATOR_OS EXT2_OS_FREEBSD -#elif defined(LITES) && defined(EXT2_OS_LITES) +#else +#if defined(LITES) && defined(EXT2_OS_LITES) #define CREATOR_OS EXT2_OS_LITES #else #define CREATOR_OS EXT2_OS_LINUX /* by default */ -#endif - +#endif /* defined(LITES) && defined(EXT2_OS_LITES) */ +#endif /* defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) */ +#endif /* defined(__GNU__) && defined(EXT2_OS_HURD) */ +#endif /* defined(__linux__) && defined(EXT2_OS_LINUX) */ + /* * Note we override the kernel include file's idea of what the default * check interval (never) should be. It's a good idea to check at diff --git a/lib/ext2fs/ismounted.c b/lib/ext2fs/ismounted.c index d3ff2763..3f2241d2 100644 --- a/lib/ext2fs/ismounted.c +++ b/lib/ext2fs/ismounted.c @@ -99,7 +99,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, } } #endif /* __GNU__ */ - goto exit; + goto errout; } #ifndef __GNU__ /* The GNU hurd is deficient; what else is new? */ /* Validate the entry in case /etc/mtab is out of date */ @@ -117,14 +117,14 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, #endif /* DEBUG */ retval = 0; } - goto exit; + goto errout; } if (file_rdev && (st_buf.st_dev != file_rdev)) { #ifdef DEBUG printf("Bogus entry in %s! (%s not mounted on %s)\n", mtab_file, file, mnt->mnt_dir); #endif /* DEBUG */ - goto exit; + goto errout; } #endif /* __GNU__ */ *mount_flags = EXT2_MF_MOUNTED; @@ -156,7 +156,7 @@ is_root: (void) unlink(TEST_FILE); } retval = 0; -exit: +errout: endmntent (f); return retval; } @@ -190,7 +190,8 @@ static errcode_t check_mntent(const char *file, int *mount_flags, #endif /* defined(MOUNTED) || defined(_PATH_MOUNTED) */ } -#elif defined(HAVE_GETMNTINFO) +#else +#if defined(HAVE_GETMNTINFO) static errcode_t check_getmntinfo(const char *file, int *mount_flags, char *mtpt, int mtlen) @@ -227,6 +228,7 @@ static errcode_t check_getmntinfo(const char *file, int *mount_flags, return 0; } #endif /* HAVE_GETMNTINFO */ +#endif /* HAVE_MNTENT_H */ /* * Check to see if we're dealing with the swap device. @@ -299,7 +301,7 @@ errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, return check_getmntinfo(device, mount_flags, mtpt, mtlen); #else #ifdef __GNUC__ -#warning "Can't use getmntent or getmntinfo to check for mounted filesystems!" + #warning "Can't use getmntent or getmntinfo to check for mounted filesystems!" #endif *mount_flags = 0; return 0; diff --git a/lib/ext2fs/kernel-jbd.h b/lib/ext2fs/kernel-jbd.h index 4d97b7f9..f3db3a7f 100644 --- a/lib/ext2fs/kernel-jbd.h +++ b/lib/ext2fs/kernel-jbd.h @@ -769,7 +769,7 @@ static inline void journal_abort_handle(handle_t *handle) /* Not all architectures define BUG() */ #ifndef BUG - #define BUG() do { \ +#define BUG() do { \ printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ * ((char *) 0) = 0; \ } while (0) diff --git a/lib/ext2fs/llseek.c b/lib/ext2fs/llseek.c index 17d3d086..855560f1 100644 --- a/lib/ext2fs/llseek.c +++ b/lib/ext2fs/llseek.c @@ -34,7 +34,8 @@ #define my_llseek lseek64 -#elif defined(HAVE_LLSEEK) +#else +#if defined(HAVE_LLSEEK) #include <syscall.h> #ifndef HAVE_LLSEEK_PROTOTYPE @@ -84,6 +85,7 @@ static ext2_loff_t my_llseek (int fd, ext2_loff_t offset, int origin) #endif /* __alpha__ || __ia64__ */ #endif /* HAVE_LLSEEK */ +#endif /* defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE) */ ext2_loff_t ext2fs_llseek (int fd, ext2_loff_t offset, int origin) { diff --git a/lib/ext2fs/lookup.c b/lib/ext2fs/lookup.c index 6010c457..af9fdd1d 100644 --- a/lib/ext2fs/lookup.c +++ b/lib/ext2fs/lookup.c @@ -26,7 +26,7 @@ struct lookup_struct { }; #ifdef __TURBOC__ -#pragma argsused + #pragma argsused #endif static int lookup_proc(struct ext2_dir_entry *dirent, int offset, diff --git a/lib/ext2fs/read_bb.c b/lib/ext2fs/read_bb.c index 5d847fb2..d0f31391 100644 --- a/lib/ext2fs/read_bb.c +++ b/lib/ext2fs/read_bb.c @@ -35,7 +35,7 @@ struct read_bb_record { * Helper function for ext2fs_read_bb_inode() */ #ifdef __TURBOC__ -#pragma argsused + #pragma argsused #endif static int mark_bad_block(ext2_filsys fs, blk_t *block_nr, e2_blkcnt_t blockcnt, blk_t ref_block, diff --git a/lib/ext2fs/test_io.c b/lib/ext2fs/test_io.c index 35106660..9ce8334f 100644 --- a/lib/ext2fs/test_io.c +++ b/lib/ext2fs/test_io.c @@ -95,7 +95,7 @@ void (*test_io_cb_write_byte) static void test_dump_block(io_channel channel, struct test_private_data *data, - unsigned long block, void *buf) + unsigned long block, const void *buf) { const unsigned char *cp; FILE *f = data->outfile; @@ -105,7 +105,7 @@ static void test_dump_block(io_channel channel, for (i=0, cp = buf; i < channel->block_size; i++, cp++) { cksum += *cp; } - fprintf(f, "Contents of block %d, checksum %08x: \n", block, cksum); + fprintf(f, "Contents of block %lu, checksum %08lu: \n", block, cksum); for (i=0, cp = buf; i < channel->block_size; i++, cp++) { if ((i % 16) == 0) fprintf(f, "%04x: ", i); |