diff options
author | Maksym Planeta <mcsim.planeta@gmail.com> | 2012-10-06 20:18:30 +0300 |
---|---|---|
committer | Maksym Planeta <mcsim.planeta@gmail.com> | 2012-10-28 12:33:36 +0100 |
commit | 4e0c82cb1ff18f7cb97eacc39aa29abdeecd5599 (patch) | |
tree | d2eacdb37ace616e50de97a007ea53e017344680 | |
parent | b9e9b82d7c56b1872a8885439f61d0a0842dce4c (diff) |
Cast type to off_t in macros where overflow is possible.
* ext2fs/ext2fs.h (trunc_block): Macro is changed.
(rount_block): Likewise.
(boffs): Likewise.
-rw-r--r-- | ext2fs/ext2fs.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ext2fs/ext2fs.h b/ext2fs/ext2fs.h index 2ad4a9df..579ef746 100644 --- a/ext2fs/ext2fs.h +++ b/ext2fs/ext2fs.h @@ -276,12 +276,13 @@ unsigned long next_generation; /* ---------------------------------------------------------------- */ /* Functions for looking inside disk_image */ -#define trunc_block(offs) (((offs) >> log2_block_size) << log2_block_size) +#define trunc_block(offs) \ + ((off_t) ((offs) >> log2_block_size) << log2_block_size) #define round_block(offs) \ - ((((offs) + block_size - 1) >> log2_block_size) << log2_block_size) + ((off_t) (((offs) + block_size - 1) >> log2_block_size) << log2_block_size) /* block num --> byte offset on disk */ -#define boffs(block) ((block) << log2_block_size) +#define boffs(block) ((off_t) (block) << log2_block_size) /* byte offset on disk --> block num */ #define boffs_block(offs) ((offs) >> log2_block_size) |