mkfs_ext2, mkfs_vfat: fix warnings in STORE_LE on big-endian platforms

"warning: large integer implicitly truncated to unsigned type [-Woverflow]"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2018-02-15 13:46:34 +01:00
parent a48eadbc22
commit 7398892ac0
2 changed files with 6 additions and 6 deletions

View File

@ -83,11 +83,11 @@ char BUG_wrong_field_size(void);
#define STORE_LE(field, value) \
do { \
if (sizeof(field) == 4) \
field = SWAP_LE32(value); \
field = SWAP_LE32((uint32_t)(value)); \
else if (sizeof(field) == 2) \
field = SWAP_LE16(value); \
field = SWAP_LE16((uint16_t)(value)); \
else if (sizeof(field) == 1) \
field = (value); \
field = (uint8_t)(value); \
else \
BUG_wrong_field_size(); \
} while (0)

View File

@ -210,11 +210,11 @@ void BUG_unsupported_field_size(void);
#define STORE_LE(field, value) \
do { \
if (sizeof(field) == 4) \
field = SWAP_LE32(value); \
field = SWAP_LE32((uint32_t)(value)); \
else if (sizeof(field) == 2) \
field = SWAP_LE16(value); \
field = SWAP_LE16((uint16_t)(value)); \
else if (sizeof(field) == 1) \
field = (value); \
field = (uint8_t)(value); \
else \
BUG_unsupported_field_size(); \
} while (0)