summaryrefslogtreecommitdiff
path: root/lib/sqfs/read_inode.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-27 18:15:40 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-27 18:15:40 +0200
commit40232f4bd4d7e8e001f7d1e8f120606f59b2c147 (patch)
tree5d763f4f22a487fd2e669efe0970615096f1f5fd /lib/sqfs/read_inode.c
parentf6904a98bffe0bce5fc6aac408c141a25c0e05ab (diff)
Cleanup: replace fixed with data types with typedefs
This is a fully automated search and replace, i.e. I ran this: git grep -l uint8_t | xargs sed -i 's/uint8_t/sqfs_u8/g' git grep -l uint16_t | xargs sed -i 's/uint16_t/sqfs_u16/g' git grep -l uint32_t | xargs sed -i 's/uint32_t/sqfs_u32/g' git grep -l uint64_t | xargs sed -i 's/uint64_t/sqfs_u64/g' git grep -l int8_t | xargs sed -i 's/int8_t/sqfs_s8/g' git grep -l int16_t | xargs sed -i 's/int16_t/sqfs_s16/g' git grep -l int32_t | xargs sed -i 's/int32_t/sqfs_s32/g' git grep -l int64_t | xargs sed -i 's/int64_t/sqfs_s64/g' and than added the appropriate definitions to sqfs/predef.h The whole point being better compatibillity with platforms that may not have an stdint.h with the propper definitions. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/read_inode.c')
-rw-r--r--lib/sqfs/read_inode.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/sqfs/read_inode.c b/lib/sqfs/read_inode.c
index 5a87a45..1916c96 100644
--- a/lib/sqfs/read_inode.c
+++ b/lib/sqfs/read_inode.c
@@ -61,10 +61,10 @@ static int set_mode(sqfs_inode_t *inode)
return 0;
}
-static uint64_t get_block_count(uint64_t size, uint64_t block_size,
- uint32_t frag_index, uint32_t frag_offset)
+static sqfs_u64 get_block_count(sqfs_u64 size, sqfs_u64 block_size,
+ sqfs_u32 frag_index, sqfs_u32 frag_offset)
{
- uint64_t count = size / block_size;
+ sqfs_u64 count = size / block_size;
if ((size % block_size) != 0 &&
(frag_index == 0xFFFFFFFF || frag_offset == 0xFFFFFFFF)) {
@@ -79,7 +79,7 @@ static int read_inode_file(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
{
sqfs_inode_generic_t *out;
sqfs_inode_file_t file;
- uint64_t i, count;
+ sqfs_u64 i, count;
int err;
err = sqfs_meta_reader_read(ir, &file, sizeof(file));
@@ -94,17 +94,17 @@ static int read_inode_file(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
count = get_block_count(file.file_size, block_size,
file.fragment_index, file.fragment_offset);
- out = alloc_flex(sizeof(*out), sizeof(uint32_t), count);
+ out = alloc_flex(sizeof(*out), sizeof(sqfs_u32), count);
if (out == NULL)
return SQFS_ERROR_ALLOC;
out->base = *base;
out->data.file = file;
- out->block_sizes = (uint32_t *)out->extra;
+ out->block_sizes = (sqfs_u32 *)out->extra;
out->num_file_blocks = count;
err = sqfs_meta_reader_read(ir, out->block_sizes,
- count * sizeof(uint32_t));
+ count * sizeof(sqfs_u32));
if (err) {
free(out);
return err;
@@ -122,7 +122,7 @@ static int read_inode_file_ext(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
{
sqfs_inode_file_ext_t file;
sqfs_inode_generic_t *out;
- uint64_t i, count;
+ sqfs_u64 i, count;
int err;
err = sqfs_meta_reader_read(ir, &file, sizeof(file));
@@ -140,7 +140,7 @@ static int read_inode_file_ext(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
count = get_block_count(file.file_size, block_size,
file.fragment_idx, file.fragment_offset);
- out = alloc_flex(sizeof(*out), sizeof(uint32_t), count);
+ out = alloc_flex(sizeof(*out), sizeof(sqfs_u32), count);
if (out == NULL) {
return errno == EOVERFLOW ? SQFS_ERROR_OVERFLOW :
SQFS_ERROR_ALLOC;
@@ -148,11 +148,11 @@ static int read_inode_file_ext(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
out->base = *base;
out->data.file_ext = file;
- out->block_sizes = (uint32_t *)out->extra;
+ out->block_sizes = (sqfs_u32 *)out->extra;
out->num_file_blocks = count;
err = sqfs_meta_reader_read(ir, out->block_sizes,
- count * sizeof(uint32_t));
+ count * sizeof(sqfs_u32));
if (err) {
free(out);
return err;
@@ -206,7 +206,7 @@ static int read_inode_slink(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
static int read_inode_slink_ext(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
sqfs_inode_generic_t **result)
{
- uint32_t xattr;
+ sqfs_u32 xattr;
int err;
err = read_inode_slink(ir, base, result);
@@ -225,7 +225,7 @@ static int read_inode_slink_ext(sqfs_meta_reader_t *ir, sqfs_inode_t *base,
int sqfs_meta_reader_read_inode(sqfs_meta_reader_t *ir,
const sqfs_super_t *super,
- uint64_t block_start, size_t offset,
+ sqfs_u64 block_start, size_t offset,
sqfs_inode_generic_t **result)
{
sqfs_inode_generic_t *out;