diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-27 18:15:40 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-27 18:15:40 +0200 |
commit | 40232f4bd4d7e8e001f7d1e8f120606f59b2c147 (patch) | |
tree | 5d763f4f22a487fd2e669efe0970615096f1f5fd /lib/sqfs/data_reader.c | |
parent | f6904a98bffe0bce5fc6aac408c141a25c0e05ab (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/data_reader.c')
-rw-r--r-- | lib/sqfs/data_reader.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/sqfs/data_reader.c b/lib/sqfs/data_reader.c index 862723d..0befb9d 100644 --- a/lib/sqfs/data_reader.c +++ b/lib/sqfs/data_reader.c @@ -25,18 +25,18 @@ struct sqfs_data_reader_t { sqfs_block_t *data_block; sqfs_block_t *frag_block; - uint64_t current_block; + sqfs_u64 current_block; sqfs_file_t *file; - uint32_t num_fragments; - uint32_t current_frag_index; - uint32_t block_size; + sqfs_u32 num_fragments; + sqfs_u32 current_frag_index; + sqfs_u32 block_size; - uint8_t scratch[]; + sqfs_u8 scratch[]; }; -static int get_block(sqfs_data_reader_t *data, uint64_t off, uint32_t size, +static int get_block(sqfs_data_reader_t *data, sqfs_u64 off, sqfs_u32 size, size_t unpacked_size, sqfs_block_t **out) { sqfs_block_t *blk = alloc_flex(sizeof(*blk), 1, unpacked_size); @@ -87,8 +87,8 @@ static int get_block(sqfs_data_reader_t *data, uint64_t off, uint32_t size, return 0; } -static int precache_data_block(sqfs_data_reader_t *data, uint64_t location, - uint32_t size) +static int precache_data_block(sqfs_data_reader_t *data, sqfs_u64 location, + sqfs_u32 size) { int ret; @@ -153,7 +153,7 @@ int sqfs_data_reader_load_fragment_table(sqfs_data_reader_t *data, { void *raw_frag; size_t size; - uint32_t i; + sqfs_u32 i; int ret; free(data->frag_block); @@ -210,7 +210,7 @@ int sqfs_data_reader_get_block(sqfs_data_reader_t *data, size_t index, sqfs_block_t **out) { size_t i, unpacked_size; - uint64_t off, filesz; + sqfs_u64 off, filesz; sqfs_inode_get_file_block_start(inode, &off); sqfs_inode_get_file_size(inode, &filesz); @@ -233,9 +233,9 @@ int sqfs_data_reader_get_fragment(sqfs_data_reader_t *data, const sqfs_inode_generic_t *inode, sqfs_block_t **out) { - uint32_t frag_idx, frag_off, frag_sz; + sqfs_u32 frag_idx, frag_off, frag_sz; sqfs_block_t *blk; - uint64_t filesz; + sqfs_u64 filesz; sqfs_inode_get_file_size(inode, &filesz); sqfs_inode_get_frag_location(inode, &frag_idx, &frag_off); @@ -266,11 +266,11 @@ int sqfs_data_reader_get_fragment(sqfs_data_reader_t *data, ssize_t sqfs_data_reader_read(sqfs_data_reader_t *data, const sqfs_inode_generic_t *inode, - uint64_t offset, void *buffer, size_t size) + sqfs_u64 offset, void *buffer, size_t size) { - uint32_t frag_idx, frag_off; + sqfs_u32 frag_idx, frag_off; size_t i, diff, total = 0; - uint64_t off, filesz; + sqfs_u64 off, filesz; char *ptr; /* work out file location and size */ |