diff options
author | Jes Sorensen <Jes.Sorensen@redhat.com> | 2013-10-10 09:42:05 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2013-10-16 12:42:29 +1100 |
commit | 8a5f247d0a4a2afab630415fd4e73e222ed089a9 (patch) | |
tree | 62e56e7aaa4c827dbcb58d6f5de4855fd7d4818d /mdadm.h | |
parent | fe8ea9407f0fbc5ffb8d2a37ba4618a2112b9a65 (diff) |
Be consistent in return types from byteswap macros
The bswap_*() macros return int values. Make sure we return the
equivalent types in same byteorder pass-through functions to avoid
problems with the original type leaking through to printf() etc.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdadm.h')
-rw-r--r-- | mdadm.h | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -129,12 +129,12 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence)); #if !defined(__KLIBC__) #if BYTE_ORDER == LITTLE_ENDIAN -#define __cpu_to_le16(_x) (_x) -#define __cpu_to_le32(_x) (_x) -#define __cpu_to_le64(_x) (_x) -#define __le16_to_cpu(_x) (_x) -#define __le32_to_cpu(_x) (_x) -#define __le64_to_cpu(_x) (_x) +#define __cpu_to_le16(_x) (unsigned int)(_x) +#define __cpu_to_le32(_x) (unsigned int)(_x) +#define __cpu_to_le64(_x) (unsigned long long)(_x) +#define __le16_to_cpu(_x) (unsigned int)(_x) +#define __le32_to_cpu(_x) (unsigned int)(_x) +#define __le64_to_cpu(_x) (unsigned long long)(_x) #define __cpu_to_be16(_x) bswap_16(_x) #define __cpu_to_be32(_x) bswap_32(_x) @@ -150,12 +150,12 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence)); #define __le32_to_cpu(_x) bswap_32(_x) #define __le64_to_cpu(_x) bswap_64(_x) -#define __cpu_to_be16(_x) (_x) -#define __cpu_to_be32(_x) (_x) -#define __cpu_to_be64(_x) (_x) -#define __be16_to_cpu(_x) (_x) -#define __be32_to_cpu(_x) (_x) -#define __be64_to_cpu(_x) (_x) +#define __cpu_to_be16(_x) (unsigned int)(_x) +#define __cpu_to_be32(_x) (unsigned int)(_x) +#define __cpu_to_be64(_x) (unsigned long long)(_x) +#define __be16_to_cpu(_x) (unsigned int)(_x) +#define __be32_to_cpu(_x) (unsigned int)(_x) +#define __be64_to_cpu(_x) (unsigned long long)(_x) #else # error "unknown endianness." #endif |