diff options
| author | Andreas Dilger <adilger@dilger.ca> | 2013-12-15 22:09:24 -0500 |
|---|---|---|
| committer | Theodore Ts'o <tytso@mit.edu> | 2013-12-15 22:10:09 -0500 |
| commit | 3a941bef3b9036ca3db9d510c71bcae801ea4dd1 (patch) | |
| tree | 0316a15c1a7011f8c2e79009bdaa6aac4422ead0 /lib | |
| parent | 66457fcb842300e757a69c49c2eb4d8e335be34c (diff) | |
| download | android_external_e2fsprogs-3a941bef3b9036ca3db9d510c71bcae801ea4dd1.tar.gz android_external_e2fsprogs-3a941bef3b9036ca3db9d510c71bcae801ea4dd1.tar.bz2 android_external_e2fsprogs-3a941bef3b9036ca3db9d510c71bcae801ea4dd1.zip | |
build: use long long for __u64 by default
Don't print a verbose configure error in parse-types.h if
<asm/types.h> missing and __[SU]*_TYPEDEF is unset. This is
always the case for non-Linux builds.
The printf formatting strings all use "%llu" for printing 64-bit
values and this it produces a large number of warnings if __u64
is defined as "unsigned long". If __U64_TYPEDEF isn't set use
"unsigned long long" for __u64 in ext2-types.h and blkid-types.h
by default instead of using "unsigned long".
Fix a few places where "%d" or "%u" or "%Lu" were used to print a
64-bit value, by converting them to use "%lld" or "%llu" instead.
Fix a few places where "%lu" was used to print .tv_usec, by casting
the variable to "(long)" since .tv_usec is "int" on some systems.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/blkid/blkid_types.h.in | 16 | ||||
| -rw-r--r-- | lib/ext2fs/ext2_types.h.in | 16 | ||||
| -rw-r--r-- | lib/uuid/gen_uuid.c | 5 | ||||
| -rw-r--r-- | lib/uuid/tst_uuid.c | 2 | ||||
| -rw-r--r-- | lib/uuid/uuid_time.c | 2 |
5 files changed, 21 insertions, 20 deletions
diff --git a/lib/blkid/blkid_types.h.in b/lib/blkid/blkid_types.h.in index cb5b10d5..2edc0dad 100644 --- a/lib/blkid/blkid_types.h.in +++ b/lib/blkid/blkid_types.h.in @@ -92,13 +92,13 @@ typedef __U64_TYPEDEF __u64; #if (@SIZEOF_INT@ == 8) typedef unsigned int __u64; #else -#if (@SIZEOF_LONG@ == 8) -typedef unsigned long __u64; -#else #if (@SIZEOF_LONG_LONG@ == 8) typedef unsigned long long __u64; -#endif /* SIZEOF_LONG_LONG == 8 */ +#else +#if (@SIZEOF_LONG@ == 8) +typedef unsigned long __u64; #endif /* SIZEOF_LONG == 8 */ +#endif /* SIZEOF_LONG_LONG == 8 */ #endif /* SIZEOF_INT == 8 */ #endif /* __U64_TYPEDEF */ @@ -108,17 +108,17 @@ typedef __S64_TYPEDEF __s64; #if (@SIZEOF_INT@ == 8) typedef int __s64; #else -#if (@SIZEOF_LONG@ == 8) -typedef long __s64; -#else #if (@SIZEOF_LONG_LONG@ == 8) #if defined(__GNUC__) typedef __signed__ long long __s64; #else typedef signed long long __s64; #endif /* __GNUC__ */ -#endif /* SIZEOF_LONG_LONG == 8 */ +#else +#if (@SIZEOF_LONG@ == 8) +typedef long __s64; #endif /* SIZEOF_LONG == 8 */ +#endif /* SIZEOF_LONG_LONG == 8 */ #endif /* SIZEOF_INT == 8 */ #endif /* __S64_TYPEDEF */ diff --git a/lib/ext2fs/ext2_types.h.in b/lib/ext2fs/ext2_types.h.in index aa7ca3a9..5b98f715 100644 --- a/lib/ext2fs/ext2_types.h.in +++ b/lib/ext2fs/ext2_types.h.in @@ -92,11 +92,11 @@ typedef __U64_TYPEDEF __u64; #if (@SIZEOF_INT@ == 8) typedef unsigned int __u64; #else -#if (@SIZEOF_LONG@ == 8) -typedef unsigned long __u64; -#else #if (@SIZEOF_LONG_LONG@ == 8) typedef unsigned long long __u64; +#else +#if (@SIZEOF_LONG@ == 8) +typedef unsigned long __u64; #endif /* SIZEOF_LONG_LONG == 8 */ #endif /* SIZEOF_LONG == 8 */ #endif /* SIZEOF_INT == 8 */ @@ -108,15 +108,15 @@ typedef __S64_TYPEDEF __s64; #if (@SIZEOF_INT@ == 8) typedef int __s64; #else -#if (@SIZEOF_LONG@ == 8) -typedef long __s64; -#else #if (@SIZEOF_LONG_LONG@ == 8) #if defined(__GNUC__) -typedef __signed__ long long __s64; +typedef __signed__ long long __s64; #else -typedef signed long long __s64; +typedef signed long long __s64; #endif /* __GNUC__ */ +#else +#if (@SIZEOF_LONG@ == 8) +typedef long __s64; #endif /* SIZEOF_LONG_LONG == 8 */ #endif /* SIZEOF_LONG == 8 */ #endif /* SIZEOF_INT == 8 */ diff --git a/lib/uuid/gen_uuid.c b/lib/uuid/gen_uuid.c index efa4e3d3..1b23d112 100644 --- a/lib/uuid/gen_uuid.c +++ b/lib/uuid/gen_uuid.c @@ -401,9 +401,10 @@ try_again: if (state_fd > 0) { rewind(state_f); - len = fprintf(state_f, + len = fprintf(state_f, "clock: %04x tv: %016lu %08lu adj: %08d\n", - clock_seq, last.tv_sec, last.tv_usec, adjustment); + clock_seq, last.tv_sec, (long)last.tv_usec, + adjustment); fflush(state_f); if (ftruncate(state_fd, len) < 0) { fprintf(state_f, " \n"); diff --git a/lib/uuid/tst_uuid.c b/lib/uuid/tst_uuid.c index 22169703..33fb80b9 100644 --- a/lib/uuid/tst_uuid.c +++ b/lib/uuid/tst_uuid.c @@ -144,7 +144,7 @@ main(int argc ATTR((unused)) , char **argv ATTR((unused))) tv.tv_usec = 0; time_reg = uuid_time(buf, &tv); printf("UUID generated at %lu reports %lu (%ld.%ld)\n", - time_gen, time_reg, tv.tv_sec, tv.tv_usec); + time_gen, time_reg, tv.tv_sec, (long)tv.tv_usec); /* allow 1s margin in case of rollover between sampling * the current time and when the UUID is generated. */ if (time_reg > time_gen + 1) { diff --git a/lib/uuid/uuid_time.c b/lib/uuid/uuid_time.c index 4c3536b4..97fd3358 100644 --- a/lib/uuid/uuid_time.c +++ b/lib/uuid/uuid_time.c @@ -165,7 +165,7 @@ main(int argc, char **argv) printf("Warning: not a time-based UUID, so UUID time " "decoding will likely not work!\n"); } - printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, tv.tv_usec, + printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, (long)tv.tv_usec, ctime(&time_reg)); return 0; |
